Merge pull request #4683 from leoetlino/rename-ipc-hle
Reorganise the IOS HLE source files (and drop WII_IPC_HLE)
This commit is contained in:
commit
629fcb437a
|
@ -27,6 +27,17 @@ enum LOG_TYPE
|
||||||
GDB_STUB,
|
GDB_STUB,
|
||||||
GPFIFO,
|
GPFIFO,
|
||||||
HOST_GPU,
|
HOST_GPU,
|
||||||
|
IOS,
|
||||||
|
IOS_DI,
|
||||||
|
IOS_ES,
|
||||||
|
IOS_FILEIO,
|
||||||
|
IOS_HID,
|
||||||
|
IOS_NET,
|
||||||
|
IOS_SD,
|
||||||
|
IOS_SSL,
|
||||||
|
IOS_STM,
|
||||||
|
IOS_WC24,
|
||||||
|
IOS_WIIMOTE,
|
||||||
MASTER_LOG,
|
MASTER_LOG,
|
||||||
MEMMAP,
|
MEMMAP,
|
||||||
MEMCARD_MANAGER,
|
MEMCARD_MANAGER,
|
||||||
|
@ -42,17 +53,6 @@ enum LOG_TYPE
|
||||||
VIDEO,
|
VIDEO,
|
||||||
VIDEOINTERFACE,
|
VIDEOINTERFACE,
|
||||||
WII_IPC,
|
WII_IPC,
|
||||||
WII_IPC_DVD,
|
|
||||||
WII_IPC_ES,
|
|
||||||
WII_IPC_FILEIO,
|
|
||||||
WII_IPC_HID,
|
|
||||||
WII_IPC_HLE,
|
|
||||||
WII_IPC_NET,
|
|
||||||
WII_IPC_SD,
|
|
||||||
WII_IPC_SSL,
|
|
||||||
WII_IPC_STM,
|
|
||||||
WII_IPC_WC24,
|
|
||||||
WII_IPC_WIIMOTE,
|
|
||||||
WIIMOTE,
|
WIIMOTE,
|
||||||
|
|
||||||
NUMBER_OF_LOGS // Must be last
|
NUMBER_OF_LOGS // Must be last
|
||||||
|
|
|
@ -61,6 +61,17 @@ LogManager::LogManager()
|
||||||
m_Log[LogTypes::GDB_STUB] = new LogContainer("GDB_STUB", "GDB Stub");
|
m_Log[LogTypes::GDB_STUB] = new LogContainer("GDB_STUB", "GDB Stub");
|
||||||
m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo");
|
m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo");
|
||||||
m_Log[LogTypes::HOST_GPU] = new LogContainer("Host GPU", "Host GPU");
|
m_Log[LogTypes::HOST_GPU] = new LogContainer("Host GPU", "Host GPU");
|
||||||
|
m_Log[LogTypes::IOS] = new LogContainer("IOS", "IOS");
|
||||||
|
m_Log[LogTypes::IOS_DI] = new LogContainer("IOS_DI", "IOS - Drive Interface");
|
||||||
|
m_Log[LogTypes::IOS_ES] = new LogContainer("IOS_ES", "IOS - ETicket Services");
|
||||||
|
m_Log[LogTypes::IOS_FILEIO] = new LogContainer("IOS_FILEIO", "IOS - FileIO");
|
||||||
|
m_Log[LogTypes::IOS_HID] = new LogContainer("IOS_HID", "IOS - USB_HID");
|
||||||
|
m_Log[LogTypes::IOS_SD] = new LogContainer("IOS_SD", "IOS - SDIO");
|
||||||
|
m_Log[LogTypes::IOS_SSL] = new LogContainer("IOS_SSL", "IOS - SSL");
|
||||||
|
m_Log[LogTypes::IOS_STM] = new LogContainer("IOS_STM", "IOS - State Transition Manager");
|
||||||
|
m_Log[LogTypes::IOS_NET] = new LogContainer("IOS_NET", "IOS - Network");
|
||||||
|
m_Log[LogTypes::IOS_WC24] = new LogContainer("IOS_WC24", "IOS - WiiConnect24");
|
||||||
|
m_Log[LogTypes::IOS_WIIMOTE] = new LogContainer("IOS_WIIMOTE", "IOS - Wii Remote");
|
||||||
m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log");
|
m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log");
|
||||||
m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
|
m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
|
||||||
m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap");
|
m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap");
|
||||||
|
@ -77,17 +88,6 @@ LogManager::LogManager()
|
||||||
m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "Video Interface (VI)");
|
m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "Video Interface (VI)");
|
||||||
m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote");
|
m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote");
|
||||||
m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
|
m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
|
||||||
m_Log[LogTypes::WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD");
|
|
||||||
m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES");
|
|
||||||
m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO", "WII IPC FILEIO");
|
|
||||||
m_Log[LogTypes::WII_IPC_HID] = new LogContainer("WII_IPC_HID", "WII IPC HID");
|
|
||||||
m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
|
|
||||||
m_Log[LogTypes::WII_IPC_SD] = new LogContainer("WII_IPC_SD", "WII IPC SD");
|
|
||||||
m_Log[LogTypes::WII_IPC_SSL] = new LogContainer("WII_IPC_SSL", "WII IPC SSL");
|
|
||||||
m_Log[LogTypes::WII_IPC_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM");
|
|
||||||
m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET");
|
|
||||||
m_Log[LogTypes::WII_IPC_WC24] = new LogContainer("WII_IPC_WC24", "WII IPC WC24");
|
|
||||||
m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE", "WII IPC WIIMOTE");
|
|
||||||
|
|
||||||
RegisterListener(LogListener::FILE_LISTENER,
|
RegisterListener(LogListener::FILE_LISTENER,
|
||||||
new FileLogListener(File::GetUserPath(F_MAINLOG_IDX)));
|
new FileLogListener(File::GetUserPath(F_MAINLOG_IDX)));
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "Core/HW/ProcessorInterface.h"
|
#include "Core/HW/ProcessorInterface.h"
|
||||||
#include "Core/HW/VideoInterface.h"
|
#include "Core/HW/VideoInterface.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/PatchEngine.h"
|
#include "Core/PatchEngine.h"
|
||||||
#include "Core/PowerPC/PPCAnalyst.h"
|
#include "Core/PowerPC/PPCAnalyst.h"
|
||||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/HW/VideoInterface.h"
|
#include "Core/HW/VideoInterface.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/FS/FileIO.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/PatchEngine.h"
|
#include "Core/PatchEngine.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
|
||||||
|
|
|
@ -135,31 +135,31 @@ set(SRCS ActionReplay.cpp
|
||||||
HW/WiimoteEmu/Speaker.cpp
|
HW/WiimoteEmu/Speaker.cpp
|
||||||
HW/WiimoteReal/WiimoteReal.cpp
|
HW/WiimoteReal/WiimoteReal.cpp
|
||||||
HW/WiiSaveCrypted.cpp
|
HW/WiiSaveCrypted.cpp
|
||||||
IPC_HLE/ESFormats.cpp
|
IOS/Device.cpp
|
||||||
IPC_HLE/ICMPLin.cpp
|
IOS/DeviceStub.cpp
|
||||||
IPC_HLE/NWC24Config.cpp
|
IOS/IPC.cpp
|
||||||
IPC_HLE/WII_IPC_HLE.cpp
|
IOS/DI/DI.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device.cpp
|
IOS/ES/ES.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_stub.cpp
|
IOS/ES/Formats.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_DI.cpp
|
IOS/FS/FileIO.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_es.cpp
|
IOS/FS/FS.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
|
IOS/Network/Config.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_fs.cpp
|
IOS/Network/ICMPLin.cpp
|
||||||
IPC_HLE/WII_Socket.cpp
|
IOS/Network/NWC24Config.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_net.cpp
|
IOS/Network/Socket.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
|
IOS/Network/Net.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_stm.cpp
|
IOS/Network/SSL.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
|
IOS/SDIO/SDIOSlot0.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.cpp
|
IOS/STM/STM.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.cpp
|
IOS/USB/USB_KBD.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_usb_bt_stub.cpp
|
IOS/USB/USB_VEN.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp
|
IOS/USB/Bluetooth/BTBase.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_usb_ven.cpp
|
IOS/USB/Bluetooth/BTEmu.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_usb_wfssrv.cpp
|
IOS/USB/Bluetooth/BTStub.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_wfsi.cpp
|
IOS/USB/Bluetooth/WiimoteDevice.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_WiiMote.cpp
|
IOS/USB/Bluetooth/WiimoteHIDAttr.cpp
|
||||||
IPC_HLE/WiiMote_HID_Attr.cpp
|
IOS/WFS/WFSSRV.cpp
|
||||||
IPC_HLE/WiiNetConfig.cpp
|
IOS/WFS/WFSI.cpp
|
||||||
PowerPC/BreakPoints.cpp
|
PowerPC/BreakPoints.cpp
|
||||||
PowerPC/MMU.cpp
|
PowerPC/MMU.cpp
|
||||||
PowerPC/PowerPC.cpp
|
PowerPC/PowerPC.cpp
|
||||||
|
@ -260,8 +260,8 @@ set(LIBS
|
||||||
if(LIBUSB_FOUND)
|
if(LIBUSB_FOUND)
|
||||||
# Using shared LibUSB
|
# Using shared LibUSB
|
||||||
set(LIBS ${LIBS} ${LIBUSB_LIBRARIES})
|
set(LIBS ${LIBS} ${LIBUSB_LIBRARIES})
|
||||||
set(SRCS ${SRCS} IPC_HLE/WII_IPC_HLE_Device_hid.cpp
|
set(SRCS ${SRCS} IOS/USB/USB_HIDv4.cpp
|
||||||
IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.cpp)
|
IOS/USB/Bluetooth/BTReal.cpp)
|
||||||
endif(LIBUSB_FOUND)
|
endif(LIBUSB_FOUND)
|
||||||
|
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "Core/Core.h" // for bWii
|
#include "Core/Core.h" // for bWii
|
||||||
#include "Core/FifoPlayer/FifoDataFile.h"
|
#include "Core/FifoPlayer/FifoDataFile.h"
|
||||||
#include "Core/HW/SI.h"
|
#include "Core/HW/SI.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
|
#include "Core/IOS/USB/Bluetooth/BTBase.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
|
|
|
@ -54,9 +54,9 @@
|
||||||
#include "Core/HW/SystemTimers.h"
|
#include "Core/HW/SystemTimers.h"
|
||||||
#include "Core/HW/VideoInterface.h"
|
#include "Core/HW/VideoInterface.h"
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
#include "Core/IOS/Network/Socket.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
||||||
#include "Core/IPC_HLE/WII_Socket.h"
|
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
#include "Core/NetPlayClient.h"
|
#include "Core/NetPlayClient.h"
|
||||||
#include "Core/NetPlayProto.h"
|
#include "Core/NetPlayProto.h"
|
||||||
|
|
|
@ -167,41 +167,41 @@
|
||||||
<ClCompile Include="HW\WiimoteReal\WiimoteReal.cpp" />
|
<ClCompile Include="HW\WiimoteReal\WiimoteReal.cpp" />
|
||||||
<ClCompile Include="HW\WII_IPC.cpp" />
|
<ClCompile Include="HW\WII_IPC.cpp" />
|
||||||
<ClCompile Include="HW\WiiSaveCrypted.cpp" />
|
<ClCompile Include="HW\WiiSaveCrypted.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\ESFormats.cpp" />
|
<ClCompile Include="IOS\Device.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\ICMPWin.cpp" />
|
<ClCompile Include="IOS\DeviceStub.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\NWC24Config.cpp" />
|
<ClCompile Include="IOS\IPC.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WiiMote_HID_Attr.cpp" />
|
<ClCompile Include="IOS\DI\DI.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE.cpp" />
|
<ClCompile Include="IOS\ES\ES.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device.cpp" />
|
<ClCompile Include="IOS\ES\Formats.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_stub.cpp" />
|
<ClCompile Include="IOS\FS\FileIO.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_DI.cpp" />
|
<ClCompile Include="IOS\FS\FS.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_es.cpp" />
|
<ClCompile Include="IOS\Network\Config.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_FileIO.cpp" />
|
<ClCompile Include="IOS\Network\ICMPLin.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_fs.cpp" />
|
<ClCompile Include="IOS\Network\NWC24Config.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_hid.cpp">
|
<ClCompile Include="IOS\Network\Socket.cpp" />
|
||||||
|
<ClCompile Include="IOS\Network\Net.cpp" />
|
||||||
|
<ClCompile Include="IOS\Network\SSL.cpp" />
|
||||||
|
<ClCompile Include="IOS\SDIO\SDIOSlot0.cpp" />
|
||||||
|
<ClCompile Include="IOS\STM\STM.cpp" />
|
||||||
|
<ClCompile Include="IOS\USB\USB_HIDv4.cpp">
|
||||||
<!--
|
<!--
|
||||||
Disable "nonstandard extension used : zero-sized array in struct/union" warning,
|
Disable "nonstandard extension used : zero-sized array in struct/union" warning,
|
||||||
which is hit in libusb.h.
|
which is hit in libusb.h.
|
||||||
-->
|
-->
|
||||||
<DisableSpecificWarnings>4200;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4200;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_net.cpp" />
|
<ClCompile Include="IOS\USB\USB_KBD.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_net_ssl.cpp" />
|
<ClCompile Include="IOS\USB\USB_VEN.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_stm.cpp" />
|
<ClCompile Include="IOS\USB\Bluetooth\BTBase.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_sdio_slot0.cpp" />
|
<ClCompile Include="IOS\USB\Bluetooth\BTEmu.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_base.cpp" />
|
<ClCompile Include="IOS\USB\Bluetooth\BTStub.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_emu.cpp" />
|
<ClCompile Include="IOS\USB\Bluetooth\BTReal.cpp">
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_real.cpp">
|
|
||||||
<DisableSpecificWarnings>4200;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4200;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_stub.cpp" />
|
<ClCompile Include="IOS\USB\Bluetooth\WiimoteDevice.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_kbd.cpp" />
|
<ClCompile Include="IOS\USB\Bluetooth\WiimoteHIDAttr.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_ven.cpp" />
|
<ClCompile Include="IOS\WFS\WFSSRV.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_wfssrv.cpp" />
|
<ClCompile Include="IOS\WFS\WFSI.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_wfsi.cpp" />
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_WiiMote.cpp" />
|
|
||||||
<ClCompile Include="IPC_HLE\WII_Socket.cpp" />
|
|
||||||
<ClCompile Include="IPC_HLE\WiiNetConfig.cpp" />
|
|
||||||
<ClCompile Include="MemTools.cpp" />
|
<ClCompile Include="MemTools.cpp" />
|
||||||
<ClCompile Include="Movie.cpp" />
|
<ClCompile Include="Movie.cpp" />
|
||||||
<ClCompile Include="NetPlayClient.cpp" />
|
<ClCompile Include="NetPlayClient.cpp" />
|
||||||
|
@ -395,35 +395,36 @@
|
||||||
<ClInclude Include="HW\WiimoteReal\WiimoteRealBase.h" />
|
<ClInclude Include="HW\WiimoteReal\WiimoteRealBase.h" />
|
||||||
<ClInclude Include="HW\WiiSaveCrypted.h" />
|
<ClInclude Include="HW\WiiSaveCrypted.h" />
|
||||||
<ClInclude Include="HW\WII_IPC.h" />
|
<ClInclude Include="HW\WII_IPC.h" />
|
||||||
<ClInclude Include="IPC_HLE\ESFormats.h" />
|
<ClInclude Include="IOS\Device.h" />
|
||||||
<ClInclude Include="IPC_HLE\hci.h" />
|
<ClInclude Include="IOS\DeviceStub.h" />
|
||||||
<ClInclude Include="IPC_HLE\ICMP.h" />
|
<ClInclude Include="IOS\IPC.h" />
|
||||||
<ClInclude Include="IPC_HLE\l2cap.h" />
|
<ClInclude Include="IOS\DI\DI.h" />
|
||||||
<ClInclude Include="IPC_HLE\NWC24Config.h" />
|
<ClInclude Include="IOS\ES\ES.h" />
|
||||||
<ClInclude Include="IPC_HLE\WiiMote_HID_Attr.h" />
|
<ClInclude Include="IOS\ES\Formats.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE.h" />
|
<ClInclude Include="IOS\FS\FileIO.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device.h" />
|
<ClInclude Include="IOS\FS\FS.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_stub.h" />
|
<ClInclude Include="IOS\Network\Config.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_DI.h" />
|
<ClInclude Include="IOS\Network\ICMPLin.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_es.h" />
|
<ClInclude Include="IOS\Network\NWC24Config.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_FileIO.h" />
|
<ClInclude Include="IOS\Network\ICMP.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_fs.h" />
|
<ClInclude Include="IOS\Network\Socket.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_hid.h" />
|
<ClInclude Include="IOS\Network\Net.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_net.h" />
|
<ClInclude Include="IOS\Network\SSL.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_net_ssl.h" />
|
<ClInclude Include="IOS\SDIO\SDIOSlot0.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_stm.h" />
|
<ClInclude Include="IOS\STM\STM.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_sdio_slot0.h" />
|
<ClInclude Include="IOS\USB\USB_HIDv4.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_base.h" />
|
<ClInclude Include="IOS\USB\USB_KBD.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_emu.h" />
|
<ClInclude Include="IOS\USB\USB_VEN.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_real.h" />
|
<ClInclude Include="IOS\USB\Bluetooth\BTBase.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_stub.h" />
|
<ClInclude Include="IOS\USB\Bluetooth\BTEmu.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_kbd.h" />
|
<ClInclude Include="IOS\USB\Bluetooth\BTStub.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_ven.h" />
|
<ClInclude Include="IOS\USB\Bluetooth\BTReal.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_wfssrv.h" />
|
<ClInclude Include="IOS\USB\Bluetooth\WiimoteDevice.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_wfsi.h" />
|
<ClInclude Include="IOS\USB\Bluetooth\WiimoteHIDAttr.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_WiiMote.h" />
|
<ClInclude Include="IOS\USB\Bluetooth\hci.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_Socket.h" />
|
<ClInclude Include="IOS\USB\Bluetooth\l2cap.h" />
|
||||||
<ClInclude Include="IPC_HLE\WiiNetConfig.h" />
|
<ClInclude Include="IOS\WFS\WFSSRV.h" />
|
||||||
|
<ClInclude Include="IOS\WFS\WFSI.h" />
|
||||||
<ClInclude Include="MachineContext.h" />
|
<ClInclude Include="MachineContext.h" />
|
||||||
<ClInclude Include="MemTools.h" />
|
<ClInclude Include="MemTools.h" />
|
||||||
<ClInclude Include="Movie.h" />
|
<ClInclude Include="Movie.h" />
|
||||||
|
|
|
@ -25,9 +25,6 @@
|
||||||
<Filter Include="HW %28Flipper/Hollywood%29">
|
<Filter Include="HW %28Flipper/Hollywood%29">
|
||||||
<UniqueIdentifier>{d060b137-c211-44eb-9cad-fc12dedbea73}</UniqueIdentifier>
|
<UniqueIdentifier>{d060b137-c211-44eb-9cad-fc12dedbea73}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="IPC HLE %28IOS/Starlet%29">
|
|
||||||
<UniqueIdentifier>{becbad5b-2531-410c-b032-2da2f078b178}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="PowerPC">
|
<Filter Include="PowerPC">
|
||||||
<UniqueIdentifier>{ebd24590-dfdc-433e-a411-21723e4b7cb5}</UniqueIdentifier>
|
<UniqueIdentifier>{ebd24590-dfdc-433e-a411-21723e4b7cb5}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
@ -112,39 +109,42 @@
|
||||||
<Filter Include="HW %28Flipper/Hollywood%29\Wii IPC">
|
<Filter Include="HW %28Flipper/Hollywood%29\Wii IPC">
|
||||||
<UniqueIdentifier>{2b41ab45-ba8c-45dc-92cc-9107c1fa3e36}</UniqueIdentifier>
|
<UniqueIdentifier>{2b41ab45-ba8c-45dc-92cc-9107c1fa3e36}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="IPC HLE %28IOS/Starlet%29\DI">
|
|
||||||
<UniqueIdentifier>{9370a21f-a7bf-4973-8258-290253617653}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="IPC HLE %28IOS/Starlet%29\ES">
|
|
||||||
<UniqueIdentifier>{3f85582a-e612-4582-b0fa-ecc27ba3658c}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="IPC HLE %28IOS/Starlet%29\FS">
|
|
||||||
<UniqueIdentifier>{1f5662c1-885f-4ed4-9f10-cc8e98eaa35d}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="IPC HLE %28IOS/Starlet%29\Keyboard">
|
|
||||||
<UniqueIdentifier>{1fb00563-01ba-42c4-82de-2c66371e614a}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="IPC HLE %28IOS/Starlet%29\Net">
|
|
||||||
<UniqueIdentifier>{4620ba8f-5638-4d56-941e-69fc4a4dfc07}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="IPC HLE %28IOS/Starlet%29\SDIO - SD Card">
|
|
||||||
<UniqueIdentifier>{83c278e5-6b06-4cd0-96fb-2e3c88eb32d7}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="IPC HLE %28IOS/Starlet%29\USB">
|
|
||||||
<UniqueIdentifier>{4a090016-76d5-43dd-95a4-abedfc11ef31}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="IPC HLE %28IOS/Starlet%29\WFS">
|
|
||||||
<UniqueIdentifier>{f11746cf-277a-4d58-bcf1-578a45348b07}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote">
|
|
||||||
<UniqueIdentifier>{8352be4d-d37d-4f55-adec-b940a9712802}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="PowerPC\JitILCommon">
|
<Filter Include="PowerPC\JitILCommon">
|
||||||
<UniqueIdentifier>{827afa93-1a80-4835-93ae-b5516d95867f}</UniqueIdentifier>
|
<UniqueIdentifier>{827afa93-1a80-4835-93ae-b5516d95867f}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="PowerPC\Jit64Common">
|
<Filter Include="PowerPC\Jit64Common">
|
||||||
<UniqueIdentifier>{81956f71-d9fe-454f-96a6-855195d611c4}</UniqueIdentifier>
|
<UniqueIdentifier>{81956f71-d9fe-454f-96a6-855195d611c4}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="IOS">
|
||||||
|
<UniqueIdentifier>{e14b3339-dc23-46d6-845d-7206dc4f88c3}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="IOS\USB">
|
||||||
|
<UniqueIdentifier>{c1e2e0dc-30ac-44cd-9909-e5b594647a04}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="IOS\USB\Bluetooth">
|
||||||
|
<UniqueIdentifier>{5846b261-397e-4e2a-89e3-88d22ab927c5}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="IOS\Network">
|
||||||
|
<UniqueIdentifier>{ab9cdd90-54d7-4f42-9248-d7903ce52cc8}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="IOS\DI">
|
||||||
|
<UniqueIdentifier>{3db8c364-1d72-4660-9179-86d1c46904b9}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="IOS\FS">
|
||||||
|
<UniqueIdentifier>{75be4669-90fe-4280-b0ea-df350f481357}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="IOS\ES">
|
||||||
|
<UniqueIdentifier>{7fae98ef-4b62-4701-8f08-c496bd1ce2a7}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="IOS\SDIO">
|
||||||
|
<UniqueIdentifier>{b132ac6a-a02e-429e-858b-bfbc3fdc1851}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="IOS\STM">
|
||||||
|
<UniqueIdentifier>{2bfd4ecc-7225-48f0-91b9-efb42aaf71bf}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="IOS\WFS">
|
||||||
|
<UniqueIdentifier>{1fa9df3e-6741-4045-b2f6-457b4a0540a9}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="BootManager.cpp" />
|
<ClCompile Include="BootManager.cpp" />
|
||||||
|
@ -568,84 +568,6 @@
|
||||||
<ClCompile Include="DSP\LabelMap.cpp">
|
<ClCompile Include="DSP\LabelMap.cpp">
|
||||||
<Filter>DSPCore</Filter>
|
<Filter>DSPCore</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="IPC_HLE\ESFormats.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\ES</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<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>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_es.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\ES</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_FileIO.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\FS</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_fs.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\FS</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_kbd.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Keyboard</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\ICMPWin.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\NWC24Config.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_net.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_net_ssl.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_Socket.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WiiNetConfig.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_sdio_slot0.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\SDIO - SD Card</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_stm.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_hid.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_base.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_emu.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_real.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_stub.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_wfssrv.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\WFS</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_wfsi.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\WFS</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_WiiMote.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IPC_HLE\WiiMote_HID_Attr.cpp">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="HW\Wiimote.cpp">
|
<ClCompile Include="HW\Wiimote.cpp">
|
||||||
<Filter>HW %28Flipper/Hollywood%29\Wiimote</Filter>
|
<Filter>HW %28Flipper/Hollywood%29\Wiimote</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -779,17 +701,89 @@
|
||||||
<Filter>PowerPC\Jit64Common</Filter>
|
<Filter>PowerPC\Jit64Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Analytics.cpp" />
|
<ClCompile Include="Analytics.cpp" />
|
||||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_ven.cpp">
|
<ClCompile Include="PowerPC\SignatureDB\CSVSignatureDB.cpp" />
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB</Filter>
|
<ClCompile Include="PowerPC\SignatureDB\DSYSignatureDB.cpp" />
|
||||||
|
<ClCompile Include="PowerPC\SignatureDB\SignatureDB.cpp" />
|
||||||
|
<ClCompile Include="IOS\USB\Bluetooth\BTBase.cpp">
|
||||||
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="PowerPC\SignatureDB\CSVSignatureDB.cpp">
|
<ClCompile Include="IOS\USB\Bluetooth\BTEmu.cpp">
|
||||||
<Filter>PowerPC\SignatureDB</Filter>
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="PowerPC\SignatureDB\DSYSignatureDB.cpp">
|
<ClCompile Include="IOS\USB\Bluetooth\BTReal.cpp">
|
||||||
<Filter>PowerPC\SignatureDB</Filter>
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="PowerPC\SignatureDB\SignatureDB.cpp">
|
<ClCompile Include="IOS\USB\Bluetooth\BTStub.cpp">
|
||||||
<Filter>PowerPC\SignatureDB</Filter>
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\Network\Config.cpp">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\Device.cpp">
|
||||||
|
<Filter>IOS</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\DeviceStub.cpp">
|
||||||
|
<Filter>IOS</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\DI\DI.cpp">
|
||||||
|
<Filter>IOS\DI</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\FS\FileIO.cpp">
|
||||||
|
<Filter>IOS\FS</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\ES\ES.cpp">
|
||||||
|
<Filter>IOS\ES</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\ES\Formats.cpp">
|
||||||
|
<Filter>IOS\ES</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\FS\FS.cpp">
|
||||||
|
<Filter>IOS\FS</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\Network\ICMPLin.cpp">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\IPC.cpp">
|
||||||
|
<Filter>IOS</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\Network\Net.cpp">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\Network\NWC24Config.cpp">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\SDIO\SDIOSlot0.cpp">
|
||||||
|
<Filter>IOS\SDIO</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\Network\Socket.cpp">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\Network\SSL.cpp">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\STM\STM.cpp">
|
||||||
|
<Filter>IOS\STM</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\USB\USB_HIDv4.cpp">
|
||||||
|
<Filter>IOS\USB</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\USB\USB_KBD.cpp">
|
||||||
|
<Filter>IOS\USB</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\USB\USB_VEN.cpp">
|
||||||
|
<Filter>IOS\USB</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\WFS\WFSI.cpp">
|
||||||
|
<Filter>IOS\WFS</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\WFS\WFSSRV.cpp">
|
||||||
|
<Filter>IOS\WFS</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\USB\Bluetooth\WiimoteDevice.cpp">
|
||||||
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="IOS\USB\Bluetooth\WiimoteHIDAttr.cpp">
|
||||||
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1174,90 +1168,6 @@
|
||||||
<ClInclude Include="DSP\LabelMap.h">
|
<ClInclude Include="DSP\LabelMap.h">
|
||||||
<Filter>DSPCore</Filter>
|
<Filter>DSPCore</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="IPC_HLE\ESFormats.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\ES</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<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>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_DI.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\DI</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_es.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\ES</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_FileIO.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\FS</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_fs.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\FS</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_kbd.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Keyboard</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\ICMP.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\NWC24Config.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_net.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_net_ssl.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_Socket.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WiiNetConfig.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_sdio_slot0.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\SDIO - SD Card</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_hid.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_base.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_emu.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_real.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_stub.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_WiiMote.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\hci.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\l2cap.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WiiMote_HID_Attr.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_wfssrv.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\WFS</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_wfsi.h">
|
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\WFS</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="HW\Wiimote.h">
|
<ClInclude Include="HW\Wiimote.h">
|
||||||
<Filter>HW %28Flipper/Hollywood%29\Wiimote</Filter>
|
<Filter>HW %28Flipper/Hollywood%29\Wiimote</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1356,17 +1266,98 @@
|
||||||
<Filter>PowerPC\Jit64Common</Filter>
|
<Filter>PowerPC\Jit64Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Analytics.h" />
|
<ClInclude Include="Analytics.h" />
|
||||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_ven.h">
|
<ClInclude Include="PowerPC\SignatureDB\CSVSignatureDB.h" />
|
||||||
<Filter>IPC HLE %28IOS/Starlet%29\USB</Filter>
|
<ClInclude Include="PowerPC\SignatureDB\DSYSignatureDB.h" />
|
||||||
|
<ClInclude Include="PowerPC\SignatureDB\SignatureDB.h" />
|
||||||
|
<ClInclude Include="IOS\USB\Bluetooth\BTBase.h">
|
||||||
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="PowerPC\SignatureDB\CSVSignatureDB.h">
|
<ClInclude Include="IOS\USB\Bluetooth\BTEmu.h">
|
||||||
<Filter>PowerPC\SignatureDB</Filter>
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="PowerPC\SignatureDB\DSYSignatureDB.h">
|
<ClInclude Include="IOS\USB\Bluetooth\BTReal.h">
|
||||||
<Filter>PowerPC\SignatureDB</Filter>
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="PowerPC\SignatureDB\SignatureDB.h">
|
<ClInclude Include="IOS\USB\Bluetooth\BTStub.h">
|
||||||
<Filter>PowerPC\SignatureDB</Filter>
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\Network\Config.h">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\DeviceStub.h">
|
||||||
|
<Filter>IOS</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\DI\DI.h">
|
||||||
|
<Filter>IOS\DI</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\ES\ES.h">
|
||||||
|
<Filter>IOS\ES</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\FS\FileIO.h">
|
||||||
|
<Filter>IOS\FS</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\ES\Formats.h">
|
||||||
|
<Filter>IOS\ES</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\FS\FS.h">
|
||||||
|
<Filter>IOS\FS</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\USB\Bluetooth\hci.h">
|
||||||
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\Network\ICMP.h">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\Network\ICMPLin.h">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\USB\Bluetooth\l2cap.h">
|
||||||
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\Network\Net.h">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\Network\NWC24Config.h">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\SDIO\SDIOSlot0.h">
|
||||||
|
<Filter>IOS\SDIO</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\Network\Socket.h">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\Network\SSL.h">
|
||||||
|
<Filter>IOS\Network</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\STM\STM.h">
|
||||||
|
<Filter>IOS\STM</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\USB\USB_HIDv4.h">
|
||||||
|
<Filter>IOS\USB</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\USB\USB_KBD.h">
|
||||||
|
<Filter>IOS\USB</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\USB\USB_VEN.h">
|
||||||
|
<Filter>IOS\USB</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\WFS\WFSI.h">
|
||||||
|
<Filter>IOS\WFS</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\WFS\WFSSRV.h">
|
||||||
|
<Filter>IOS\WFS</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\USB\Bluetooth\WiimoteDevice.h">
|
||||||
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\USB\Bluetooth\WiimoteHIDAttr.h">
|
||||||
|
<Filter>IOS\USB\Bluetooth</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\Device.h">
|
||||||
|
<Filter>IOS</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="IOS\IPC.h">
|
||||||
|
<Filter>IOS</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "Core/HLE/HLE_Misc.h"
|
#include "Core/HLE/HLE_Misc.h"
|
||||||
#include "Core/HLE/HLE_OS.h"
|
#include "Core/HLE/HLE_OS.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_es.h"
|
#include "Core/IOS/ES/ES.h"
|
||||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#include "Core/HW/ProcessorInterface.h"
|
#include "Core/HW/ProcessorInterface.h"
|
||||||
#include "Core/HW/StreamADPCM.h"
|
#include "Core/HW/StreamADPCM.h"
|
||||||
#include "Core/HW/SystemTimers.h"
|
#include "Core/HW/SystemTimers.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/DI/DI.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
|
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
|
@ -729,7 +729,7 @@ bool ExecuteReadCommand(u64 DVD_offset, u32 output_address, u32 DVD_length, u32
|
||||||
void ExecuteCommand(u32 command_0, u32 command_1, u32 command_2, u32 output_address,
|
void ExecuteCommand(u32 command_0, u32 command_1, u32 command_2, u32 output_address,
|
||||||
u32 output_length, bool reply_to_ios)
|
u32 output_length, bool reply_to_ios)
|
||||||
{
|
{
|
||||||
ReplyType reply_type = reply_to_ios ? ReplyType::IOS_HLE : ReplyType::Interrupt;
|
ReplyType reply_type = reply_to_ios ? ReplyType::IOS : ReplyType::Interrupt;
|
||||||
DIInterruptType interrupt_type = INT_TCINT;
|
DIInterruptType interrupt_type = INT_TCINT;
|
||||||
s64 ticks_until_completion = SystemTimers::GetTicksPerSecond() / 15000;
|
s64 ticks_until_completion = SystemTimers::GetTicksPerSecond() / 15000;
|
||||||
bool command_handled_by_thread = false;
|
bool command_handled_by_thread = false;
|
||||||
|
@ -1153,11 +1153,11 @@ void FinishExecutingCommand(ReplyType reply_type, DIInterruptType interrupt_type
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ReplyType::IOS_HLE:
|
case ReplyType::IOS:
|
||||||
{
|
{
|
||||||
std::shared_ptr<IOS::HLE::IWII_IPC_HLE_Device> di = IOS::HLE::GetDeviceByName("/dev/di");
|
auto di = IOS::HLE::GetDeviceByName("/dev/di");
|
||||||
if (di)
|
if (di)
|
||||||
std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_di>(di)->FinishIOCtl(interrupt_type);
|
std::static_pointer_cast<IOS::HLE::Device::DI>(di)->FinishIOCtl(interrupt_type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ enum DIInterruptType : int
|
||||||
enum class ReplyType : u32
|
enum class ReplyType : u32
|
||||||
{
|
{
|
||||||
Interrupt,
|
Interrupt,
|
||||||
IOS_HLE,
|
IOS,
|
||||||
DTK
|
DTK
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "Core/HW/SystemTimers.h"
|
#include "Core/HW/SystemTimers.h"
|
||||||
#include "Core/HW/VideoInterface.h"
|
#include "Core/HW/VideoInterface.h"
|
||||||
#include "Core/HW/WII_IPC.h"
|
#include "Core/HW/WII_IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
#include "Core/WiiRoot.h"
|
#include "Core/WiiRoot.h"
|
||||||
#include "DiscIO/NANDContentLoader.h"
|
#include "DiscIO/NANDContentLoader.h"
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include "Core/HW/MMIO.h"
|
#include "Core/HW/MMIO.h"
|
||||||
#include "Core/HW/ProcessorInterface.h"
|
#include "Core/HW/ProcessorInterface.h"
|
||||||
#include "Core/HW/SystemTimers.h"
|
#include "Core/HW/SystemTimers.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h"
|
#include "Core/IOS/STM/STM.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
|
||||||
namespace ProcessorInterface
|
namespace ProcessorInterface
|
||||||
|
@ -212,10 +212,9 @@ static void IOSNotifyResetButtonCallback(u64 userdata, s64 cyclesLate)
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().bWii)
|
if (SConfig::GetInstance().bWii)
|
||||||
{
|
{
|
||||||
std::shared_ptr<IOS::HLE::IWII_IPC_HLE_Device> stm =
|
auto stm = IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
|
||||||
IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
|
|
||||||
if (stm)
|
if (stm)
|
||||||
std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_stm_eventhook>(stm)->ResetButton();
|
std::static_pointer_cast<IOS::HLE::Device::STMEventHook>(stm)->ResetButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,10 +222,9 @@ static void IOSNotifyPowerButtonCallback(u64 userdata, s64 cyclesLate)
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().bWii)
|
if (SConfig::GetInstance().bWii)
|
||||||
{
|
{
|
||||||
std::shared_ptr<IOS::HLE::IWII_IPC_HLE_Device> stm =
|
auto stm = IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
|
||||||
IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
|
|
||||||
if (stm)
|
if (stm)
|
||||||
std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_stm_eventhook>(stm)->PowerButton();
|
std::static_pointer_cast<IOS::HLE::Device::STMEventHook>(stm)->PowerButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,13 +34,13 @@ IPC_HLE_PERIOD: For the Wii Remote this is the call schedule:
|
||||||
// If the AclFrameQue is empty this will call Wiimote_Update() and make it send
|
// If the AclFrameQue is empty this will call Wiimote_Update() and make it send
|
||||||
the current input status to the game. I'm not sure if this occurs approximately
|
the current input status to the game. I'm not sure if this occurs approximately
|
||||||
once every frame or if the frequency is not exactly tied to rendered frames
|
once every frame or if the frequency is not exactly tied to rendered frames
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
|
IOS::HLE::Device::BluetoothEmu::Update()
|
||||||
PluginWiimote::Wiimote_Update()
|
PluginWiimote::Wiimote_Update()
|
||||||
|
|
||||||
// This is also a device updated by IOS::HLE::Update() but it doesn't
|
// This is also a device updated by IOS::HLE::Update() but it doesn't
|
||||||
seem to ultimately call PluginWiimote::Wiimote_Update(). However it can be called
|
seem to ultimately call PluginWiimote::Wiimote_Update(). However it can be called
|
||||||
by the /dev/usb/oh1 device if the AclFrameQue is empty.
|
by the /dev/usb/oh1 device if the AclFrameQue is empty.
|
||||||
CWII_IPC_HLE_WiiMote::Update()
|
IOS::HLE::WiimoteDevice::Update()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Core/HW/SystemTimers.h"
|
#include "Core/HW/SystemTimers.h"
|
||||||
|
@ -57,7 +57,7 @@ IPC_HLE_PERIOD: For the Wii Remote this is the call schedule:
|
||||||
#include "Core/HW/DSP.h"
|
#include "Core/HW/DSP.h"
|
||||||
#include "Core/HW/EXI_DeviceIPL.h"
|
#include "Core/HW/EXI_DeviceIPL.h"
|
||||||
#include "Core/HW/VideoInterface.h"
|
#include "Core/HW/VideoInterface.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/PatchEngine.h"
|
#include "Core/PatchEngine.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "VideoCommon/Fifo.h"
|
#include "VideoCommon/Fifo.h"
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HW/MMIO.h"
|
#include "Core/HW/MMIO.h"
|
||||||
#include "Core/HW/ProcessorInterface.h"
|
#include "Core/HW/ProcessorInterface.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
// This is the intercommunication between ARM and PPC. Currently only PPC actually uses it, because
|
// This is the intercommunication between ARM and PPC. Currently only PPC actually uses it, because
|
||||||
// of the IOS HLE
|
// of the IOS HLE
|
||||||
|
|
|
@ -110,7 +110,7 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "Unknown speaker format %x", m_reg_speaker.format);
|
ERROR_LOG(IOS_WIIMOTE, "Unknown speaker format %x", m_reg_speaker.format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,33 +13,30 @@
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
#include "Core/HW/DVDInterface.h"
|
#include "Core/HW/DVDInterface.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/DI/DI.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "DiscIO/Volume.h"
|
#include "DiscIO/Volume.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName)
|
namespace Device
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
{
|
||||||
|
DI::DI(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_di::~CWII_IPC_HLE_Device_di()
|
void DI::DoState(PointerWrap& p)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_di::DoState(PointerWrap& p)
|
|
||||||
{
|
{
|
||||||
DoStateShared(p);
|
DoStateShared(p);
|
||||||
p.Do(m_commands_to_execute);
|
p.Do(m_commands_to_execute);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_di::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult DI::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
// DI IOCtls are handled in a special way by Dolphin
|
// DI IOCtls are handled in a special way by Dolphin
|
||||||
// compared to other WII_IPC_HLE functions.
|
// compared to other IOS functions.
|
||||||
// This is a wrapper around DVDInterface's ExecuteCommand,
|
// This is a wrapper around DVDInterface's ExecuteCommand,
|
||||||
// which will execute commands more or less asynchronously.
|
// which will execute commands more or less asynchronously.
|
||||||
// Only one command can be executed at a time, so commands
|
// Only one command can be executed at a time, so commands
|
||||||
|
@ -50,12 +47,12 @@ IPCCommandResult CWII_IPC_HLE_Device_di::IOCtl(const IOSIOCtlRequest& request)
|
||||||
if (ready_to_execute)
|
if (ready_to_execute)
|
||||||
StartIOCtl(request);
|
StartIOCtl(request);
|
||||||
|
|
||||||
// DVDInterface handles the timing and we handle the reply,
|
// DVDInterface handles the timing and will call FinishIOCtl after the command
|
||||||
// so WII_IPC_HLE shouldn't handle anything.
|
// has been executed to reply to the request, so we shouldn't reply here.
|
||||||
return GetNoReply();
|
return GetNoReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_di::StartIOCtl(const IOSIOCtlRequest& request)
|
void DI::StartIOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
const u32 command_0 = Memory::Read_U32(request.buffer_in);
|
const u32 command_0 = Memory::Read_U32(request.buffer_in);
|
||||||
const u32 command_1 = Memory::Read_U32(request.buffer_in + 4);
|
const u32 command_1 = Memory::Read_U32(request.buffer_in + 4);
|
||||||
|
@ -67,11 +64,11 @@ void CWII_IPC_HLE_Device_di::StartIOCtl(const IOSIOCtlRequest& request)
|
||||||
request.buffer_out_size, true);
|
request.buffer_out_size, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_di::FinishIOCtl(DVDInterface::DIInterruptType interrupt_type)
|
void DI::FinishIOCtl(DVDInterface::DIInterruptType interrupt_type)
|
||||||
{
|
{
|
||||||
if (m_commands_to_execute.empty())
|
if (m_commands_to_execute.empty())
|
||||||
{
|
{
|
||||||
PanicAlert("WII_IPC_HLE_Device_DI: There is no command to execute!");
|
PanicAlert("IOS::HLE::Device::DI: There is no command to execute!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +86,7 @@ void CWII_IPC_HLE_Device_di::FinishIOCtl(DVDInterface::DIInterruptType interrupt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_di::IOCtlV(const IOSIOCtlVRequest& request)
|
IPCCommandResult DI::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
for (const auto& vector : request.io_vectors)
|
for (const auto& vector : request.io_vectors)
|
||||||
Memory::Memset(vector.address, 0, vector.size);
|
Memory::Memset(vector.address, 0, vector.size);
|
||||||
|
@ -98,15 +95,14 @@ IPCCommandResult CWII_IPC_HLE_Device_di::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
case DVDInterface::DVDLowOpenPartition:
|
case DVDInterface::DVDLowOpenPartition:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_DVD, request.in_vectors[1].address == 0,
|
_dbg_assert_msg_(IOS_DI, request.in_vectors[1].address == 0, "DVDLowOpenPartition with ticket");
|
||||||
"DVDLowOpenPartition with ticket");
|
_dbg_assert_msg_(IOS_DI, request.in_vectors[2].address == 0,
|
||||||
_dbg_assert_msg_(WII_IPC_DVD, request.in_vectors[2].address == 0,
|
|
||||||
"DVDLowOpenPartition with cert chain");
|
"DVDLowOpenPartition with cert chain");
|
||||||
|
|
||||||
u64 const partition_offset = ((u64)Memory::Read_U32(request.in_vectors[0].address + 4) << 2);
|
u64 const partition_offset = ((u64)Memory::Read_U32(request.in_vectors[0].address + 4) << 2);
|
||||||
DVDInterface::ChangePartition(partition_offset);
|
DVDInterface::ChangePartition(partition_offset);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_DVD, "DVDLowOpenPartition: partition_offset 0x%016" PRIx64, partition_offset);
|
INFO_LOG(IOS_DI, "DVDLowOpenPartition: partition_offset 0x%016" PRIx64, partition_offset);
|
||||||
|
|
||||||
// Read TMD to the buffer
|
// Read TMD to the buffer
|
||||||
std::vector<u8> tmd_buffer = DVDInterface::GetVolume().GetTMD();
|
std::vector<u8> tmd_buffer = DVDInterface::GetVolume().GetTMD();
|
||||||
|
@ -117,9 +113,10 @@ IPCCommandResult CWII_IPC_HLE_Device_di::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_DVD);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_DI);
|
||||||
}
|
}
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -8,8 +8,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
|
@ -22,12 +22,12 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
class CWII_IPC_HLE_Device_di : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class DI : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName);
|
DI(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
virtual ~CWII_IPC_HLE_Device_di();
|
|
||||||
|
|
||||||
void DoState(PointerWrap& p) override;
|
void DoState(PointerWrap& p) override;
|
||||||
|
|
||||||
|
@ -41,5 +41,6 @@ private:
|
||||||
|
|
||||||
std::deque<u32> m_commands_to_execute;
|
std::deque<u32> m_commands_to_execute;
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -9,8 +9,8 @@
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/HW/SystemTimers.h"
|
#include "Core/HW/SystemTimers.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -121,19 +121,20 @@ void IOSIOCtlVRequest::DumpUnknown(const std::string& description, LogTypes::LOG
|
||||||
Dump("Unknown IOCtlV - " + description, type, level);
|
Dump("Unknown IOCtlV - " + description, type, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
IWII_IPC_HLE_Device::IWII_IPC_HLE_Device(const u32 device_id, const std::string& device_name,
|
namespace Device
|
||||||
const DeviceType type)
|
{
|
||||||
|
Device::Device(const u32 device_id, const std::string& device_name, const DeviceType type)
|
||||||
: m_name(device_name), m_device_id(device_id), m_device_type(type)
|
: m_name(device_name), m_device_id(device_id), m_device_type(type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void IWII_IPC_HLE_Device::DoState(PointerWrap& p)
|
void Device::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
DoStateShared(p);
|
DoStateShared(p);
|
||||||
p.Do(m_is_active);
|
p.Do(m_is_active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IWII_IPC_HLE_Device::DoStateShared(PointerWrap& p)
|
void Device::DoStateShared(PointerWrap& p)
|
||||||
{
|
{
|
||||||
p.Do(m_name);
|
p.Do(m_name);
|
||||||
p.Do(m_device_id);
|
p.Do(m_device_id);
|
||||||
|
@ -141,39 +142,40 @@ void IWII_IPC_HLE_Device::DoStateShared(PointerWrap& p)
|
||||||
p.Do(m_is_active);
|
p.Do(m_is_active);
|
||||||
}
|
}
|
||||||
|
|
||||||
IOSReturnCode IWII_IPC_HLE_Device::Open(const IOSOpenRequest& request)
|
IOSReturnCode Device::Open(const IOSOpenRequest& request)
|
||||||
{
|
{
|
||||||
m_is_active = true;
|
m_is_active = true;
|
||||||
return IPC_SUCCESS;
|
return IPC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IWII_IPC_HLE_Device::Close()
|
void Device::Close()
|
||||||
{
|
{
|
||||||
m_is_active = false;
|
m_is_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::Unsupported(const IOSRequest& request)
|
IPCCommandResult Device::Unsupported(const IOSRequest& request)
|
||||||
{
|
{
|
||||||
static std::map<IPCCommandType, std::string> names = {{{IPC_CMD_READ, "Read"},
|
static std::map<IPCCommandType, std::string> names = {{{IPC_CMD_READ, "Read"},
|
||||||
{IPC_CMD_WRITE, "Write"},
|
{IPC_CMD_WRITE, "Write"},
|
||||||
{IPC_CMD_SEEK, "Seek"},
|
{IPC_CMD_SEEK, "Seek"},
|
||||||
{IPC_CMD_IOCTL, "IOCtl"},
|
{IPC_CMD_IOCTL, "IOCtl"},
|
||||||
{IPC_CMD_IOCTLV, "IOCtlV"}}};
|
{IPC_CMD_IOCTLV, "IOCtlV"}}};
|
||||||
WARN_LOG(WII_IPC_HLE, "%s does not support %s()", m_name.c_str(), names[request.command].c_str());
|
WARN_LOG(IOS, "%s does not support %s()", m_name.c_str(), names[request.command].c_str());
|
||||||
return GetDefaultReply(IPC_EINVAL);
|
return GetDefaultReply(IPC_EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an IPCCommandResult for a reply that takes 250 us (arbitrarily chosen value)
|
// Returns an IPCCommandResult for a reply that takes 250 us (arbitrarily chosen value)
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::GetDefaultReply(const s32 return_value)
|
IPCCommandResult Device::GetDefaultReply(const s32 return_value)
|
||||||
{
|
{
|
||||||
return {return_value, 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
|
// Returns an IPCCommandResult with no reply. Useful for async commands that will generate a reply
|
||||||
// later. This takes no return value because it won't be used.
|
// later. This takes no return value because it won't be used.
|
||||||
IPCCommandResult IWII_IPC_HLE_Device::GetNoReply()
|
IPCCommandResult Device::GetNoReply()
|
||||||
{
|
{
|
||||||
return {IPC_SUCCESS, false, 0};
|
return {IPC_SUCCESS, false, 0};
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -11,7 +11,7 @@
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -96,11 +96,11 @@ struct IOSIOCtlRequest final : IOSRequest
|
||||||
u32 buffer_out = 0;
|
u32 buffer_out = 0;
|
||||||
u32 buffer_out_size = 0;
|
u32 buffer_out_size = 0;
|
||||||
explicit IOSIOCtlRequest(u32 address);
|
explicit IOSIOCtlRequest(u32 address);
|
||||||
void Log(const std::string& description, LogTypes::LOG_TYPE type = LogTypes::WII_IPC_HLE,
|
void Log(const std::string& description, LogTypes::LOG_TYPE type = LogTypes::IOS,
|
||||||
LogTypes::LOG_LEVELS level = LogTypes::LINFO) const;
|
LogTypes::LOG_LEVELS level = LogTypes::LINFO) const;
|
||||||
void Dump(const std::string& description, LogTypes::LOG_TYPE type = LogTypes::WII_IPC_HLE,
|
void Dump(const std::string& description, LogTypes::LOG_TYPE type = LogTypes::IOS,
|
||||||
LogTypes::LOG_LEVELS level = LogTypes::LINFO) const;
|
LogTypes::LOG_LEVELS level = LogTypes::LINFO) const;
|
||||||
void DumpUnknown(const std::string& description, LogTypes::LOG_TYPE type = LogTypes::WII_IPC_HLE,
|
void DumpUnknown(const std::string& description, LogTypes::LOG_TYPE type = LogTypes::IOS,
|
||||||
LogTypes::LOG_LEVELS level = LogTypes::LERROR) const;
|
LogTypes::LOG_LEVELS level = LogTypes::LERROR) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -122,13 +122,15 @@ struct IOSIOCtlVRequest final : IOSRequest
|
||||||
std::vector<IOVector> io_vectors;
|
std::vector<IOVector> io_vectors;
|
||||||
explicit IOSIOCtlVRequest(u32 address);
|
explicit IOSIOCtlVRequest(u32 address);
|
||||||
bool HasInputVectorWithAddress(u32 vector_address) const;
|
bool HasInputVectorWithAddress(u32 vector_address) const;
|
||||||
void Dump(const std::string& description, LogTypes::LOG_TYPE type = LogTypes::WII_IPC_HLE,
|
void Dump(const std::string& description, LogTypes::LOG_TYPE type = LogTypes::IOS,
|
||||||
LogTypes::LOG_LEVELS level = LogTypes::LINFO) const;
|
LogTypes::LOG_LEVELS level = LogTypes::LINFO) const;
|
||||||
void DumpUnknown(const std::string& description, LogTypes::LOG_TYPE type = LogTypes::WII_IPC_HLE,
|
void DumpUnknown(const std::string& description, LogTypes::LOG_TYPE type = LogTypes::IOS,
|
||||||
LogTypes::LOG_LEVELS level = LogTypes::LERROR) const;
|
LogTypes::LOG_LEVELS level = LogTypes::LERROR) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class DeviceType : u32
|
enum class DeviceType : u32
|
||||||
|
@ -137,10 +139,9 @@ public:
|
||||||
FileIO, // FileIO devices which are created dynamically.
|
FileIO, // FileIO devices which are created dynamically.
|
||||||
};
|
};
|
||||||
|
|
||||||
IWII_IPC_HLE_Device(u32 device_id, const std::string& device_name,
|
Device(u32 device_id, const std::string& device_name, DeviceType type = DeviceType::Static);
|
||||||
DeviceType type = DeviceType::Static);
|
|
||||||
|
|
||||||
virtual ~IWII_IPC_HLE_Device() = default;
|
virtual ~Device() = default;
|
||||||
// Release any resources which might interfere with savestating.
|
// Release any resources which might interfere with savestating.
|
||||||
virtual void PrepareForState(PointerWrap::Mode mode) {}
|
virtual void PrepareForState(PointerWrap::Mode mode) {}
|
||||||
virtual void DoState(PointerWrap& p);
|
virtual void DoState(PointerWrap& p);
|
||||||
|
@ -148,7 +149,8 @@ public:
|
||||||
|
|
||||||
const std::string& GetDeviceName() const { return m_name; }
|
const std::string& GetDeviceName() const { return m_name; }
|
||||||
u32 GetDeviceID() const { return m_device_id; }
|
u32 GetDeviceID() const { return m_device_id; }
|
||||||
// Replies to Open and Close requests are sent by WII_IPC_HLE, not by the devices themselves.
|
// Replies to Open and Close requests are sent by the IPC request handler (HandleCommand),
|
||||||
|
// not by the devices themselves.
|
||||||
virtual IOSReturnCode Open(const IOSOpenRequest& request);
|
virtual IOSReturnCode Open(const IOSOpenRequest& request);
|
||||||
virtual void Close();
|
virtual void Close();
|
||||||
virtual IPCCommandResult Seek(const IOSSeekRequest& seek) { return Unsupported(seek); }
|
virtual IPCCommandResult Seek(const IOSSeekRequest& seek) { return Unsupported(seek); }
|
||||||
|
@ -172,5 +174,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
IPCCommandResult Unsupported(const IOSRequest& request);
|
IPCCommandResult Unsupported(const IOSRequest& request);
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -0,0 +1,44 @@
|
||||||
|
// Copyright 2016 Dolphin Emulator Project
|
||||||
|
// Licensed under GPLv2+
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "Core/IOS/DeviceStub.h"
|
||||||
|
#include "Common/Logging/Log.h"
|
||||||
|
|
||||||
|
namespace IOS
|
||||||
|
{
|
||||||
|
namespace HLE
|
||||||
|
{
|
||||||
|
namespace Device
|
||||||
|
{
|
||||||
|
Stub::Stub(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
IOSReturnCode Stub::Open(const IOSOpenRequest& request)
|
||||||
|
{
|
||||||
|
WARN_LOG(IOS, "%s faking Open()", m_name.c_str());
|
||||||
|
m_is_active = true;
|
||||||
|
return IPC_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Stub::Close()
|
||||||
|
{
|
||||||
|
WARN_LOG(IOS, "%s faking Close()", m_name.c_str());
|
||||||
|
m_is_active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPCCommandResult Stub::IOCtl(const IOSIOCtlRequest& request)
|
||||||
|
{
|
||||||
|
WARN_LOG(IOS, "%s faking IOCtl()", m_name.c_str());
|
||||||
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
IPCCommandResult Stub::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
{
|
||||||
|
WARN_LOG(IOS, "%s faking IOCtlV()", m_name.c_str());
|
||||||
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
|
}
|
||||||
|
} // namespace Device
|
||||||
|
} // namespace HLE
|
||||||
|
} // namespace IOS
|
|
@ -7,22 +7,25 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
class CWII_IPC_HLE_Device_stub : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class Stub final : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_stub(u32 device_id, const std::string& device_name);
|
Stub(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
IOSReturnCode Open(const IOSOpenRequest& request) override;
|
IOSReturnCode Open(const IOSOpenRequest& request) override;
|
||||||
void Close() override;
|
void Close() override;
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -53,10 +53,10 @@
|
||||||
#include "Core/HW/DVDInterface.h"
|
#include "Core/HW/DVDInterface.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/IPC_HLE/ESFormats.h"
|
#include "Core/IOS/ES/ES.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_es.h"
|
#include "Core/IOS/ES/Formats.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "Core/ec_wii.h"
|
#include "Core/ec_wii.h"
|
||||||
|
@ -71,10 +71,11 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
std::string CWII_IPC_HLE_Device_es::m_ContentFile;
|
namespace Device
|
||||||
|
{
|
||||||
|
std::string ES::m_ContentFile;
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 device_id, const std::string& device_name)
|
ES::ES(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +88,7 @@ static u8 key_empty[0x10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
|
||||||
// default key table
|
// default key table
|
||||||
u8* CWII_IPC_HLE_Device_es::keyTable[11] = {
|
u8* ES::keyTable[11] = {
|
||||||
key_ecc, // ECC Private Key
|
key_ecc, // ECC Private Key
|
||||||
key_empty, // Console ID
|
key_empty, // Console ID
|
||||||
key_empty, // NAND AES Key
|
key_empty, // NAND AES Key
|
||||||
|
@ -101,13 +102,12 @@ u8* CWII_IPC_HLE_Device_es::keyTable[11] = {
|
||||||
key_empty, // Unknown
|
key_empty, // Unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_es::LoadWAD(const std::string& _rContentFile)
|
void ES::LoadWAD(const std::string& _rContentFile)
|
||||||
{
|
{
|
||||||
m_ContentFile = _rContentFile;
|
m_ContentFile = _rContentFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_es::DecryptContent(u32 key_index, u8* iv, u8* input, u32 size, u8* new_iv,
|
void ES::DecryptContent(u32 key_index, u8* iv, u8* input, u32 size, u8* new_iv, u8* output)
|
||||||
u8* output)
|
|
||||||
{
|
{
|
||||||
mbedtls_aes_context AES_ctx;
|
mbedtls_aes_context AES_ctx;
|
||||||
mbedtls_aes_setkey_dec(&AES_ctx, keyTable[key_index], 128);
|
mbedtls_aes_setkey_dec(&AES_ctx, keyTable[key_index], 128);
|
||||||
|
@ -115,7 +115,7 @@ void CWII_IPC_HLE_Device_es::DecryptContent(u32 key_index, u8* iv, u8* input, u3
|
||||||
mbedtls_aes_crypt_cbc(&AES_ctx, MBEDTLS_AES_DECRYPT, size, new_iv, input, output);
|
mbedtls_aes_crypt_cbc(&AES_ctx, MBEDTLS_AES_DECRYPT, size, new_iv, input, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_es::OpenInternal()
|
void ES::OpenInternal()
|
||||||
{
|
{
|
||||||
auto& contentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(m_ContentFile);
|
auto& contentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(m_ContentFile);
|
||||||
|
|
||||||
|
@ -141,12 +141,12 @@ void CWII_IPC_HLE_Device_es::OpenInternal()
|
||||||
m_TitleID = ((u64)0x00010000 << 32) | 0xF00DBEEF;
|
m_TitleID = ((u64)0x00010000 << 32) | 0xF00DBEEF;
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "Set default title to %08x/%08x", (u32)(m_TitleID >> 32), (u32)m_TitleID);
|
INFO_LOG(IOS_ES, "Set default title to %08x/%08x", (u32)(m_TitleID >> 32), (u32)m_TitleID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_es::DoState(PointerWrap& p)
|
void ES::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
IWII_IPC_HLE_Device::DoState(p);
|
Device::DoState(p);
|
||||||
p.Do(m_ContentFile);
|
p.Do(m_ContentFile);
|
||||||
OpenInternal();
|
OpenInternal();
|
||||||
p.Do(m_AccessIdentID);
|
p.Do(m_AccessIdentID);
|
||||||
|
@ -195,35 +195,35 @@ void CWII_IPC_HLE_Device_es::DoState(PointerWrap& p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IOSReturnCode CWII_IPC_HLE_Device_es::Open(const IOSOpenRequest& request)
|
IOSReturnCode ES::Open(const IOSOpenRequest& request)
|
||||||
{
|
{
|
||||||
OpenInternal();
|
OpenInternal();
|
||||||
|
|
||||||
if (m_is_active)
|
if (m_is_active)
|
||||||
INFO_LOG(WII_IPC_ES, "Device was re-opened.");
|
INFO_LOG(IOS_ES, "Device was re-opened.");
|
||||||
return IWII_IPC_HLE_Device::Open(request);
|
return Device::Open(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_es::Close()
|
void ES::Close()
|
||||||
{
|
{
|
||||||
m_ContentAccessMap.clear();
|
m_ContentAccessMap.clear();
|
||||||
m_TitleIDs.clear();
|
m_TitleIDs.clear();
|
||||||
m_TitleID = -1;
|
m_TitleID = -1;
|
||||||
m_AccessIdentID = 0x6000000;
|
m_AccessIdentID = 0x6000000;
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "ES: Close");
|
INFO_LOG(IOS_ES, "ES: Close");
|
||||||
m_is_active = false;
|
m_is_active = false;
|
||||||
// clear the NAND content cache to make sure nothing remains open.
|
// clear the NAND content cache to make sure nothing remains open.
|
||||||
DiscIO::CNANDContentManager::Access().ClearCache();
|
DiscIO::CNANDContentManager::Access().ClearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
|
u32 ES::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
|
||||||
{
|
{
|
||||||
const DiscIO::CNANDContentLoader& Loader = AccessContentDevice(TitleID);
|
const DiscIO::CNANDContentLoader& Loader = AccessContentDevice(TitleID);
|
||||||
|
|
||||||
if (!Loader.IsValid())
|
if (!Loader.IsValid())
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_ES, "ES: loader not valid for %" PRIx64, TitleID);
|
WARN_LOG(IOS_ES, "ES: loader not valid for %" PRIx64, TitleID);
|
||||||
return 0xffffffff;
|
return 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,9 +246,9 @@ u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
|
||||||
return CFD;
|
return CFD;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
IPCCommandResult ES::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_ES, "%s (0x%x)", GetDeviceName().c_str(), request.request);
|
DEBUG_LOG(IOS_ES, "%s (0x%x)", GetDeviceName().c_str(), request.request);
|
||||||
// Clear the IO buffers. Note that this is unsafe for other ioctlvs.
|
// Clear the IO buffers. Note that this is unsafe for other ioctlvs.
|
||||||
for (const auto& io_vector : request.io_vectors)
|
for (const auto& io_vector : request.io_vectors)
|
||||||
{
|
{
|
||||||
|
@ -259,10 +259,10 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
case IOCTL_ES_ADDTICKET:
|
case IOCTL_ES_ADDTICKET:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 3,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 3,
|
||||||
"IOCTL_ES_ADDTICKET wrong number of inputs");
|
"IOCTL_ES_ADDTICKET wrong number of inputs");
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_ADDTICKET");
|
INFO_LOG(IOS_ES, "IOCTL_ES_ADDTICKET");
|
||||||
std::vector<u8> ticket(request.in_vectors[0].size);
|
std::vector<u8> ticket(request.in_vectors[0].size);
|
||||||
Memory::CopyFromEmu(ticket.data(), request.in_vectors[0].address, request.in_vectors[0].size);
|
Memory::CopyFromEmu(ticket.data(), request.in_vectors[0].address, request.in_vectors[0].size);
|
||||||
DiscIO::AddTicket(ticket);
|
DiscIO::AddTicket(ticket);
|
||||||
|
@ -271,17 +271,17 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_ADDTITLESTART:
|
case IOCTL_ES_ADDTITLESTART:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 4,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 4,
|
||||||
"IOCTL_ES_ADDTITLESTART wrong number of inputs");
|
"IOCTL_ES_ADDTITLESTART wrong number of inputs");
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_ADDTITLESTART");
|
INFO_LOG(IOS_ES, "IOCTL_ES_ADDTITLESTART");
|
||||||
std::vector<u8> tmd(request.in_vectors[0].size);
|
std::vector<u8> tmd(request.in_vectors[0].size);
|
||||||
Memory::CopyFromEmu(tmd.data(), request.in_vectors[0].address, request.in_vectors[0].size);
|
Memory::CopyFromEmu(tmd.data(), request.in_vectors[0].address, request.in_vectors[0].size);
|
||||||
|
|
||||||
m_addtitle_tmd.SetBytes(tmd);
|
m_addtitle_tmd.SetBytes(tmd);
|
||||||
if (!m_addtitle_tmd.IsValid())
|
if (!m_addtitle_tmd.IsValid())
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_ES, "Invalid TMD while adding title (size = %zd)", tmd.size());
|
ERROR_LOG(IOS_ES, "Invalid TMD while adding title (size = %zd)", tmd.size());
|
||||||
return GetDefaultReply(ES_INVALID_TMD);
|
return GetDefaultReply(ES_INVALID_TMD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_ADDCONTENTSTART:
|
case IOCTL_ES_ADDCONTENTSTART:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 2,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 2,
|
||||||
"IOCTL_ES_ADDCONTENTSTART wrong number of inputs");
|
"IOCTL_ES_ADDCONTENTSTART wrong number of inputs");
|
||||||
|
|
||||||
u64 title_id = Memory::Read_U64(request.in_vectors[0].address);
|
u64 title_id = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
|
@ -305,7 +305,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
if (m_addtitle_content_id != 0xFFFFFFFF)
|
if (m_addtitle_content_id != 0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_ES, "Trying to add content when we haven't finished adding "
|
ERROR_LOG(IOS_ES, "Trying to add content when we haven't finished adding "
|
||||||
"another content. Unsupported.");
|
"another content. Unsupported.");
|
||||||
return GetDefaultReply(ES_WRITE_FAILURE);
|
return GetDefaultReply(ES_WRITE_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -313,13 +313,13 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
m_addtitle_content_buffer.clear();
|
m_addtitle_content_buffer.clear();
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_ADDCONTENTSTART: title id %016" PRIx64 ", "
|
INFO_LOG(IOS_ES, "IOCTL_ES_ADDCONTENTSTART: title id %016" PRIx64 ", "
|
||||||
"content id %08x",
|
"content id %08x",
|
||||||
title_id, m_addtitle_content_id);
|
title_id, m_addtitle_content_id);
|
||||||
|
|
||||||
if (title_id != m_addtitle_tmd.GetTitleId())
|
if (title_id != m_addtitle_tmd.GetTitleId())
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_ES, "IOCTL_ES_ADDCONTENTSTART: title id %016" PRIx64 " != "
|
ERROR_LOG(IOS_ES, "IOCTL_ES_ADDCONTENTSTART: title id %016" PRIx64 " != "
|
||||||
"TMD title id %016lx, ignoring",
|
"TMD title id %016lx, ignoring",
|
||||||
title_id, m_addtitle_tmd.GetTitleId());
|
title_id, m_addtitle_tmd.GetTitleId());
|
||||||
}
|
}
|
||||||
|
@ -334,11 +334,11 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_ADDCONTENTDATA:
|
case IOCTL_ES_ADDCONTENTDATA:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 2,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 2,
|
||||||
"IOCTL_ES_ADDCONTENTDATA wrong number of inputs");
|
"IOCTL_ES_ADDCONTENTDATA wrong number of inputs");
|
||||||
|
|
||||||
u32 content_fd = Memory::Read_U32(request.in_vectors[0].address);
|
u32 content_fd = Memory::Read_U32(request.in_vectors[0].address);
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_ADDCONTENTDATA: content fd %08x, "
|
INFO_LOG(IOS_ES, "IOCTL_ES_ADDCONTENTDATA: content fd %08x, "
|
||||||
"size %d",
|
"size %d",
|
||||||
content_fd, request.in_vectors[1].size);
|
content_fd, request.in_vectors[1].size);
|
||||||
|
|
||||||
|
@ -350,11 +350,11 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_ADDCONTENTFINISH:
|
case IOCTL_ES_ADDCONTENTFINISH:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 1,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 1,
|
||||||
"IOCTL_ES_ADDCONTENTFINISH wrong number of inputs");
|
"IOCTL_ES_ADDCONTENTFINISH wrong number of inputs");
|
||||||
|
|
||||||
u32 content_fd = Memory::Read_U32(request.in_vectors[0].address);
|
u32 content_fd = Memory::Read_U32(request.in_vectors[0].address);
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_ADDCONTENTFINISH: content fd %08x", content_fd);
|
INFO_LOG(IOS_ES, "IOCTL_ES_ADDCONTENTFINISH: content fd %08x", content_fd);
|
||||||
|
|
||||||
// Try to find the title key from a pre-installed ticket.
|
// Try to find the title key from a pre-installed ticket.
|
||||||
std::vector<u8> ticket = DiscIO::FindSignedTicket(m_addtitle_tmd.GetTitleId());
|
std::vector<u8> ticket = DiscIO::FindSignedTicket(m_addtitle_tmd.GetTitleId());
|
||||||
|
@ -394,25 +394,24 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_ADDTITLEFINISH:
|
case IOCTL_ES_ADDTITLEFINISH:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_ADDTITLEFINISH");
|
INFO_LOG(IOS_ES, "IOCTL_ES_ADDTITLEFINISH");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IOCTL_ES_GETDEVICEID:
|
case IOCTL_ES_GETDEVICEID:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1,
|
_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1, "IOCTL_ES_GETDEVICEID no io vectors");
|
||||||
"IOCTL_ES_GETDEVICEID no io vectors");
|
|
||||||
|
|
||||||
EcWii& ec = EcWii::GetInstance();
|
EcWii& ec = EcWii::GetInstance();
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETDEVICEID %08X", ec.getNgId());
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETDEVICEID %08X", ec.getNgId());
|
||||||
Memory::Write_U32(ec.getNgId(), request.io_vectors[0].address);
|
Memory::Write_U32(ec.getNgId(), request.io_vectors[0].address);
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
case IOCTL_ES_GETTITLECONTENTSCNT:
|
case IOCTL_ES_GETTITLECONTENTSCNT:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_ES, request.in_vectors.size() == 1);
|
_dbg_assert_(IOS_ES, request.in_vectors.size() == 1);
|
||||||
_dbg_assert_(WII_IPC_ES, request.io_vectors.size() == 1);
|
_dbg_assert_(IOS_ES, request.io_vectors.size() == 1);
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
|
|
||||||
|
@ -433,7 +432,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
return_value = 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",
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETTITLECONTENTSCNT: TitleID: %08x/%08x content count %i",
|
||||||
(u32)(TitleID >> 32), (u32)TitleID,
|
(u32)(TitleID >> 32), (u32)TitleID,
|
||||||
rNANDContent.IsValid() ? NumberOfPrivateContent : (u32)rNANDContent.GetContentSize());
|
rNANDContent.IsValid() ? NumberOfPrivateContent : (u32)rNANDContent.GetContentSize());
|
||||||
|
|
||||||
|
@ -443,9 +442,9 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_GETTITLECONTENTS:
|
case IOCTL_ES_GETTITLECONTENTS:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 2,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 2,
|
||||||
"IOCTL_ES_GETTITLECONTENTS bad in buffer");
|
"IOCTL_ES_GETTITLECONTENTS bad in buffer");
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1,
|
_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1,
|
||||||
"IOCTL_ES_GETTITLECONTENTS bad out buffer");
|
"IOCTL_ES_GETTITLECONTENTS bad out buffer");
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
|
@ -458,14 +457,14 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
Memory::Write_U32(rNANDContent.GetContentByIndex(i)->m_ContentID,
|
Memory::Write_U32(rNANDContent.GetContentByIndex(i)->m_ContentID,
|
||||||
request.io_vectors[0].address + i * 4);
|
request.io_vectors[0].address + i * 4);
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECONTENTS: Index %d: %08x", i,
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETTITLECONTENTS: Index %d: %08x", i,
|
||||||
rNANDContent.GetContentByIndex(i)->m_ContentID);
|
rNANDContent.GetContentByIndex(i)->m_ContentID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return_value = 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",
|
ERROR_LOG(IOS_ES, "IOCTL_ES_GETTITLECONTENTS: Unable to open content %zu",
|
||||||
rNANDContent.GetContentSize());
|
rNANDContent.GetContentSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,15 +474,15 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_OPENTITLECONTENT:
|
case IOCTL_ES_OPENTITLECONTENT:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_ES, request.in_vectors.size() == 3);
|
_dbg_assert_(IOS_ES, request.in_vectors.size() == 3);
|
||||||
_dbg_assert_(WII_IPC_ES, request.io_vectors.size() == 0);
|
_dbg_assert_(IOS_ES, request.io_vectors.size() == 0);
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
u32 Index = Memory::Read_U32(request.in_vectors[2].address);
|
u32 Index = Memory::Read_U32(request.in_vectors[2].address);
|
||||||
|
|
||||||
s32 CFD = OpenTitleContent(m_AccessIdentID++, TitleID, Index);
|
s32 CFD = OpenTitleContent(m_AccessIdentID++, TitleID, Index);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_OPENTITLECONTENT: TitleID: %08x/%08x Index %i -> got CFD %x",
|
INFO_LOG(IOS_ES, "IOCTL_ES_OPENTITLECONTENT: TitleID: %08x/%08x Index %i -> got CFD %x",
|
||||||
(u32)(TitleID >> 32), (u32)TitleID, Index, CFD);
|
(u32)(TitleID >> 32), (u32)TitleID, Index, CFD);
|
||||||
|
|
||||||
return GetDefaultReply(CFD);
|
return GetDefaultReply(CFD);
|
||||||
|
@ -492,12 +491,12 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_OPENCONTENT:
|
case IOCTL_ES_OPENCONTENT:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_ES, request.in_vectors.size() == 1);
|
_dbg_assert_(IOS_ES, request.in_vectors.size() == 1);
|
||||||
_dbg_assert_(WII_IPC_ES, request.io_vectors.size() == 0);
|
_dbg_assert_(IOS_ES, request.io_vectors.size() == 0);
|
||||||
u32 Index = Memory::Read_U32(request.in_vectors[0].address);
|
u32 Index = Memory::Read_U32(request.in_vectors[0].address);
|
||||||
|
|
||||||
s32 CFD = OpenTitleContent(m_AccessIdentID++, m_TitleID, Index);
|
s32 CFD = OpenTitleContent(m_AccessIdentID++, m_TitleID, Index);
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_OPENCONTENT: Index %i -> got CFD %x", Index, CFD);
|
INFO_LOG(IOS_ES, "IOCTL_ES_OPENCONTENT: Index %i -> got CFD %x", Index, CFD);
|
||||||
|
|
||||||
return GetDefaultReply(CFD);
|
return GetDefaultReply(CFD);
|
||||||
}
|
}
|
||||||
|
@ -505,8 +504,8 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_READCONTENT:
|
case IOCTL_ES_READCONTENT:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_ES, request.in_vectors.size() == 1);
|
_dbg_assert_(IOS_ES, request.in_vectors.size() == 1);
|
||||||
_dbg_assert_(WII_IPC_ES, request.io_vectors.size() == 1);
|
_dbg_assert_(IOS_ES, request.io_vectors.size() == 1);
|
||||||
|
|
||||||
u32 CFD = Memory::Read_U32(request.in_vectors[0].address);
|
u32 CFD = Memory::Read_U32(request.in_vectors[0].address);
|
||||||
u32 Size = request.io_vectors[0].size;
|
u32 Size = request.io_vectors[0].size;
|
||||||
|
@ -536,8 +535,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(rContent.m_Index);
|
const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(rContent.m_Index);
|
||||||
if (!pContent->m_Data->GetRange(rContent.m_Position, Size, pDest))
|
if (!pContent->m_Data->GetRange(rContent.m_Position, Size, pDest))
|
||||||
ERROR_LOG(WII_IPC_ES, "ES: failed to read %u bytes from %u!", Size,
|
ERROR_LOG(IOS_ES, "ES: failed to read %u bytes from %u!", Size, rContent.m_Position);
|
||||||
rContent.m_Position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rContent.m_Position += Size;
|
rContent.m_Position += Size;
|
||||||
|
@ -548,7 +546,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_ES,
|
DEBUG_LOG(IOS_ES,
|
||||||
"IOCTL_ES_READCONTENT: CFD %x, Address 0x%x, Size %i -> stream pos %i (Index %i)",
|
"IOCTL_ES_READCONTENT: CFD %x, Address 0x%x, Size %i -> stream pos %i (Index %i)",
|
||||||
CFD, Addr, Size, rContent.m_Position, rContent.m_Index);
|
CFD, Addr, Size, rContent.m_Position, rContent.m_Index);
|
||||||
|
|
||||||
|
@ -558,12 +556,12 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_CLOSECONTENT:
|
case IOCTL_ES_CLOSECONTENT:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_ES, request.in_vectors.size() == 1);
|
_dbg_assert_(IOS_ES, request.in_vectors.size() == 1);
|
||||||
_dbg_assert_(WII_IPC_ES, request.io_vectors.size() == 0);
|
_dbg_assert_(IOS_ES, request.io_vectors.size() == 0);
|
||||||
|
|
||||||
u32 CFD = Memory::Read_U32(request.in_vectors[0].address);
|
u32 CFD = Memory::Read_U32(request.in_vectors[0].address);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_CLOSECONTENT: CFD %x", CFD);
|
INFO_LOG(IOS_ES, "IOCTL_ES_CLOSECONTENT: CFD %x", CFD);
|
||||||
|
|
||||||
auto itr = m_ContentAccessMap.find(CFD);
|
auto itr = m_ContentAccessMap.find(CFD);
|
||||||
if (itr == m_ContentAccessMap.end())
|
if (itr == m_ContentAccessMap.end())
|
||||||
|
@ -587,8 +585,8 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_SEEKCONTENT:
|
case IOCTL_ES_SEEKCONTENT:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_ES, request.in_vectors.size() == 3);
|
_dbg_assert_(IOS_ES, request.in_vectors.size() == 3);
|
||||||
_dbg_assert_(WII_IPC_ES, request.io_vectors.size() == 0);
|
_dbg_assert_(IOS_ES, request.io_vectors.size() == 0);
|
||||||
|
|
||||||
u32 CFD = Memory::Read_U32(request.in_vectors[0].address);
|
u32 CFD = Memory::Read_U32(request.in_vectors[0].address);
|
||||||
u32 Addr = Memory::Read_U32(request.in_vectors[1].address);
|
u32 Addr = Memory::Read_U32(request.in_vectors[1].address);
|
||||||
|
@ -616,8 +614,8 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_ES, "IOCTL_ES_SEEKCONTENT: CFD %x, Address 0x%x, Mode %i -> Pos %i", CFD,
|
DEBUG_LOG(IOS_ES, "IOCTL_ES_SEEKCONTENT: CFD %x, Address 0x%x, Mode %i -> Pos %i", CFD, Addr,
|
||||||
Addr, Mode, rContent.m_Position);
|
Mode, rContent.m_Position);
|
||||||
|
|
||||||
return GetDefaultReply(rContent.m_Position);
|
return GetDefaultReply(rContent.m_Position);
|
||||||
}
|
}
|
||||||
|
@ -625,52 +623,51 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_GETTITLEDIR:
|
case IOCTL_ES_GETTITLEDIR:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_ES, request.in_vectors.size() == 1);
|
_dbg_assert_(IOS_ES, request.in_vectors.size() == 1);
|
||||||
_dbg_assert_(WII_IPC_ES, request.io_vectors.size() == 1);
|
_dbg_assert_(IOS_ES, request.io_vectors.size() == 1);
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
|
|
||||||
char* Path = (char*)Memory::GetPointer(request.io_vectors[0].address);
|
char* Path = (char*)Memory::GetPointer(request.io_vectors[0].address);
|
||||||
sprintf(Path, "/title/%08x/%08x/data", (u32)(TitleID >> 32), (u32)TitleID);
|
sprintf(Path, "/title/%08x/%08x/data", (u32)(TitleID >> 32), (u32)TitleID);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLEDIR: %s", Path);
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETTITLEDIR: %s", Path);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_ES_GETTITLEID:
|
case IOCTL_ES_GETTITLEID:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_ES, request.in_vectors.size() == 0);
|
_dbg_assert_(IOS_ES, request.in_vectors.size() == 0);
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1,
|
_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1, "IOCTL_ES_GETTITLEID no out buffer");
|
||||||
"IOCTL_ES_GETTITLEID no out buffer");
|
|
||||||
|
|
||||||
Memory::Write_U64(m_TitleID, request.io_vectors[0].address);
|
Memory::Write_U64(m_TitleID, request.io_vectors[0].address);
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLEID: %08x/%08x", (u32)(m_TitleID >> 32), (u32)m_TitleID);
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETTITLEID: %08x/%08x", (u32)(m_TitleID >> 32), (u32)m_TitleID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_ES_SETUID:
|
case IOCTL_ES_SETUID:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 1, "IOCTL_ES_SETUID no in buffer");
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 1, "IOCTL_ES_SETUID no in buffer");
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 0,
|
_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 0,
|
||||||
"IOCTL_ES_SETUID has a payload, it shouldn't");
|
"IOCTL_ES_SETUID has a payload, it shouldn't");
|
||||||
// TODO: fs permissions based on this
|
// TODO: fs permissions based on this
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_SETUID titleID: %08x/%08x", (u32)(TitleID >> 32), (u32)TitleID);
|
INFO_LOG(IOS_ES, "IOCTL_ES_SETUID titleID: %08x/%08x", (u32)(TitleID >> 32), (u32)TitleID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_ES_GETTITLECNT:
|
case IOCTL_ES_GETTITLECNT:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 0,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 0,
|
||||||
"IOCTL_ES_GETTITLECNT has an in buffer");
|
"IOCTL_ES_GETTITLECNT has an in buffer");
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1,
|
_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1,
|
||||||
"IOCTL_ES_GETTITLECNT has no out buffer");
|
"IOCTL_ES_GETTITLECNT has no out buffer");
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors[0].size == 4,
|
_dbg_assert_msg_(IOS_ES, request.io_vectors[0].size == 4,
|
||||||
"IOCTL_ES_GETTITLECNT payload[0].size != 4");
|
"IOCTL_ES_GETTITLECNT payload[0].size != 4");
|
||||||
|
|
||||||
Memory::Write_U32((u32)m_TitleIDs.size(), request.io_vectors[0].address);
|
Memory::Write_U32((u32)m_TitleIDs.size(), request.io_vectors[0].address);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECNT: Number of Titles %zu", m_TitleIDs.size());
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETTITLECNT: Number of Titles %zu", m_TitleIDs.size());
|
||||||
|
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -678,9 +675,8 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_GETTITLES:
|
case IOCTL_ES_GETTITLES:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 1,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 1, "IOCTL_ES_GETTITLES has an in buffer");
|
||||||
"IOCTL_ES_GETTITLES has an in buffer");
|
_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1,
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1,
|
|
||||||
"IOCTL_ES_GETTITLES has no out buffer");
|
"IOCTL_ES_GETTITLES has no out buffer");
|
||||||
|
|
||||||
u32 MaxCount = Memory::Read_U32(request.in_vectors[0].address);
|
u32 MaxCount = Memory::Read_U32(request.in_vectors[0].address);
|
||||||
|
@ -688,24 +684,22 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
for (int i = 0; i < (int)m_TitleIDs.size(); i++)
|
for (int i = 0; i < (int)m_TitleIDs.size(); i++)
|
||||||
{
|
{
|
||||||
Memory::Write_U64(m_TitleIDs[i], request.io_vectors[0].address + i * 8);
|
Memory::Write_U64(m_TitleIDs[i], request.io_vectors[0].address + i * 8);
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLES: %08x/%08x", (u32)(m_TitleIDs[i] >> 32),
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETTITLES: %08x/%08x", (u32)(m_TitleIDs[i] >> 32),
|
||||||
(u32)m_TitleIDs[i]);
|
(u32)m_TitleIDs[i]);
|
||||||
Count++;
|
Count++;
|
||||||
if (Count >= MaxCount)
|
if (Count >= MaxCount)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLES: Number of titles returned %i", Count);
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETTITLES: Number of titles returned %i", Count);
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_ES_GETVIEWCNT:
|
case IOCTL_ES_GETVIEWCNT:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 1,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 1, "IOCTL_ES_GETVIEWCNT no in buffer");
|
||||||
"IOCTL_ES_GETVIEWCNT no in buffer");
|
_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1, "IOCTL_ES_GETVIEWCNT no out buffer");
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1,
|
|
||||||
"IOCTL_ES_GETVIEWCNT no out buffer");
|
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
|
|
||||||
|
@ -720,11 +714,11 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
if (File::Exists(TicketFilename))
|
if (File::Exists(TicketFilename))
|
||||||
{
|
{
|
||||||
u32 FileSize = (u32)File::GetSize(TicketFilename);
|
u32 FileSize = (u32)File::GetSize(TicketFilename);
|
||||||
_dbg_assert_msg_(WII_IPC_ES, (FileSize % DiscIO::CNANDContentLoader::TICKET_SIZE) == 0,
|
_dbg_assert_msg_(IOS_ES, (FileSize % DiscIO::CNANDContentLoader::TICKET_SIZE) == 0,
|
||||||
"IOCTL_ES_GETVIEWCNT ticket file size seems to be wrong");
|
"IOCTL_ES_GETVIEWCNT ticket file size seems to be wrong");
|
||||||
|
|
||||||
ViewCount = FileSize / DiscIO::CNANDContentLoader::TICKET_SIZE;
|
ViewCount = FileSize / DiscIO::CNANDContentLoader::TICKET_SIZE;
|
||||||
_dbg_assert_msg_(WII_IPC_ES, (ViewCount > 0) && (ViewCount <= 4),
|
_dbg_assert_msg_(IOS_ES, (ViewCount > 0) && (ViewCount <= 4),
|
||||||
"IOCTL_ES_GETVIEWCNT ticket count seems to be wrong");
|
"IOCTL_ES_GETVIEWCNT ticket count seems to be wrong");
|
||||||
}
|
}
|
||||||
else if (TitleID >> 32 == 0x00000001)
|
else if (TitleID >> 32 == 0x00000001)
|
||||||
|
@ -744,7 +738,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETVIEWCNT for titleID: %08x/%08x (View Count = %i)",
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETVIEWCNT for titleID: %08x/%08x (View Count = %i)",
|
||||||
(u32)(TitleID >> 32), (u32)TitleID, ViewCount);
|
(u32)(TitleID >> 32), (u32)TitleID, ViewCount);
|
||||||
|
|
||||||
Memory::Write_U32(ViewCount, request.io_vectors[0].address);
|
Memory::Write_U32(ViewCount, request.io_vectors[0].address);
|
||||||
|
@ -754,8 +748,8 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_GETVIEWS:
|
case IOCTL_ES_GETVIEWS:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 2, "IOCTL_ES_GETVIEWS no in buffer");
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 2, "IOCTL_ES_GETVIEWS no in buffer");
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1, "IOCTL_ES_GETVIEWS no out buffer");
|
_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1, "IOCTL_ES_GETVIEWS no out buffer");
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
u32 maxViews = Memory::Read_U32(request.in_vectors[1].address);
|
u32 maxViews = Memory::Read_U32(request.in_vectors[1].address);
|
||||||
|
@ -817,7 +811,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)",
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETVIEWS for titleID: %08x/%08x (MaxViews = %i)",
|
||||||
(u32)(TitleID >> 32), (u32)TitleID, maxViews);
|
(u32)(TitleID >> 32), (u32)TitleID, maxViews);
|
||||||
|
|
||||||
return GetDefaultReply(retVal);
|
return GetDefaultReply(retVal);
|
||||||
|
@ -826,9 +820,8 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_GETTMDVIEWCNT:
|
case IOCTL_ES_GETTMDVIEWCNT:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 1,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 1, "IOCTL_ES_GETTMDVIEWCNT no in buffer");
|
||||||
"IOCTL_ES_GETTMDVIEWCNT no in buffer");
|
_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1,
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1,
|
|
||||||
"IOCTL_ES_GETTMDVIEWCNT no out buffer");
|
"IOCTL_ES_GETTMDVIEWCNT no out buffer");
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
|
@ -846,7 +839,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
}
|
}
|
||||||
Memory::Write_U32(TMDViewCnt, request.io_vectors[0].address);
|
Memory::Write_U32(TMDViewCnt, request.io_vectors[0].address);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x (view size %i)",
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x (view size %i)",
|
||||||
(u32)(TitleID >> 32), (u32)TitleID, TMDViewCnt);
|
(u32)(TitleID >> 32), (u32)TitleID, TMDViewCnt);
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -854,9 +847,8 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_GETTMDVIEWS:
|
case IOCTL_ES_GETTMDVIEWS:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 2,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 2, "IOCTL_ES_GETTMDVIEWCNT no in buffer");
|
||||||
"IOCTL_ES_GETTMDVIEWCNT no in buffer");
|
_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1,
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1,
|
|
||||||
"IOCTL_ES_GETTMDVIEWCNT no out buffer");
|
"IOCTL_ES_GETTMDVIEWCNT no out buffer");
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
|
@ -864,7 +856,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
const DiscIO::CNANDContentLoader& Loader = AccessContentDevice(TitleID);
|
const DiscIO::CNANDContentLoader& Loader = AccessContentDevice(TitleID);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x buffer size: %i",
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x buffer size: %i",
|
||||||
(u32)(TitleID >> 32), (u32)TitleID, MaxCount);
|
(u32)(TitleID >> 32), (u32)TitleID, MaxCount);
|
||||||
|
|
||||||
if (Loader.IsValid())
|
if (Loader.IsValid())
|
||||||
|
@ -892,11 +884,10 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
Address += 8;
|
Address += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
_dbg_assert_(WII_IPC_ES,
|
_dbg_assert_(IOS_ES, (Address - request.io_vectors[0].address) == request.io_vectors[0].size);
|
||||||
(Address - request.io_vectors[0].address) == request.io_vectors[0].size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWS: title: %08x/%08x (buffer size: %i)",
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETTMDVIEWS: title: %08x/%08x (buffer size: %i)",
|
||||||
(u32)(TitleID >> 32), (u32)TitleID, MaxCount);
|
(u32)(TitleID >> 32), (u32)TitleID, MaxCount);
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -904,14 +895,13 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_GETCONSUMPTION: // This is at least what crediar's ES module does
|
case IOCTL_ES_GETCONSUMPTION: // This is at least what crediar's ES module does
|
||||||
Memory::Write_U32(0, request.io_vectors[1].address);
|
Memory::Write_U32(0, request.io_vectors[1].address);
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETCONSUMPTION");
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETCONSUMPTION");
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
|
|
||||||
case IOCTL_ES_DELETETICKET:
|
case IOCTL_ES_DELETETICKET:
|
||||||
{
|
{
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_DELETETICKET: title: %08x/%08x", (u32)(TitleID >> 32),
|
INFO_LOG(IOS_ES, "IOCTL_ES_DELETETICKET: title: %08x/%08x", (u32)(TitleID >> 32), (u32)TitleID);
|
||||||
(u32)TitleID);
|
|
||||||
// Presumably return -1017 when delete fails
|
// Presumably return -1017 when delete fails
|
||||||
if (!File::Delete(Common::GetTicketFileName(TitleID, Common::FROM_SESSION_ROOT)))
|
if (!File::Delete(Common::GetTicketFileName(TitleID, Common::FROM_SESSION_ROOT)))
|
||||||
return GetDefaultReply(ES_PARAMETER_SIZE_OR_ALIGNMENT);
|
return GetDefaultReply(ES_PARAMETER_SIZE_OR_ALIGNMENT);
|
||||||
|
@ -921,7 +911,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
case IOCTL_ES_DELETETITLECONTENT:
|
case IOCTL_ES_DELETETITLECONTENT:
|
||||||
{
|
{
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_DELETETITLECONTENT: title: %08x/%08x", (u32)(TitleID >> 32),
|
INFO_LOG(IOS_ES, "IOCTL_ES_DELETETITLECONTENT: title: %08x/%08x", (u32)(TitleID >> 32),
|
||||||
(u32)TitleID);
|
(u32)TitleID);
|
||||||
// Presumably return -1017 when title not installed TODO verify
|
// Presumably return -1017 when title not installed TODO verify
|
||||||
if (!DiscIO::CNANDContentManager::Access().RemoveTitle(TitleID, Common::FROM_SESSION_ROOT))
|
if (!DiscIO::CNANDContentManager::Access().RemoveTitle(TitleID, Common::FROM_SESSION_ROOT))
|
||||||
|
@ -931,15 +921,15 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_GETSTOREDTMDSIZE:
|
case IOCTL_ES_GETSTOREDTMDSIZE:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 1,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() == 1,
|
||||||
"IOCTL_ES_GETSTOREDTMDSIZE no in buffer");
|
"IOCTL_ES_GETSTOREDTMDSIZE no in buffer");
|
||||||
// _dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1, "IOCTL_ES_ES_GETSTOREDTMDSIZE
|
// _dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1, "IOCTL_ES_ES_GETSTOREDTMDSIZE
|
||||||
// no out buffer");
|
// no out buffer");
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
const DiscIO::CNANDContentLoader& Loader = AccessContentDevice(TitleID);
|
const DiscIO::CNANDContentLoader& Loader = AccessContentDevice(TitleID);
|
||||||
|
|
||||||
_dbg_assert_(WII_IPC_ES, Loader.IsValid());
|
_dbg_assert_(IOS_ES, Loader.IsValid());
|
||||||
u32 TMDCnt = 0;
|
u32 TMDCnt = 0;
|
||||||
if (Loader.IsValid())
|
if (Loader.IsValid())
|
||||||
{
|
{
|
||||||
|
@ -949,19 +939,18 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
if (request.io_vectors.size())
|
if (request.io_vectors.size())
|
||||||
Memory::Write_U32(TMDCnt, request.io_vectors[0].address);
|
Memory::Write_U32(TMDCnt, request.io_vectors[0].address);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMDSIZE: title: %08x/%08x (view size %i)",
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETSTOREDTMDSIZE: title: %08x/%08x (view size %i)",
|
||||||
(u32)(TitleID >> 32), (u32)TitleID, TMDCnt);
|
(u32)(TitleID >> 32), (u32)TitleID, TMDCnt);
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IOCTL_ES_GETSTOREDTMD:
|
case IOCTL_ES_GETSTOREDTMD:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() > 0,
|
_dbg_assert_msg_(IOS_ES, request.in_vectors.size() > 0, "IOCTL_ES_GETSTOREDTMD no in buffer");
|
||||||
"IOCTL_ES_GETSTOREDTMD no in buffer");
|
|
||||||
// requires 1 inbuffer and no outbuffer, presumably outbuffer required when second inbuffer is
|
// requires 1 inbuffer and no outbuffer, presumably outbuffer required when second inbuffer is
|
||||||
// used for maxcount (allocated mem?)
|
// used for maxcount (allocated mem?)
|
||||||
// called with 1 inbuffer after deleting a titleid
|
// called with 1 inbuffer after deleting a titleid
|
||||||
//_dbg_assert_msg_(WII_IPC_ES, request.io_vectors.size() == 1, "IOCTL_ES_GETSTOREDTMD no out
|
//_dbg_assert_msg_(IOS_ES, request.io_vectors.size() == 1, "IOCTL_ES_GETSTOREDTMD no out
|
||||||
// buffer");
|
// buffer");
|
||||||
|
|
||||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||||
|
@ -973,7 +962,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
}
|
}
|
||||||
const DiscIO::CNANDContentLoader& Loader = AccessContentDevice(TitleID);
|
const DiscIO::CNANDContentLoader& Loader = AccessContentDevice(TitleID);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x buffer size: %i",
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x buffer size: %i",
|
||||||
(u32)(TitleID >> 32), (u32)TitleID, MaxCount);
|
(u32)(TitleID >> 32), (u32)TitleID, MaxCount);
|
||||||
|
|
||||||
if (Loader.IsValid() && request.io_vectors.size())
|
if (Loader.IsValid() && request.io_vectors.size())
|
||||||
|
@ -992,11 +981,10 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
Address += DiscIO::CNANDContentLoader::CONTENT_HEADER_SIZE;
|
Address += DiscIO::CNANDContentLoader::CONTENT_HEADER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_dbg_assert_(WII_IPC_ES,
|
_dbg_assert_(IOS_ES, (Address - request.io_vectors[0].address) == request.io_vectors[0].size);
|
||||||
(Address - request.io_vectors[0].address) == request.io_vectors[0].size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x (buffer size: %i)",
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x (buffer size: %i)",
|
||||||
(u32)(TitleID >> 32), (u32)TitleID, MaxCount);
|
(u32)(TitleID >> 32), (u32)TitleID, MaxCount);
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -1016,7 +1004,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
memcpy(newIV, IV, 16);
|
memcpy(newIV, IV, 16);
|
||||||
mbedtls_aes_crypt_cbc(&AES_ctx, MBEDTLS_AES_ENCRYPT, size, newIV, source, destination);
|
mbedtls_aes_crypt_cbc(&AES_ctx, MBEDTLS_AES_ENCRYPT, size, newIV, source, destination);
|
||||||
|
|
||||||
_dbg_assert_msg_(WII_IPC_ES, keyIndex == 6,
|
_dbg_assert_msg_(IOS_ES, keyIndex == 6,
|
||||||
"IOCTL_ES_ENCRYPT: Key type is not SD, data will be crap");
|
"IOCTL_ES_ENCRYPT: Key type is not SD, data will be crap");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1032,14 +1020,14 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
DecryptContent(keyIndex, IV, source, size, newIV, destination);
|
DecryptContent(keyIndex, IV, source, size, newIV, destination);
|
||||||
|
|
||||||
_dbg_assert_msg_(WII_IPC_ES, keyIndex == 6,
|
_dbg_assert_msg_(IOS_ES, keyIndex == 6,
|
||||||
"IOCTL_ES_DECRYPT: Key type is not SD, data will be crap");
|
"IOCTL_ES_DECRYPT: Key type is not SD, data will be crap");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_ES_LAUNCH:
|
case IOCTL_ES_LAUNCH:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_ES, request.in_vectors.size() == 2);
|
_dbg_assert_(IOS_ES, request.in_vectors.size() == 2);
|
||||||
bool bSuccess = false;
|
bool bSuccess = false;
|
||||||
bool bReset = false;
|
bool bReset = false;
|
||||||
u16 IOSv = 0xffff;
|
u16 IOSv = 0xffff;
|
||||||
|
@ -1113,7 +1101,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
bool* wiiMoteConnected = new bool[MAX_BBMOTES];
|
bool* wiiMoteConnected = new bool[MAX_BBMOTES];
|
||||||
if (!SConfig::GetInstance().m_bt_passthrough_enabled)
|
if (!SConfig::GetInstance().m_bt_passthrough_enabled)
|
||||||
{
|
{
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* s_Usb = GetUsbPointer();
|
BluetoothEmu* s_Usb = GetUsbPointer();
|
||||||
for (unsigned int i = 0; i < MAX_BBMOTES; i++)
|
for (unsigned int i = 0; i < MAX_BBMOTES; i++)
|
||||||
wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected();
|
wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected();
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1111,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
if (!SConfig::GetInstance().m_bt_passthrough_enabled)
|
if (!SConfig::GetInstance().m_bt_passthrough_enabled)
|
||||||
{
|
{
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* s_Usb = GetUsbPointer();
|
BluetoothEmu* s_Usb = GetUsbPointer();
|
||||||
for (unsigned int i = 0; i < MAX_BBMOTES; i++)
|
for (unsigned int i = 0; i < MAX_BBMOTES; i++)
|
||||||
{
|
{
|
||||||
if (wiiMoteConnected[i])
|
if (wiiMoteConnected[i])
|
||||||
|
@ -1153,8 +1141,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
// Note: If we just reset the PPC, don't write anything to the command buffer. This
|
// Note: If we just reset the PPC, don't write anything to the command buffer. This
|
||||||
// could clobber the DOL we just loaded.
|
// could clobber the DOL we just loaded.
|
||||||
|
|
||||||
ERROR_LOG(WII_IPC_ES,
|
ERROR_LOG(IOS_ES, "IOCTL_ES_LAUNCH %016" PRIx64 " %08x %016" PRIx64 " %08x %016" PRIx64 " %04x",
|
||||||
"IOCTL_ES_LAUNCH %016" PRIx64 " %08x %016" PRIx64 " %08x %016" PRIx64 " %04x",
|
|
||||||
TitleID, view, ticketid, devicetype, titleid, access);
|
TitleID, view, ticketid, devicetype, titleid, access);
|
||||||
// IOCTL_ES_LAUNCH 0001000248414341 00000001 0001c0fef3df2cfa 00000000
|
// IOCTL_ES_LAUNCH 0001000248414341 00000001 0001c0fef3df2cfa 00000000
|
||||||
// 0001000248414341 ffff
|
// 0001000248414341 ffff
|
||||||
|
@ -1181,13 +1168,13 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
// IOS70 has this to let system menu 4.2 check if the console is region changed. it returns
|
// IOS70 has this to let system menu 4.2 check if the console is region changed. it returns
|
||||||
// -1017
|
// -1017
|
||||||
// if the IOS didn't find the Korean keys and 0 if it does. 0 leads to a error 003
|
// 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.");
|
INFO_LOG(IOS_ES, "IOCTL_ES_CHECKKOREAREGION: Title checked for Korean keys.");
|
||||||
return GetDefaultReply(ES_PARAMETER_SIZE_OR_ALIGNMENT);
|
return GetDefaultReply(ES_PARAMETER_SIZE_OR_ALIGNMENT);
|
||||||
|
|
||||||
case IOCTL_ES_GETDEVICECERT: // (Input: none, Output: 384 bytes)
|
case IOCTL_ES_GETDEVICECERT: // (Input: none, Output: 384 bytes)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETDEVICECERT");
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETDEVICECERT");
|
||||||
_dbg_assert_(WII_IPC_ES, request.io_vectors.size() == 1);
|
_dbg_assert_(IOS_ES, request.io_vectors.size() == 1);
|
||||||
u8* destination = Memory::GetPointer(request.io_vectors[0].address);
|
u8* destination = Memory::GetPointer(request.io_vectors[0].address);
|
||||||
|
|
||||||
EcWii& ec = EcWii::GetInstance();
|
EcWii& ec = EcWii::GetInstance();
|
||||||
|
@ -1197,7 +1184,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_SIGN:
|
case IOCTL_ES_SIGN:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_SIGN");
|
INFO_LOG(IOS_ES, "IOCTL_ES_SIGN");
|
||||||
u8* ap_cert_out = Memory::GetPointer(request.io_vectors[1].address);
|
u8* ap_cert_out = Memory::GetPointer(request.io_vectors[1].address);
|
||||||
u8* data = Memory::GetPointer(request.in_vectors[0].address);
|
u8* data = Memory::GetPointer(request.in_vectors[0].address);
|
||||||
u32 data_size = request.in_vectors[0].size;
|
u32 data_size = request.in_vectors[0].size;
|
||||||
|
@ -1211,7 +1198,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTL_ES_GETBOOT2VERSION:
|
case IOCTL_ES_GETBOOT2VERSION:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETBOOT2VERSION");
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETBOOT2VERSION");
|
||||||
|
|
||||||
Memory::Write_U32(
|
Memory::Write_U32(
|
||||||
4, request.io_vectors[0].address); // as of 26/02/2012, this was latest bootmii version
|
4, request.io_vectors[0].address); // as of 26/02/2012, this was latest bootmii version
|
||||||
|
@ -1222,22 +1209,22 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
// unsupported functions
|
// unsupported functions
|
||||||
// ===============================================================================================
|
// ===============================================================================================
|
||||||
case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes) bug crediar :D
|
case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes) bug crediar :D
|
||||||
WARN_LOG(WII_IPC_ES, "IOCTL_ES_DIGETTICKETVIEW: this looks really wrong...");
|
WARN_LOG(IOS_ES, "IOCTL_ES_DIGETTICKETVIEW: this looks really wrong...");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_ES_GETOWNEDTITLECNT:
|
case IOCTL_ES_GETOWNEDTITLECNT:
|
||||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETOWNEDTITLECNT");
|
INFO_LOG(IOS_ES, "IOCTL_ES_GETOWNEDTITLECNT");
|
||||||
Memory::Write_U32(0, request.io_vectors[0].address);
|
Memory::Write_U32(0, request.io_vectors[0].address);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_HLE);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DiscIO::CNANDContentLoader& CWII_IPC_HLE_Device_es::AccessContentDevice(u64 title_id)
|
const DiscIO::CNANDContentLoader& ES::AccessContentDevice(u64 title_id)
|
||||||
{
|
{
|
||||||
// for WADs, the passed title id and the stored title id match; along with m_ContentFile being set
|
// for WADs, the passed title id and the stored title id match; along with m_ContentFile being set
|
||||||
// to the
|
// to the
|
||||||
|
@ -1251,7 +1238,7 @@ const DiscIO::CNANDContentLoader& CWII_IPC_HLE_Device_es::AccessContentDevice(u6
|
||||||
return DiscIO::CNANDContentManager::Access().GetNANDLoader(title_id, Common::FROM_SESSION_ROOT);
|
return DiscIO::CNANDContentManager::Access().GetNANDLoader(title_id, Common::FROM_SESSION_ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CWII_IPC_HLE_Device_es::ES_DIVerify(const std::vector<u8>& tmd)
|
u32 ES::ES_DIVerify(const std::vector<u8>& tmd)
|
||||||
{
|
{
|
||||||
u64 title_id = 0xDEADBEEFDEADBEEFull;
|
u64 title_id = 0xDEADBEEFDEADBEEFull;
|
||||||
u64 tmd_title_id = Common::swap64(&tmd[0x18C]);
|
u64 tmd_title_id = Common::swap64(&tmd[0x18C]);
|
||||||
|
@ -1315,7 +1302,7 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(const std::vector<u8>& tmd)
|
||||||
{
|
{
|
||||||
File::IOFile tmd_file(tmd_path, "wb");
|
File::IOFile tmd_file(tmd_path, "wb");
|
||||||
if (!tmd_file.WriteBytes(tmd.data(), tmd.size()))
|
if (!tmd_file.WriteBytes(tmd.data(), tmd.size()))
|
||||||
ERROR_LOG(WII_IPC_ES, "DIVerify failed to write disc TMD to NAND.");
|
ERROR_LOG(IOS_ES, "DIVerify failed to write disc TMD to NAND.");
|
||||||
}
|
}
|
||||||
DiscIO::cUIDsys::AccessInstance().AddTitle(tmd_title_id);
|
DiscIO::cUIDsys::AccessInstance().AddTitle(tmd_title_id);
|
||||||
// DI_VERIFY writes to title.tmd, which is read and cached inside the NAND Content Manager.
|
// DI_VERIFY writes to title.tmd, which is read and cached inside the NAND Content Manager.
|
||||||
|
@ -1323,5 +1310,6 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(const std::vector<u8>& tmd)
|
||||||
DiscIO::CNANDContentManager::Access().ClearCache();
|
DiscIO::CNANDContentManager::Access().ClearCache();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -10,9 +10,9 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/ESFormats.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/ES/Formats.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
|
@ -26,10 +26,12 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
class CWII_IPC_HLE_Device_es : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class ES : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName);
|
ES(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
void LoadWAD(const std::string& _rContentFile);
|
void LoadWAD(const std::string& _rContentFile);
|
||||||
|
|
||||||
|
@ -166,5 +168,6 @@ private:
|
||||||
u8 padding[0x3c];
|
u8 padding[0x3c];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/IPC_HLE/ESFormats.h"
|
#include "Core/IOS/ES/Formats.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <utility>
|
#include <utility>
|
|
@ -19,8 +19,8 @@
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/HW/SystemTimers.h"
|
#include "Core/HW/SystemTimers.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
|
#include "Core/IOS/FS/FS.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_fs.h"
|
#include "Core/IOS/FS/FileIO.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -31,19 +31,20 @@ static bool IsValidWiiPath(const std::string& path)
|
||||||
return path.compare(0, 1, "/") == 0;
|
return path.compare(0, 1, "/") == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_fs::CWII_IPC_HLE_Device_fs(u32 _DeviceID, const std::string& _rDeviceName)
|
namespace Device
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
{
|
||||||
|
FS::FS(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~1/1000th of a second is too short and causes hangs in Wii Party
|
// ~1/1000th of a second is too short and causes hangs in Wii Party
|
||||||
// Play it safe at 1/500th
|
// Play it safe at 1/500th
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_fs::GetFSReply(const s32 return_value) const
|
IPCCommandResult FS::GetFSReply(const s32 return_value) const
|
||||||
{
|
{
|
||||||
return {return_value, true, SystemTimers::GetTicksPerSecond() / 500};
|
return {return_value, true, SystemTimers::GetTicksPerSecond() / 500};
|
||||||
}
|
}
|
||||||
|
|
||||||
IOSReturnCode CWII_IPC_HLE_Device_fs::Open(const IOSOpenRequest& request)
|
IOSReturnCode FS::Open(const IOSOpenRequest& request)
|
||||||
{
|
{
|
||||||
// clear tmp folder
|
// clear tmp folder
|
||||||
{
|
{
|
||||||
|
@ -71,7 +72,7 @@ static u64 ComputeTotalFileSize(const File::FSTEntry& parentEntry)
|
||||||
return sizeOfFiles;
|
return sizeOfFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
IPCCommandResult FS::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
s32 return_value = IPC_SUCCESS;
|
s32 return_value = IPC_SUCCESS;
|
||||||
switch (request.request)
|
switch (request.request)
|
||||||
|
@ -83,7 +84,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
if (!IsValidWiiPath(relative_path))
|
if (!IsValidWiiPath(relative_path))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", relative_path.c_str());
|
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", relative_path.c_str());
|
||||||
return_value = FS_EINVAL;
|
return_value = FS_EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -91,11 +92,11 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
// the Wii uses this function to define the type (dir or file)
|
// the Wii uses this function to define the type (dir or file)
|
||||||
std::string DirName(HLE_IPC_BuildFilename(relative_path));
|
std::string DirName(HLE_IPC_BuildFilename(relative_path));
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: IOCTL_READ_DIR %s", DirName.c_str());
|
INFO_LOG(IOS_FILEIO, "FS: IOCTL_READ_DIR %s", DirName.c_str());
|
||||||
|
|
||||||
if (!File::Exists(DirName))
|
if (!File::Exists(DirName))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "FS: Search not found: %s", DirName.c_str());
|
WARN_LOG(IOS_FILEIO, "FS: Search not found: %s", DirName.c_str());
|
||||||
return_value = FS_ENOENT;
|
return_value = FS_ENOENT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +105,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
// It's not a directory, so error.
|
// It's not a directory, so error.
|
||||||
// Games don't usually seem to care WHICH error they get, as long as it's <
|
// Games don't usually seem to care WHICH error they get, as long as it's <
|
||||||
// Well the system menu CARES!
|
// Well the system menu CARES!
|
||||||
WARN_LOG(WII_IPC_FILEIO, "\tNot a directory - return FS_EINVAL");
|
WARN_LOG(IOS_FILEIO, "\tNot a directory - return FS_EINVAL");
|
||||||
return_value = FS_EINVAL;
|
return_value = FS_EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +116,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
if ((request.in_vectors.size() == 1) && (request.io_vectors.size() == 1))
|
if ((request.in_vectors.size() == 1) && (request.io_vectors.size() == 1))
|
||||||
{
|
{
|
||||||
size_t numFile = entry.children.size();
|
size_t numFile = entry.children.size();
|
||||||
INFO_LOG(WII_IPC_FILEIO, "\t%zu files found", numFile);
|
INFO_LOG(IOS_FILEIO, "\t%zu files found", numFile);
|
||||||
|
|
||||||
Memory::Write_U32((u32)numFile, request.io_vectors[0].address);
|
Memory::Write_U32((u32)numFile, request.io_vectors[0].address);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +150,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
*pFilename++ = 0x00; // termination
|
*pFilename++ = 0x00; // termination
|
||||||
numFiles++;
|
numFiles++;
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_FILEIO, "\tFound: %s", FileName.c_str());
|
INFO_LOG(IOS_FILEIO, "\tFound: %s", FileName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory::Write_U32((u32)numFiles, request.io_vectors[1].address);
|
Memory::Write_U32((u32)numFiles, request.io_vectors[1].address);
|
||||||
|
@ -161,9 +162,9 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTLV_GETUSAGE:
|
case IOCTLV_GETUSAGE:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_FILEIO, request.io_vectors.size() == 2);
|
_dbg_assert_(IOS_FILEIO, request.io_vectors.size() == 2);
|
||||||
_dbg_assert_(WII_IPC_FILEIO, request.io_vectors[0].size == 4);
|
_dbg_assert_(IOS_FILEIO, request.io_vectors[0].size == 4);
|
||||||
_dbg_assert_(WII_IPC_FILEIO, request.io_vectors[1].size == 4);
|
_dbg_assert_(IOS_FILEIO, request.io_vectors[1].size == 4);
|
||||||
|
|
||||||
// this command sucks because it asks of the number of used
|
// this command sucks because it asks of the number of used
|
||||||
// fsBlocks and inodes
|
// fsBlocks and inodes
|
||||||
|
@ -173,7 +174,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
|
|
||||||
if (!IsValidWiiPath(relativepath))
|
if (!IsValidWiiPath(relativepath))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", relativepath.c_str());
|
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", relativepath.c_str());
|
||||||
return_value = FS_EINVAL;
|
return_value = FS_EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +183,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
u32 fsBlocks = 0;
|
u32 fsBlocks = 0;
|
||||||
u32 iNodes = 0;
|
u32 iNodes = 0;
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_FILEIO, "IOCTL_GETUSAGE %s", path.c_str());
|
INFO_LOG(IOS_FILEIO, "IOCTL_GETUSAGE %s", path.c_str());
|
||||||
if (File::IsDirectory(path))
|
if (File::IsDirectory(path))
|
||||||
{
|
{
|
||||||
// LPFaint99: After I found that setting the number of inodes to the number of children + 1
|
// LPFaint99: After I found that setting the number of inodes to the number of children + 1
|
||||||
|
@ -208,14 +209,14 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
}
|
}
|
||||||
return_value = IPC_SUCCESS;
|
return_value = IPC_SUCCESS;
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: fsBlock: %i, iNodes: %i", fsBlocks, iNodes);
|
INFO_LOG(IOS_FILEIO, "FS: fsBlock: %i, iNodes: %i", fsBlocks, iNodes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fsBlocks = 0;
|
fsBlocks = 0;
|
||||||
iNodes = 0;
|
iNodes = 0;
|
||||||
return_value = IPC_SUCCESS;
|
return_value = IPC_SUCCESS;
|
||||||
WARN_LOG(WII_IPC_FILEIO, "FS: fsBlock failed, cannot find directory: %s", path.c_str());
|
WARN_LOG(IOS_FILEIO, "FS: fsBlock failed, cannot find directory: %s", path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory::Write_U32(fsBlocks, request.io_vectors[0].address);
|
Memory::Write_U32(fsBlocks, request.io_vectors[0].address);
|
||||||
|
@ -224,21 +225,21 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_FILEIO);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_FILEIO);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetFSReply(return_value);
|
return GetFSReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult FS::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
||||||
const s32 return_value = ExecuteCommand(request);
|
const s32 return_value = ExecuteCommand(request);
|
||||||
return GetFSReply(return_value);
|
return GetFSReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
s32 FS::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
switch (request.request)
|
switch (request.request)
|
||||||
{
|
{
|
||||||
|
@ -247,7 +248,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
if (request.buffer_out_size < 0x1c)
|
if (request.buffer_out_size < 0x1c)
|
||||||
return -1017;
|
return -1017;
|
||||||
|
|
||||||
WARN_LOG(WII_IPC_FILEIO, "FS: GET STATS - returning static values for now");
|
WARN_LOG(IOS_FILEIO, "FS: GET STATS - returning static values for now");
|
||||||
|
|
||||||
NANDStat fs;
|
NANDStat fs;
|
||||||
|
|
||||||
|
@ -268,7 +269,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
|
|
||||||
case IOCTL_CREATE_DIR:
|
case IOCTL_CREATE_DIR:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_FILEIO, request.buffer_out_size == 0);
|
_dbg_assert_(IOS_FILEIO, request.buffer_out_size == 0);
|
||||||
u32 Addr = request.buffer_in;
|
u32 Addr = request.buffer_in;
|
||||||
|
|
||||||
u32 OwnerID = Memory::Read_U32(Addr);
|
u32 OwnerID = Memory::Read_U32(Addr);
|
||||||
|
@ -278,7 +279,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
const std::string wii_path = Memory::GetString(Addr, 64);
|
const std::string wii_path = Memory::GetString(Addr, 64);
|
||||||
if (!IsValidWiiPath(wii_path))
|
if (!IsValidWiiPath(wii_path))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||||
return FS_EINVAL;
|
return FS_EINVAL;
|
||||||
}
|
}
|
||||||
std::string DirName(HLE_IPC_BuildFilename(wii_path));
|
std::string DirName(HLE_IPC_BuildFilename(wii_path));
|
||||||
|
@ -286,12 +287,12 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
Addr += 9; // owner attribs, permission
|
Addr += 9; // owner attribs, permission
|
||||||
u8 Attribs = Memory::Read_U8(Addr);
|
u8 Attribs = Memory::Read_U8(Addr);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: CREATE_DIR %s, OwnerID %#x, GroupID %#x, Attributes %#x",
|
INFO_LOG(IOS_FILEIO, "FS: CREATE_DIR %s, OwnerID %#x, GroupID %#x, Attributes %#x",
|
||||||
DirName.c_str(), OwnerID, GroupID, Attribs);
|
DirName.c_str(), OwnerID, GroupID, Attribs);
|
||||||
|
|
||||||
DirName += DIR_SEP;
|
DirName += DIR_SEP;
|
||||||
File::CreateFullPath(DirName);
|
File::CreateFullPath(DirName);
|
||||||
_dbg_assert_msg_(WII_IPC_FILEIO, File::IsDirectory(DirName), "FS: CREATE_DIR %s failed",
|
_dbg_assert_msg_(IOS_FILEIO, File::IsDirectory(DirName), "FS: CREATE_DIR %s failed",
|
||||||
DirName.c_str());
|
DirName.c_str());
|
||||||
|
|
||||||
return IPC_SUCCESS;
|
return IPC_SUCCESS;
|
||||||
|
@ -309,7 +310,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
const std::string wii_path = Memory::GetString(Addr, 64);
|
const std::string wii_path = Memory::GetString(Addr, 64);
|
||||||
if (!IsValidWiiPath(wii_path))
|
if (!IsValidWiiPath(wii_path))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||||
return FS_EINVAL;
|
return FS_EINVAL;
|
||||||
}
|
}
|
||||||
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
||||||
|
@ -323,13 +324,13 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
u8 Attributes = Memory::Read_U8(Addr);
|
u8 Attributes = Memory::Read_U8(Addr);
|
||||||
Addr += 1;
|
Addr += 1;
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: SetAttrib %s", Filename.c_str());
|
INFO_LOG(IOS_FILEIO, "FS: SetAttrib %s", Filename.c_str());
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " OwnerID: 0x%08x", OwnerID);
|
DEBUG_LOG(IOS_FILEIO, " OwnerID: 0x%08x", OwnerID);
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " GroupID: 0x%04x", GroupID);
|
DEBUG_LOG(IOS_FILEIO, " GroupID: 0x%04x", GroupID);
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " OwnerPerm: 0x%02x", OwnerPerm);
|
DEBUG_LOG(IOS_FILEIO, " OwnerPerm: 0x%02x", OwnerPerm);
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " GroupPerm: 0x%02x", GroupPerm);
|
DEBUG_LOG(IOS_FILEIO, " GroupPerm: 0x%02x", GroupPerm);
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " OtherPerm: 0x%02x", OtherPerm);
|
DEBUG_LOG(IOS_FILEIO, " OtherPerm: 0x%02x", OtherPerm);
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " Attributes: 0x%02x", Attributes);
|
DEBUG_LOG(IOS_FILEIO, " Attributes: 0x%02x", Attributes);
|
||||||
|
|
||||||
return IPC_SUCCESS;
|
return IPC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -337,7 +338,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
|
|
||||||
case IOCTL_GET_ATTR:
|
case IOCTL_GET_ATTR:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_FILEIO, request.buffer_out_size == 76,
|
_dbg_assert_msg_(IOS_FILEIO, request.buffer_out_size == 76,
|
||||||
" GET_ATTR needs an 76 bytes large output buffer but it is %i bytes large",
|
" GET_ATTR needs an 76 bytes large output buffer but it is %i bytes large",
|
||||||
request.buffer_out_size);
|
request.buffer_out_size);
|
||||||
|
|
||||||
|
@ -347,7 +348,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
const std::string wii_path = Memory::GetString(request.buffer_in, 64);
|
const std::string wii_path = Memory::GetString(request.buffer_in, 64);
|
||||||
if (!IsValidWiiPath(wii_path))
|
if (!IsValidWiiPath(wii_path))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||||
return FS_EINVAL;
|
return FS_EINVAL;
|
||||||
}
|
}
|
||||||
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
||||||
|
@ -357,19 +358,18 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
u8 Attributes = 0x00; // no attributes
|
u8 Attributes = 0x00; // no attributes
|
||||||
if (File::IsDirectory(Filename))
|
if (File::IsDirectory(Filename))
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR Directory %s - all permission flags are set",
|
INFO_LOG(IOS_FILEIO, "FS: GET_ATTR Directory %s - all permission flags are set",
|
||||||
Filename.c_str());
|
Filename.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (File::Exists(Filename))
|
if (File::Exists(Filename))
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR %s - all permission flags are set",
|
INFO_LOG(IOS_FILEIO, "FS: GET_ATTR %s - all permission flags are set", Filename.c_str());
|
||||||
Filename.c_str());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR unknown %s", Filename.c_str());
|
INFO_LOG(IOS_FILEIO, "FS: GET_ATTR unknown %s", Filename.c_str());
|
||||||
return FS_ENOENT;
|
return FS_ENOENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -400,28 +400,28 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
|
|
||||||
case IOCTL_DELETE_FILE:
|
case IOCTL_DELETE_FILE:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_FILEIO, request.buffer_out_size == 0);
|
_dbg_assert_(IOS_FILEIO, request.buffer_out_size == 0);
|
||||||
int Offset = 0;
|
int Offset = 0;
|
||||||
|
|
||||||
const std::string wii_path = Memory::GetString(request.buffer_in + Offset, 64);
|
const std::string wii_path = Memory::GetString(request.buffer_in + Offset, 64);
|
||||||
if (!IsValidWiiPath(wii_path))
|
if (!IsValidWiiPath(wii_path))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||||
return FS_EINVAL;
|
return FS_EINVAL;
|
||||||
}
|
}
|
||||||
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
||||||
Offset += 64;
|
Offset += 64;
|
||||||
if (File::Delete(Filename))
|
if (File::Delete(Filename))
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: DeleteFile %s", Filename.c_str());
|
INFO_LOG(IOS_FILEIO, "FS: DeleteFile %s", Filename.c_str());
|
||||||
}
|
}
|
||||||
else if (File::DeleteDir(Filename))
|
else if (File::DeleteDir(Filename))
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: DeleteDir %s", Filename.c_str());
|
INFO_LOG(IOS_FILEIO, "FS: DeleteDir %s", Filename.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "FS: DeleteFile %s - failed!!!", Filename.c_str());
|
WARN_LOG(IOS_FILEIO, "FS: DeleteFile %s - failed!!!", Filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return IPC_SUCCESS;
|
return IPC_SUCCESS;
|
||||||
|
@ -430,13 +430,13 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
|
|
||||||
case IOCTL_RENAME_FILE:
|
case IOCTL_RENAME_FILE:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_FILEIO, request.buffer_out_size == 0);
|
_dbg_assert_(IOS_FILEIO, request.buffer_out_size == 0);
|
||||||
int Offset = 0;
|
int Offset = 0;
|
||||||
|
|
||||||
const std::string wii_path = Memory::GetString(request.buffer_in + Offset, 64);
|
const std::string wii_path = Memory::GetString(request.buffer_in + Offset, 64);
|
||||||
if (!IsValidWiiPath(wii_path))
|
if (!IsValidWiiPath(wii_path))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||||
return FS_EINVAL;
|
return FS_EINVAL;
|
||||||
}
|
}
|
||||||
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
||||||
|
@ -445,7 +445,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
const std::string wii_path_rename = Memory::GetString(request.buffer_in + Offset, 64);
|
const std::string wii_path_rename = Memory::GetString(request.buffer_in + Offset, 64);
|
||||||
if (!IsValidWiiPath(wii_path_rename))
|
if (!IsValidWiiPath(wii_path_rename))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path_rename.c_str());
|
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", wii_path_rename.c_str());
|
||||||
return FS_EINVAL;
|
return FS_EINVAL;
|
||||||
}
|
}
|
||||||
std::string FilenameRename = HLE_IPC_BuildFilename(wii_path_rename);
|
std::string FilenameRename = HLE_IPC_BuildFilename(wii_path_rename);
|
||||||
|
@ -463,11 +463,11 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
// finally try to rename the file
|
// finally try to rename the file
|
||||||
if (File::Rename(Filename, FilenameRename))
|
if (File::Rename(Filename, FilenameRename))
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: Rename %s to %s", Filename.c_str(), FilenameRename.c_str());
|
INFO_LOG(IOS_FILEIO, "FS: Rename %s to %s", Filename.c_str(), FilenameRename.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_FILEIO, "FS: Rename %s to %s - failed", Filename.c_str(),
|
ERROR_LOG(IOS_FILEIO, "FS: Rename %s to %s - failed", Filename.c_str(),
|
||||||
FilenameRename.c_str());
|
FilenameRename.c_str());
|
||||||
return FS_ENOENT;
|
return FS_ENOENT;
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
|
|
||||||
case IOCTL_CREATE_FILE:
|
case IOCTL_CREATE_FILE:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_FILEIO, request.buffer_out_size == 0);
|
_dbg_assert_(IOS_FILEIO, request.buffer_out_size == 0);
|
||||||
|
|
||||||
u32 Addr = request.buffer_in;
|
u32 Addr = request.buffer_in;
|
||||||
u32 OwnerID = Memory::Read_U32(Addr);
|
u32 OwnerID = Memory::Read_U32(Addr);
|
||||||
|
@ -488,7 +488,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
const std::string wii_path = Memory::GetString(Addr, 64);
|
const std::string wii_path = Memory::GetString(Addr, 64);
|
||||||
if (!IsValidWiiPath(wii_path))
|
if (!IsValidWiiPath(wii_path))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
WARN_LOG(IOS_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||||
return FS_EINVAL;
|
return FS_EINVAL;
|
||||||
}
|
}
|
||||||
std::string Filename(HLE_IPC_BuildFilename(wii_path));
|
std::string Filename(HLE_IPC_BuildFilename(wii_path));
|
||||||
|
@ -502,18 +502,18 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
u8 Attributes = Memory::Read_U8(Addr);
|
u8 Attributes = Memory::Read_U8(Addr);
|
||||||
Addr++;
|
Addr++;
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FS: CreateFile %s", Filename.c_str());
|
INFO_LOG(IOS_FILEIO, "FS: CreateFile %s", Filename.c_str());
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " OwnerID: 0x%08x", OwnerID);
|
DEBUG_LOG(IOS_FILEIO, " OwnerID: 0x%08x", OwnerID);
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " GroupID: 0x%04x", GroupID);
|
DEBUG_LOG(IOS_FILEIO, " GroupID: 0x%04x", GroupID);
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " OwnerPerm: 0x%02x", OwnerPerm);
|
DEBUG_LOG(IOS_FILEIO, " OwnerPerm: 0x%02x", OwnerPerm);
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " GroupPerm: 0x%02x", GroupPerm);
|
DEBUG_LOG(IOS_FILEIO, " GroupPerm: 0x%02x", GroupPerm);
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " OtherPerm: 0x%02x", OtherPerm);
|
DEBUG_LOG(IOS_FILEIO, " OtherPerm: 0x%02x", OtherPerm);
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, " Attributes: 0x%02x", Attributes);
|
DEBUG_LOG(IOS_FILEIO, " Attributes: 0x%02x", Attributes);
|
||||||
|
|
||||||
// check if the file already exist
|
// check if the file already exist
|
||||||
if (File::Exists(Filename))
|
if (File::Exists(Filename))
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_FILEIO, "\tresult = FS_EEXIST");
|
INFO_LOG(IOS_FILEIO, "\tresult = FS_EEXIST");
|
||||||
return FS_EEXIST;
|
return FS_EEXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,29 +522,29 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||||
bool Result = File::CreateEmptyFile(Filename);
|
bool Result = File::CreateEmptyFile(Filename);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_FILEIO, "CWII_IPC_HLE_Device_fs: couldn't create new file");
|
ERROR_LOG(IOS_FILEIO, "FS: couldn't create new file");
|
||||||
PanicAlert("CWII_IPC_HLE_Device_fs: couldn't create new file");
|
PanicAlert("FS: couldn't create new file");
|
||||||
return FS_EINVAL;
|
return FS_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_FILEIO, "\tresult = IPC_SUCCESS");
|
INFO_LOG(IOS_FILEIO, "\tresult = IPC_SUCCESS");
|
||||||
return IPC_SUCCESS;
|
return IPC_SUCCESS;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IOCTL_SHUTDOWN:
|
case IOCTL_SHUTDOWN:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_FILEIO, "Wii called Shutdown()");
|
INFO_LOG(IOS_FILEIO, "Wii called Shutdown()");
|
||||||
// TODO: stop emulation
|
// TODO: stop emulation
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_FILEIO);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_FILEIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FS_EINVAL;
|
return FS_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
|
void FS::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
DoStateShared(p);
|
DoStateShared(p);
|
||||||
|
|
||||||
|
@ -638,5 +638,6 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
|
||||||
p.Do(type);
|
p.Do(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -7,8 +7,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
|
@ -27,10 +27,12 @@ struct NANDStat
|
||||||
u32 Used_Inodes;
|
u32 Used_Inodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWII_IPC_HLE_Device_fs : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class FS : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_fs(u32 _DeviceID, const std::string& _rDeviceName);
|
FS(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
void DoState(PointerWrap& p) override;
|
void DoState(PointerWrap& p) override;
|
||||||
|
|
||||||
|
@ -56,5 +58,6 @@ private:
|
||||||
IPCCommandResult GetFSReply(s32 return_value) const;
|
IPCCommandResult GetFSReply(s32 return_value) const;
|
||||||
s32 ExecuteCommand(const IOSIOCtlRequest& request);
|
s32 ExecuteCommand(const IOSIOCtlRequest& request);
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -14,8 +14,8 @@
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/NandPaths.h"
|
#include "Common/NandPaths.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/FS/FileIO.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -69,15 +69,16 @@ void HLE_IPC_CreateVirtualFATFilesystem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_FileIO::CWII_IPC_HLE_Device_FileIO(u32 device_id,
|
namespace Device
|
||||||
const std::string& device_name)
|
{
|
||||||
: IWII_IPC_HLE_Device(device_id, device_name, DeviceType::FileIO)
|
FileIO::FileIO(u32 device_id, const std::string& device_name)
|
||||||
|
: Device(device_id, device_name, DeviceType::FileIO)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_FileIO::Close()
|
void FileIO::Close()
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FileIO: Close %s (DeviceID=%08x)", m_name.c_str(), m_device_id);
|
INFO_LOG(IOS_FILEIO, "FileIO: Close %s (DeviceID=%08x)", m_name.c_str(), m_device_id);
|
||||||
m_Mode = 0;
|
m_Mode = 0;
|
||||||
|
|
||||||
// Let go of our pointer to the file, it will automatically close if we are the last handle
|
// Let go of our pointer to the file, it will automatically close if we are the last handle
|
||||||
|
@ -87,7 +88,7 @@ void CWII_IPC_HLE_Device_FileIO::Close()
|
||||||
m_is_active = false;
|
m_is_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOSReturnCode CWII_IPC_HLE_Device_FileIO::Open(const IOSOpenRequest& request)
|
IOSReturnCode FileIO::Open(const IOSOpenRequest& request)
|
||||||
{
|
{
|
||||||
m_Mode = request.flags;
|
m_Mode = request.flags;
|
||||||
|
|
||||||
|
@ -99,12 +100,12 @@ IOSReturnCode CWII_IPC_HLE_Device_FileIO::Open(const IOSOpenRequest& request)
|
||||||
// It should be created by ISFS_CreateFile, not here
|
// It should be created by ISFS_CreateFile, not here
|
||||||
if (!File::Exists(m_filepath) || File::IsDirectory(m_filepath))
|
if (!File::Exists(m_filepath) || File::IsDirectory(m_filepath))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO, "FileIO: Open (%s) failed - File doesn't exist %s", Modes[m_Mode],
|
WARN_LOG(IOS_FILEIO, "FileIO: Open (%s) failed - File doesn't exist %s", Modes[m_Mode],
|
||||||
m_filepath.c_str());
|
m_filepath.c_str());
|
||||||
return FS_ENOENT;
|
return FS_ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_FILEIO, "FileIO: Open %s (%s == %08X)", m_name.c_str(), Modes[m_Mode], m_Mode);
|
INFO_LOG(IOS_FILEIO, "FileIO: Open %s (%s == %08X)", m_name.c_str(), Modes[m_Mode], m_Mode);
|
||||||
OpenFile();
|
OpenFile();
|
||||||
|
|
||||||
m_is_active = true;
|
m_is_active = true;
|
||||||
|
@ -112,7 +113,7 @@ IOSReturnCode CWII_IPC_HLE_Device_FileIO::Open(const IOSOpenRequest& request)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This isn't theadsafe, but it's only called from the CPU thread.
|
// This isn't theadsafe, but it's only called from the CPU thread.
|
||||||
void CWII_IPC_HLE_Device_FileIO::OpenFile()
|
void FileIO::OpenFile()
|
||||||
{
|
{
|
||||||
// On the wii, all file operations are strongly ordered.
|
// On the wii, all file operations are strongly ordered.
|
||||||
// If a game opens the same file twice (or 8 times, looking at you PokePark Wii)
|
// If a game opens the same file twice (or 8 times, looking at you PokePark Wii)
|
||||||
|
@ -155,15 +156,15 @@ void CWII_IPC_HLE_Device_FileIO::OpenFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_FileIO::Seek(const IOSSeekRequest& request)
|
IPCCommandResult FileIO::Seek(const IOSSeekRequest& request)
|
||||||
{
|
{
|
||||||
u32 return_value = FS_EINVAL;
|
u32 return_value = FS_EINVAL;
|
||||||
|
|
||||||
if (m_file->IsOpen())
|
if (m_file->IsOpen())
|
||||||
{
|
{
|
||||||
const u32 file_size = static_cast<u32>(m_file->GetSize());
|
const u32 file_size = static_cast<u32>(m_file->GetSize());
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, "FileIO: Seek Pos: 0x%08x, Mode: %i (%s, Length=0x%08x)",
|
DEBUG_LOG(IOS_FILEIO, "FileIO: Seek Pos: 0x%08x, Mode: %i (%s, Length=0x%08x)", request.offset,
|
||||||
request.offset, request.mode, m_name.c_str(), file_size);
|
request.mode, m_name.c_str(), file_size);
|
||||||
|
|
||||||
switch (request.mode)
|
switch (request.mode)
|
||||||
{
|
{
|
||||||
|
@ -201,7 +202,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Seek(const IOSSeekRequest& request)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
PanicAlert("CWII_IPC_HLE_Device_FileIO Unsupported seek mode %i", request.mode);
|
PanicAlert("FileIO Unsupported seek mode %i", request.mode);
|
||||||
return_value = FS_EINVAL;
|
return_value = FS_EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -214,20 +215,19 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Seek(const IOSSeekRequest& request)
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_FileIO::Read(const IOSReadWriteRequest& request)
|
IPCCommandResult FileIO::Read(const IOSReadWriteRequest& request)
|
||||||
{
|
{
|
||||||
s32 return_value = FS_EACCESS;
|
s32 return_value = FS_EACCESS;
|
||||||
if (m_file->IsOpen())
|
if (m_file->IsOpen())
|
||||||
{
|
{
|
||||||
if (m_Mode == IOS_OPEN_WRITE)
|
if (m_Mode == IOS_OPEN_WRITE)
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO,
|
WARN_LOG(IOS_FILEIO, "FileIO: Attempted to read 0x%x bytes to 0x%08x on a write-only file %s",
|
||||||
"FileIO: Attempted to read 0x%x bytes to 0x%08x on a write-only file %s",
|
|
||||||
request.size, request.buffer, m_name.c_str());
|
request.size, request.buffer, m_name.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, "FileIO: Read 0x%x bytes to 0x%08x from %s", request.size,
|
DEBUG_LOG(IOS_FILEIO, "FileIO: Read 0x%x bytes to 0x%08x from %s", request.size,
|
||||||
request.buffer, m_name.c_str());
|
request.buffer, m_name.c_str());
|
||||||
m_file->Seek(m_SeekPos, SEEK_SET); // File might be opened twice, need to seek before we read
|
m_file->Seek(m_SeekPos, SEEK_SET); // File might be opened twice, need to seek before we read
|
||||||
return_value = static_cast<u32>(
|
return_value = static_cast<u32>(
|
||||||
|
@ -244,7 +244,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Read(const IOSReadWriteRequest& req
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_FILEIO, "FileIO: Failed to read from %s (Addr=0x%08x Size=0x%x) - file could "
|
ERROR_LOG(IOS_FILEIO, "FileIO: Failed to read from %s (Addr=0x%08x Size=0x%x) - file could "
|
||||||
"not be opened or does not exist",
|
"not be opened or does not exist",
|
||||||
m_name.c_str(), request.buffer, request.size);
|
m_name.c_str(), request.buffer, request.size);
|
||||||
return_value = FS_ENOENT;
|
return_value = FS_ENOENT;
|
||||||
|
@ -253,20 +253,20 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Read(const IOSReadWriteRequest& req
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_FileIO::Write(const IOSReadWriteRequest& request)
|
IPCCommandResult FileIO::Write(const IOSReadWriteRequest& request)
|
||||||
{
|
{
|
||||||
s32 return_value = FS_EACCESS;
|
s32 return_value = FS_EACCESS;
|
||||||
if (m_file->IsOpen())
|
if (m_file->IsOpen())
|
||||||
{
|
{
|
||||||
if (m_Mode == IOS_OPEN_READ)
|
if (m_Mode == IOS_OPEN_READ)
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_FILEIO,
|
WARN_LOG(IOS_FILEIO,
|
||||||
"FileIO: Attempted to write 0x%x bytes from 0x%08x to a read-only file %s",
|
"FileIO: Attempted to write 0x%x bytes from 0x%08x to a read-only file %s",
|
||||||
request.size, request.buffer, m_name.c_str());
|
request.size, request.buffer, m_name.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, "FileIO: Write 0x%04x bytes from 0x%08x to %s", request.size,
|
DEBUG_LOG(IOS_FILEIO, "FileIO: Write 0x%04x bytes from 0x%08x to %s", request.size,
|
||||||
request.buffer, m_name.c_str());
|
request.buffer, m_name.c_str());
|
||||||
m_file->Seek(m_SeekPos,
|
m_file->Seek(m_SeekPos,
|
||||||
SEEK_SET); // File might be opened twice, need to seek before we write
|
SEEK_SET); // File might be opened twice, need to seek before we write
|
||||||
|
@ -279,7 +279,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Write(const IOSReadWriteRequest& re
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_FILEIO, "FileIO: Failed to read from %s (Addr=0x%08x Size=0x%x) - file could "
|
ERROR_LOG(IOS_FILEIO, "FileIO: Failed to read from %s (Addr=0x%08x Size=0x%x) - file could "
|
||||||
"not be opened or does not exist",
|
"not be opened or does not exist",
|
||||||
m_name.c_str(), request.buffer, request.size);
|
m_name.c_str(), request.buffer, request.size);
|
||||||
return_value = FS_ENOENT;
|
return_value = FS_ENOENT;
|
||||||
|
@ -288,9 +288,9 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Write(const IOSReadWriteRequest& re
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_FileIO::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult FileIO::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, "FileIO: IOCtl (Device=%s)", m_name.c_str());
|
DEBUG_LOG(IOS_FILEIO, "FileIO: IOCtl (Device=%s)", m_name.c_str());
|
||||||
s32 return_value = IPC_SUCCESS;
|
s32 return_value = IPC_SUCCESS;
|
||||||
|
|
||||||
switch (request.request)
|
switch (request.request)
|
||||||
|
@ -299,7 +299,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::IOCtl(const IOSIOCtlRequest& reques
|
||||||
{
|
{
|
||||||
if (m_file->IsOpen())
|
if (m_file->IsOpen())
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_FILEIO, "File: %s, Length: %" PRIu64 ", Pos: %i", m_name.c_str(),
|
DEBUG_LOG(IOS_FILEIO, "File: %s, Length: %" PRIu64 ", Pos: %i", m_name.c_str(),
|
||||||
m_file->GetSize(), m_SeekPos);
|
m_file->GetSize(), m_SeekPos);
|
||||||
Memory::Write_U32(static_cast<u32>(m_file->GetSize()), request.buffer_out);
|
Memory::Write_U32(static_cast<u32>(m_file->GetSize()), request.buffer_out);
|
||||||
Memory::Write_U32(m_SeekPos, request.buffer_out + 4);
|
Memory::Write_U32(m_SeekPos, request.buffer_out + 4);
|
||||||
|
@ -312,20 +312,20 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::IOCtl(const IOSIOCtlRequest& reques
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_FILEIO, LogTypes::LERROR);
|
request.Log(GetDeviceName(), LogTypes::IOS_FILEIO, LogTypes::LERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_FileIO::PrepareForState(PointerWrap::Mode mode)
|
void FileIO::PrepareForState(PointerWrap::Mode mode)
|
||||||
{
|
{
|
||||||
// Temporally close the file, to prevent any issues with the savestating of /tmp
|
// Temporally close the file, to prevent any issues with the savestating of /tmp
|
||||||
// it can be opened again with another call to OpenFile()
|
// it can be opened again with another call to OpenFile()
|
||||||
m_file.reset();
|
m_file.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_FileIO::DoState(PointerWrap& p)
|
void FileIO::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
DoStateShared(p);
|
DoStateShared(p);
|
||||||
|
|
||||||
|
@ -338,5 +338,6 @@ void CWII_IPC_HLE_Device_FileIO::DoState(PointerWrap& p)
|
||||||
// Open it again
|
// Open it again
|
||||||
OpenFile();
|
OpenFile();
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
|
@ -25,10 +25,12 @@ namespace HLE
|
||||||
std::string HLE_IPC_BuildFilename(const std::string& wii_path);
|
std::string HLE_IPC_BuildFilename(const std::string& wii_path);
|
||||||
void HLE_IPC_CreateVirtualFATFilesystem();
|
void HLE_IPC_CreateVirtualFATFilesystem();
|
||||||
|
|
||||||
class CWII_IPC_HLE_Device_FileIO : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class FileIO : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_FileIO(u32 _DeviceID, const std::string& _rDeviceName);
|
FileIO(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
void Close() override;
|
void Close() override;
|
||||||
IOSReturnCode Open(const IOSOpenRequest& request) override;
|
IOSReturnCode Open(const IOSOpenRequest& request) override;
|
||||||
|
@ -74,5 +76,6 @@ private:
|
||||||
std::string m_filepath;
|
std::string m_filepath;
|
||||||
std::shared_ptr<File::IOFile> m_file;
|
std::shared_ptr<File::IOFile> m_file;
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -33,23 +33,23 @@
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/HW/WII_IPC.h"
|
#include "Core/HW/WII_IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/DI/DI.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
|
#include "Core/IOS/DeviceStub.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
|
#include "Core/IOS/ES/ES.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_es.h"
|
#include "Core/IOS/FS/FS.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_fs.h"
|
#include "Core/IOS/FS/FileIO.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
|
#include "Core/IOS/Network/Net.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h"
|
#include "Core/IOS/Network/SSL.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h"
|
#include "Core/IOS/SDIO/SDIOSlot0.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stub.h"
|
#include "Core/IOS/STM/STM.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.h"
|
#include "Core/IOS/USB/Bluetooth/BTReal.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.h"
|
#include "Core/IOS/USB/USB_KBD.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_ven.h"
|
#include "Core/IOS/USB/USB_VEN.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_wfssrv.h"
|
#include "Core/IOS/WFS/WFSI.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_wfsi.h"
|
#include "Core/IOS/WFS/WFSSRV.h"
|
||||||
|
|
||||||
namespace CoreTiming
|
namespace CoreTiming
|
||||||
{
|
{
|
||||||
|
@ -57,21 +57,21 @@ struct EventType;
|
||||||
} // namespace CoreTiming
|
} // namespace CoreTiming
|
||||||
|
|
||||||
#if defined(__LIBUSB__)
|
#if defined(__LIBUSB__)
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_hid.h"
|
#include "Core/IOS/USB/USB_HIDv4.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
static std::map<u32, std::shared_ptr<IWII_IPC_HLE_Device>> s_device_map;
|
static std::map<u32, std::shared_ptr<Device::Device>> s_device_map;
|
||||||
static std::mutex s_device_map_mutex;
|
static std::mutex s_device_map_mutex;
|
||||||
|
|
||||||
// STATE_TO_SAVE
|
// STATE_TO_SAVE
|
||||||
constexpr u8 IPC_MAX_FDS = 0x18;
|
constexpr u8 IPC_MAX_FDS = 0x18;
|
||||||
constexpr u8 ES_MAX_COUNT = 3;
|
constexpr u8 ES_MAX_COUNT = 3;
|
||||||
static std::shared_ptr<IWII_IPC_HLE_Device> s_fdmap[IPC_MAX_FDS];
|
static std::shared_ptr<Device::Device> s_fdmap[IPC_MAX_FDS];
|
||||||
static std::shared_ptr<CWII_IPC_HLE_Device_es> s_es_handles[ES_MAX_COUNT];
|
static std::shared_ptr<Device::ES> s_es_handles[ES_MAX_COUNT];
|
||||||
|
|
||||||
using IPCMsgQueue = std::deque<u32>;
|
using IPCMsgQueue = std::deque<u32>;
|
||||||
static IPCMsgQueue s_request_queue; // ppc -> arm
|
static IPCMsgQueue s_request_queue; // ppc -> arm
|
||||||
|
@ -104,8 +104,7 @@ static void EnqueueEvent(u64 userdata, s64 cycles_late = 0)
|
||||||
|
|
||||||
static void SDIO_EventNotify_CPUThread(u64 userdata, s64 cycles_late)
|
static void SDIO_EventNotify_CPUThread(u64 userdata, s64 cycles_late)
|
||||||
{
|
{
|
||||||
auto device =
|
auto device = static_cast<Device::SDIOSlot0*>(GetDeviceByName("/dev/sdio/slot0").get());
|
||||||
static_cast<CWII_IPC_HLE_Device_sdio_slot0*>(GetDeviceByName("/dev/sdio/slot0").get());
|
|
||||||
if (device)
|
if (device)
|
||||||
device->EventNotify();
|
device->EventNotify();
|
||||||
}
|
}
|
||||||
|
@ -116,7 +115,7 @@ template <typename T>
|
||||||
std::shared_ptr<T> AddDevice(const char* device_name)
|
std::shared_ptr<T> AddDevice(const char* device_name)
|
||||||
{
|
{
|
||||||
auto device = std::make_shared<T>(num_devices, device_name);
|
auto device = std::make_shared<T>(num_devices, device_name);
|
||||||
_assert_(device->GetDeviceType() == IWII_IPC_HLE_Device::DeviceType::Static);
|
_assert_(device->GetDeviceType() == Device::Device::DeviceType::Static);
|
||||||
s_device_map[num_devices] = device;
|
s_device_map[num_devices] = device;
|
||||||
num_devices++;
|
num_devices++;
|
||||||
return device;
|
return device;
|
||||||
|
@ -125,44 +124,44 @@ std::shared_ptr<T> AddDevice(const char* device_name)
|
||||||
void Reinit()
|
void Reinit()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(s_device_map_mutex);
|
std::lock_guard<std::mutex> lock(s_device_map_mutex);
|
||||||
_assert_msg_(WII_IPC_HLE, s_device_map.empty(), "Reinit called while already initialized");
|
_assert_msg_(IOS, s_device_map.empty(), "Reinit called while already initialized");
|
||||||
CWII_IPC_HLE_Device_es::m_ContentFile = "";
|
Device::ES::m_ContentFile = "";
|
||||||
|
|
||||||
num_devices = 0;
|
num_devices = 0;
|
||||||
|
|
||||||
// Build hardware devices
|
// Build hardware devices
|
||||||
if (!SConfig::GetInstance().m_bt_passthrough_enabled)
|
if (!SConfig::GetInstance().m_bt_passthrough_enabled)
|
||||||
AddDevice<CWII_IPC_HLE_Device_usb_oh1_57e_305_emu>("/dev/usb/oh1/57e/305");
|
AddDevice<Device::BluetoothEmu>("/dev/usb/oh1/57e/305");
|
||||||
else
|
else
|
||||||
AddDevice<CWII_IPC_HLE_Device_usb_oh1_57e_305_real>("/dev/usb/oh1/57e/305");
|
AddDevice<Device::BluetoothReal>("/dev/usb/oh1/57e/305");
|
||||||
|
|
||||||
AddDevice<CWII_IPC_HLE_Device_stm_immediate>("/dev/stm/immediate");
|
AddDevice<Device::STMImmediate>("/dev/stm/immediate");
|
||||||
AddDevice<CWII_IPC_HLE_Device_stm_eventhook>("/dev/stm/eventhook");
|
AddDevice<Device::STMEventHook>("/dev/stm/eventhook");
|
||||||
AddDevice<CWII_IPC_HLE_Device_fs>("/dev/fs");
|
AddDevice<Device::FS>("/dev/fs");
|
||||||
|
|
||||||
// IOS allows two ES devices at a time
|
// IOS allows two ES devices at a time
|
||||||
for (auto& es_device : s_es_handles)
|
for (auto& es_device : s_es_handles)
|
||||||
es_device = AddDevice<CWII_IPC_HLE_Device_es>("/dev/es");
|
es_device = AddDevice<Device::ES>("/dev/es");
|
||||||
|
|
||||||
AddDevice<CWII_IPC_HLE_Device_di>("/dev/di");
|
AddDevice<Device::DI>("/dev/di");
|
||||||
AddDevice<CWII_IPC_HLE_Device_net_kd_request>("/dev/net/kd/request");
|
AddDevice<Device::NetKDRequest>("/dev/net/kd/request");
|
||||||
AddDevice<CWII_IPC_HLE_Device_net_kd_time>("/dev/net/kd/time");
|
AddDevice<Device::NetKDTime>("/dev/net/kd/time");
|
||||||
AddDevice<CWII_IPC_HLE_Device_net_ncd_manage>("/dev/net/ncd/manage");
|
AddDevice<Device::NetNCDManage>("/dev/net/ncd/manage");
|
||||||
AddDevice<CWII_IPC_HLE_Device_net_wd_command>("/dev/net/wd/command");
|
AddDevice<Device::NetWDCommand>("/dev/net/wd/command");
|
||||||
AddDevice<CWII_IPC_HLE_Device_net_ip_top>("/dev/net/ip/top");
|
AddDevice<Device::NetIPTop>("/dev/net/ip/top");
|
||||||
AddDevice<CWII_IPC_HLE_Device_net_ssl>("/dev/net/ssl");
|
AddDevice<Device::NetSSL>("/dev/net/ssl");
|
||||||
AddDevice<CWII_IPC_HLE_Device_usb_kbd>("/dev/usb/kbd");
|
AddDevice<Device::USB_KBD>("/dev/usb/kbd");
|
||||||
AddDevice<CWII_IPC_HLE_Device_usb_ven>("/dev/usb/ven");
|
AddDevice<Device::USB_VEN>("/dev/usb/ven");
|
||||||
AddDevice<CWII_IPC_HLE_Device_sdio_slot0>("/dev/sdio/slot0");
|
AddDevice<Device::SDIOSlot0>("/dev/sdio/slot0");
|
||||||
AddDevice<CWII_IPC_HLE_Device_stub>("/dev/sdio/slot1");
|
AddDevice<Device::Stub>("/dev/sdio/slot1");
|
||||||
#if defined(__LIBUSB__)
|
#if defined(__LIBUSB__)
|
||||||
AddDevice<CWII_IPC_HLE_Device_hid>("/dev/usb/hid");
|
AddDevice<Device::USB_HIDv4>("/dev/usb/hid");
|
||||||
#else
|
#else
|
||||||
AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/hid");
|
AddDevice<Device::Stub>("/dev/usb/hid");
|
||||||
#endif
|
#endif
|
||||||
AddDevice<CWII_IPC_HLE_Device_stub>("/dev/usb/oh1");
|
AddDevice<Device::Stub>("/dev/usb/oh1");
|
||||||
AddDevice<CWII_IPC_HLE_Device_usb_wfssrv>("/dev/usb/wfssrv");
|
AddDevice<Device::WFSSRV>("/dev/usb/wfssrv");
|
||||||
AddDevice<CWII_IPC_HLE_Device_wfsi>("/dev/wfsi");
|
AddDevice<Device::WFSI>("/dev/wfsi");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
|
@ -212,7 +211,7 @@ void SetDefaultContentFile(const std::string& file_name)
|
||||||
|
|
||||||
void ES_DIVerify(const std::vector<u8>& tmd)
|
void ES_DIVerify(const std::vector<u8>& tmd)
|
||||||
{
|
{
|
||||||
CWII_IPC_HLE_Device_es::ES_DIVerify(tmd);
|
Device::ES::ES_DIVerify(tmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDIO_EventNotify()
|
void SDIO_EventNotify()
|
||||||
|
@ -236,7 +235,7 @@ static int GetFreeDeviceID()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<IWII_IPC_HLE_Device> GetDeviceByName(const std::string& device_name)
|
std::shared_ptr<Device::Device> GetDeviceByName(const std::string& device_name)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(s_device_map_mutex);
|
std::lock_guard<std::mutex> lock(s_device_map_mutex);
|
||||||
for (const auto& entry : s_device_map)
|
for (const auto& entry : s_device_map)
|
||||||
|
@ -250,7 +249,7 @@ std::shared_ptr<IWII_IPC_HLE_Device> GetDeviceByName(const std::string& device_n
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<IWII_IPC_HLE_Device> AccessDeviceByID(u32 id)
|
std::shared_ptr<Device::Device> AccessDeviceByID(u32 id)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(s_device_map_mutex);
|
std::lock_guard<std::mutex> lock(s_device_map_mutex);
|
||||||
if (s_device_map.find(id) != s_device_map.end())
|
if (s_device_map.find(id) != s_device_map.end())
|
||||||
|
@ -267,7 +266,7 @@ void DoState(PointerWrap& p)
|
||||||
p.Do(s_reply_queue);
|
p.Do(s_reply_queue);
|
||||||
p.Do(s_last_reply_time);
|
p.Do(s_last_reply_time);
|
||||||
|
|
||||||
// We need to make sure all file handles are closed so WII_IPC_Devices_fs::DoState can
|
// We need to make sure all file handles are closed so IOS::HLE::Device::FS::DoState can
|
||||||
// successfully save or re-create /tmp
|
// successfully save or re-create /tmp
|
||||||
for (auto& descriptor : s_fdmap)
|
for (auto& descriptor : s_fdmap)
|
||||||
{
|
{
|
||||||
|
@ -286,19 +285,19 @@ void DoState(PointerWrap& p)
|
||||||
p.Do(exists);
|
p.Do(exists);
|
||||||
if (exists)
|
if (exists)
|
||||||
{
|
{
|
||||||
auto device_type = IWII_IPC_HLE_Device::DeviceType::Static;
|
auto device_type = Device::Device::DeviceType::Static;
|
||||||
p.Do(device_type);
|
p.Do(device_type);
|
||||||
switch (device_type)
|
switch (device_type)
|
||||||
{
|
{
|
||||||
case IWII_IPC_HLE_Device::DeviceType::Static:
|
case Device::Device::DeviceType::Static:
|
||||||
{
|
{
|
||||||
u32 device_id = 0;
|
u32 device_id = 0;
|
||||||
p.Do(device_id);
|
p.Do(device_id);
|
||||||
s_fdmap[i] = AccessDeviceByID(device_id);
|
s_fdmap[i] = AccessDeviceByID(device_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IWII_IPC_HLE_Device::DeviceType::FileIO:
|
case Device::Device::DeviceType::FileIO:
|
||||||
s_fdmap[i] = std::make_shared<CWII_IPC_HLE_Device_FileIO>(i, "");
|
s_fdmap[i] = std::make_shared<Device::FileIO>(i, "");
|
||||||
s_fdmap[i]->DoState(p);
|
s_fdmap[i]->DoState(p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +308,7 @@ void DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
const u32 handle_id = es_device->GetDeviceID();
|
const u32 handle_id = es_device->GetDeviceID();
|
||||||
p.Do(handle_id);
|
p.Do(handle_id);
|
||||||
es_device = std::static_pointer_cast<CWII_IPC_HLE_Device_es>(AccessDeviceByID(handle_id));
|
es_device = std::static_pointer_cast<Device::ES>(AccessDeviceByID(handle_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -322,7 +321,7 @@ void DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
auto device_type = descriptor->GetDeviceType();
|
auto device_type = descriptor->GetDeviceType();
|
||||||
p.Do(device_type);
|
p.Do(device_type);
|
||||||
if (device_type == IWII_IPC_HLE_Device::DeviceType::Static)
|
if (device_type == Device::Device::DeviceType::Static)
|
||||||
{
|
{
|
||||||
u32 hwId = descriptor->GetDeviceID();
|
u32 hwId = descriptor->GetDeviceID();
|
||||||
p.Do(hwId);
|
p.Do(hwId);
|
||||||
|
@ -342,7 +341,7 @@ void DoState(PointerWrap& p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::shared_ptr<IWII_IPC_HLE_Device> GetUnusedESDevice()
|
static std::shared_ptr<Device::Device> GetUnusedESDevice()
|
||||||
{
|
{
|
||||||
const auto iterator = std::find_if(std::begin(s_es_handles), std::end(s_es_handles),
|
const auto iterator = std::find_if(std::begin(s_es_handles), std::end(s_es_handles),
|
||||||
[](const auto& es_device) { return !es_device->IsOpened(); });
|
[](const auto& es_device) { return !es_device->IsOpened(); });
|
||||||
|
@ -353,14 +352,14 @@ static std::shared_ptr<IWII_IPC_HLE_Device> GetUnusedESDevice()
|
||||||
static s32 OpenDevice(const IOSOpenRequest& request)
|
static s32 OpenDevice(const IOSOpenRequest& request)
|
||||||
{
|
{
|
||||||
const s32 new_fd = GetFreeDeviceID();
|
const s32 new_fd = GetFreeDeviceID();
|
||||||
INFO_LOG(WII_IPC_HLE, "Opening %s (mode %d, fd %d)", request.path.c_str(), request.flags, new_fd);
|
INFO_LOG(IOS, "Opening %s (mode %d, fd %d)", request.path.c_str(), request.flags, new_fd);
|
||||||
if (new_fd < 0 || new_fd >= IPC_MAX_FDS)
|
if (new_fd < 0 || new_fd >= IPC_MAX_FDS)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HLE, "Couldn't get a free fd, too many open files");
|
ERROR_LOG(IOS, "Couldn't get a free fd, too many open files");
|
||||||
return FS_EFDEXHAUSTED;
|
return FS_EFDEXHAUSTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<IWII_IPC_HLE_Device> device;
|
std::shared_ptr<Device::Device> device;
|
||||||
if (request.path == "/dev/es")
|
if (request.path == "/dev/es")
|
||||||
{
|
{
|
||||||
device = GetUnusedESDevice();
|
device = GetUnusedESDevice();
|
||||||
|
@ -373,12 +372,12 @@ static s32 OpenDevice(const IOSOpenRequest& request)
|
||||||
}
|
}
|
||||||
else if (request.path.find('/') == 0)
|
else if (request.path.find('/') == 0)
|
||||||
{
|
{
|
||||||
device = std::make_shared<CWII_IPC_HLE_Device_FileIO>(new_fd, request.path);
|
device = std::make_shared<Device::FileIO>(new_fd, request.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!device)
|
if (!device)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HLE, "Unknown device: %s", request.path.c_str());
|
ERROR_LOG(IOS, "Unknown device: %s", request.path.c_str());
|
||||||
return IPC_ENOENT;
|
return IPC_ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,19 +394,19 @@ static IPCCommandResult HandleCommand(const IOSRequest& request)
|
||||||
{
|
{
|
||||||
IOSOpenRequest open_request{request.address};
|
IOSOpenRequest open_request{request.address};
|
||||||
const s32 new_fd = OpenDevice(open_request);
|
const s32 new_fd = OpenDevice(open_request);
|
||||||
return IWII_IPC_HLE_Device::GetDefaultReply(new_fd);
|
return Device::Device::GetDefaultReply(new_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto device = (request.fd < IPC_MAX_FDS) ? s_fdmap[request.fd] : nullptr;
|
const auto device = (request.fd < IPC_MAX_FDS) ? s_fdmap[request.fd] : nullptr;
|
||||||
if (!device)
|
if (!device)
|
||||||
return IWII_IPC_HLE_Device::GetDefaultReply(IPC_EINVAL);
|
return Device::Device::GetDefaultReply(IPC_EINVAL);
|
||||||
|
|
||||||
switch (request.command)
|
switch (request.command)
|
||||||
{
|
{
|
||||||
case IPC_CMD_CLOSE:
|
case IPC_CMD_CLOSE:
|
||||||
s_fdmap[request.fd].reset();
|
s_fdmap[request.fd].reset();
|
||||||
device->Close();
|
device->Close();
|
||||||
return IWII_IPC_HLE_Device::GetDefaultReply(IPC_SUCCESS);
|
return Device::Device::GetDefaultReply(IPC_SUCCESS);
|
||||||
case IPC_CMD_READ:
|
case IPC_CMD_READ:
|
||||||
return device->Read(IOSReadWriteRequest{request.address});
|
return device->Read(IOSReadWriteRequest{request.address});
|
||||||
case IPC_CMD_WRITE:
|
case IPC_CMD_WRITE:
|
||||||
|
@ -419,8 +418,8 @@ static IPCCommandResult HandleCommand(const IOSRequest& request)
|
||||||
case IPC_CMD_IOCTLV:
|
case IPC_CMD_IOCTLV:
|
||||||
return device->IOCtlV(IOSIOCtlVRequest{request.address});
|
return device->IOCtlV(IOSIOCtlVRequest{request.address});
|
||||||
default:
|
default:
|
||||||
_assert_msg_(WII_IPC_HLE, false, "Unexpected command: %x", request.command);
|
_assert_msg_(IOS, false, "Unexpected command: %x", request.command);
|
||||||
return IWII_IPC_HLE_Device::GetDefaultReply(IPC_EINVAL);
|
return Device::Device::GetDefaultReply(IPC_EINVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,7 +472,7 @@ void Update()
|
||||||
if (s_request_queue.size())
|
if (s_request_queue.size())
|
||||||
{
|
{
|
||||||
GenerateAck(s_request_queue.front());
|
GenerateAck(s_request_queue.front());
|
||||||
DEBUG_LOG(WII_IPC_HLE, "||-- Acknowledge IPC Request @ 0x%08x", s_request_queue.front());
|
DEBUG_LOG(IOS, "||-- Acknowledge IPC Request @ 0x%08x", s_request_queue.front());
|
||||||
u32 command = s_request_queue.front();
|
u32 command = s_request_queue.front();
|
||||||
s_request_queue.pop_front();
|
s_request_queue.pop_front();
|
||||||
ExecuteCommand(command);
|
ExecuteCommand(command);
|
||||||
|
@ -483,7 +482,7 @@ void Update()
|
||||||
if (s_reply_queue.size())
|
if (s_reply_queue.size())
|
||||||
{
|
{
|
||||||
GenerateReply(s_reply_queue.front());
|
GenerateReply(s_reply_queue.front());
|
||||||
DEBUG_LOG(WII_IPC_HLE, "<<-- Reply to IPC Request @ 0x%08x", s_reply_queue.front());
|
DEBUG_LOG(IOS, "<<-- Reply to IPC Request @ 0x%08x", s_reply_queue.front());
|
||||||
s_reply_queue.pop_front();
|
s_reply_queue.pop_front();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -491,7 +490,7 @@ void Update()
|
||||||
if (s_ack_queue.size())
|
if (s_ack_queue.size())
|
||||||
{
|
{
|
||||||
GenerateAck(s_ack_queue.front());
|
GenerateAck(s_ack_queue.front());
|
||||||
WARN_LOG(WII_IPC_HLE, "<<-- Double-ack to IPC Request @ 0x%08x", s_ack_queue.front());
|
WARN_LOG(IOS, "<<-- Double-ack to IPC Request @ 0x%08x", s_ack_queue.front());
|
||||||
s_ack_queue.pop_front();
|
s_ack_queue.pop_front();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
|
@ -18,7 +18,11 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
class IWII_IPC_HLE_Device;
|
namespace Device
|
||||||
|
{
|
||||||
|
class Device;
|
||||||
|
}
|
||||||
|
|
||||||
struct IOSRequest;
|
struct IOSRequest;
|
||||||
|
|
||||||
struct IPCCommandResult
|
struct IPCCommandResult
|
||||||
|
@ -62,8 +66,8 @@ void ES_DIVerify(const std::vector<u8>& tmd);
|
||||||
|
|
||||||
void SDIO_EventNotify();
|
void SDIO_EventNotify();
|
||||||
|
|
||||||
std::shared_ptr<IWII_IPC_HLE_Device> GetDeviceByName(const std::string& device_name);
|
std::shared_ptr<Device::Device> GetDeviceByName(const std::string& device_name);
|
||||||
std::shared_ptr<IWII_IPC_HLE_Device> AccessDeviceByID(u32 id);
|
std::shared_ptr<Device::Device> AccessDeviceByID(u32 id);
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
void Update();
|
void Update();
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/IPC_HLE/WiiNetConfig.h"
|
#include "Core/IOS/Network/Config.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ void WiiNetConfig::WriteConfig() const
|
||||||
if (!File::CreateFullPath(File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_SYSCONF_DIR
|
if (!File::CreateFullPath(File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_SYSCONF_DIR
|
||||||
"/net/02/"))
|
"/net/02/"))
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_NET, "Failed to create directory for network config file");
|
ERROR_LOG(IOS_NET, "Failed to create directory for network config file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "ICMP.h"
|
#include "Core/IOS/Network/ICMP.h"
|
||||||
|
|
||||||
// Currently stubbed. AFAIK (delroth) there is no way to send ICMP echo
|
// Currently stubbed. AFAIK (delroth) there is no way to send ICMP echo
|
||||||
// requests without being root on current Linux versions.
|
// requests without being root on current Linux versions.
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/IPC_HLE/ICMP.h"
|
#include "Core/IOS/Network/ICMP.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/IPC_HLE/NWC24Config.h"
|
#include "Core/IOS/Network/NWC24Config.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ void NWC24Config::ReadConfig()
|
||||||
{
|
{
|
||||||
const s32 config_error = CheckNwc24Config();
|
const s32 config_error = CheckNwc24Config();
|
||||||
if (config_error)
|
if (config_error)
|
||||||
ERROR_LOG(WII_IPC_WC24, "There is an error in the config for for WC24: %d", config_error);
|
ERROR_LOG(IOS_WC24, "There is an error in the config for for WC24: %d", config_error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -51,7 +51,7 @@ void NWC24Config::WriteConfig() const
|
||||||
{
|
{
|
||||||
if (!File::CreateFullPath(File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_WC24CONF_DIR))
|
if (!File::CreateFullPath(File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_WC24CONF_DIR))
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WC24, "Failed to create directory for WC24");
|
ERROR_LOG(IOS_WC24, "Failed to create directory for WC24");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,21 +105,21 @@ s32 NWC24Config::CheckNwc24Config() const
|
||||||
// 'WcCf' magic
|
// 'WcCf' magic
|
||||||
if (Magic() != 0x57634366)
|
if (Magic() != 0x57634366)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WC24, "Magic mismatch");
|
ERROR_LOG(IOS_WC24, "Magic mismatch");
|
||||||
return -14;
|
return -14;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u32 checksum = CalculateNwc24ConfigChecksum();
|
const u32 checksum = CalculateNwc24ConfigChecksum();
|
||||||
DEBUG_LOG(WII_IPC_WC24, "Checksum: %X", checksum);
|
DEBUG_LOG(IOS_WC24, "Checksum: %X", checksum);
|
||||||
if (Checksum() != checksum)
|
if (Checksum() != checksum)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WC24, "Checksum mismatch expected %X and got %X", checksum, Checksum());
|
ERROR_LOG(IOS_WC24, "Checksum mismatch expected %X and got %X", checksum, Checksum());
|
||||||
return -14;
|
return -14;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IdGen() > 0x1F)
|
if (IdGen() > 0x1F)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WC24, "Id gen error");
|
ERROR_LOG(IOS_WC24, "Id gen error");
|
||||||
return -14;
|
return -14;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/IPC_HLE/ICMP.h"
|
#include "Core/IOS/Network/ICMP.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net.h"
|
#include "Core/IOS/Network/Net.h"
|
||||||
#include "Core/IPC_HLE/WII_Socket.h"
|
#include "Core/IOS/Network/Socket.h"
|
||||||
#include "Core/ec_wii.h"
|
#include "Core/ec_wii.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -63,36 +63,37 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
|
namespace Device
|
||||||
|
{
|
||||||
// **********************************************************************************
|
// **********************************************************************************
|
||||||
// Handle /dev/net/kd/request requests
|
// Handle /dev/net/kd/request requests
|
||||||
CWII_IPC_HLE_Device_net_kd_request::CWII_IPC_HLE_Device_net_kd_request(
|
NetKDRequest::NetKDRequest(u32 device_id, const std::string& device_name)
|
||||||
u32 _DeviceID, const std::string& _rDeviceName)
|
: Device(device_id, device_name)
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_net_kd_request::~CWII_IPC_HLE_Device_net_kd_request()
|
NetKDRequest::~NetKDRequest()
|
||||||
{
|
{
|
||||||
WiiSockMan::GetInstance().Clean();
|
WiiSockMan::GetInstance().Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_net_kd_request::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult NetKDRequest::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
s32 return_value = 0;
|
s32 return_value = 0;
|
||||||
switch (request.request)
|
switch (request.request)
|
||||||
{
|
{
|
||||||
case IOCTL_NWC24_SUSPEND_SCHEDULAR:
|
case IOCTL_NWC24_SUSPEND_SCHEDULAR:
|
||||||
// NWC24iResumeForCloseLib from NWC24SuspendScheduler (Input: none, Output: 32 bytes)
|
// NWC24iResumeForCloseLib from NWC24SuspendScheduler (Input: none, Output: 32 bytes)
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_SUSPEND_SCHEDULAR - NI");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_SUSPEND_SCHEDULAR - NI");
|
||||||
Memory::Write_U32(0, request.buffer_out); // no error
|
Memory::Write_U32(0, request.buffer_out); // no error
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR: // NWC24iResumeForCloseLib
|
case IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR: // NWC24iResumeForCloseLib
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR - NI");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR - NI");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_NWC24_EXEC_RESUME_SCHEDULAR: // NWC24iResumeForCloseLib
|
case IOCTL_NWC24_EXEC_RESUME_SCHEDULAR: // NWC24iResumeForCloseLib
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_EXEC_RESUME_SCHEDULAR - NI");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_EXEC_RESUME_SCHEDULAR - NI");
|
||||||
Memory::Write_U32(0, request.buffer_out); // no error
|
Memory::Write_U32(0, request.buffer_out); // no error
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -100,29 +101,29 @@ IPCCommandResult CWII_IPC_HLE_Device_net_kd_request::IOCtl(const IOSIOCtlRequest
|
||||||
Memory::Write_U32(0, request.buffer_out);
|
Memory::Write_U32(0, request.buffer_out);
|
||||||
Memory::Write_U32(0, request.buffer_out + 4);
|
Memory::Write_U32(0, request.buffer_out + 4);
|
||||||
return_value = 0;
|
return_value = 0;
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_STARTUP_SOCKET - NI");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_STARTUP_SOCKET - NI");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_NWC24_CLEANUP_SOCKET:
|
case IOCTL_NWC24_CLEANUP_SOCKET:
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_CLEANUP_SOCKET - NI");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_CLEANUP_SOCKET - NI");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_NWC24_LOCK_SOCKET: // WiiMenu
|
case IOCTL_NWC24_LOCK_SOCKET: // WiiMenu
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_LOCK_SOCKET - NI");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_LOCK_SOCKET - NI");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_NWC24_UNLOCK_SOCKET:
|
case IOCTL_NWC24_UNLOCK_SOCKET:
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_UNLOCK_SOCKET - NI");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_UNLOCK_SOCKET - NI");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_NWC24_REQUEST_REGISTER_USER_ID:
|
case IOCTL_NWC24_REQUEST_REGISTER_USER_ID:
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_REQUEST_REGISTER_USER_ID");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_REQUEST_REGISTER_USER_ID");
|
||||||
Memory::Write_U32(0, request.buffer_out);
|
Memory::Write_U32(0, request.buffer_out);
|
||||||
Memory::Write_U32(0, request.buffer_out + 4);
|
Memory::Write_U32(0, request.buffer_out + 4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_NWC24_REQUEST_GENERATED_USER_ID: // (Input: none, Output: 32 bytes)
|
case IOCTL_NWC24_REQUEST_GENERATED_USER_ID: // (Input: none, Output: 32 bytes)
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_REQUEST_GENERATED_USER_ID");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_REQUEST_GENERATED_USER_ID");
|
||||||
if (config.CreationStage() == NWC24::NWC24Config::NWC24_IDCS_INITIAL)
|
if (config.CreationStage() == NWC24::NWC24Config::NWC24_IDCS_INITIAL)
|
||||||
{
|
{
|
||||||
std::string settings_Filename(
|
std::string settings_Filename(
|
||||||
|
@ -178,26 +179,26 @@ IPCCommandResult CWII_IPC_HLE_Device_net_kd_request::IOCtl(const IOSIOCtlRequest
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_NWC24_GET_SCHEDULAR_STAT:
|
case IOCTL_NWC24_GET_SCHEDULAR_STAT:
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_GET_SCHEDULAR_STAT - NI");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_GET_SCHEDULAR_STAT - NI");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_NWC24_SAVE_MAIL_NOW:
|
case IOCTL_NWC24_SAVE_MAIL_NOW:
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_SAVE_MAIL_NOW - NI");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_SAVE_MAIL_NOW - NI");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_NWC24_REQUEST_SHUTDOWN:
|
case IOCTL_NWC24_REQUEST_SHUTDOWN:
|
||||||
// if ya set the IOS version to a very high value this happens ...
|
// if ya set the IOS version to a very high value this happens ...
|
||||||
INFO_LOG(WII_IPC_WC24, "NET_KD_REQ: IOCTL_NWC24_REQUEST_SHUTDOWN - NI");
|
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_REQUEST_SHUTDOWN - NI");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_WC24);
|
request.Log(GetDeviceName(), LogTypes::IOS_WC24);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 CWII_IPC_HLE_Device_net_kd_request::GetAreaCode(const std::string& area) const
|
u8 NetKDRequest::GetAreaCode(const std::string& area) const
|
||||||
{
|
{
|
||||||
static std::map<const std::string, u8> regions = {
|
static std::map<const std::string, u8> regions = {
|
||||||
{"JPN", 0}, {"USA", 1}, {"EUR", 2}, {"AUS", 2}, {"BRA", 1}, {"TWN", 3}, {"ROC", 3},
|
{"JPN", 0}, {"USA", 1}, {"EUR", 2}, {"AUS", 2}, {"BRA", 1}, {"TWN", 3}, {"ROC", 3},
|
||||||
|
@ -211,7 +212,7 @@ u8 CWII_IPC_HLE_Device_net_kd_request::GetAreaCode(const std::string& area) cons
|
||||||
return 7; // Unknown
|
return 7; // Unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 CWII_IPC_HLE_Device_net_kd_request::GetHardwareModel(const std::string& model) const
|
u8 NetKDRequest::GetHardwareModel(const std::string& model) const
|
||||||
{
|
{
|
||||||
static std::map<const std::string, u8> models = {
|
static std::map<const std::string, u8> models = {
|
||||||
{"RVL", MODEL_RVL}, {"RVT", MODEL_RVT}, {"RVV", MODEL_RVV}, {"RVD", MODEL_RVD},
|
{"RVL", MODEL_RVL}, {"RVT", MODEL_RVT}, {"RVV", MODEL_RVV}, {"RVD", MODEL_RVD},
|
||||||
|
@ -236,8 +237,8 @@ static inline u64 u64_insert_byte(u64 value, u8 shift, u8 byte)
|
||||||
return (value & ~mask) | inst;
|
return (value & ~mask) | inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 CWII_IPC_HLE_Device_net_kd_request::NWC24MakeUserID(u64* nwc24_id, u32 hollywood_id, u16 id_ctr,
|
s32 NetKDRequest::NWC24MakeUserID(u64* nwc24_id, u32 hollywood_id, u16 id_ctr, u8 hardware_model,
|
||||||
u8 hardware_model, u8 area_code)
|
u8 area_code)
|
||||||
{
|
{
|
||||||
const u8 table2[8] = {0x1, 0x5, 0x0, 0x4, 0x2, 0x3, 0x6, 0x7};
|
const u8 table2[8] = {0x1, 0x5, 0x0, 0x4, 0x2, 0x3, 0x6, 0x7};
|
||||||
const u8 table1[16] = {0x4, 0xB, 0x7, 0x9, 0xF, 0x1, 0xD, 0x3,
|
const u8 table1[16] = {0x4, 0xB, 0x7, 0x9, 0xF, 0x1, 0xD, 0x3,
|
||||||
|
@ -310,27 +311,22 @@ static void GetMacAddress(u8* mac)
|
||||||
SaveMacAddress(mac);
|
SaveMacAddress(mac);
|
||||||
if (!wireless_mac.empty())
|
if (!wireless_mac.empty())
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_NET, "The MAC provided (%s) is invalid. We have "
|
ERROR_LOG(IOS_NET, "The MAC provided (%s) is invalid. We have "
|
||||||
"generated another one for you.",
|
"generated another one for you.",
|
||||||
Common::MacAddressToString(mac).c_str());
|
Common::MacAddressToString(mac).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INFO_LOG(WII_IPC_NET, "Using MAC address: %s", Common::MacAddressToString(mac).c_str());
|
INFO_LOG(IOS_NET, "Using MAC address: %s", Common::MacAddressToString(mac).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// **********************************************************************************
|
// **********************************************************************************
|
||||||
// Handle /dev/net/ncd/manage requests
|
// Handle /dev/net/ncd/manage requests
|
||||||
CWII_IPC_HLE_Device_net_ncd_manage::CWII_IPC_HLE_Device_net_ncd_manage(
|
NetNCDManage::NetNCDManage(u32 device_id, const std::string& device_name)
|
||||||
u32 _DeviceID, const std::string& _rDeviceName)
|
: Device(device_id, device_name)
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_net_ncd_manage::~CWII_IPC_HLE_Device_net_ncd_manage()
|
IPCCommandResult NetNCDManage::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(const IOSIOCtlVRequest& request)
|
|
||||||
{
|
{
|
||||||
s32 return_value = IPC_SUCCESS;
|
s32 return_value = IPC_SUCCESS;
|
||||||
u32 common_result = 0;
|
u32 common_result = 0;
|
||||||
|
@ -346,37 +342,37 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(const IOSIOCtlVReque
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTLV_NCD_GETCONFIG:
|
case IOCTLV_NCD_GETCONFIG:
|
||||||
INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETCONFIG");
|
INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETCONFIG");
|
||||||
config.WriteToMem(request.io_vectors.at(0).address);
|
config.WriteToMem(request.io_vectors.at(0).address);
|
||||||
common_vector = 1;
|
common_vector = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTLV_NCD_SETCONFIG:
|
case IOCTLV_NCD_SETCONFIG:
|
||||||
INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: IOCTLV_NCD_SETCONFIG");
|
INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_SETCONFIG");
|
||||||
config.ReadFromMem(request.in_vectors.at(0).address);
|
config.ReadFromMem(request.in_vectors.at(0).address);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTLV_NCD_READCONFIG:
|
case IOCTLV_NCD_READCONFIG:
|
||||||
INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: IOCTLV_NCD_READCONFIG");
|
INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_READCONFIG");
|
||||||
config.ReadConfig();
|
config.ReadConfig();
|
||||||
config.WriteToMem(request.io_vectors.at(0).address);
|
config.WriteToMem(request.io_vectors.at(0).address);
|
||||||
common_vector = 1;
|
common_vector = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTLV_NCD_WRITECONFIG:
|
case IOCTLV_NCD_WRITECONFIG:
|
||||||
INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: IOCTLV_NCD_WRITECONFIG");
|
INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_WRITECONFIG");
|
||||||
config.ReadFromMem(request.in_vectors.at(0).address);
|
config.ReadFromMem(request.in_vectors.at(0).address);
|
||||||
config.WriteConfig();
|
config.WriteConfig();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTLV_NCD_GETLINKSTATUS:
|
case IOCTLV_NCD_GETLINKSTATUS:
|
||||||
INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETLINKSTATUS");
|
INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETLINKSTATUS");
|
||||||
// Always connected
|
// Always connected
|
||||||
Memory::Write_U32(Net::ConnectionSettings::LINK_WIRED, request.io_vectors.at(0).address + 4);
|
Memory::Write_U32(Net::ConnectionSettings::LINK_WIRED, request.io_vectors.at(0).address + 4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTLV_NCD_GETWIRELESSMACADDRESS:
|
case IOCTLV_NCD_GETWIRELESSMACADDRESS:
|
||||||
INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETWIRELESSMACADDRESS");
|
INFO_LOG(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETWIRELESSMACADDRESS");
|
||||||
|
|
||||||
u8 address[Common::MAC_ADDRESS_SIZE];
|
u8 address[Common::MAC_ADDRESS_SIZE];
|
||||||
GetMacAddress(address);
|
GetMacAddress(address);
|
||||||
|
@ -384,7 +380,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(const IOSIOCtlVReque
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE IOCtlV: %#x", request.request);
|
INFO_LOG(IOS_NET, "NET_NCD_MANAGE IOCtlV: %#x", request.request);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,20 +394,15 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(const IOSIOCtlVReque
|
||||||
|
|
||||||
// **********************************************************************************
|
// **********************************************************************************
|
||||||
// Handle /dev/net/wd/command requests
|
// Handle /dev/net/wd/command requests
|
||||||
CWII_IPC_HLE_Device_net_wd_command::CWII_IPC_HLE_Device_net_wd_command(
|
NetWDCommand::NetWDCommand(u32 device_id, const std::string& device_name)
|
||||||
u32 DeviceID, const std::string& DeviceName)
|
: Device(device_id, device_name)
|
||||||
: IWII_IPC_HLE_Device(DeviceID, DeviceName)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_net_wd_command::~CWII_IPC_HLE_Device_net_wd_command()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is just for debugging / playing around.
|
// This is just for debugging / playing around.
|
||||||
// There really is no reason to implement wd unless we can bend it such that
|
// There really is no reason to implement wd unless we can bend it such that
|
||||||
// we can talk to the DS.
|
// we can talk to the DS.
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_net_wd_command::IOCtlV(const IOSIOCtlVRequest& request)
|
IPCCommandResult NetWDCommand::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
s32 return_value = IPC_SUCCESS;
|
s32 return_value = IPC_SUCCESS;
|
||||||
|
|
||||||
|
@ -475,7 +466,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_wd_command::IOCtlV(const IOSIOCtlVReque
|
||||||
case IOCTLV_WD_RECV_FRAME:
|
case IOCTLV_WD_RECV_FRAME:
|
||||||
case IOCTLV_WD_RECV_NOTIFICATION:
|
case IOCTLV_WD_RECV_NOTIFICATION:
|
||||||
default:
|
default:
|
||||||
request.Dump(GetDeviceName(), LogTypes::WII_IPC_NET, LogTypes::LINFO);
|
request.Dump(GetDeviceName(), LogTypes::IOS_NET, LogTypes::LINFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
|
@ -483,17 +474,15 @@ IPCCommandResult CWII_IPC_HLE_Device_net_wd_command::IOCtlV(const IOSIOCtlVReque
|
||||||
|
|
||||||
// **********************************************************************************
|
// **********************************************************************************
|
||||||
// Handle /dev/net/ip/top requests
|
// Handle /dev/net/ip/top requests
|
||||||
CWII_IPC_HLE_Device_net_ip_top::CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID,
|
NetIPTop::NetIPTop(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
const std::string& _rDeviceName)
|
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
int ret = WSAStartup(MAKEWORD(2, 2), &InitData);
|
int ret = WSAStartup(MAKEWORD(2, 2), &InitData);
|
||||||
INFO_LOG(WII_IPC_NET, "WSAStartup: %d", ret);
|
INFO_LOG(IOS_NET, "WSAStartup: %d", ret);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_net_ip_top::~CWII_IPC_HLE_Device_net_ip_top()
|
NetIPTop::~NetIPTop()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
|
@ -550,7 +539,7 @@ static unsigned int opt_level_mapping[][2] = {{SOL_SOCKET, 0xFFFF}};
|
||||||
static unsigned int opt_name_mapping[][2] = {
|
static unsigned int opt_name_mapping[][2] = {
|
||||||
{SO_REUSEADDR, 0x4}, {SO_SNDBUF, 0x1001}, {SO_RCVBUF, 0x1002}, {SO_ERROR, 0x1009}};
|
{SO_REUSEADDR, 0x4}, {SO_SNDBUF, 0x1001}, {SO_RCVBUF, 0x1002}, {SO_ERROR, 0x1009}};
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult NetIPTop::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
if (Core::g_want_determinism)
|
if (Core::g_want_determinism)
|
||||||
{
|
{
|
||||||
|
@ -562,7 +551,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
{
|
{
|
||||||
case IOCTL_SO_STARTUP:
|
case IOCTL_SO_STARTUP:
|
||||||
{
|
{
|
||||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_WC24);
|
request.Log(GetDeviceName(), LogTypes::IOS_WC24);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IOCTL_SO_SOCKET:
|
case IOCTL_SO_SOCKET:
|
||||||
|
@ -573,7 +562,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
|
|
||||||
WiiSockMan& sm = WiiSockMan::GetInstance();
|
WiiSockMan& sm = WiiSockMan::GetInstance();
|
||||||
return_value = sm.NewSocket(af, type, prot);
|
return_value = sm.NewSocket(af, type, prot);
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_SOCKET "
|
INFO_LOG(IOS_NET, "IOCTL_SO_SOCKET "
|
||||||
"Socket: %08x (%d,%d,%d), BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
|
"Socket: %08x (%d,%d,%d), BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
|
||||||
return_value, af, type, prot, request.buffer_in, request.buffer_in_size,
|
return_value, af, type, prot, request.buffer_in, request.buffer_in_size,
|
||||||
request.buffer_out, request.buffer_out_size);
|
request.buffer_out, request.buffer_out_size);
|
||||||
|
@ -585,7 +574,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
|
|
||||||
WiiSockMan& sm = WiiSockMan::GetInstance();
|
WiiSockMan& sm = WiiSockMan::GetInstance();
|
||||||
return_value = sm.NewSocket(pf, SOCK_RAW, IPPROTO_ICMP);
|
return_value = sm.NewSocket(pf, SOCK_RAW, IPPROTO_ICMP);
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_ICMPSOCKET(%x) %d", pf, return_value);
|
INFO_LOG(IOS_NET, "IOCTL_SO_ICMPSOCKET(%x) %d", pf, return_value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IOCTL_SO_CLOSE:
|
case IOCTL_SO_CLOSE:
|
||||||
|
@ -594,7 +583,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
u32 fd = Memory::Read_U32(request.buffer_in);
|
u32 fd = Memory::Read_U32(request.buffer_in);
|
||||||
WiiSockMan& sm = WiiSockMan::GetInstance();
|
WiiSockMan& sm = WiiSockMan::GetInstance();
|
||||||
return_value = sm.DeleteSocket(fd);
|
return_value = sm.DeleteSocket(fd);
|
||||||
INFO_LOG(WII_IPC_NET, "%s(%x) %x",
|
INFO_LOG(IOS_NET, "%s(%x) %x",
|
||||||
request.request == IOCTL_SO_ICMPCLOSE ? "IOCTL_SO_ICMPCLOSE" : "IOCTL_SO_CLOSE", fd,
|
request.request == IOCTL_SO_ICMPCLOSE ? "IOCTL_SO_ICMPCLOSE" : "IOCTL_SO_CLOSE", fd,
|
||||||
return_value);
|
return_value);
|
||||||
break;
|
break;
|
||||||
|
@ -614,7 +603,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
case IOCTL_SO_SHUTDOWN:
|
case IOCTL_SO_SHUTDOWN:
|
||||||
{
|
{
|
||||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_WC24);
|
request.Log(GetDeviceName(), LogTypes::IOS_WC24);
|
||||||
|
|
||||||
u32 fd = Memory::Read_U32(request.buffer_in);
|
u32 fd = Memory::Read_U32(request.buffer_in);
|
||||||
u32 how = Memory::Read_U32(request.buffer_in + 4);
|
u32 how = Memory::Read_U32(request.buffer_in + 4);
|
||||||
|
@ -628,7 +617,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
u32 BACKLOG = Memory::Read_U32(request.buffer_in + 0x04);
|
u32 BACKLOG = Memory::Read_U32(request.buffer_in + 0x04);
|
||||||
u32 ret = listen(fd, BACKLOG);
|
u32 ret = listen(fd, BACKLOG);
|
||||||
return_value = WiiSockMan::GetNetErrorCode(ret, "SO_LISTEN", false);
|
return_value = WiiSockMan::GetNetErrorCode(ret, "SO_LISTEN", false);
|
||||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_WC24);
|
request.Log(GetDeviceName(), LogTypes::IOS_WC24);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IOCTL_SO_GETSOCKOPT:
|
case IOCTL_SO_GETSOCKOPT:
|
||||||
|
@ -637,7 +626,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
u32 level = Memory::Read_U32(request.buffer_out + 4);
|
u32 level = Memory::Read_U32(request.buffer_out + 4);
|
||||||
u32 optname = Memory::Read_U32(request.buffer_out + 8);
|
u32 optname = Memory::Read_U32(request.buffer_out + 8);
|
||||||
|
|
||||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_WC24);
|
request.Log(GetDeviceName(), LogTypes::IOS_WC24);
|
||||||
|
|
||||||
// Do the level/optname translation
|
// Do the level/optname translation
|
||||||
int nat_level = -1, nat_optname = -1;
|
int nat_level = -1, nat_optname = -1;
|
||||||
|
@ -679,7 +668,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
optlen = std::min(optlen, (u32)sizeof(optval));
|
optlen = std::min(optlen, (u32)sizeof(optval));
|
||||||
Memory::CopyFromEmu(optval, request.buffer_in + 0x10, optlen);
|
Memory::CopyFromEmu(optval, request.buffer_in + 0x10, optlen);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_SETSOCKOPT(%08x, %08x, %08x, %08x) "
|
INFO_LOG(IOS_NET, "IOCTL_SO_SETSOCKOPT(%08x, %08x, %08x, %08x) "
|
||||||
"BufferIn: (%08x, %i), BufferOut: (%08x, %i)"
|
"BufferIn: (%08x, %i), BufferOut: (%08x, %i)"
|
||||||
"%02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx "
|
"%02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx "
|
||||||
"%02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx",
|
"%02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx",
|
||||||
|
@ -710,7 +699,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
|
|
||||||
if (nat_level == -1 || nat_optname == -1)
|
if (nat_level == -1 || nat_optname == -1)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_NET, "SO_SETSOCKOPT: unknown level %d or optname %d", level, optname);
|
INFO_LOG(IOS_NET, "SO_SETSOCKOPT: unknown level %d or optname %d", level, optname);
|
||||||
|
|
||||||
// Default to the given level/optname. They match on Windows...
|
// Default to the given level/optname. They match on Windows...
|
||||||
nat_level = level;
|
nat_level = level;
|
||||||
|
@ -725,7 +714,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
{
|
{
|
||||||
u32 fd = Memory::Read_U32(request.buffer_in);
|
u32 fd = Memory::Read_U32(request.buffer_in);
|
||||||
|
|
||||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_WC24);
|
request.Log(GetDeviceName(), LogTypes::IOS_WC24);
|
||||||
|
|
||||||
sockaddr sa;
|
sockaddr sa;
|
||||||
socklen_t sa_len;
|
socklen_t sa_len;
|
||||||
|
@ -733,7 +722,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
int ret = getsockname(fd, &sa, &sa_len);
|
int ret = getsockname(fd, &sa, &sa_len);
|
||||||
|
|
||||||
if (request.buffer_out_size < 2 + sizeof(sa.sa_data))
|
if (request.buffer_out_size < 2 + sizeof(sa.sa_data))
|
||||||
WARN_LOG(WII_IPC_NET, "IOCTL_SO_GETSOCKNAME output buffer is too small. Truncating");
|
WARN_LOG(IOS_NET, "IOCTL_SO_GETSOCKNAME output buffer is too small. Truncating");
|
||||||
|
|
||||||
if (request.buffer_out_size > 0)
|
if (request.buffer_out_size > 0)
|
||||||
Memory::Write_U8(request.buffer_out_size, request.buffer_out);
|
Memory::Write_U8(request.buffer_out_size, request.buffer_out);
|
||||||
|
@ -756,7 +745,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
int ret = getpeername(fd, &sa, &sa_len);
|
int ret = getpeername(fd, &sa, &sa_len);
|
||||||
|
|
||||||
if (request.buffer_out_size < 2 + sizeof(sa.sa_data))
|
if (request.buffer_out_size < 2 + sizeof(sa.sa_data))
|
||||||
WARN_LOG(WII_IPC_NET, "IOCTL_SO_GETPEERNAME output buffer is too small. Truncating");
|
WARN_LOG(IOS_NET, "IOCTL_SO_GETPEERNAME output buffer is too small. Truncating");
|
||||||
|
|
||||||
if (request.buffer_out_size > 0)
|
if (request.buffer_out_size > 0)
|
||||||
Memory::Write_U8(request.buffer_out_size, request.buffer_out);
|
Memory::Write_U8(request.buffer_out_size, request.buffer_out);
|
||||||
|
@ -766,7 +755,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
Memory::CopyToEmu(request.buffer_out + 2, &sa.sa_data,
|
Memory::CopyToEmu(request.buffer_out + 2, &sa.sa_data,
|
||||||
std::min<size_t>(sizeof(sa.sa_data), request.buffer_out_size - 2));
|
std::min<size_t>(sizeof(sa.sa_data), request.buffer_out_size - 2));
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_GETPEERNAME(%x)", fd);
|
INFO_LOG(IOS_NET, "IOCTL_SO_GETPEERNAME(%x)", fd);
|
||||||
|
|
||||||
return_value = ret;
|
return_value = ret;
|
||||||
break;
|
break;
|
||||||
|
@ -774,7 +763,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
|
|
||||||
case IOCTL_SO_GETHOSTID:
|
case IOCTL_SO_GETHOSTID:
|
||||||
{
|
{
|
||||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_WC24);
|
request.Log(GetDeviceName(), LogTypes::IOS_WC24);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD forwardTableSize, ipTableSize, result;
|
DWORD forwardTableSize, ipTableSize, result;
|
||||||
|
@ -842,7 +831,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
if (remoteHost == nullptr || remoteHost->h_addr_list == nullptr ||
|
if (remoteHost == nullptr || remoteHost->h_addr_list == nullptr ||
|
||||||
remoteHost->h_addr_list[0] == nullptr)
|
remoteHost->h_addr_list[0] == nullptr)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETATON = -1 "
|
INFO_LOG(IOS_NET, "IOCTL_SO_INETATON = -1 "
|
||||||
"%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: None",
|
"%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: None",
|
||||||
hostname.c_str(), request.buffer_in, request.buffer_in_size, request.buffer_out,
|
hostname.c_str(), request.buffer_in, request.buffer_in_size, request.buffer_out,
|
||||||
request.buffer_out_size);
|
request.buffer_out_size);
|
||||||
|
@ -851,7 +840,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Memory::Write_U32(Common::swap32(*(u32*)remoteHost->h_addr_list[0]), request.buffer_out);
|
Memory::Write_U32(Common::swap32(*(u32*)remoteHost->h_addr_list[0]), request.buffer_out);
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETATON = 0 "
|
INFO_LOG(IOS_NET, "IOCTL_SO_INETATON = 0 "
|
||||||
"%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: %08X",
|
"%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: %08X",
|
||||||
hostname.c_str(), request.buffer_in, request.buffer_in_size, request.buffer_out,
|
hostname.c_str(), request.buffer_in, request.buffer_in_size, request.buffer_out,
|
||||||
request.buffer_out_size, Common::swap32(*(u32*)remoteHost->h_addr_list[0]));
|
request.buffer_out_size, Common::swap32(*(u32*)remoteHost->h_addr_list[0]));
|
||||||
|
@ -863,7 +852,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
case IOCTL_SO_INETPTON:
|
case IOCTL_SO_INETPTON:
|
||||||
{
|
{
|
||||||
std::string address = Memory::GetString(request.buffer_in);
|
std::string address = Memory::GetString(request.buffer_in);
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETPTON "
|
INFO_LOG(IOS_NET, "IOCTL_SO_INETPTON "
|
||||||
"(Translating: %s)",
|
"(Translating: %s)",
|
||||||
address.c_str());
|
address.c_str());
|
||||||
return_value = inet_pton(address.c_str(), Memory::GetPointer(request.buffer_out + 4));
|
return_value = inet_pton(address.c_str(), Memory::GetPointer(request.buffer_out + 4));
|
||||||
|
@ -879,7 +868,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
sprintf(ip_s, "%i.%i.%i.%i", Memory::Read_U8(request.buffer_in + 8),
|
sprintf(ip_s, "%i.%i.%i.%i", Memory::Read_U8(request.buffer_in + 8),
|
||||||
Memory::Read_U8(request.buffer_in + 8 + 1), Memory::Read_U8(request.buffer_in + 8 + 2),
|
Memory::Read_U8(request.buffer_in + 8 + 1), Memory::Read_U8(request.buffer_in + 8 + 2),
|
||||||
Memory::Read_U8(request.buffer_in + 8 + 3));
|
Memory::Read_U8(request.buffer_in + 8 + 3));
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETNTOP %s", ip_s);
|
INFO_LOG(IOS_NET, "IOCTL_SO_INETNTOP %s", ip_s);
|
||||||
Memory::CopyToEmu(request.buffer_out, (u8*)ip_s, strlen(ip_s));
|
Memory::CopyToEmu(request.buffer_out, (u8*)ip_s, strlen(ip_s));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -901,7 +890,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
|
|
||||||
int nfds = request.buffer_out_size / 0xc;
|
int nfds = request.buffer_out_size / 0xc;
|
||||||
if (nfds == 0)
|
if (nfds == 0)
|
||||||
ERROR_LOG(WII_IPC_NET, "Hidden POLL");
|
ERROR_LOG(IOS_NET, "Hidden POLL");
|
||||||
|
|
||||||
std::vector<pollfd_t> ufds(nfds);
|
std::vector<pollfd_t> ufds(nfds);
|
||||||
|
|
||||||
|
@ -920,7 +909,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
ufds[i].events |= map.native;
|
ufds[i].events |= map.native;
|
||||||
unhandled_events &= ~map.wii;
|
unhandled_events &= ~map.wii;
|
||||||
}
|
}
|
||||||
DEBUG_LOG(WII_IPC_NET, "IOCTL_SO_POLL(%d) "
|
DEBUG_LOG(IOS_NET, "IOCTL_SO_POLL(%d) "
|
||||||
"Sock: %08x, Unknown: %08x, Events: %08x, "
|
"Sock: %08x, Unknown: %08x, Events: %08x, "
|
||||||
"NativeEvents: %08x",
|
"NativeEvents: %08x",
|
||||||
i, ufds[i].fd, unknown, events, ufds[i].events);
|
i, ufds[i].fd, unknown, events, ufds[i].events);
|
||||||
|
@ -929,7 +918,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
ufds[i].events &= ~(POLLERR | POLLHUP | POLLNVAL | UNSUPPORTED_WSAPOLL);
|
ufds[i].events &= ~(POLLERR | POLLHUP | POLLNVAL | UNSUPPORTED_WSAPOLL);
|
||||||
|
|
||||||
if (unhandled_events)
|
if (unhandled_events)
|
||||||
ERROR_LOG(WII_IPC_NET, "SO_POLL: unhandled Wii event types: %04x", unhandled_events);
|
ERROR_LOG(IOS_NET, "SO_POLL: unhandled Wii event types: %04x", unhandled_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = poll(ufds.data(), nfds, timeout);
|
int ret = poll(ufds.data(), nfds, timeout);
|
||||||
|
@ -950,7 +939,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
// Memory::Write_U32(events, request.buffer_out + 0xc*i + 4); //events
|
// Memory::Write_U32(events, request.buffer_out + 0xc*i + 4); //events
|
||||||
Memory::Write_U32(revents, request.buffer_out + 0xc * i + 8); // revents
|
Memory::Write_U32(revents, request.buffer_out + 0xc * i + 8); // revents
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_NET, "IOCTL_SO_POLL socket %d wevents %08X events %08X revents %08X", i,
|
DEBUG_LOG(IOS_NET, "IOCTL_SO_POLL socket %d wevents %08X events %08X revents %08X", i,
|
||||||
revents, ufds[i].events, ufds[i].revents);
|
revents, ufds[i].events, ufds[i].revents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -962,7 +951,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
{
|
{
|
||||||
if (request.buffer_out_size != 0x460)
|
if (request.buffer_out_size != 0x460)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_NET, "Bad buffer size for IOCTL_SO_GETHOSTBYNAME");
|
ERROR_LOG(IOS_NET, "Bad buffer size for IOCTL_SO_GETHOSTBYNAME");
|
||||||
return_value = -1;
|
return_value = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -970,7 +959,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
std::string hostname = Memory::GetString(request.buffer_in);
|
std::string hostname = Memory::GetString(request.buffer_in);
|
||||||
hostent* remoteHost = gethostbyname(hostname.c_str());
|
hostent* remoteHost = gethostbyname(hostname.c_str());
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_GETHOSTBYNAME "
|
INFO_LOG(IOS_NET, "IOCTL_SO_GETHOSTBYNAME "
|
||||||
"Address: %s, BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
|
"Address: %s, BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
|
||||||
hostname.c_str(), request.buffer_in, request.buffer_in_size, request.buffer_out,
|
hostname.c_str(), request.buffer_in, request.buffer_in_size, request.buffer_out,
|
||||||
request.buffer_out_size);
|
request.buffer_out_size);
|
||||||
|
@ -979,7 +968,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
{
|
{
|
||||||
for (int i = 0; remoteHost->h_aliases[i]; ++i)
|
for (int i = 0; remoteHost->h_aliases[i]; ++i)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_NET, "alias%i:%s", i, remoteHost->h_aliases[i]);
|
DEBUG_LOG(IOS_NET, "alias%i:%s", i, remoteHost->h_aliases[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; remoteHost->h_addr_list[i]; ++i)
|
for (int i = 0; remoteHost->h_addr_list[i]; ++i)
|
||||||
|
@ -987,7 +976,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
u32 ip = Common::swap32(*(u32*)(remoteHost->h_addr_list[i]));
|
u32 ip = Common::swap32(*(u32*)(remoteHost->h_addr_list[i]));
|
||||||
std::string ip_s = StringFromFormat("%i.%i.%i.%i", ip >> 24, (ip >> 16) & 0xff,
|
std::string ip_s = StringFromFormat("%i.%i.%i.%i", ip >> 24, (ip >> 16) & 0xff,
|
||||||
(ip >> 8) & 0xff, ip & 0xff);
|
(ip >> 8) & 0xff, ip & 0xff);
|
||||||
DEBUG_LOG(WII_IPC_NET, "addr%i:%s", i, ip_s.c_str());
|
DEBUG_LOG(IOS_NET, "addr%i:%s", i, ip_s.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Host name; located immediately after struct
|
// Host name; located immediately after struct
|
||||||
|
@ -997,7 +986,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
u32 name_length = (u32)strlen(remoteHost->h_name) + 1;
|
u32 name_length = (u32)strlen(remoteHost->h_name) + 1;
|
||||||
if (name_length > (GETHOSTBYNAME_IP_LIST_OFFSET - GETHOSTBYNAME_STRUCT_SIZE))
|
if (name_length > (GETHOSTBYNAME_IP_LIST_OFFSET - GETHOSTBYNAME_STRUCT_SIZE))
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_NET, "Hostname too long in IOCTL_SO_GETHOSTBYNAME");
|
ERROR_LOG(IOS_NET, "Hostname too long in IOCTL_SO_GETHOSTBYNAME");
|
||||||
return_value = -1;
|
return_value = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1037,7 +1026,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
request.buffer_out + 4);
|
request.buffer_out + 4);
|
||||||
|
|
||||||
// Returned struct must be ipv4.
|
// Returned struct must be ipv4.
|
||||||
_assert_msg_(WII_IPC_NET,
|
_assert_msg_(IOS_NET,
|
||||||
remoteHost->h_addrtype == AF_INET && remoteHost->h_length == sizeof(u32),
|
remoteHost->h_addrtype == AF_INET && remoteHost->h_length == sizeof(u32),
|
||||||
"returned host info is not IPv4");
|
"returned host info is not IPv4");
|
||||||
Memory::Write_U16(AF_INET, request.buffer_out + 8);
|
Memory::Write_U16(AF_INET, request.buffer_out + 8);
|
||||||
|
@ -1054,16 +1043,16 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
||||||
}
|
}
|
||||||
|
|
||||||
case IOCTL_SO_ICMPCANCEL:
|
case IOCTL_SO_ICMPCANCEL:
|
||||||
ERROR_LOG(WII_IPC_NET, "IOCTL_SO_ICMPCANCEL");
|
ERROR_LOG(IOS_NET, "IOCTL_SO_ICMPCANCEL");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_NET);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_NET);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(const IOSIOCtlVRequest& request)
|
IPCCommandResult NetIPTop::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
s32 return_value = 0;
|
s32 return_value = 0;
|
||||||
|
|
||||||
|
@ -1081,7 +1070,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(const IOSIOCtlVRequest&
|
||||||
param5 = Memory::Read_U32(request.io_vectors[0].address + 4);
|
param5 = Memory::Read_U32(request.io_vectors[0].address + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTLV_SO_GETINTERFACEOPT(%08X, %08X, %X, %X, %X) "
|
INFO_LOG(IOS_NET, "IOCTLV_SO_GETINTERFACEOPT(%08X, %08X, %X, %X, %X) "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i) ",
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i) ",
|
||||||
param, param2, param3, param4, param5, request.in_vectors[0].address,
|
param, param2, param3, param4, param5, request.in_vectors[0].address,
|
||||||
request.in_vectors[0].size,
|
request.in_vectors[0].size,
|
||||||
|
@ -1133,8 +1122,8 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(const IOSIOCtlVRequest&
|
||||||
if (AdapterList->IfIndex == dwBestIfIndex && AdapterList->FirstDnsServerAddress &&
|
if (AdapterList->IfIndex == dwBestIfIndex && AdapterList->FirstDnsServerAddress &&
|
||||||
AdapterList->OperStatus == IfOperStatusUp)
|
AdapterList->OperStatus == IfOperStatusUp)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_NET, "Name of valid interface: %S", AdapterList->FriendlyName);
|
INFO_LOG(IOS_NET, "Name of valid interface: %S", AdapterList->FriendlyName);
|
||||||
INFO_LOG(WII_IPC_NET, "DNS: %u.%u.%u.%u",
|
INFO_LOG(IOS_NET, "DNS: %u.%u.%u.%u",
|
||||||
(unsigned char)
|
(unsigned char)
|
||||||
AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[2],
|
AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[2],
|
||||||
(unsigned char)
|
(unsigned char)
|
||||||
|
@ -1190,7 +1179,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(const IOSIOCtlVRequest&
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(WII_IPC_NET, "Unknown param2: %08X", param2);
|
ERROR_LOG(IOS_NET, "Unknown param2: %08X", param2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1299,7 +1288,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(const IOSIOCtlVRequest&
|
||||||
ret = -305;
|
ret = -305;
|
||||||
}
|
}
|
||||||
|
|
||||||
request.Dump(GetDeviceName(), LogTypes::WII_IPC_NET, LogTypes::LINFO);
|
request.Dump(GetDeviceName(), LogTypes::IOS_NET, LogTypes::LINFO);
|
||||||
return_value = ret;
|
return_value = ret;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1319,7 +1308,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(const IOSIOCtlVRequest&
|
||||||
|
|
||||||
if (num_ip != 1)
|
if (num_ip != 1)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTLV_SO_ICMPPING %i IPs", num_ip);
|
INFO_LOG(IOS_NET, "IOCTLV_SO_ICMPPING %i IPs", num_ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
ip_info.length = Memory::Read_U8(request.in_vectors[0].address + 16);
|
ip_info.length = Memory::Read_U8(request.in_vectors[0].address + 16);
|
||||||
|
@ -1329,12 +1318,12 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(const IOSIOCtlVRequest&
|
||||||
|
|
||||||
if (ip_info.length != 8 || ip_info.addr_family != AF_INET)
|
if (ip_info.length != 8 || ip_info.addr_family != AF_INET)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTLV_SO_ICMPPING strange IPInfo:\n"
|
INFO_LOG(IOS_NET, "IOCTLV_SO_ICMPPING strange IPInfo:\n"
|
||||||
"length %x addr_family %x",
|
"length %x addr_family %x",
|
||||||
ip_info.length, ip_info.addr_family);
|
ip_info.length, ip_info.addr_family);
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTLV_SO_ICMPPING %x", ip_info.ip);
|
INFO_LOG(IOS_NET, "IOCTLV_SO_ICMPPING %x", ip_info.ip);
|
||||||
|
|
||||||
sockaddr_in addr;
|
sockaddr_in addr;
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
|
@ -1367,15 +1356,16 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(const IOSIOCtlVRequest&
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_NET);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_NET);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_net_ip_top::Update()
|
void NetIPTop::Update()
|
||||||
{
|
{
|
||||||
WiiSockMan::GetInstance().Update();
|
WiiSockMan::GetInstance().Update();
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -10,10 +10,10 @@
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Core/HW/EXI_DeviceIPL.h"
|
#include "Core/HW/EXI_DeviceIPL.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/NWC24Config.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/Network/Config.h"
|
||||||
#include "Core/IPC_HLE/WiiNetConfig.h"
|
#include "Core/IOS/Network/NWC24Config.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
@ -23,16 +23,58 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
|
enum NET_IOCTL
|
||||||
|
{
|
||||||
|
IOCTL_SO_ACCEPT = 1,
|
||||||
|
IOCTL_SO_BIND,
|
||||||
|
IOCTL_SO_CLOSE,
|
||||||
|
IOCTL_SO_CONNECT,
|
||||||
|
IOCTL_SO_FCNTL,
|
||||||
|
IOCTL_SO_GETPEERNAME,
|
||||||
|
IOCTL_SO_GETSOCKNAME,
|
||||||
|
IOCTL_SO_GETSOCKOPT,
|
||||||
|
IOCTL_SO_SETSOCKOPT,
|
||||||
|
IOCTL_SO_LISTEN,
|
||||||
|
IOCTL_SO_POLL,
|
||||||
|
IOCTLV_SO_RECVFROM,
|
||||||
|
IOCTLV_SO_SENDTO,
|
||||||
|
IOCTL_SO_SHUTDOWN,
|
||||||
|
IOCTL_SO_SOCKET,
|
||||||
|
IOCTL_SO_GETHOSTID,
|
||||||
|
IOCTL_SO_GETHOSTBYNAME,
|
||||||
|
IOCTL_SO_GETHOSTBYADDR,
|
||||||
|
IOCTLV_SO_GETNAMEINFO,
|
||||||
|
IOCTL_SO_UNK14,
|
||||||
|
IOCTL_SO_INETATON,
|
||||||
|
IOCTL_SO_INETPTON,
|
||||||
|
IOCTL_SO_INETNTOP,
|
||||||
|
IOCTLV_SO_GETADDRINFO,
|
||||||
|
IOCTL_SO_SOCKATMARK,
|
||||||
|
IOCTLV_SO_UNK1A,
|
||||||
|
IOCTLV_SO_UNK1B,
|
||||||
|
IOCTLV_SO_GETINTERFACEOPT,
|
||||||
|
IOCTLV_SO_SETINTERFACEOPT,
|
||||||
|
IOCTL_SO_SETINTERFACE,
|
||||||
|
IOCTL_SO_STARTUP,
|
||||||
|
IOCTL_SO_ICMPSOCKET = 0x30,
|
||||||
|
IOCTLV_SO_ICMPPING,
|
||||||
|
IOCTL_SO_ICMPCANCEL,
|
||||||
|
IOCTL_SO_ICMPCLOSE
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: split this up.
|
||||||
|
namespace Device
|
||||||
|
{
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// KD is the IOS module responsible for implementing WiiConnect24 functionality.
|
// KD is the IOS module responsible for implementing WiiConnect24 functionality.
|
||||||
// It can perform HTTPS downloads, send and receive mail via SMTP, and execute a
|
// It can perform HTTPS downloads, send and receive mail via SMTP, and execute a
|
||||||
// JavaScript-like language while the Wii is in standby mode.
|
// JavaScript-like language while the Wii is in standby mode.
|
||||||
class CWII_IPC_HLE_Device_net_kd_request : public IWII_IPC_HLE_Device
|
class NetKDRequest : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName);
|
NetKDRequest(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
virtual ~CWII_IPC_HLE_Device_net_kd_request();
|
virtual ~NetKDRequest();
|
||||||
|
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
|
|
||||||
|
@ -81,15 +123,15 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
class CWII_IPC_HLE_Device_net_kd_time : public IWII_IPC_HLE_Device
|
class NetKDTime : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_net_kd_time(u32 _DeviceID, const std::string& _rDeviceName)
|
NetKDTime(u32 device_id, const std::string& device_name)
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName), rtc(), utcdiff()
|
: Device(device_id, device_name), rtc(), utcdiff()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~CWII_IPC_HLE_Device_net_kd_time() {}
|
virtual ~NetKDTime() {}
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override
|
||||||
{
|
{
|
||||||
s32 result = 0;
|
s32 result = 0;
|
||||||
|
@ -122,7 +164,7 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(WII_IPC_NET, "%s - unknown IOCtl: %x", GetDeviceName().c_str(), request.request);
|
ERROR_LOG(IOS_NET, "%s - unknown IOCtl: %x", GetDeviceName().c_str(), request.request);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,52 +201,13 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
enum NET_IOCTL
|
|
||||||
{
|
|
||||||
IOCTL_SO_ACCEPT = 1,
|
|
||||||
IOCTL_SO_BIND,
|
|
||||||
IOCTL_SO_CLOSE,
|
|
||||||
IOCTL_SO_CONNECT,
|
|
||||||
IOCTL_SO_FCNTL,
|
|
||||||
IOCTL_SO_GETPEERNAME,
|
|
||||||
IOCTL_SO_GETSOCKNAME,
|
|
||||||
IOCTL_SO_GETSOCKOPT,
|
|
||||||
IOCTL_SO_SETSOCKOPT,
|
|
||||||
IOCTL_SO_LISTEN,
|
|
||||||
IOCTL_SO_POLL,
|
|
||||||
IOCTLV_SO_RECVFROM,
|
|
||||||
IOCTLV_SO_SENDTO,
|
|
||||||
IOCTL_SO_SHUTDOWN,
|
|
||||||
IOCTL_SO_SOCKET,
|
|
||||||
IOCTL_SO_GETHOSTID,
|
|
||||||
IOCTL_SO_GETHOSTBYNAME,
|
|
||||||
IOCTL_SO_GETHOSTBYADDR,
|
|
||||||
IOCTLV_SO_GETNAMEINFO,
|
|
||||||
IOCTL_SO_UNK14,
|
|
||||||
IOCTL_SO_INETATON,
|
|
||||||
IOCTL_SO_INETPTON,
|
|
||||||
IOCTL_SO_INETNTOP,
|
|
||||||
IOCTLV_SO_GETADDRINFO,
|
|
||||||
IOCTL_SO_SOCKATMARK,
|
|
||||||
IOCTLV_SO_UNK1A,
|
|
||||||
IOCTLV_SO_UNK1B,
|
|
||||||
IOCTLV_SO_GETINTERFACEOPT,
|
|
||||||
IOCTLV_SO_SETINTERFACEOPT,
|
|
||||||
IOCTL_SO_SETINTERFACE,
|
|
||||||
IOCTL_SO_STARTUP,
|
|
||||||
IOCTL_SO_ICMPSOCKET = 0x30,
|
|
||||||
IOCTLV_SO_ICMPPING,
|
|
||||||
IOCTL_SO_ICMPCANCEL,
|
|
||||||
IOCTL_SO_ICMPCLOSE
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
class CWII_IPC_HLE_Device_net_ip_top : public IWII_IPC_HLE_Device
|
class NetIPTop : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName);
|
NetIPTop(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
virtual ~CWII_IPC_HLE_Device_net_ip_top();
|
virtual ~NetIPTop();
|
||||||
|
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
||||||
|
@ -219,12 +222,10 @@ private:
|
||||||
|
|
||||||
// **********************************************************************************
|
// **********************************************************************************
|
||||||
// Interface for reading and changing network configuration (probably some other stuff as well)
|
// Interface for reading and changing network configuration (probably some other stuff as well)
|
||||||
class CWII_IPC_HLE_Device_net_ncd_manage : public IWII_IPC_HLE_Device
|
class NetNCDManage : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_net_ncd_manage(u32 _DeviceID, const std::string& _rDeviceName);
|
NetNCDManage(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
virtual ~CWII_IPC_HLE_Device_net_ncd_manage();
|
|
||||||
|
|
||||||
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
||||||
|
|
||||||
|
@ -245,12 +246,10 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
class CWII_IPC_HLE_Device_net_wd_command : public IWII_IPC_HLE_Device
|
class NetWDCommand : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_net_wd_command(u32 DeviceID, const std::string& DeviceName);
|
NetWDCommand(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
virtual ~CWII_IPC_HLE_Device_net_wd_command();
|
|
||||||
|
|
||||||
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
||||||
|
|
||||||
|
@ -335,5 +334,6 @@ private:
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -13,14 +13,16 @@
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
|
#include "Core/IOS/Network/SSL.h"
|
||||||
#include "Core/IPC_HLE/WII_Socket.h"
|
#include "Core/IOS/Network/Socket.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
WII_SSL CWII_IPC_HLE_Device_net_ssl::_SSL[NET_SSL_MAXINSTANCES];
|
namespace Device
|
||||||
|
{
|
||||||
|
WII_SSL NetSSL::_SSL[NET_SSL_MAXINSTANCES];
|
||||||
|
|
||||||
static constexpr mbedtls_x509_crt_profile mbedtls_x509_crt_profile_wii = {
|
static constexpr mbedtls_x509_crt_profile mbedtls_x509_crt_profile_wii = {
|
||||||
/* Hashes from SHA-1 and above */
|
/* Hashes from SHA-1 and above */
|
||||||
|
@ -32,9 +34,7 @@ static constexpr mbedtls_x509_crt_profile mbedtls_x509_crt_profile_wii = {
|
||||||
0, /* No RSA min key size */
|
0, /* No RSA min key size */
|
||||||
};
|
};
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_net_ssl::CWII_IPC_HLE_Device_net_ssl(u32 _DeviceID,
|
NetSSL::NetSSL(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
const std::string& _rDeviceName)
|
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
|
||||||
{
|
{
|
||||||
for (WII_SSL& ssl : _SSL)
|
for (WII_SSL& ssl : _SSL)
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ CWII_IPC_HLE_Device_net_ssl::CWII_IPC_HLE_Device_net_ssl(u32 _DeviceID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_net_ssl::~CWII_IPC_HLE_Device_net_ssl()
|
NetSSL::~NetSSL()
|
||||||
{
|
{
|
||||||
// Cleanup sessions
|
// Cleanup sessions
|
||||||
for (WII_SSL& ssl : _SSL)
|
for (WII_SSL& ssl : _SSL)
|
||||||
|
@ -67,7 +67,7 @@ CWII_IPC_HLE_Device_net_ssl::~CWII_IPC_HLE_Device_net_ssl()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CWII_IPC_HLE_Device_net_ssl::GetSSLFreeID() const
|
int NetSSL::GetSSLFreeID() const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NET_SSL_MAXINSTANCES; i++)
|
for (int i = 0; i < NET_SSL_MAXINSTANCES; i++)
|
||||||
{
|
{
|
||||||
|
@ -79,13 +79,13 @@ int CWII_IPC_HLE_Device_net_ssl::GetSSLFreeID() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult NetSSL::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_SSL, LogTypes::LINFO);
|
request.Log(GetDeviceName(), LogTypes::IOS_SSL, LogTypes::LINFO);
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& request)
|
IPCCommandResult NetSSL::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
u32 BufferIn = 0, BufferIn2 = 0, BufferIn3 = 0;
|
u32 BufferIn = 0, BufferIn2 = 0, BufferIn3 = 0;
|
||||||
u32 BufferInSize = 0, BufferInSize2 = 0, BufferInSize3 = 0;
|
u32 BufferInSize = 0, BufferInSize2 = 0, BufferInSize3 = 0;
|
||||||
|
@ -185,7 +185,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
Memory::Write_U32(SSL_ERR_FAILED, BufferIn);
|
Memory::Write_U32(SSL_ERR_FAILED, BufferIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_NEW (%d, %s) "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_NEW (%d, %s) "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
|
@ -222,7 +222,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
{
|
{
|
||||||
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
||||||
}
|
}
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SHUTDOWN "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SHUTDOWN "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
|
@ -232,7 +232,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
}
|
}
|
||||||
case IOCTLV_NET_SSL_SETROOTCA:
|
case IOCTLV_NET_SSL_SETROOTCA:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETROOTCA "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETROOTCA "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
|
@ -262,7 +262,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
Memory::Write_U32(SSL_OK, BufferIn);
|
Memory::Write_U32(SSL_OK, BufferIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETROOTCA = %d", ret);
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETROOTCA = %d", ret);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -272,7 +272,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
}
|
}
|
||||||
case IOCTLV_NET_SSL_SETBUILTINCLIENTCERT:
|
case IOCTLV_NET_SSL_SETBUILTINCLIENTCERT:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
|
@ -300,18 +300,18 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
Memory::Write_U32(SSL_OK, BufferIn);
|
Memory::Write_U32(SSL_OK, BufferIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT = (%d, %d)", ret, pk_ret);
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT = (%d, %d)", ret, pk_ret);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT invalid sslID = %d", sslID);
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT invalid sslID = %d", sslID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IOCTLV_NET_SSL_REMOVECLIENTCERT:
|
case IOCTLV_NET_SSL_REMOVECLIENTCERT:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_REMOVECLIENTCERT "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_REMOVECLIENTCERT "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
|
@ -331,7 +331,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT invalid sslID = %d", sslID);
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT invalid sslID = %d", sslID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -354,13 +354,13 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
mbedtls_ssl_conf_ca_chain(&ssl->config, &ssl->cacert, nullptr);
|
mbedtls_ssl_conf_ca_chain(&ssl->config, &ssl->cacert, nullptr);
|
||||||
Memory::Write_U32(SSL_OK, BufferIn);
|
Memory::Write_U32(SSL_OK, BufferIn);
|
||||||
}
|
}
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETBUILTINROOTCA = %d", ret);
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINROOTCA = %d", ret);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
||||||
}
|
}
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETBUILTINROOTCA "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINROOTCA "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
|
@ -376,7 +376,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
WII_SSL* ssl = &_SSL[sslID];
|
WII_SSL* ssl = &_SSL[sslID];
|
||||||
mbedtls_ssl_setup(&ssl->ctx, &ssl->config);
|
mbedtls_ssl_setup(&ssl->ctx, &ssl->config);
|
||||||
ssl->sockfd = Memory::Read_U32(BufferOut2);
|
ssl->sockfd = Memory::Read_U32(BufferOut2);
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_CONNECT socket = %d", ssl->sockfd);
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_CONNECT socket = %d", ssl->sockfd);
|
||||||
mbedtls_ssl_set_bio(&ssl->ctx, &ssl->sockfd, mbedtls_net_send, mbedtls_net_recv, nullptr);
|
mbedtls_ssl_set_bio(&ssl->ctx, &ssl->sockfd, mbedtls_net_send, mbedtls_net_recv, nullptr);
|
||||||
Memory::Write_U32(SSL_OK, BufferIn);
|
Memory::Write_U32(SSL_OK, BufferIn);
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
{
|
{
|
||||||
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
||||||
}
|
}
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_CONNECT "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_CONNECT "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
|
@ -420,13 +420,13 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
{
|
{
|
||||||
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
||||||
}
|
}
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_WRITE "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_WRITE "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
BufferIn, BufferInSize, BufferIn2, BufferInSize2, BufferIn3, BufferInSize3, BufferOut,
|
BufferIn, BufferInSize, BufferIn2, BufferInSize2, BufferIn3, BufferInSize3, BufferOut,
|
||||||
BufferOutSize, BufferOut2, BufferOutSize2, BufferOut3, BufferOutSize3);
|
BufferOutSize, BufferOut2, BufferOutSize2, BufferOut3, BufferOutSize3);
|
||||||
INFO_LOG(WII_IPC_SSL, "%s", Memory::GetString(BufferOut2).c_str());
|
INFO_LOG(IOS_SSL, "%s", Memory::GetString(BufferOut2).c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IOCTLV_NET_SSL_READ:
|
case IOCTLV_NET_SSL_READ:
|
||||||
|
@ -444,7 +444,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_READ(%d)"
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_READ(%d)"
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
|
@ -463,7 +463,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
{
|
{
|
||||||
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
Memory::Write_U32(SSL_ERR_ID, BufferIn);
|
||||||
}
|
}
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETROOTCADEFAULT "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETROOTCADEFAULT "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
|
@ -473,7 +473,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
}
|
}
|
||||||
case IOCTLV_NET_SSL_SETCLIENTCERTDEFAULT:
|
case IOCTLV_NET_SSL_SETCLIENTCERTDEFAULT:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETCLIENTCERTDEFAULT "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETCLIENTCERTDEFAULT "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
"BufferIn3: (%08x, %i), BufferOut: (%08x, %i), "
|
||||||
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
"BufferOut2: (%08x, %i), BufferOut3: (%08x, %i)",
|
||||||
|
@ -492,11 +492,12 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_SSL);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_SSL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SSL return codes are written to BufferIn
|
// SSL return codes are written to BufferIn
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -19,8 +19,8 @@
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/Device.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -28,8 +28,9 @@ namespace HLE
|
||||||
{
|
{
|
||||||
#define NET_SSL_MAXINSTANCES 4
|
#define NET_SSL_MAXINSTANCES 4
|
||||||
|
|
||||||
|
// TODO: remove this macro.
|
||||||
#define SSLID_VALID(x) \
|
#define SSLID_VALID(x) \
|
||||||
(x >= 0 && x < NET_SSL_MAXINSTANCES && CWII_IPC_HLE_Device_net_ssl::_SSL[x].active)
|
(x >= 0 && x < NET_SSL_MAXINSTANCES && ::IOS::HLE::Device::NetSSL::_SSL[x].active)
|
||||||
|
|
||||||
enum ssl_err_t
|
enum ssl_err_t
|
||||||
{
|
{
|
||||||
|
@ -84,12 +85,14 @@ struct WII_SSL
|
||||||
bool active;
|
bool active;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWII_IPC_HLE_Device_net_ssl : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class NetSSL : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_net_ssl(u32 _DeviceID, const std::string& _rDeviceName);
|
NetSSL(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
virtual ~CWII_IPC_HLE_Device_net_ssl();
|
virtual ~NetSSL();
|
||||||
|
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
||||||
|
@ -98,5 +101,6 @@ public:
|
||||||
|
|
||||||
static WII_SSL _SSL[NET_SSL_MAXINSTANCES];
|
static WII_SSL _SSL[NET_SSL_MAXINSTANCES];
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -12,9 +12,9 @@
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_Socket.h" // No Wii socket support while using NetPlay or TAS
|
#include "Core/IOS/Network/Socket.h" // No Wii socket support while using NetPlay or TAS
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define ERRORCODE(name) WSA##name
|
#define ERRORCODE(name) WSA##name
|
||||||
|
@ -50,7 +50,7 @@ static s32 TranslateErrorCode(s32 native_error, bool isRW)
|
||||||
switch (native_error)
|
switch (native_error)
|
||||||
{
|
{
|
||||||
case ERRORCODE(EMSGSIZE):
|
case ERRORCODE(EMSGSIZE):
|
||||||
ERROR_LOG(WII_IPC_NET, "Find out why this happened, looks like PEEK failure?");
|
ERROR_LOG(IOS_NET, "Find out why this happened, looks like PEEK failure?");
|
||||||
return -1; // Should be -SO_EMSGSIZE
|
return -1; // Should be -SO_EMSGSIZE
|
||||||
case EITHER(WSAENOTSOCK, EBADF):
|
case EITHER(WSAENOTSOCK, EBADF):
|
||||||
return -SO_EBADF;
|
return -SO_EBADF;
|
||||||
|
@ -103,7 +103,7 @@ s32 WiiSockMan::GetNetErrorCode(s32 ret, const char* caller, bool isRW)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR_LOG(WII_IPC_NET, "%s failed with error %d: %s, ret= %d", caller, errorCode,
|
ERROR_LOG(IOS_NET, "%s failed with error %d: %s, ret= %d", caller, errorCode,
|
||||||
DecodeError(errorCode), ret);
|
DecodeError(errorCode), ret);
|
||||||
|
|
||||||
s32 ReturnValue = TranslateErrorCode(errorCode, isRW);
|
s32 ReturnValue = TranslateErrorCode(errorCode, isRW);
|
||||||
|
@ -176,10 +176,10 @@ s32 WiiSocket::FCntl(u32 cmd, u32 arg)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_NET, "SO_FCNTL unknown command");
|
ERROR_LOG(IOS_NET, "SO_FCNTL unknown command");
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_FCNTL(%08x, %08X, %08X)", fd, cmd, arg);
|
INFO_LOG(IOS_NET, "IOCTL_SO_FCNTL(%08x, %08X, %08X)", fd, cmd, arg);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -213,8 +213,8 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
int ret = bind(fd, (sockaddr*)&local_name, sizeof(local_name));
|
int ret = bind(fd, (sockaddr*)&local_name, sizeof(local_name));
|
||||||
ReturnValue = WiiSockMan::GetNetErrorCode(ret, "SO_BIND", false);
|
ReturnValue = WiiSockMan::GetNetErrorCode(ret, "SO_BIND", false);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_BIND (%08X %s:%d) = %d ", fd,
|
INFO_LOG(IOS_NET, "IOCTL_SO_BIND (%08X %s:%d) = %d ", fd, inet_ntoa(local_name.sin_addr),
|
||||||
inet_ntoa(local_name.sin_addr), Common::swap16(local_name.sin_port), ret);
|
Common::swap16(local_name.sin_port), ret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IOCTL_SO_CONNECT:
|
case IOCTL_SO_CONNECT:
|
||||||
|
@ -226,7 +226,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
int ret = connect(fd, (sockaddr*)&local_name, sizeof(local_name));
|
int ret = connect(fd, (sockaddr*)&local_name, sizeof(local_name));
|
||||||
ReturnValue = WiiSockMan::GetNetErrorCode(ret, "SO_CONNECT", false);
|
ReturnValue = WiiSockMan::GetNetErrorCode(ret, "SO_CONNECT", false);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_CONNECT (%08x, %s:%d)", fd, inet_ntoa(local_name.sin_addr),
|
INFO_LOG(IOS_NET, "IOCTL_SO_CONNECT (%08x, %s:%d)", fd, inet_ntoa(local_name.sin_addr),
|
||||||
Common::swap16(local_name.sin_port));
|
Common::swap16(local_name.sin_port));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
|
|
||||||
WiiSockMan::GetInstance().AddSocket(ReturnValue);
|
WiiSockMan::GetInstance().AddSocket(ReturnValue);
|
||||||
|
|
||||||
ioctl.Log("IOCTL_SO_ACCEPT", LogTypes::WII_IPC_NET);
|
ioctl.Log("IOCTL_SO_ACCEPT", LogTypes::IOS_NET);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -309,13 +309,13 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
{
|
{
|
||||||
case IOCTLV_NET_SSL_DOHANDSHAKE:
|
case IOCTLV_NET_SSL_DOHANDSHAKE:
|
||||||
{
|
{
|
||||||
mbedtls_ssl_context* ctx = &CWII_IPC_HLE_Device_net_ssl::_SSL[sslID].ctx;
|
mbedtls_ssl_context* ctx = &Device::NetSSL::_SSL[sslID].ctx;
|
||||||
int ret = mbedtls_ssl_handshake(ctx);
|
int ret = mbedtls_ssl_handshake(ctx);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
char error_buffer[256] = "";
|
char error_buffer[256] = "";
|
||||||
mbedtls_strerror(ret, error_buffer, sizeof(error_buffer));
|
mbedtls_strerror(ret, error_buffer, sizeof(error_buffer));
|
||||||
ERROR_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_DOHANDSHAKE: %s", error_buffer);
|
ERROR_LOG(IOS_SSL, "IOCTLV_NET_SSL_DOHANDSHAKE: %s", error_buffer);
|
||||||
}
|
}
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
|
@ -337,7 +337,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
char error_buffer[256] = "";
|
char error_buffer[256] = "";
|
||||||
int res = mbedtls_ssl_get_verify_result(ctx);
|
int res = mbedtls_ssl_get_verify_result(ctx);
|
||||||
mbedtls_x509_crt_verify_info(error_buffer, sizeof(error_buffer), "", res);
|
mbedtls_x509_crt_verify_info(error_buffer, sizeof(error_buffer), "", res);
|
||||||
ERROR_LOG(WII_IPC_SSL, "MBEDTLS_ERR_X509_CERT_VERIFY_FAILED (verify_result = %d): %s",
|
ERROR_LOG(IOS_SSL, "MBEDTLS_ERR_X509_CERT_VERIFY_FAILED (verify_result = %d): %s",
|
||||||
res, error_buffer);
|
res, error_buffer);
|
||||||
|
|
||||||
if (res & MBEDTLS_X509_BADCERT_CN_MISMATCH)
|
if (res & MBEDTLS_X509_BADCERT_CN_MISMATCH)
|
||||||
|
@ -375,7 +375,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_DOHANDSHAKE = (%d) "
|
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_DOHANDSHAKE = (%d) "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferOut: (%08x, %i), BufferOut2: (%08x, %i)",
|
"BufferOut: (%08x, %i), BufferOut2: (%08x, %i)",
|
||||||
ret, BufferIn, BufferInSize, BufferIn2, BufferInSize2, BufferOut,
|
ret, BufferIn, BufferInSize, BufferIn2, BufferInSize2, BufferOut,
|
||||||
|
@ -384,7 +384,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
}
|
}
|
||||||
case IOCTLV_NET_SSL_WRITE:
|
case IOCTLV_NET_SSL_WRITE:
|
||||||
{
|
{
|
||||||
int ret = mbedtls_ssl_write(&CWII_IPC_HLE_Device_net_ssl::_SSL[sslID].ctx,
|
int ret = mbedtls_ssl_write(&Device::NetSSL::_SSL[sslID].ctx,
|
||||||
Memory::GetPointer(BufferOut2), BufferOutSize2);
|
Memory::GetPointer(BufferOut2), BufferOutSize2);
|
||||||
|
|
||||||
if (SConfig::GetInstance().m_SSLDumpWrite && ret > 0)
|
if (SConfig::GetInstance().m_SSLDumpWrite && ret > 0)
|
||||||
|
@ -422,7 +422,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
}
|
}
|
||||||
case IOCTLV_NET_SSL_READ:
|
case IOCTLV_NET_SSL_READ:
|
||||||
{
|
{
|
||||||
int ret = mbedtls_ssl_read(&CWII_IPC_HLE_Device_net_ssl::_SSL[sslID].ctx,
|
int ret = mbedtls_ssl_read(&Device::NetSSL::_SSL[sslID].ctx,
|
||||||
Memory::GetPointer(BufferIn2), BufferInSize2);
|
Memory::GetPointer(BufferIn2), BufferInSize2);
|
||||||
|
|
||||||
if (SConfig::GetInstance().m_SSLDumpRead && ret > 0)
|
if (SConfig::GetInstance().m_SSLDumpRead && ret > 0)
|
||||||
|
@ -497,7 +497,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
ReturnValue = WiiSockMan::GetNetErrorCode(ret, "SO_SENDTO", true);
|
ReturnValue = WiiSockMan::GetNetErrorCode(ret, "SO_SENDTO", true);
|
||||||
|
|
||||||
DEBUG_LOG(
|
DEBUG_LOG(
|
||||||
WII_IPC_NET,
|
IOS_NET,
|
||||||
"%s = %d Socket: %08x, BufferIn: (%08x, %i), BufferIn2: (%08x, %i), %u.%u.%u.%u",
|
"%s = %d Socket: %08x, BufferIn: (%08x, %i), BufferIn2: (%08x, %i), %u.%u.%u.%u",
|
||||||
has_destaddr ? "IOCTLV_SO_SENDTO " : "IOCTLV_SO_SEND ", ReturnValue, fd, BufferIn,
|
has_destaddr ? "IOCTLV_SO_SENDTO " : "IOCTLV_SO_SEND ", ReturnValue, fd, BufferIn,
|
||||||
BufferInSize, BufferIn2, BufferInSize2, local_name.sin_addr.s_addr & 0xFF,
|
BufferInSize, BufferIn2, BufferInSize2, local_name.sin_addr.s_addr & 0xFF,
|
||||||
|
@ -542,7 +542,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
ReturnValue =
|
ReturnValue =
|
||||||
WiiSockMan::GetNetErrorCode(ret, BufferOutSize2 ? "SO_RECVFROM" : "SO_RECV", true);
|
WiiSockMan::GetNetErrorCode(ret, BufferOutSize2 ? "SO_RECVFROM" : "SO_RECV", true);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_NET, "%s(%d, %p) Socket: %08X, Flags: %08X, "
|
INFO_LOG(IOS_NET, "%s(%d, %p) Socket: %08X, Flags: %08X, "
|
||||||
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
|
||||||
"BufferOut: (%08x, %i), BufferOut2: (%08x, %i)",
|
"BufferOut: (%08x, %i), BufferOut2: (%08x, %i)",
|
||||||
BufferOutSize2 ? "IOCTLV_SO_RECVFROM " : "IOCTLV_SO_RECV ", ReturnValue, data,
|
BufferOutSize2 ? "IOCTLV_SO_RECVFROM " : "IOCTLV_SO_RECV ", ReturnValue, data,
|
||||||
|
@ -567,7 +567,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
||||||
ReturnValue != -SO_EALREADY) ||
|
ReturnValue != -SO_EALREADY) ||
|
||||||
(it->is_ssl && ReturnValue != SSL_ERR_WAGAIN && ReturnValue != SSL_ERR_RAGAIN))
|
(it->is_ssl && ReturnValue != SSL_ERR_WAGAIN && ReturnValue != SSL_ERR_RAGAIN))
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_NET,
|
DEBUG_LOG(IOS_NET,
|
||||||
"IOCTL(V) Sock: %08x ioctl/v: %d returned: %d nonBlock: %d forceNonBlock: %d", fd,
|
"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,
|
it->is_ssl ? (int)it->ssl_type : (int)it->net_type, ReturnValue, nonBlock,
|
||||||
forceNonBlock);
|
forceNonBlock);
|
|
@ -52,9 +52,9 @@ typedef struct pollfd pollfd_t;
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/NonCopyable.h"
|
#include "Common/NonCopyable.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net.h"
|
#include "Core/IOS/Network/Net.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
|
#include "Core/IOS/Network/SSL.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -232,8 +232,8 @@ public:
|
||||||
auto socket_entry = WiiSockets.find(sock);
|
auto socket_entry = WiiSockets.find(sock);
|
||||||
if (socket_entry == WiiSockets.end())
|
if (socket_entry == WiiSockets.end())
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_NET, "DoSock: Error, fd not found (%08x, %08X, %08X)", sock,
|
ERROR_LOG(IOS_NET, "DoSock: Error, fd not found (%08x, %08X, %08X)", sock, request.address,
|
||||||
request.address, type);
|
type);
|
||||||
EnqueueReply(request, -SO_EBADF);
|
EnqueueReply(request, -SO_EBADF);
|
||||||
}
|
}
|
||||||
else
|
else
|
|
@ -14,20 +14,20 @@
|
||||||
#include "Common/SDCardUtil.h"
|
#include "Common/SDCardUtil.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h"
|
#include "Core/IOS/SDIO/SDIOSlot0.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
CWII_IPC_HLE_Device_sdio_slot0::CWII_IPC_HLE_Device_sdio_slot0(const u32 device_id,
|
namespace Device
|
||||||
const std::string& device_name)
|
{
|
||||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
SDIOSlot0::SDIOSlot0(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_sdio_slot0::DoState(PointerWrap& p)
|
void SDIOSlot0::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
DoStateShared(p);
|
DoStateShared(p);
|
||||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||||
|
@ -40,7 +40,7 @@ void CWII_IPC_HLE_Device_sdio_slot0::DoState(PointerWrap& p)
|
||||||
p.Do(m_registers);
|
p.Do(m_registers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_sdio_slot0::EventNotify()
|
void SDIOSlot0::EventNotify()
|
||||||
{
|
{
|
||||||
if (!m_event)
|
if (!m_event)
|
||||||
return;
|
return;
|
||||||
|
@ -54,27 +54,27 @@ void CWII_IPC_HLE_Device_sdio_slot0::EventNotify()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_sdio_slot0::OpenInternal()
|
void SDIOSlot0::OpenInternal()
|
||||||
{
|
{
|
||||||
const std::string filename = File::GetUserPath(F_WIISDCARD_IDX);
|
const std::string filename = File::GetUserPath(F_WIISDCARD_IDX);
|
||||||
m_Card.Open(filename, "r+b");
|
m_Card.Open(filename, "r+b");
|
||||||
if (!m_Card)
|
if (!m_Card)
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_SD, "Failed to open SD Card image, trying to create a new 128MB image...");
|
WARN_LOG(IOS_SD, "Failed to open SD Card image, trying to create a new 128MB image...");
|
||||||
if (SDCardCreate(128, filename))
|
if (SDCardCreate(128, filename))
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_SD, "Successfully created %s", filename.c_str());
|
INFO_LOG(IOS_SD, "Successfully created %s", filename.c_str());
|
||||||
m_Card.Open(filename, "r+b");
|
m_Card.Open(filename, "r+b");
|
||||||
}
|
}
|
||||||
if (!m_Card)
|
if (!m_Card)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_SD, "Could not open SD Card image or create a new one, are you running "
|
ERROR_LOG(IOS_SD, "Could not open SD Card image or create a new one, are you running "
|
||||||
"from a read-only directory?");
|
"from a read-only directory?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IOSReturnCode CWII_IPC_HLE_Device_sdio_slot0::Open(const IOSOpenRequest& request)
|
IOSReturnCode SDIOSlot0::Open(const IOSOpenRequest& request)
|
||||||
{
|
{
|
||||||
OpenInternal();
|
OpenInternal();
|
||||||
m_registers.fill(0);
|
m_registers.fill(0);
|
||||||
|
@ -83,7 +83,7 @@ IOSReturnCode CWII_IPC_HLE_Device_sdio_slot0::Open(const IOSOpenRequest& request
|
||||||
return IPC_SUCCESS;
|
return IPC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_sdio_slot0::Close()
|
void SDIOSlot0::Close()
|
||||||
{
|
{
|
||||||
m_Card.Close();
|
m_Card.Close();
|
||||||
m_BlockLength = 0;
|
m_BlockLength = 0;
|
||||||
|
@ -93,7 +93,7 @@ void CWII_IPC_HLE_Device_sdio_slot0::Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// The front SD slot
|
// The front SD slot
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult SDIOSlot0::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
||||||
s32 return_value = IPC_SUCCESS;
|
s32 return_value = IPC_SUCCESS;
|
||||||
|
@ -104,11 +104,11 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtl(const IOSIOCtlRequest& re
|
||||||
u32 reg = Memory::Read_U32(request.buffer_in);
|
u32 reg = Memory::Read_U32(request.buffer_in);
|
||||||
u32 val = Memory::Read_U32(request.buffer_in + 16);
|
u32 val = Memory::Read_U32(request.buffer_in + 16);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_SD, "IOCTL_WRITEHCR 0x%08x - 0x%08x", reg, val);
|
INFO_LOG(IOS_SD, "IOCTL_WRITEHCR 0x%08x - 0x%08x", reg, val);
|
||||||
|
|
||||||
if (reg >= m_registers.size())
|
if (reg >= m_registers.size())
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_SD, "IOCTL_WRITEHCR out of range");
|
WARN_LOG(IOS_SD, "IOCTL_WRITEHCR out of range");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,12 +136,12 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtl(const IOSIOCtlRequest& re
|
||||||
|
|
||||||
if (reg >= m_registers.size())
|
if (reg >= m_registers.size())
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_SD, "IOCTL_READHCR out of range");
|
WARN_LOG(IOS_SD, "IOCTL_READHCR out of range");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 val = m_registers[reg];
|
u32 val = m_registers[reg];
|
||||||
INFO_LOG(WII_IPC_SD, "IOCTL_READHCR 0x%08x - 0x%08x", reg, val);
|
INFO_LOG(IOS_SD, "IOCTL_READHCR 0x%08x - 0x%08x", reg, val);
|
||||||
|
|
||||||
// Just reading the register
|
// Just reading the register
|
||||||
Memory::Write_U32(val, request.buffer_out);
|
Memory::Write_U32(val, request.buffer_out);
|
||||||
|
@ -149,7 +149,7 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtl(const IOSIOCtlRequest& re
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_RESETCARD:
|
case IOCTL_RESETCARD:
|
||||||
INFO_LOG(WII_IPC_SD, "IOCTL_RESETCARD");
|
INFO_LOG(IOS_SD, "IOCTL_RESETCARD");
|
||||||
if (m_Card)
|
if (m_Card)
|
||||||
m_Status |= CARD_INITIALIZED;
|
m_Status |= CARD_INITIALIZED;
|
||||||
// Returns 16bit RCA and 16bit 0s (meaning success)
|
// Returns 16bit RCA and 16bit 0s (meaning success)
|
||||||
|
@ -158,17 +158,17 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtl(const IOSIOCtlRequest& re
|
||||||
|
|
||||||
case IOCTL_SETCLK:
|
case IOCTL_SETCLK:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_SD, "IOCTL_SETCLK");
|
INFO_LOG(IOS_SD, "IOCTL_SETCLK");
|
||||||
// libogc only sets it to 1 and makes sure the return isn't negative...
|
// libogc only sets it to 1 and makes sure the return isn't negative...
|
||||||
// one half of the sdclk divisor: a power of two or zero.
|
// one half of the sdclk divisor: a power of two or zero.
|
||||||
u32 clock = Memory::Read_U32(request.buffer_in);
|
u32 clock = Memory::Read_U32(request.buffer_in);
|
||||||
if (clock != 1)
|
if (clock != 1)
|
||||||
INFO_LOG(WII_IPC_SD, "Setting to %i, interesting", clock);
|
INFO_LOG(IOS_SD, "Setting to %i, interesting", clock);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_SENDCMD:
|
case IOCTL_SENDCMD:
|
||||||
INFO_LOG(WII_IPC_SD, "IOCTL_SENDCMD %x IPC:%08x", Memory::Read_U32(request.buffer_in),
|
INFO_LOG(IOS_SD, "IOCTL_SENDCMD %x IPC:%08x", Memory::Read_U32(request.buffer_in),
|
||||||
request.address);
|
request.address);
|
||||||
return_value = ExecuteCommand(request, request.buffer_in, request.buffer_in_size, 0, 0,
|
return_value = ExecuteCommand(request, request.buffer_in, request.buffer_in_size, 0, 0,
|
||||||
request.buffer_out, request.buffer_out_size);
|
request.buffer_out, request.buffer_out_size);
|
||||||
|
@ -179,19 +179,19 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtl(const IOSIOCtlRequest& re
|
||||||
m_Status |= CARD_INSERTED;
|
m_Status |= CARD_INSERTED;
|
||||||
else
|
else
|
||||||
m_Status = CARD_NOT_EXIST;
|
m_Status = CARD_NOT_EXIST;
|
||||||
INFO_LOG(WII_IPC_SD, "IOCTL_GETSTATUS. Replying that SD card is %s%s",
|
INFO_LOG(IOS_SD, "IOCTL_GETSTATUS. Replying that SD card is %s%s",
|
||||||
(m_Status & CARD_INSERTED) ? "inserted" : "not present",
|
(m_Status & CARD_INSERTED) ? "inserted" : "not present",
|
||||||
(m_Status & CARD_INITIALIZED) ? " and initialized" : "");
|
(m_Status & CARD_INITIALIZED) ? " and initialized" : "");
|
||||||
Memory::Write_U32(m_Status, request.buffer_out);
|
Memory::Write_U32(m_Status, request.buffer_out);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_GETOCR:
|
case IOCTL_GETOCR:
|
||||||
INFO_LOG(WII_IPC_SD, "IOCTL_GETOCR");
|
INFO_LOG(IOS_SD, "IOCTL_GETOCR");
|
||||||
Memory::Write_U32(0x80ff8000, request.buffer_out);
|
Memory::Write_U32(0x80ff8000, request.buffer_out);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(WII_IPC_SD, "Unknown SD IOCtl command (0x%08x)", request.request);
|
ERROR_LOG(IOS_SD, "Unknown SD IOCtl command (0x%08x)", request.request);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,13 +204,13 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtl(const IOSIOCtlRequest& re
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(const IOSIOCtlVRequest& request)
|
IPCCommandResult SDIOSlot0::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
s32 return_value = IPC_SUCCESS;
|
s32 return_value = IPC_SUCCESS;
|
||||||
switch (request.request)
|
switch (request.request)
|
||||||
{
|
{
|
||||||
case IOCTLV_SENDCMD:
|
case IOCTLV_SENDCMD:
|
||||||
DEBUG_LOG(WII_IPC_SD, "IOCTLV_SENDCMD 0x%08x", Memory::Read_U32(request.in_vectors[0].address));
|
DEBUG_LOG(IOS_SD, "IOCTLV_SENDCMD 0x%08x", Memory::Read_U32(request.in_vectors[0].address));
|
||||||
Memory::Memset(request.io_vectors[0].address, 0, request.io_vectors[0].size);
|
Memory::Memset(request.io_vectors[0].address, 0, request.io_vectors[0].size);
|
||||||
return_value =
|
return_value =
|
||||||
ExecuteCommand(request, request.in_vectors[0].address, request.in_vectors[0].size,
|
ExecuteCommand(request, request.in_vectors[0].address, request.in_vectors[0].size,
|
||||||
|
@ -219,16 +219,14 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(const IOSIOCtlVRequest&
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(WII_IPC_SD, "Unknown SD IOCtlV command 0x%08x", request.request);
|
ERROR_LOG(IOS_SD, "Unknown SD IOCtlV command 0x%08x", request.request);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u32 _BufferIn,
|
u32 SDIOSlot0::ExecuteCommand(const IOSRequest& request, u32 _BufferIn, u32 _BufferInSize,
|
||||||
u32 _BufferInSize, u32 _rwBuffer,
|
u32 _rwBuffer, u32 _rwBufferSize, u32 _BufferOut, u32 _BufferOutSize)
|
||||||
u32 _rwBufferSize, u32 _BufferOut,
|
|
||||||
u32 _BufferOutSize)
|
|
||||||
{
|
{
|
||||||
// The game will send us a SendCMD with this information. To be able to read and write
|
// The game will send us a SendCMD with this information. To be able to read and write
|
||||||
// to a file we need to prepare a 0x10 byte output buffer as response.
|
// to a file we need to prepare a 0x10 byte output buffer as response.
|
||||||
|
@ -284,7 +282,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u3
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SEND_CSD:
|
case SEND_CSD:
|
||||||
INFO_LOG(WII_IPC_SD, "SEND_CSD");
|
INFO_LOG(IOS_SD, "SEND_CSD");
|
||||||
// <WntrMute> shuffle2_, OCR: 0x80ff8000 CID: 0x38a00000 0x480032d5 0x3c608030 0x8803d420
|
// <WntrMute> shuffle2_, OCR: 0x80ff8000 CID: 0x38a00000 0x480032d5 0x3c608030 0x8803d420
|
||||||
// CSD: 0xff928040 0xc93efbcf 0x325f5a83 0x00002600
|
// CSD: 0xff928040 0xc93efbcf 0x325f5a83 0x00002600
|
||||||
|
|
||||||
|
@ -297,7 +295,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u3
|
||||||
|
|
||||||
case ALL_SEND_CID:
|
case ALL_SEND_CID:
|
||||||
case SEND_CID:
|
case SEND_CID:
|
||||||
INFO_LOG(WII_IPC_SD, "(ALL_)SEND_CID");
|
INFO_LOG(IOS_SD, "(ALL_)SEND_CID");
|
||||||
Memory::Write_U32(0x80114d1c, _BufferOut);
|
Memory::Write_U32(0x80114d1c, _BufferOut);
|
||||||
Memory::Write_U32(0x80080000, _BufferOut + 4);
|
Memory::Write_U32(0x80080000, _BufferOut + 4);
|
||||||
Memory::Write_U32(0x8007b520, _BufferOut + 8);
|
Memory::Write_U32(0x8007b520, _BufferOut + 8);
|
||||||
|
@ -330,7 +328,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u3
|
||||||
{
|
{
|
||||||
// Data address (req.arg) is in byte units in a Standard Capacity SD Memory Card
|
// Data address (req.arg) is in byte units in a Standard Capacity SD Memory Card
|
||||||
// and in block (512 Byte) units in a High Capacity SD Memory Card.
|
// and in block (512 Byte) units in a High Capacity SD Memory Card.
|
||||||
INFO_LOG(WII_IPC_SD, "%sRead %i Block(s) from 0x%08x bsize %i into 0x%08x!",
|
INFO_LOG(IOS_SD, "%sRead %i Block(s) from 0x%08x bsize %i into 0x%08x!",
|
||||||
req.isDMA ? "DMA " : "", req.blocks, req.arg, req.bsize, req.addr);
|
req.isDMA ? "DMA " : "", req.blocks, req.arg, req.bsize, req.addr);
|
||||||
|
|
||||||
if (m_Card)
|
if (m_Card)
|
||||||
|
@ -338,15 +336,15 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u3
|
||||||
u32 size = req.bsize * req.blocks;
|
u32 size = req.bsize * req.blocks;
|
||||||
|
|
||||||
if (!m_Card.Seek(req.arg, SEEK_SET))
|
if (!m_Card.Seek(req.arg, SEEK_SET))
|
||||||
ERROR_LOG(WII_IPC_SD, "Seek failed WTF");
|
ERROR_LOG(IOS_SD, "Seek failed WTF");
|
||||||
|
|
||||||
if (m_Card.ReadBytes(Memory::GetPointer(req.addr), size))
|
if (m_Card.ReadBytes(Memory::GetPointer(req.addr), size))
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_SD, "Outbuffer size %i got %i", _rwBufferSize, size);
|
DEBUG_LOG(IOS_SD, "Outbuffer size %i got %i", _rwBufferSize, size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_SD, "Read Failed - error: %i, eof: %i", ferror(m_Card.GetHandle()),
|
ERROR_LOG(IOS_SD, "Read Failed - error: %i, eof: %i", ferror(m_Card.GetHandle()),
|
||||||
feof(m_Card.GetHandle()));
|
feof(m_Card.GetHandle()));
|
||||||
ret = RET_FAIL;
|
ret = RET_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -359,7 +357,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u3
|
||||||
{
|
{
|
||||||
// Data address (req.arg) is in byte units in a Standard Capacity SD Memory Card
|
// Data address (req.arg) is in byte units in a Standard Capacity SD Memory Card
|
||||||
// and in block (512 Byte) units in a High Capacity SD Memory Card.
|
// and in block (512 Byte) units in a High Capacity SD Memory Card.
|
||||||
INFO_LOG(WII_IPC_SD, "%sWrite %i Block(s) from 0x%08x bsize %i to offset 0x%08x!",
|
INFO_LOG(IOS_SD, "%sWrite %i Block(s) from 0x%08x bsize %i to offset 0x%08x!",
|
||||||
req.isDMA ? "DMA " : "", req.blocks, req.addr, req.bsize, req.arg);
|
req.isDMA ? "DMA " : "", req.blocks, req.addr, req.bsize, req.arg);
|
||||||
|
|
||||||
if (m_Card && SConfig::GetInstance().bEnableMemcardSdWriting)
|
if (m_Card && SConfig::GetInstance().bEnableMemcardSdWriting)
|
||||||
|
@ -367,11 +365,11 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u3
|
||||||
u32 size = req.bsize * req.blocks;
|
u32 size = req.bsize * req.blocks;
|
||||||
|
|
||||||
if (!m_Card.Seek(req.arg, SEEK_SET))
|
if (!m_Card.Seek(req.arg, SEEK_SET))
|
||||||
ERROR_LOG(WII_IPC_SD, "fseeko failed WTF");
|
ERROR_LOG(IOS_SD, "fseeko failed WTF");
|
||||||
|
|
||||||
if (!m_Card.WriteBytes(Memory::GetPointer(req.addr), size))
|
if (!m_Card.WriteBytes(Memory::GetPointer(req.addr), size))
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_SD, "Write Failed - error: %i, eof: %i", ferror(m_Card.GetHandle()),
|
ERROR_LOG(IOS_SD, "Write Failed - error: %i, eof: %i", ferror(m_Card.GetHandle()),
|
||||||
feof(m_Card.GetHandle()));
|
feof(m_Card.GetHandle()));
|
||||||
ret = RET_FAIL;
|
ret = RET_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +379,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u3
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_REGISTER: // async
|
case EVENT_REGISTER: // async
|
||||||
INFO_LOG(WII_IPC_SD, "Register event %x", req.arg);
|
INFO_LOG(IOS_SD, "Register event %x", req.arg);
|
||||||
m_event = std::make_unique<Event>(static_cast<EventType>(req.arg), request);
|
m_event = std::make_unique<Event>(static_cast<EventType>(req.arg), request);
|
||||||
ret = RET_EVENT_REGISTER;
|
ret = RET_EVENT_REGISTER;
|
||||||
break;
|
break;
|
||||||
|
@ -389,7 +387,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u3
|
||||||
// Used to cancel an event that was already registered.
|
// Used to cancel an event that was already registered.
|
||||||
case EVENT_UNREGISTER:
|
case EVENT_UNREGISTER:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_SD, "Unregister event %x", req.arg);
|
INFO_LOG(IOS_SD, "Unregister event %x", req.arg);
|
||||||
if (!m_event)
|
if (!m_event)
|
||||||
return IPC_EINVAL;
|
return IPC_EINVAL;
|
||||||
// release returns 0
|
// release returns 0
|
||||||
|
@ -401,11 +399,12 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u3
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(WII_IPC_SD, "Unknown SD command 0x%08x", req.command);
|
ERROR_LOG(IOS_SD, "Unknown SD command 0x%08x", req.command);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
|
@ -20,10 +20,12 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
class CWII_IPC_HLE_Device_sdio_slot0 : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class SDIOSlot0 : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_sdio_slot0(u32 device_id, const std::string& device_name);
|
SDIOSlot0(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
void DoState(PointerWrap& p) override;
|
void DoState(PointerWrap& p) override;
|
||||||
|
|
||||||
|
@ -129,5 +131,6 @@ private:
|
||||||
u32 BufferInSize2, u32 _BufferOut, u32 BufferOutSize);
|
u32 BufferInSize2, u32 _BufferOut, u32 BufferOutSize);
|
||||||
void OpenInternal();
|
void OpenInternal();
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h"
|
#include "Core/IOS/STM/STM.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -21,16 +21,18 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
|
namespace Device
|
||||||
|
{
|
||||||
static std::unique_ptr<IOSIOCtlRequest> s_event_hook_request;
|
static std::unique_ptr<IOSIOCtlRequest> s_event_hook_request;
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult STMImmediate::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
s32 return_value = IPC_SUCCESS;
|
s32 return_value = IPC_SUCCESS;
|
||||||
switch (request.request)
|
switch (request.request)
|
||||||
{
|
{
|
||||||
case IOCTL_STM_IDLE:
|
case IOCTL_STM_IDLE:
|
||||||
case IOCTL_STM_SHUTDOWN:
|
case IOCTL_STM_SHUTDOWN:
|
||||||
NOTICE_LOG(WII_IPC_STM, "IOCTL_STM_IDLE or IOCTL_STM_SHUTDOWN received, shutting down");
|
NOTICE_LOG(IOS_STM, "IOCTL_STM_IDLE or IOCTL_STM_SHUTDOWN received, shutting down");
|
||||||
Core::QueueHostJob(&Core::Stop, false);
|
Core::QueueHostJob(&Core::Stop, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -46,42 +48,39 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::IOCtl(const IOSIOCtlRequest&
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_STM_HOTRESET:
|
case IOCTL_STM_HOTRESET:
|
||||||
INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str());
|
INFO_LOG(IOS_STM, "%s - IOCtl:", GetDeviceName().c_str());
|
||||||
INFO_LOG(WII_IPC_STM, " IOCTL_STM_HOTRESET");
|
INFO_LOG(IOS_STM, " IOCTL_STM_HOTRESET");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes)
|
case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes)
|
||||||
INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str());
|
INFO_LOG(IOS_STM, "%s - IOCtl:", GetDeviceName().c_str());
|
||||||
INFO_LOG(WII_IPC_STM, " IOCTL_STM_VIDIMMING");
|
INFO_LOG(IOS_STM, " IOCTL_STM_VIDIMMING");
|
||||||
// Memory::Write_U32(1, buffer_out);
|
// Memory::Write_U32(1, buffer_out);
|
||||||
// return_value = 1;
|
// return_value = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes)
|
case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes)
|
||||||
INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str());
|
INFO_LOG(IOS_STM, "%s - IOCtl:", GetDeviceName().c_str());
|
||||||
INFO_LOG(WII_IPC_STM, " IOCTL_STM_LEDMODE");
|
INFO_LOG(IOS_STM, " IOCTL_STM_LEDMODE");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_STM);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_STM);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_stm_eventhook::Close()
|
void STMEventHook::Close()
|
||||||
{
|
{
|
||||||
s_event_hook_request.reset();
|
s_event_hook_request.reset();
|
||||||
m_is_active = false;
|
m_is_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult STMEventHook::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
if (request.request != IOCTL_STM_EVENTHOOK)
|
if (request.request != IOCTL_STM_EVENTHOOK)
|
||||||
{
|
|
||||||
ERROR_LOG(WII_IPC_STM, "Bad IOCtl in CWII_IPC_HLE_Device_stm_eventhook");
|
|
||||||
return GetDefaultReply(IPC_EINVAL);
|
return GetDefaultReply(IPC_EINVAL);
|
||||||
}
|
|
||||||
|
|
||||||
if (s_event_hook_request)
|
if (s_event_hook_request)
|
||||||
return GetDefaultReply(IPC_EEXIST);
|
return GetDefaultReply(IPC_EEXIST);
|
||||||
|
@ -91,12 +90,12 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::IOCtl(const IOSIOCtlRequest&
|
||||||
return GetNoReply();
|
return GetNoReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWII_IPC_HLE_Device_stm_eventhook::HasHookInstalled() const
|
bool STMEventHook::HasHookInstalled() const
|
||||||
{
|
{
|
||||||
return s_event_hook_request != nullptr;
|
return s_event_hook_request != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_stm_eventhook::TriggerEvent(const u32 event) const
|
void STMEventHook::TriggerEvent(const u32 event) const
|
||||||
{
|
{
|
||||||
// If the device isn't open, ignore the button press.
|
// If the device isn't open, ignore the button press.
|
||||||
if (!m_is_active || !s_event_hook_request)
|
if (!m_is_active || !s_event_hook_request)
|
||||||
|
@ -107,15 +106,16 @@ void CWII_IPC_HLE_Device_stm_eventhook::TriggerEvent(const u32 event) const
|
||||||
s_event_hook_request.reset();
|
s_event_hook_request.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_stm_eventhook::ResetButton() const
|
void STMEventHook::ResetButton() const
|
||||||
{
|
{
|
||||||
// The reset button triggers STM_EVENT_RESET.
|
// The reset button triggers STM_EVENT_RESET.
|
||||||
TriggerEvent(STM_EVENT_RESET);
|
TriggerEvent(STM_EVENT_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_stm_eventhook::PowerButton() const
|
void STMEventHook::PowerButton() const
|
||||||
{
|
{
|
||||||
TriggerEvent(STM_EVENT_POWER);
|
TriggerEvent(STM_EVENT_POWER);
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -7,8 +7,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -38,27 +38,21 @@ enum
|
||||||
STM_EVENT_POWER = 0x00000800
|
STM_EVENT_POWER = 0x00000800
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace Device
|
||||||
|
{
|
||||||
// The /dev/stm/immediate
|
// The /dev/stm/immediate
|
||||||
class CWII_IPC_HLE_Device_stm_immediate final : public IWII_IPC_HLE_Device
|
class STMImmediate final : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_stm_immediate(u32 device_id, const std::string& device_name)
|
STMImmediate(u32 device_id, const std::string& device_name) : Device(device_id, device_name) {}
|
||||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// The /dev/stm/eventhook
|
// The /dev/stm/eventhook
|
||||||
class CWII_IPC_HLE_Device_stm_eventhook final : public IWII_IPC_HLE_Device
|
class STMEventHook final : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_stm_eventhook(u32 device_id, const std::string& device_name)
|
STMEventHook(u32 device_id, const std::string& device_name) : Device(device_id, device_name) {}
|
||||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Close() override;
|
void Close() override;
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
|
|
||||||
|
@ -69,5 +63,6 @@ public:
|
||||||
private:
|
private:
|
||||||
void TriggerEvent(u32 event) const;
|
void TriggerEvent(u32 event) const;
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -14,7 +14,7 @@
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/SysConf.h"
|
#include "Common/SysConf.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
|
#include "Core/IOS/USB/Bluetooth/BTBase.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -31,11 +31,11 @@ void BackUpBTInfoSection(SysConf* sysconf)
|
||||||
std::vector<u8> section(BT_INFO_SECTION_LENGTH);
|
std::vector<u8> section(BT_INFO_SECTION_LENGTH);
|
||||||
if (!sysconf->GetArrayData("BT.DINF", section.data(), static_cast<u16>(section.size())))
|
if (!sysconf->GetArrayData("BT.DINF", section.data(), static_cast<u16>(section.size())))
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "Failed to read source BT.DINF section");
|
ERROR_LOG(IOS_WIIMOTE, "Failed to read source BT.DINF section");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!backup.WriteBytes(section.data(), section.size()))
|
if (!backup.WriteBytes(section.data(), section.size()))
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "Failed to back up BT.DINF section");
|
ERROR_LOG(IOS_WIIMOTE, "Failed to back up BT.DINF section");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestoreBTInfoSection(SysConf* sysconf)
|
void RestoreBTInfoSection(SysConf* sysconf)
|
||||||
|
@ -47,15 +47,16 @@ void RestoreBTInfoSection(SysConf* sysconf)
|
||||||
std::vector<u8> section(BT_INFO_SECTION_LENGTH);
|
std::vector<u8> section(BT_INFO_SECTION_LENGTH);
|
||||||
if (!backup.ReadBytes(section.data(), section.size()))
|
if (!backup.ReadBytes(section.data(), section.size()))
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "Failed to read backed up BT.DINF section");
|
ERROR_LOG(IOS_WIIMOTE, "Failed to read backed up BT.DINF section");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sysconf->SetArrayData("BT.DINF", section.data(), static_cast<u16>(section.size()));
|
sysconf->SetArrayData("BT.DINF", section.data(), static_cast<u16>(section.size()));
|
||||||
File::Delete(filename);
|
File::Delete(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_base::CtrlMessage::CtrlMessage(const IOSIOCtlVRequest& ioctlv)
|
namespace Device
|
||||||
: ios_request(ioctlv)
|
{
|
||||||
|
BluetoothBase::CtrlMessage::CtrlMessage(const IOSIOCtlVRequest& ioctlv) : ios_request(ioctlv)
|
||||||
{
|
{
|
||||||
request_type = Memory::Read_U8(ioctlv.in_vectors[0].address);
|
request_type = Memory::Read_U8(ioctlv.in_vectors[0].address);
|
||||||
request = Memory::Read_U8(ioctlv.in_vectors[1].address);
|
request = Memory::Read_U8(ioctlv.in_vectors[1].address);
|
||||||
|
@ -65,20 +66,19 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305_base::CtrlMessage::CtrlMessage(const IOSIOCt
|
||||||
payload_addr = ioctlv.io_vectors[0].address;
|
payload_addr = ioctlv.io_vectors[0].address;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_base::CtrlBuffer::CtrlBuffer(const IOSIOCtlVRequest& ioctlv)
|
BluetoothBase::CtrlBuffer::CtrlBuffer(const IOSIOCtlVRequest& ioctlv) : ios_request(ioctlv)
|
||||||
: ios_request(ioctlv)
|
|
||||||
{
|
{
|
||||||
m_endpoint = Memory::Read_U8(ioctlv.in_vectors[0].address);
|
m_endpoint = Memory::Read_U8(ioctlv.in_vectors[0].address);
|
||||||
m_length = Memory::Read_U16(ioctlv.in_vectors[1].address);
|
m_length = Memory::Read_U16(ioctlv.in_vectors[1].address);
|
||||||
m_payload_addr = ioctlv.io_vectors[0].address;
|
m_payload_addr = ioctlv.io_vectors[0].address;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_base::CtrlBuffer::FillBuffer(const u8* src,
|
void BluetoothBase::CtrlBuffer::FillBuffer(const u8* src, const size_t size) const
|
||||||
const size_t size) const
|
|
||||||
{
|
{
|
||||||
_assert_msg_(WII_IPC_WIIMOTE, size <= m_length, "FillBuffer: size %li > payload length %i", size,
|
_assert_msg_(IOS_WIIMOTE, size <= m_length, "FillBuffer: size %li > payload length %i", size,
|
||||||
m_length);
|
m_length);
|
||||||
Memory::CopyToEmu(m_payload_addr, src, size);
|
Memory::CopyToEmu(m_payload_addr, src, size);
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -8,8 +8,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
class SysConf;
|
class SysConf;
|
||||||
|
@ -21,14 +21,12 @@ namespace HLE
|
||||||
void BackUpBTInfoSection(SysConf* sysconf);
|
void BackUpBTInfoSection(SysConf* sysconf);
|
||||||
void RestoreBTInfoSection(SysConf* sysconf);
|
void RestoreBTInfoSection(SysConf* sysconf);
|
||||||
|
|
||||||
class CWII_IPC_HLE_Device_usb_oh1_57e_305_base : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class BluetoothBase : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_base(u32 device_id, const std::string& device_name)
|
BluetoothBase(u32 device_id, const std::string& device_name) : Device(device_id, device_name) {}
|
||||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void UpdateSyncButtonState(bool is_held) {}
|
virtual void UpdateSyncButtonState(bool is_held) {}
|
||||||
virtual void TriggerSyncButtonPressedEvent() {}
|
virtual void TriggerSyncButtonPressedEvent() {}
|
||||||
virtual void TriggerSyncButtonHeldEvent() {}
|
virtual void TriggerSyncButtonHeldEvent() {}
|
||||||
|
@ -75,5 +73,6 @@ protected:
|
||||||
u32 m_payload_addr = 0;
|
u32 m_payload_addr = 0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
File diff suppressed because it is too large
Load Diff
|
@ -13,11 +13,11 @@
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
|
#include "Core/IOS/USB/Bluetooth/BTBase.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
|
||||||
#include "Core/IPC_HLE/hci.h"
|
#include "Core/IOS/USB/Bluetooth/hci.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
|
@ -25,8 +25,6 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
class CWII_IPC_HLE_WiiMote;
|
|
||||||
|
|
||||||
struct SQueuedEvent
|
struct SQueuedEvent
|
||||||
{
|
{
|
||||||
u8 m_buffer[1024] = {0};
|
u8 m_buffer[1024] = {0};
|
||||||
|
@ -37,17 +35,18 @@ struct SQueuedEvent
|
||||||
SQueuedEvent() = default;
|
SQueuedEvent() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace Device
|
||||||
|
{
|
||||||
// Important to remember that this class is for /dev/usb/oh1/57e/305 ONLY
|
// Important to remember that this class is for /dev/usb/oh1/57e/305 ONLY
|
||||||
// /dev/usb/oh1 -> internal usb bus
|
// /dev/usb/oh1 -> internal usb bus
|
||||||
// 57e/305 -> VendorID/ProductID of device on usb bus
|
// 57e/305 -> VendorID/ProductID of device on usb bus
|
||||||
// This device is ONLY the internal Bluetooth module (based on BCM2045 chip)
|
// This device is ONLY the internal Bluetooth module (based on BCM2045 chip)
|
||||||
class CWII_IPC_HLE_Device_usb_oh1_57e_305_emu final
|
class BluetoothEmu final : public BluetoothBase
|
||||||
: public CWII_IPC_HLE_Device_usb_oh1_57e_305_base
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_emu(u32 _DeviceID, const std::string& _rDeviceName);
|
BluetoothEmu(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
virtual ~CWII_IPC_HLE_Device_usb_oh1_57e_305_emu();
|
virtual ~BluetoothEmu();
|
||||||
|
|
||||||
void Close() override;
|
void Close() override;
|
||||||
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
||||||
|
@ -59,9 +58,9 @@ public:
|
||||||
|
|
||||||
bool RemoteDisconnect(u16 _connectionHandle);
|
bool RemoteDisconnect(u16 _connectionHandle);
|
||||||
|
|
||||||
std::vector<CWII_IPC_HLE_WiiMote> m_WiiMotes;
|
std::vector<WiimoteDevice> m_WiiMotes;
|
||||||
CWII_IPC_HLE_WiiMote* AccessWiiMote(const bdaddr_t& _rAddr);
|
WiimoteDevice* AccessWiiMote(const bdaddr_t& _rAddr);
|
||||||
CWII_IPC_HLE_WiiMote* AccessWiiMote(u16 _ConnectionHandle);
|
WiimoteDevice* AccessWiiMote(u16 _ConnectionHandle);
|
||||||
|
|
||||||
void DoState(PointerWrap& p) override;
|
void DoState(PointerWrap& p) override;
|
||||||
|
|
||||||
|
@ -112,7 +111,7 @@ private:
|
||||||
bool SendEventInquiryResponse();
|
bool SendEventInquiryResponse();
|
||||||
bool SendEventInquiryComplete();
|
bool SendEventInquiryComplete();
|
||||||
bool SendEventRemoteNameReq(const bdaddr_t& _bd);
|
bool SendEventRemoteNameReq(const bdaddr_t& _bd);
|
||||||
bool SendEventRequestConnection(CWII_IPC_HLE_WiiMote& _rWiiMote);
|
bool SendEventRequestConnection(WiimoteDevice& _rWiiMote);
|
||||||
bool SendEventConnectionComplete(const bdaddr_t& _bd);
|
bool SendEventConnectionComplete(const bdaddr_t& _bd);
|
||||||
bool SendEventReadClockOffsetComplete(u16 _connectionHandle);
|
bool SendEventReadClockOffsetComplete(u16 _connectionHandle);
|
||||||
bool SendEventConPacketTypeChange(u16 _connectionHandle, u16 _packetType);
|
bool SendEventConPacketTypeChange(u16 _connectionHandle, u16 _packetType);
|
||||||
|
@ -194,5 +193,6 @@ private:
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -27,9 +27,9 @@
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.h"
|
#include "Core/IOS/USB/Bluetooth/BTReal.h"
|
||||||
#include "Core/IPC_HLE/hci.h"
|
#include "Core/IOS/USB/Bluetooth/hci.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -66,17 +66,18 @@ static bool IsBluetoothDevice(const libusb_interface_descriptor& descriptor)
|
||||||
descriptor.bInterfaceProtocol == PROTOCOL_BLUETOOTH;
|
descriptor.bInterfaceProtocol == PROTOCOL_BLUETOOTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_real::CWII_IPC_HLE_Device_usb_oh1_57e_305_real(
|
namespace Device
|
||||||
u32 device_id, const std::string& device_name)
|
{
|
||||||
: CWII_IPC_HLE_Device_usb_oh1_57e_305_base(device_id, device_name)
|
BluetoothReal::BluetoothReal(u32 device_id, const std::string& device_name)
|
||||||
|
: BluetoothBase(device_id, device_name)
|
||||||
{
|
{
|
||||||
const int ret = libusb_init(&m_libusb_context);
|
const int ret = libusb_init(&m_libusb_context);
|
||||||
_assert_msg_(WII_IPC_WIIMOTE, ret == 0, "Failed to init libusb.");
|
_assert_msg_(IOS_WIIMOTE, ret == 0, "Failed to init libusb.");
|
||||||
|
|
||||||
LoadLinkKeys();
|
LoadLinkKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_real::~CWII_IPC_HLE_Device_usb_oh1_57e_305_real()
|
BluetoothReal::~BluetoothReal()
|
||||||
{
|
{
|
||||||
if (m_handle != nullptr)
|
if (m_handle != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -94,11 +95,11 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305_real::~CWII_IPC_HLE_Device_usb_oh1_57e_305_r
|
||||||
SaveLinkKeys();
|
SaveLinkKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
IOSReturnCode CWII_IPC_HLE_Device_usb_oh1_57e_305_real::Open(const IOSOpenRequest& request)
|
IOSReturnCode BluetoothReal::Open(const IOSOpenRequest& request)
|
||||||
{
|
{
|
||||||
libusb_device** list;
|
libusb_device** list;
|
||||||
const ssize_t cnt = libusb_get_device_list(m_libusb_context, &list);
|
const ssize_t cnt = libusb_get_device_list(m_libusb_context, &list);
|
||||||
_dbg_assert_msg_(WII_IPC_HLE, cnt > 0, "Couldn't get device list");
|
_dbg_assert_msg_(IOS, cnt > 0, "Couldn't get device list");
|
||||||
for (ssize_t i = 0; i < cnt; ++i)
|
for (ssize_t i = 0; i < cnt; ++i)
|
||||||
{
|
{
|
||||||
libusb_device* device = list[i];
|
libusb_device* device = list[i];
|
||||||
|
@ -108,7 +109,7 @@ IOSReturnCode CWII_IPC_HLE_Device_usb_oh1_57e_305_real::Open(const IOSOpenReques
|
||||||
const int ret = libusb_get_active_config_descriptor(device, &config_descriptor);
|
const int ret = libusb_get_active_config_descriptor(device, &config_descriptor);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "Failed to get config descriptor for device %04x:%04x: %s",
|
ERROR_LOG(IOS_WIIMOTE, "Failed to get config descriptor for device %04x:%04x: %s",
|
||||||
device_descriptor.idVendor, device_descriptor.idProduct, libusb_error_name(ret));
|
device_descriptor.idVendor, device_descriptor.idProduct, libusb_error_name(ret));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +125,7 @@ IOSReturnCode CWII_IPC_HLE_Device_usb_oh1_57e_305_real::Open(const IOSOpenReques
|
||||||
sizeof(product));
|
sizeof(product));
|
||||||
libusb_get_string_descriptor_ascii(m_handle, device_descriptor.iSerialNumber, serial_number,
|
libusb_get_string_descriptor_ascii(m_handle, device_descriptor.iSerialNumber, serial_number,
|
||||||
sizeof(serial_number));
|
sizeof(serial_number));
|
||||||
NOTICE_LOG(WII_IPC_WIIMOTE, "Using device %04x:%04x (rev %x) for Bluetooth: %s %s %s",
|
NOTICE_LOG(IOS_WIIMOTE, "Using device %04x:%04x (rev %x) for Bluetooth: %s %s %s",
|
||||||
device_descriptor.idVendor, device_descriptor.idProduct,
|
device_descriptor.idVendor, device_descriptor.idProduct,
|
||||||
device_descriptor.bcdDevice, manufacturer, product, serial_number);
|
device_descriptor.bcdDevice, manufacturer, product, serial_number);
|
||||||
m_is_wii_bt_module =
|
m_is_wii_bt_module =
|
||||||
|
@ -150,7 +151,7 @@ IOSReturnCode CWII_IPC_HLE_Device_usb_oh1_57e_305_real::Open(const IOSOpenReques
|
||||||
return IPC_SUCCESS;
|
return IPC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::Close()
|
void BluetoothReal::Close()
|
||||||
{
|
{
|
||||||
if (m_handle)
|
if (m_handle)
|
||||||
{
|
{
|
||||||
|
@ -163,7 +164,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::Close()
|
||||||
m_is_active = false;
|
m_is_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_usb_oh1_57e_305_real::IOCtlV(const IOSIOCtlVRequest& request)
|
IPCCommandResult BluetoothReal::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
if (!m_is_wii_bt_module && s_need_reset_keys.TestAndClear())
|
if (!m_is_wii_bt_module && s_need_reset_keys.TestAndClear())
|
||||||
{
|
{
|
||||||
|
@ -266,7 +267,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_oh1_57e_305_real::IOCtlV(const IOSIOCtl
|
||||||
return GetNoReply();
|
return GetNoReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::DoState(PointerWrap& p)
|
void BluetoothReal::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
bool passthrough_bluetooth = true;
|
bool passthrough_bluetooth = true;
|
||||||
p.Do(passthrough_bluetooth);
|
p.Do(passthrough_bluetooth);
|
||||||
|
@ -280,7 +281,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::DoState(PointerWrap& p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::UpdateSyncButtonState(const bool is_held)
|
void BluetoothReal::UpdateSyncButtonState(const bool is_held)
|
||||||
{
|
{
|
||||||
if (m_sync_button_state == SyncButtonState::Unpressed && is_held)
|
if (m_sync_button_state == SyncButtonState::Unpressed && is_held)
|
||||||
{
|
{
|
||||||
|
@ -298,17 +299,17 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::UpdateSyncButtonState(const bool
|
||||||
m_sync_button_state = SyncButtonState::Unpressed;
|
m_sync_button_state = SyncButtonState::Unpressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::TriggerSyncButtonPressedEvent()
|
void BluetoothReal::TriggerSyncButtonPressedEvent()
|
||||||
{
|
{
|
||||||
m_sync_button_state = SyncButtonState::Pressed;
|
m_sync_button_state = SyncButtonState::Pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::TriggerSyncButtonHeldEvent()
|
void BluetoothReal::TriggerSyncButtonHeldEvent()
|
||||||
{
|
{
|
||||||
m_sync_button_state = SyncButtonState::LongPressed;
|
m_sync_button_state = SyncButtonState::LongPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::WaitForHCICommandComplete(const u16 opcode)
|
void BluetoothReal::WaitForHCICommandComplete(const u16 opcode)
|
||||||
{
|
{
|
||||||
int actual_length;
|
int actual_length;
|
||||||
std::vector<u8> buffer(1024);
|
std::vector<u8> buffer(1024);
|
||||||
|
@ -323,17 +324,17 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::WaitForHCICommandComplete(const u
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::SendHCIResetCommand()
|
void BluetoothReal::SendHCIResetCommand()
|
||||||
{
|
{
|
||||||
const u8 type = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE;
|
const u8 type = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE;
|
||||||
u8 packet[3] = {};
|
u8 packet[3] = {};
|
||||||
const u16 payload[] = {HCI_CMD_RESET};
|
const u16 payload[] = {HCI_CMD_RESET};
|
||||||
memcpy(packet, payload, sizeof(payload));
|
memcpy(packet, payload, sizeof(payload));
|
||||||
libusb_control_transfer(m_handle, type, 0, 0, 0, packet, sizeof(packet), TIMEOUT);
|
libusb_control_transfer(m_handle, type, 0, 0, 0, packet, sizeof(packet), TIMEOUT);
|
||||||
INFO_LOG(WII_IPC_WIIMOTE, "Sent a reset command to adapter");
|
INFO_LOG(IOS_WIIMOTE, "Sent a reset command to adapter");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::SendHCIDeleteLinkKeyCommand()
|
void BluetoothReal::SendHCIDeleteLinkKeyCommand()
|
||||||
{
|
{
|
||||||
const u8 type = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE;
|
const u8 type = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE;
|
||||||
std::vector<u8> packet(sizeof(hci_cmd_hdr_t) + sizeof(hci_delete_stored_link_key_cp));
|
std::vector<u8> packet(sizeof(hci_cmd_hdr_t) + sizeof(hci_delete_stored_link_key_cp));
|
||||||
|
@ -350,7 +351,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::SendHCIDeleteLinkKeyCommand()
|
||||||
TIMEOUT);
|
TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWII_IPC_HLE_Device_usb_oh1_57e_305_real::SendHCIStoreLinkKeyCommand()
|
bool BluetoothReal::SendHCIStoreLinkKeyCommand()
|
||||||
{
|
{
|
||||||
if (s_link_keys.empty())
|
if (s_link_keys.empty())
|
||||||
return false;
|
return false;
|
||||||
|
@ -389,7 +390,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305_real::SendHCIStoreLinkKeyCommand()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeVendorCommandReply(CtrlBuffer& ctrl)
|
void BluetoothReal::FakeVendorCommandReply(CtrlBuffer& ctrl)
|
||||||
{
|
{
|
||||||
u8* packet = Memory::GetPointer(ctrl.m_payload_addr);
|
u8* packet = Memory::GetPointer(ctrl.m_payload_addr);
|
||||||
auto* hci_event = reinterpret_cast<SHCIEventCommand*>(packet);
|
auto* hci_event = reinterpret_cast<SHCIEventCommand*>(packet);
|
||||||
|
@ -406,7 +407,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeVendorCommandReply(CtrlBuffer
|
||||||
// - it will cause a u8 underflow and royally screw things up.
|
// - it will cause a u8 underflow and royally screw things up.
|
||||||
// Therefore, the reply to this command has to be faked to avoid random, weird issues
|
// Therefore, the reply to this command has to be faked to avoid random, weird issues
|
||||||
// (including Wiimote disconnects and "event mismatch" warning messages).
|
// (including Wiimote disconnects and "event mismatch" warning messages).
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeReadBufferSizeReply(CtrlBuffer& ctrl)
|
void BluetoothReal::FakeReadBufferSizeReply(CtrlBuffer& ctrl)
|
||||||
{
|
{
|
||||||
u8* packet = Memory::GetPointer(ctrl.m_payload_addr);
|
u8* packet = Memory::GetPointer(ctrl.m_payload_addr);
|
||||||
auto* hci_event = reinterpret_cast<SHCIEventCommand*>(packet);
|
auto* hci_event = reinterpret_cast<SHCIEventCommand*>(packet);
|
||||||
|
@ -427,8 +428,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeReadBufferSizeReply(CtrlBuffe
|
||||||
static_cast<s32>(sizeof(SHCIEventCommand) + sizeof(hci_read_buffer_size_rp)));
|
static_cast<s32>(sizeof(SHCIEventCommand) + sizeof(hci_read_buffer_size_rp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeSyncButtonEvent(CtrlBuffer& ctrl,
|
void BluetoothReal::FakeSyncButtonEvent(CtrlBuffer& ctrl, const u8* payload, const u8 size)
|
||||||
const u8* payload, const u8 size)
|
|
||||||
{
|
{
|
||||||
u8* packet = Memory::GetPointer(ctrl.m_payload_addr);
|
u8* packet = Memory::GetPointer(ctrl.m_payload_addr);
|
||||||
auto* hci_event = reinterpret_cast<hci_event_hdr_t*>(packet);
|
auto* hci_event = reinterpret_cast<hci_event_hdr_t*>(packet);
|
||||||
|
@ -442,24 +442,24 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeSyncButtonEvent(CtrlBuffer& c
|
||||||
// > HCI Event: Vendor (0xff) plen 1
|
// > HCI Event: Vendor (0xff) plen 1
|
||||||
// 08
|
// 08
|
||||||
// This causes the emulated software to perform a BT inquiry and connect to found Wiimotes.
|
// This causes the emulated software to perform a BT inquiry and connect to found Wiimotes.
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeSyncButtonPressedEvent(CtrlBuffer& ctrl)
|
void BluetoothReal::FakeSyncButtonPressedEvent(CtrlBuffer& ctrl)
|
||||||
{
|
{
|
||||||
NOTICE_LOG(WII_IPC_WIIMOTE, "Faking 'sync button pressed' (0x08) event packet");
|
NOTICE_LOG(IOS_WIIMOTE, "Faking 'sync button pressed' (0x08) event packet");
|
||||||
const u8 payload[1] = {0x08};
|
const u8 payload[1] = {0x08};
|
||||||
FakeSyncButtonEvent(ctrl, payload, sizeof(payload));
|
FakeSyncButtonEvent(ctrl, payload, sizeof(payload));
|
||||||
m_sync_button_state = SyncButtonState::Ignored;
|
m_sync_button_state = SyncButtonState::Ignored;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the red sync button is held for 10 seconds, a HCI event with payload 09 is sent.
|
// When the red sync button is held for 10 seconds, a HCI event with payload 09 is sent.
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeSyncButtonHeldEvent(CtrlBuffer& ctrl)
|
void BluetoothReal::FakeSyncButtonHeldEvent(CtrlBuffer& ctrl)
|
||||||
{
|
{
|
||||||
NOTICE_LOG(WII_IPC_WIIMOTE, "Faking 'sync button held' (0x09) event packet");
|
NOTICE_LOG(IOS_WIIMOTE, "Faking 'sync button held' (0x09) event packet");
|
||||||
const u8 payload[1] = {0x09};
|
const u8 payload[1] = {0x09};
|
||||||
FakeSyncButtonEvent(ctrl, payload, sizeof(payload));
|
FakeSyncButtonEvent(ctrl, payload, sizeof(payload));
|
||||||
m_sync_button_state = SyncButtonState::Ignored;
|
m_sync_button_state = SyncButtonState::Ignored;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::LoadLinkKeys()
|
void BluetoothReal::LoadLinkKeys()
|
||||||
{
|
{
|
||||||
const std::string& entries = SConfig::GetInstance().m_bt_passthrough_link_keys;
|
const std::string& entries = SConfig::GetInstance().m_bt_passthrough_link_keys;
|
||||||
if (entries.empty())
|
if (entries.empty())
|
||||||
|
@ -490,7 +490,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::LoadLinkKeys()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::SaveLinkKeys()
|
void BluetoothReal::SaveLinkKeys()
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
for (const auto& entry : s_link_keys)
|
for (const auto& entry : s_link_keys)
|
||||||
|
@ -511,7 +511,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::SaveLinkKeys()
|
||||||
SConfig::GetInstance().m_bt_passthrough_link_keys = config_string;
|
SConfig::GetInstance().m_bt_passthrough_link_keys = config_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWII_IPC_HLE_Device_usb_oh1_57e_305_real::OpenDevice(libusb_device* device)
|
bool BluetoothReal::OpenDevice(libusb_device* device)
|
||||||
{
|
{
|
||||||
m_device = libusb_ref_device(device);
|
m_device = libusb_ref_device(device);
|
||||||
const int ret = libusb_open(m_device, &m_handle);
|
const int ret = libusb_open(m_device, &m_handle);
|
||||||
|
@ -536,15 +536,15 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305_real::OpenDevice(libusb_device* device)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::StartTransferThread()
|
void BluetoothReal::StartTransferThread()
|
||||||
{
|
{
|
||||||
if (m_thread_running.IsSet())
|
if (m_thread_running.IsSet())
|
||||||
return;
|
return;
|
||||||
m_thread_running.Set();
|
m_thread_running.Set();
|
||||||
m_thread = std::thread(&CWII_IPC_HLE_Device_usb_oh1_57e_305_real::TransferThread, this);
|
m_thread = std::thread(&BluetoothReal::TransferThread, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::StopTransferThread()
|
void BluetoothReal::StopTransferThread()
|
||||||
{
|
{
|
||||||
if (m_thread_running.TestAndClear())
|
if (m_thread_running.TestAndClear())
|
||||||
{
|
{
|
||||||
|
@ -553,7 +553,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::StopTransferThread()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::TransferThread()
|
void BluetoothReal::TransferThread()
|
||||||
{
|
{
|
||||||
Common::SetCurrentThreadName("BT USB Thread");
|
Common::SetCurrentThreadName("BT USB Thread");
|
||||||
while (m_thread_running.IsSet())
|
while (m_thread_running.IsSet())
|
||||||
|
@ -563,12 +563,12 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::TransferThread()
|
||||||
}
|
}
|
||||||
|
|
||||||
// The callbacks are called from libusb code on a separate thread.
|
// The callbacks are called from libusb code on a separate thread.
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::CommandCallback(libusb_transfer* tr)
|
void BluetoothReal::CommandCallback(libusb_transfer* tr)
|
||||||
{
|
{
|
||||||
const std::unique_ptr<CtrlMessage> cmd(static_cast<CtrlMessage*>(tr->user_data));
|
const std::unique_ptr<CtrlMessage> cmd(static_cast<CtrlMessage*>(tr->user_data));
|
||||||
if (tr->status != LIBUSB_TRANSFER_COMPLETED && tr->status != LIBUSB_TRANSFER_NO_DEVICE)
|
if (tr->status != LIBUSB_TRANSFER_COMPLETED && tr->status != LIBUSB_TRANSFER_NO_DEVICE)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "libusb command transfer failed, status: 0x%02x", tr->status);
|
ERROR_LOG(IOS_WIIMOTE, "libusb command transfer failed, status: 0x%02x", tr->status);
|
||||||
if (!s_showed_failed_transfer.IsSet())
|
if (!s_showed_failed_transfer.IsSet())
|
||||||
{
|
{
|
||||||
Core::DisplayMessage("Failed to send a command to the Bluetooth adapter.", 10000);
|
Core::DisplayMessage("Failed to send a command to the Bluetooth adapter.", 10000);
|
||||||
|
@ -584,13 +584,13 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::CommandCallback(libusb_transfer*
|
||||||
EnqueueReply(cmd->ios_request, tr->actual_length, 0, CoreTiming::FromThread::NON_CPU);
|
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)
|
void BluetoothReal::TransferCallback(libusb_transfer* tr)
|
||||||
{
|
{
|
||||||
const std::unique_ptr<CtrlBuffer> ctrl(static_cast<CtrlBuffer*>(tr->user_data));
|
const std::unique_ptr<CtrlBuffer> ctrl(static_cast<CtrlBuffer*>(tr->user_data));
|
||||||
if (tr->status != LIBUSB_TRANSFER_COMPLETED && tr->status != LIBUSB_TRANSFER_TIMED_OUT &&
|
if (tr->status != LIBUSB_TRANSFER_COMPLETED && tr->status != LIBUSB_TRANSFER_TIMED_OUT &&
|
||||||
tr->status != LIBUSB_TRANSFER_NO_DEVICE)
|
tr->status != LIBUSB_TRANSFER_NO_DEVICE)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "libusb transfer failed, status: 0x%02x", tr->status);
|
ERROR_LOG(IOS_WIIMOTE, "libusb transfer failed, status: 0x%02x", tr->status);
|
||||||
if (!s_showed_failed_transfer.IsSet())
|
if (!s_showed_failed_transfer.IsSet())
|
||||||
{
|
{
|
||||||
Core::DisplayMessage("Failed to transfer to or from to the Bluetooth adapter.", 10000);
|
Core::DisplayMessage("Failed to transfer to or from to the Bluetooth adapter.", 10000);
|
||||||
|
@ -627,5 +627,6 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::TransferCallback(libusb_transfer*
|
||||||
|
|
||||||
EnqueueReply(ctrl->ios_request, tr->actual_length, 0, CoreTiming::FromThread::NON_CPU);
|
EnqueueReply(ctrl->ios_request, tr->actual_length, 0, CoreTiming::FromThread::NON_CPU);
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -13,8 +13,8 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Flag.h"
|
#include "Common/Flag.h"
|
||||||
#include "Common/Timer.h"
|
#include "Common/Timer.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
|
#include "Core/IOS/USB/Bluetooth/BTBase.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
struct libusb_context;
|
struct libusb_context;
|
||||||
|
@ -39,12 +39,13 @@ enum class SyncButtonState
|
||||||
using btaddr_t = std::array<u8, 6>;
|
using btaddr_t = std::array<u8, 6>;
|
||||||
using linkkey_t = std::array<u8, 16>;
|
using linkkey_t = std::array<u8, 16>;
|
||||||
|
|
||||||
class CWII_IPC_HLE_Device_usb_oh1_57e_305_real final
|
namespace Device
|
||||||
: public CWII_IPC_HLE_Device_usb_oh1_57e_305_base
|
{
|
||||||
|
class BluetoothReal final : public BluetoothBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_real(u32 device_id, const std::string& device_name);
|
BluetoothReal(u32 device_id, const std::string& device_name);
|
||||||
~CWII_IPC_HLE_Device_usb_oh1_57e_305_real() override;
|
~BluetoothReal() override;
|
||||||
|
|
||||||
IOSReturnCode Open(const IOSOpenRequest& request) override;
|
IOSReturnCode Open(const IOSOpenRequest& request) override;
|
||||||
void Close() override;
|
void Close() override;
|
||||||
|
@ -100,17 +101,21 @@ private:
|
||||||
static void CommandCallback(libusb_transfer* transfer);
|
static void CommandCallback(libusb_transfer* transfer);
|
||||||
static void TransferCallback(libusb_transfer* transfer);
|
static void TransferCallback(libusb_transfer* transfer);
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_stub.h"
|
#include "Core/IOS/USB/Bluetooth/BTStub.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
using CWII_IPC_HLE_Device_usb_oh1_57e_305_real = CWII_IPC_HLE_Device_usb_oh1_57e_305_stub;
|
namespace Device
|
||||||
|
{
|
||||||
|
using BluetoothReal = BluetoothStub;
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
||||||
#endif
|
#endif
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_stub.h"
|
#include "Core/IOS/USB/Bluetooth/BTStub.h"
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
|
@ -16,17 +16,20 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
IOSReturnCode CWII_IPC_HLE_Device_usb_oh1_57e_305_stub::Open(const IOSOpenRequest& request)
|
namespace Device
|
||||||
|
{
|
||||||
|
IOSReturnCode BluetoothStub::Open(const IOSOpenRequest& request)
|
||||||
{
|
{
|
||||||
PanicAlertT("Bluetooth passthrough mode is enabled, but Dolphin was built without libusb."
|
PanicAlertT("Bluetooth passthrough mode is enabled, but Dolphin was built without libusb."
|
||||||
" Passthrough mode cannot be used.");
|
" Passthrough mode cannot be used.");
|
||||||
return IPC_ENOENT;
|
return IPC_ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_stub::DoState(PointerWrap& p)
|
void BluetoothStub::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
Core::DisplayMessage("The current IPC_HLE_Device_usb is a stub. Aborting load.", 4000);
|
Core::DisplayMessage("The current IPC_HLE_Device_usb is a stub. Aborting load.", 4000);
|
||||||
p.SetMode(PointerWrap::MODE_VERIFY);
|
p.SetMode(PointerWrap::MODE_VERIFY);
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -7,8 +7,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
|
#include "Core/IOS/USB/Bluetooth/BTBase.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
|
@ -16,16 +16,18 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
class CWII_IPC_HLE_Device_usb_oh1_57e_305_stub final
|
namespace Device
|
||||||
: public CWII_IPC_HLE_Device_usb_oh1_57e_305_base
|
{
|
||||||
|
class BluetoothStub final : public BluetoothBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_stub(const u32 device_id, const std::string& device_name)
|
BluetoothStub(const u32 device_id, const std::string& device_name)
|
||||||
: CWII_IPC_HLE_Device_usb_oh1_57e_305_base(device_id, device_name)
|
: BluetoothBase(device_id, device_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
IOSReturnCode Open(const IOSOpenRequest& request) override;
|
IOSReturnCode Open(const IOSOpenRequest& request) override;
|
||||||
void DoState(PointerWrap& p) override;
|
void DoState(PointerWrap& p) override;
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -16,34 +16,33 @@
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
|
||||||
#include "Core/IPC_HLE/WiiMote_HID_Attr.h"
|
#include "Core/IOS/USB/Bluetooth/WiimoteHIDAttr.h"
|
||||||
#include "Core/IPC_HLE/l2cap.h"
|
#include "Core/IOS/USB/Bluetooth/l2cap.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
static CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* s_Usb = nullptr;
|
static Device::BluetoothEmu* s_Usb = nullptr;
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* GetUsbPointer()
|
Device::BluetoothEmu* GetUsbPointer()
|
||||||
{
|
{
|
||||||
return s_Usb;
|
return s_Usb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUsbPointer(CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* ptr)
|
void SetUsbPointer(Device::BluetoothEmu* ptr)
|
||||||
{
|
{
|
||||||
s_Usb = ptr;
|
s_Usb = ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* host,
|
WiimoteDevice::WiimoteDevice(Device::BluetoothEmu* host, int number, bdaddr_t bd, bool ready)
|
||||||
int number, bdaddr_t bd, bool ready)
|
|
||||||
: m_BD(bd),
|
: m_BD(bd),
|
||||||
m_Name(number == WIIMOTE_BALANCE_BOARD ? "Nintendo RVL-WBC-01" : "Nintendo RVL-CNT-01"),
|
m_Name(number == WIIMOTE_BALANCE_BOARD ? "Nintendo RVL-WBC-01" : "Nintendo RVL-CNT-01"),
|
||||||
m_pHost(host)
|
m_pHost(host)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_WIIMOTE, "Wiimote: #%i Constructed", number);
|
INFO_LOG(IOS_WIIMOTE, "Wiimote: #%i Constructed", number);
|
||||||
|
|
||||||
m_ConnectionState = (ready) ? CONN_READY : CONN_INACTIVE;
|
m_ConnectionState = (ready) ? CONN_READY : CONN_INACTIVE;
|
||||||
m_ConnectionHandle = 0x100 + number;
|
m_ConnectionHandle = 0x100 + number;
|
||||||
|
@ -76,7 +75,7 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305_e
|
||||||
lmp_subversion = 0x229;
|
lmp_subversion = 0x229;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::DoState(PointerWrap& p)
|
void WiimoteDevice::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
bool passthrough_bluetooth = false;
|
bool passthrough_bluetooth = false;
|
||||||
p.Do(passthrough_bluetooth);
|
p.Do(passthrough_bluetooth);
|
||||||
|
@ -88,7 +87,7 @@ void CWII_IPC_HLE_WiiMote::DoState(PointerWrap& p)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function is usually not called... see CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState
|
// this function is usually not called... see Device::BluetoothEmu::DoState
|
||||||
|
|
||||||
p.Do(m_ConnectionState);
|
p.Do(m_ConnectionState);
|
||||||
|
|
||||||
|
@ -124,7 +123,7 @@ void CWII_IPC_HLE_WiiMote::DoState(PointerWrap& p)
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
bool CWII_IPC_HLE_WiiMote::LinkChannel()
|
bool WiimoteDevice::LinkChannel()
|
||||||
{
|
{
|
||||||
if (m_ConnectionState != CONN_LINKING)
|
if (m_ConnectionState != CONN_LINKING)
|
||||||
return false;
|
return false;
|
||||||
|
@ -173,7 +172,7 @@ bool CWII_IPC_HLE_WiiMote::LinkChannel()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "ConnectionState CONN_LINKING -> CONN_COMPLETE");
|
DEBUG_LOG(IOS_WIIMOTE, "ConnectionState CONN_LINKING -> CONN_COMPLETE");
|
||||||
m_ConnectionState = CONN_COMPLETE;
|
m_ConnectionState = CONN_COMPLETE;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -189,7 +188,7 @@ bool CWII_IPC_HLE_WiiMote::LinkChannel()
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
void CWII_IPC_HLE_WiiMote::Activate(bool ready)
|
void WiimoteDevice::Activate(bool ready)
|
||||||
{
|
{
|
||||||
if (ready && (m_ConnectionState == CONN_INACTIVE))
|
if (ready && (m_ConnectionState == CONN_INACTIVE))
|
||||||
{
|
{
|
||||||
|
@ -202,13 +201,13 @@ void CWII_IPC_HLE_WiiMote::Activate(bool ready)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::EventConnectionAccepted()
|
void WiimoteDevice::EventConnectionAccepted()
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "ConnectionState %x -> CONN_LINKING", m_ConnectionState);
|
DEBUG_LOG(IOS_WIIMOTE, "ConnectionState %x -> CONN_LINKING", m_ConnectionState);
|
||||||
m_ConnectionState = CONN_LINKING;
|
m_ConnectionState = CONN_LINKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::EventDisconnect()
|
void WiimoteDevice::EventDisconnect()
|
||||||
{
|
{
|
||||||
// Send disconnect message to plugin
|
// Send disconnect message to plugin
|
||||||
Wiimote::ControlChannel(m_ConnectionHandle & 0xFF, 99, nullptr, 0);
|
Wiimote::ControlChannel(m_ConnectionHandle & 0xFF, 99, nullptr, 0);
|
||||||
|
@ -218,7 +217,7 @@ void CWII_IPC_HLE_WiiMote::EventDisconnect()
|
||||||
ResetChannels();
|
ResetChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWII_IPC_HLE_WiiMote::EventPagingChanged(u8 _pageMode)
|
bool WiimoteDevice::EventPagingChanged(u8 _pageMode)
|
||||||
{
|
{
|
||||||
if ((m_ConnectionState == CONN_READY) && (_pageMode & HCI_PAGE_SCAN_ENABLE))
|
if ((m_ConnectionState == CONN_READY) && (_pageMode & HCI_PAGE_SCAN_ENABLE))
|
||||||
return true;
|
return true;
|
||||||
|
@ -226,7 +225,7 @@ bool CWII_IPC_HLE_WiiMote::EventPagingChanged(u8 _pageMode)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::ResetChannels()
|
void WiimoteDevice::ResetChannels()
|
||||||
{
|
{
|
||||||
// reset connection process
|
// reset connection process
|
||||||
m_HIDControlChannel_Connected = false;
|
m_HIDControlChannel_Connected = false;
|
||||||
|
@ -251,18 +250,18 @@ void CWII_IPC_HLE_WiiMote::ResetChannels()
|
||||||
//
|
//
|
||||||
|
|
||||||
// This function receives L2CAP commands from the CPU
|
// This function receives L2CAP commands from the CPU
|
||||||
void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size)
|
void WiimoteDevice::ExecuteL2capCmd(u8* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
// parse the command
|
// parse the command
|
||||||
l2cap_hdr_t* pHeader = (l2cap_hdr_t*)_pData;
|
l2cap_hdr_t* pHeader = (l2cap_hdr_t*)_pData;
|
||||||
u8* pData = _pData + sizeof(l2cap_hdr_t);
|
u8* pData = _pData + sizeof(l2cap_hdr_t);
|
||||||
u32 DataSize = _Size - sizeof(l2cap_hdr_t);
|
u32 DataSize = _Size - sizeof(l2cap_hdr_t);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " CID 0x%04x, Len 0x%x, DataSize 0x%x", pHeader->dcid,
|
DEBUG_LOG(IOS_WIIMOTE, " CID 0x%04x, Len 0x%x, DataSize 0x%x", pHeader->dcid, pHeader->length,
|
||||||
pHeader->length, DataSize);
|
DataSize);
|
||||||
|
|
||||||
if (pHeader->length != DataSize)
|
if (pHeader->length != DataSize)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_WIIMOTE, "Faulty packet. It is dropped.");
|
INFO_LOG(IOS_WIIMOTE, "Faulty packet. It is dropped.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +273,7 @@ void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
_dbg_assert_msg_(WII_IPC_WIIMOTE, DoesChannelExist(pHeader->dcid),
|
_dbg_assert_msg_(IOS_WIIMOTE, DoesChannelExist(pHeader->dcid),
|
||||||
"L2CAP: SendACLPacket to unknown channel %i", pHeader->dcid);
|
"L2CAP: SendACLPacket to unknown channel %i", pHeader->dcid);
|
||||||
CChannelMap::iterator itr = m_Channel.find(pHeader->dcid);
|
CChannelMap::iterator itr = m_Channel.find(pHeader->dcid);
|
||||||
|
|
||||||
|
@ -309,8 +308,7 @@ void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "Channel 0x04%x has unknown PSM %x", pHeader->dcid,
|
ERROR_LOG(IOS_WIIMOTE, "Channel 0x04%x has unknown PSM %x", pHeader->dcid, rChannel.PSM);
|
||||||
rChannel.PSM);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,7 +317,7 @@ void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size)
|
void WiimoteDevice::SignalChannel(u8* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
while (_Size >= sizeof(l2cap_cmd_hdr_t))
|
while (_Size >= sizeof(l2cap_cmd_hdr_t))
|
||||||
{
|
{
|
||||||
|
@ -330,7 +328,7 @@ void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size)
|
||||||
switch (cmd_hdr->code)
|
switch (cmd_hdr->code)
|
||||||
{
|
{
|
||||||
case L2CAP_COMMAND_REJ:
|
case L2CAP_COMMAND_REJ:
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "SignalChannel - L2CAP_COMMAND_REJ (something went wrong)."
|
ERROR_LOG(IOS_WIIMOTE, "SignalChannel - L2CAP_COMMAND_REJ (something went wrong)."
|
||||||
"Try to replace your SYSCONF file with a new copy.");
|
"Try to replace your SYSCONF file with a new copy.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -355,7 +353,7 @@ void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, " Unknown Command-Code (0x%02x)", cmd_hdr->code);
|
ERROR_LOG(IOS_WIIMOTE, " Unknown Command-Code (0x%02x)", cmd_hdr->code);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +372,7 @@ void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size)
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::ReceiveConnectionReq(u8 _Ident, u8* _pData, u32 _Size)
|
void WiimoteDevice::ReceiveConnectionReq(u8 _Ident, u8* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
l2cap_con_req_cp* pCommandConnectionReq = (l2cap_con_req_cp*)_pData;
|
l2cap_con_req_cp* pCommandConnectionReq = (l2cap_con_req_cp*)_pData;
|
||||||
|
|
||||||
|
@ -384,11 +382,11 @@ void CWII_IPC_HLE_WiiMote::ReceiveConnectionReq(u8 _Ident, u8* _pData, u32 _Size
|
||||||
rChannel.SCID = pCommandConnectionReq->scid;
|
rChannel.SCID = pCommandConnectionReq->scid;
|
||||||
rChannel.DCID = pCommandConnectionReq->scid;
|
rChannel.DCID = pCommandConnectionReq->scid;
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveConnectionRequest");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] ReceiveConnectionRequest");
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Ident: 0x%02x", _Ident);
|
DEBUG_LOG(IOS_WIIMOTE, " Ident: 0x%02x", _Ident);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " PSM: 0x%04x", rChannel.PSM);
|
DEBUG_LOG(IOS_WIIMOTE, " PSM: 0x%04x", rChannel.PSM);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", rChannel.SCID);
|
DEBUG_LOG(IOS_WIIMOTE, " SCID: 0x%04x", rChannel.SCID);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", rChannel.DCID);
|
DEBUG_LOG(IOS_WIIMOTE, " DCID: 0x%04x", rChannel.DCID);
|
||||||
|
|
||||||
// response
|
// response
|
||||||
l2cap_con_rsp_cp Rsp;
|
l2cap_con_rsp_cp Rsp;
|
||||||
|
@ -397,7 +395,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConnectionReq(u8 _Ident, u8* _pData, u32 _Size
|
||||||
Rsp.result = L2CAP_SUCCESS;
|
Rsp.result = L2CAP_SUCCESS;
|
||||||
Rsp.status = L2CAP_NO_INFO;
|
Rsp.status = L2CAP_NO_INFO;
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConnectionResponse");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] SendConnectionResponse");
|
||||||
SendCommandToACL(_Ident, L2CAP_CONNECT_RSP, sizeof(l2cap_con_rsp_cp), (u8*)&Rsp);
|
SendCommandToACL(_Ident, L2CAP_CONNECT_RSP, sizeof(l2cap_con_rsp_cp), (u8*)&Rsp);
|
||||||
|
|
||||||
// update state machine
|
// update state machine
|
||||||
|
@ -409,21 +407,21 @@ void CWII_IPC_HLE_WiiMote::ReceiveConnectionReq(u8 _Ident, u8* _pData, u32 _Size
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::ReceiveConnectionResponse(u8 _Ident, u8* _pData, u32 _Size)
|
void WiimoteDevice::ReceiveConnectionResponse(u8 _Ident, u8* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
l2cap_con_rsp_cp* rsp = (l2cap_con_rsp_cp*)_pData;
|
l2cap_con_rsp_cp* rsp = (l2cap_con_rsp_cp*)_pData;
|
||||||
|
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, _Size == sizeof(l2cap_con_rsp_cp));
|
_dbg_assert_(IOS_WIIMOTE, _Size == sizeof(l2cap_con_rsp_cp));
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveConnectionResponse");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] ReceiveConnectionResponse");
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", rsp->dcid);
|
DEBUG_LOG(IOS_WIIMOTE, " DCID: 0x%04x", rsp->dcid);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", rsp->scid);
|
DEBUG_LOG(IOS_WIIMOTE, " SCID: 0x%04x", rsp->scid);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Result: 0x%04x", rsp->result);
|
DEBUG_LOG(IOS_WIIMOTE, " Result: 0x%04x", rsp->result);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Status: 0x%04x", rsp->status);
|
DEBUG_LOG(IOS_WIIMOTE, " Status: 0x%04x", rsp->status);
|
||||||
|
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, rsp->result == L2CAP_SUCCESS);
|
_dbg_assert_(IOS_WIIMOTE, rsp->result == L2CAP_SUCCESS);
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, rsp->status == L2CAP_NO_INFO);
|
_dbg_assert_(IOS_WIIMOTE, rsp->status == L2CAP_NO_INFO);
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, DoesChannelExist(rsp->scid));
|
_dbg_assert_(IOS_WIIMOTE, DoesChannelExist(rsp->scid));
|
||||||
|
|
||||||
SChannel& rChannel = m_Channel[rsp->scid];
|
SChannel& rChannel = m_Channel[rsp->scid];
|
||||||
rChannel.DCID = rsp->dcid;
|
rChannel.DCID = rsp->dcid;
|
||||||
|
@ -435,21 +433,21 @@ void CWII_IPC_HLE_WiiMote::ReceiveConnectionResponse(u8 _Ident, u8* _pData, u32
|
||||||
m_HIDInterruptChannel_Connected = true;
|
m_HIDInterruptChannel_Connected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _Size)
|
void WiimoteDevice::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
u32 Offset = 0;
|
u32 Offset = 0;
|
||||||
l2cap_cfg_req_cp* pCommandConfigReq = (l2cap_cfg_req_cp*)_pData;
|
l2cap_cfg_req_cp* pCommandConfigReq = (l2cap_cfg_req_cp*)_pData;
|
||||||
|
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, pCommandConfigReq->flags ==
|
_dbg_assert_(IOS_WIIMOTE, pCommandConfigReq->flags ==
|
||||||
0x00); // 1 means that the options are send in multi-packets
|
0x00); // 1 means that the options are send in multi-packets
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, DoesChannelExist(pCommandConfigReq->dcid));
|
_dbg_assert_(IOS_WIIMOTE, DoesChannelExist(pCommandConfigReq->dcid));
|
||||||
|
|
||||||
SChannel& rChannel = m_Channel[pCommandConfigReq->dcid];
|
SChannel& rChannel = m_Channel[pCommandConfigReq->dcid];
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveConfigurationRequest");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] ReceiveConfigurationRequest");
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Ident: 0x%02x", _Ident);
|
DEBUG_LOG(IOS_WIIMOTE, " Ident: 0x%02x", _Ident);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", pCommandConfigReq->dcid);
|
DEBUG_LOG(IOS_WIIMOTE, " DCID: 0x%04x", pCommandConfigReq->dcid);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Flags: 0x%04x", pCommandConfigReq->flags);
|
DEBUG_LOG(IOS_WIIMOTE, " Flags: 0x%04x", pCommandConfigReq->flags);
|
||||||
|
|
||||||
Offset += sizeof(l2cap_cfg_req_cp);
|
Offset += sizeof(l2cap_cfg_req_cp);
|
||||||
|
|
||||||
|
@ -473,24 +471,24 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _S
|
||||||
{
|
{
|
||||||
case L2CAP_OPT_MTU:
|
case L2CAP_OPT_MTU:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, pOptions->length == L2CAP_OPT_MTU_SIZE);
|
_dbg_assert_(IOS_WIIMOTE, pOptions->length == L2CAP_OPT_MTU_SIZE);
|
||||||
l2cap_cfg_opt_val_t* pMTU = (l2cap_cfg_opt_val_t*)&_pData[Offset];
|
l2cap_cfg_opt_val_t* pMTU = (l2cap_cfg_opt_val_t*)&_pData[Offset];
|
||||||
rChannel.MTU = pMTU->mtu;
|
rChannel.MTU = pMTU->mtu;
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " MTU: 0x%04x", pMTU->mtu);
|
DEBUG_LOG(IOS_WIIMOTE, " MTU: 0x%04x", pMTU->mtu);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L2CAP_OPT_FLUSH_TIMO:
|
case L2CAP_OPT_FLUSH_TIMO:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, pOptions->length == L2CAP_OPT_FLUSH_TIMO_SIZE);
|
_dbg_assert_(IOS_WIIMOTE, pOptions->length == L2CAP_OPT_FLUSH_TIMO_SIZE);
|
||||||
l2cap_cfg_opt_val_t* pFlushTimeOut = (l2cap_cfg_opt_val_t*)&_pData[Offset];
|
l2cap_cfg_opt_val_t* pFlushTimeOut = (l2cap_cfg_opt_val_t*)&_pData[Offset];
|
||||||
rChannel.FlushTimeOut = pFlushTimeOut->flush_timo;
|
rChannel.FlushTimeOut = pFlushTimeOut->flush_timo;
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " FlushTimeOut: 0x%04x", pFlushTimeOut->flush_timo);
|
DEBUG_LOG(IOS_WIIMOTE, " FlushTimeOut: 0x%04x", pFlushTimeOut->flush_timo);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_dbg_assert_msg_(WII_IPC_WIIMOTE, 0, "Unknown Option: 0x%02x", pOptions->type);
|
_dbg_assert_msg_(IOS_WIIMOTE, 0, "Unknown Option: 0x%02x", pOptions->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +499,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _S
|
||||||
RespLen += OptionSize;
|
RespLen += OptionSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConfigurationResponse");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] SendConfigurationResponse");
|
||||||
SendCommandToACL(_Ident, L2CAP_CONFIG_RSP, RespLen, TempBuffer);
|
SendCommandToACL(_Ident, L2CAP_CONFIG_RSP, RespLen, TempBuffer);
|
||||||
|
|
||||||
// update state machine
|
// update state machine
|
||||||
|
@ -511,16 +509,16 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationReq(u8 _Ident, u8* _pData, u32 _S
|
||||||
m_HIDInterruptChannel_Connected = true;
|
m_HIDInterruptChannel_Connected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::ReceiveConfigurationResponse(u8 _Ident, u8* _pData, u32 _Size)
|
void WiimoteDevice::ReceiveConfigurationResponse(u8 _Ident, u8* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
l2cap_cfg_rsp_cp* rsp = (l2cap_cfg_rsp_cp*)_pData;
|
l2cap_cfg_rsp_cp* rsp = (l2cap_cfg_rsp_cp*)_pData;
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveConfigurationResponse");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] ReceiveConfigurationResponse");
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", rsp->scid);
|
DEBUG_LOG(IOS_WIIMOTE, " SCID: 0x%04x", rsp->scid);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Flags: 0x%04x", rsp->flags);
|
DEBUG_LOG(IOS_WIIMOTE, " Flags: 0x%04x", rsp->flags);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Result: 0x%04x", rsp->result);
|
DEBUG_LOG(IOS_WIIMOTE, " Result: 0x%04x", rsp->result);
|
||||||
|
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, rsp->result == L2CAP_SUCCESS);
|
_dbg_assert_(IOS_WIIMOTE, rsp->result == L2CAP_SUCCESS);
|
||||||
|
|
||||||
// update state machine
|
// update state machine
|
||||||
SChannel& rChannel = m_Channel[rsp->scid];
|
SChannel& rChannel = m_Channel[rsp->scid];
|
||||||
|
@ -531,21 +529,21 @@ void CWII_IPC_HLE_WiiMote::ReceiveConfigurationResponse(u8 _Ident, u8* _pData, u
|
||||||
m_HIDInterruptChannel_Config = true;
|
m_HIDInterruptChannel_Config = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::ReceiveDisconnectionReq(u8 _Ident, u8* _pData, u32 _Size)
|
void WiimoteDevice::ReceiveDisconnectionReq(u8 _Ident, u8* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
l2cap_discon_req_cp* pCommandDisconnectionReq = (l2cap_discon_req_cp*)_pData;
|
l2cap_discon_req_cp* pCommandDisconnectionReq = (l2cap_discon_req_cp*)_pData;
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] ReceiveDisconnectionReq");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] ReceiveDisconnectionReq");
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Ident: 0x%02x", _Ident);
|
DEBUG_LOG(IOS_WIIMOTE, " Ident: 0x%02x", _Ident);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " DCID: 0x%04x", pCommandDisconnectionReq->dcid);
|
DEBUG_LOG(IOS_WIIMOTE, " DCID: 0x%04x", pCommandDisconnectionReq->dcid);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " SCID: 0x%04x", pCommandDisconnectionReq->scid);
|
DEBUG_LOG(IOS_WIIMOTE, " SCID: 0x%04x", pCommandDisconnectionReq->scid);
|
||||||
|
|
||||||
// response
|
// response
|
||||||
l2cap_discon_req_cp Rsp;
|
l2cap_discon_req_cp Rsp;
|
||||||
Rsp.dcid = pCommandDisconnectionReq->dcid;
|
Rsp.dcid = pCommandDisconnectionReq->dcid;
|
||||||
Rsp.scid = pCommandDisconnectionReq->scid;
|
Rsp.scid = pCommandDisconnectionReq->scid;
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendDisconnectionResponse");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] SendDisconnectionResponse");
|
||||||
SendCommandToACL(_Ident, L2CAP_DISCONNECT_RSP, sizeof(l2cap_discon_req_cp), (u8*)&Rsp);
|
SendCommandToACL(_Ident, L2CAP_DISCONNECT_RSP, sizeof(l2cap_discon_req_cp), (u8*)&Rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,7 +559,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveDisconnectionReq(u8 _Ident, u8* _pData, u32 _S
|
||||||
//
|
//
|
||||||
|
|
||||||
// We assume Wiimote is always connected
|
// We assume Wiimote is always connected
|
||||||
void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm)
|
void WiimoteDevice::SendConnectionRequest(u16 scid, u16 psm)
|
||||||
{
|
{
|
||||||
// create the channel
|
// create the channel
|
||||||
SChannel& rChannel = m_Channel[scid];
|
SChannel& rChannel = m_Channel[scid];
|
||||||
|
@ -572,15 +570,15 @@ void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm)
|
||||||
cr.psm = psm;
|
cr.psm = psm;
|
||||||
cr.scid = scid;
|
cr.scid = scid;
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConnectionRequest");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] SendConnectionRequest");
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Psm: 0x%04x", cr.psm);
|
DEBUG_LOG(IOS_WIIMOTE, " Psm: 0x%04x", cr.psm);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Scid: 0x%04x", cr.scid);
|
DEBUG_LOG(IOS_WIIMOTE, " Scid: 0x%04x", cr.scid);
|
||||||
|
|
||||||
SendCommandToACL(L2CAP_CONNECT_REQ, L2CAP_CONNECT_REQ, sizeof(l2cap_con_req_cp), (u8*)&cr);
|
SendCommandToACL(L2CAP_CONNECT_REQ, L2CAP_CONNECT_REQ, sizeof(l2cap_con_req_cp), (u8*)&cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't initially disconnect Wiimote though ...
|
// We don't initially disconnect Wiimote though ...
|
||||||
void CWII_IPC_HLE_WiiMote::SendDisconnectRequest(u16 scid)
|
void WiimoteDevice::SendDisconnectRequest(u16 scid)
|
||||||
{
|
{
|
||||||
// create the channel
|
// create the channel
|
||||||
SChannel& rChannel = m_Channel[scid];
|
SChannel& rChannel = m_Channel[scid];
|
||||||
|
@ -589,17 +587,17 @@ void CWII_IPC_HLE_WiiMote::SendDisconnectRequest(u16 scid)
|
||||||
cr.dcid = rChannel.DCID;
|
cr.dcid = rChannel.DCID;
|
||||||
cr.scid = rChannel.SCID;
|
cr.scid = rChannel.SCID;
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendDisconnectionRequest");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] SendDisconnectionRequest");
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Dcid: 0x%04x", cr.dcid);
|
DEBUG_LOG(IOS_WIIMOTE, " Dcid: 0x%04x", cr.dcid);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Scid: 0x%04x", cr.scid);
|
DEBUG_LOG(IOS_WIIMOTE, " Scid: 0x%04x", cr.scid);
|
||||||
|
|
||||||
SendCommandToACL(L2CAP_DISCONNECT_REQ, L2CAP_DISCONNECT_REQ, sizeof(l2cap_discon_req_cp),
|
SendCommandToACL(L2CAP_DISCONNECT_REQ, L2CAP_DISCONNECT_REQ, sizeof(l2cap_discon_req_cp),
|
||||||
(u8*)&cr);
|
(u8*)&cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 FlushTimeOut)
|
void WiimoteDevice::SendConfigurationRequest(u16 scid, u16 MTU, u16 FlushTimeOut)
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, DoesChannelExist(scid));
|
_dbg_assert_(IOS_WIIMOTE, DoesChannelExist(scid));
|
||||||
SChannel& rChannel = m_Channel[scid];
|
SChannel& rChannel = m_Channel[scid];
|
||||||
|
|
||||||
u8 Buffer[1024];
|
u8 Buffer[1024];
|
||||||
|
@ -610,9 +608,9 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
|
||||||
cr->flags = 0;
|
cr->flags = 0;
|
||||||
Offset += sizeof(l2cap_cfg_req_cp);
|
Offset += sizeof(l2cap_cfg_req_cp);
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConfigurationRequest");
|
DEBUG_LOG(IOS_WIIMOTE, "[L2CAP] SendConfigurationRequest");
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Dcid: 0x%04x", cr->dcid);
|
DEBUG_LOG(IOS_WIIMOTE, " Dcid: 0x%04x", cr->dcid);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Flags: 0x%04x", cr->flags);
|
DEBUG_LOG(IOS_WIIMOTE, " Flags: 0x%04x", cr->flags);
|
||||||
|
|
||||||
l2cap_cfg_opt_t* pOptions;
|
l2cap_cfg_opt_t* pOptions;
|
||||||
|
|
||||||
|
@ -630,7 +628,7 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
|
||||||
pOptions->length = L2CAP_OPT_MTU_SIZE;
|
pOptions->length = L2CAP_OPT_MTU_SIZE;
|
||||||
*(u16*)&Buffer[Offset] = MTU;
|
*(u16*)&Buffer[Offset] = MTU;
|
||||||
Offset += L2CAP_OPT_MTU_SIZE;
|
Offset += L2CAP_OPT_MTU_SIZE;
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " MTU: 0x%04x", MTU);
|
DEBUG_LOG(IOS_WIIMOTE, " MTU: 0x%04x", MTU);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FlushTimeOut || rChannel.FlushTimeOut)
|
if (FlushTimeOut || rChannel.FlushTimeOut)
|
||||||
|
@ -643,7 +641,7 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
|
||||||
pOptions->length = L2CAP_OPT_FLUSH_TIMO_SIZE;
|
pOptions->length = L2CAP_OPT_FLUSH_TIMO_SIZE;
|
||||||
*(u16*)&Buffer[Offset] = FlushTimeOut;
|
*(u16*)&Buffer[Offset] = FlushTimeOut;
|
||||||
Offset += L2CAP_OPT_FLUSH_TIMO_SIZE;
|
Offset += L2CAP_OPT_FLUSH_TIMO_SIZE;
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " FlushTimeOut: 0x%04x", FlushTimeOut);
|
DEBUG_LOG(IOS_WIIMOTE, " FlushTimeOut: 0x%04x", FlushTimeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendCommandToACL(L2CAP_CONFIG_REQ, L2CAP_CONFIG_REQ, Offset, Buffer);
|
SendCommandToACL(L2CAP_CONFIG_REQ, L2CAP_CONFIG_REQ, Offset, Buffer);
|
||||||
|
@ -666,19 +664,19 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
|
||||||
#define SDP_SEQ8 0x35
|
#define SDP_SEQ8 0x35
|
||||||
#define SDP_SEQ16 0x36
|
#define SDP_SEQ16 0x36
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::SDPSendServiceSearchResponse(u16 cid, u16 TransactionID,
|
void WiimoteDevice::SDPSendServiceSearchResponse(u16 cid, u16 TransactionID,
|
||||||
u8* pServiceSearchPattern,
|
u8* pServiceSearchPattern,
|
||||||
u16 MaximumServiceRecordCount)
|
u16 MaximumServiceRecordCount)
|
||||||
{
|
{
|
||||||
// verify block... we handle search pattern for HID service only
|
// verify block... we handle search pattern for HID service only
|
||||||
{
|
{
|
||||||
CBigEndianBuffer buffer(pServiceSearchPattern);
|
CBigEndianBuffer buffer(pServiceSearchPattern);
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, buffer.Read8(0) == SDP_SEQ8); // data sequence
|
_dbg_assert_(IOS_WIIMOTE, buffer.Read8(0) == SDP_SEQ8); // data sequence
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, buffer.Read8(1) == 0x03); // sequence size
|
_dbg_assert_(IOS_WIIMOTE, buffer.Read8(1) == 0x03); // sequence size
|
||||||
|
|
||||||
// HIDClassID
|
// HIDClassID
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, buffer.Read8(2) == 0x19);
|
_dbg_assert_(IOS_WIIMOTE, buffer.Read8(2) == 0x19);
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, buffer.Read16(3) == 0x1124);
|
_dbg_assert_(IOS_WIIMOTE, buffer.Read16(3) == 0x1124);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 DataFrame[1000];
|
u8 DataFrame[1000];
|
||||||
|
@ -723,7 +721,7 @@ static u32 ParseCont(u8* pCont)
|
||||||
{
|
{
|
||||||
return 0x00;
|
return 0x00;
|
||||||
}
|
}
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "ParseCont: wrong cont: %i", typeID);
|
ERROR_LOG(IOS_WIIMOTE, "ParseCont: wrong cont: %i", typeID);
|
||||||
PanicAlert("ParseCont: wrong cont: %i", typeID);
|
PanicAlert("ParseCont: wrong cont: %i", typeID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -742,7 +740,7 @@ static int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID)
|
||||||
|
|
||||||
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG)
|
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG)
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, sequence == SDP_SEQ8);
|
_dbg_assert_(IOS_WIIMOTE, sequence == SDP_SEQ8);
|
||||||
(void)seqSize;
|
(void)seqSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,26 +756,25 @@ static int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID)
|
||||||
_startID = attribList.Read16(attribOffset);
|
_startID = attribList.Read16(attribOffset);
|
||||||
attribOffset += 2;
|
attribOffset += 2;
|
||||||
_endID = _startID;
|
_endID = _startID;
|
||||||
WARN_LOG(WII_IPC_WIIMOTE, "Read just a single attrib - not tested");
|
WARN_LOG(IOS_WIIMOTE, "Read just a single attrib - not tested");
|
||||||
PanicAlert("Read just a single attrib - not tested");
|
PanicAlert("Read just a single attrib - not tested");
|
||||||
}
|
}
|
||||||
|
|
||||||
return attribOffset;
|
return attribOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID,
|
void WiimoteDevice::SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID, u32 ServiceHandle,
|
||||||
u32 ServiceHandle, u16 startAttrID,
|
u16 startAttrID, u16 endAttrID,
|
||||||
u16 endAttrID,
|
|
||||||
u16 MaximumAttributeByteCount,
|
u16 MaximumAttributeByteCount,
|
||||||
u8* pContinuationState)
|
u8* pContinuationState)
|
||||||
{
|
{
|
||||||
if (ServiceHandle != 0x10000)
|
if (ServiceHandle != 0x10000)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "Unknown service handle %x", ServiceHandle);
|
ERROR_LOG(IOS_WIIMOTE, "Unknown service handle %x", ServiceHandle);
|
||||||
PanicAlert("Unknown service handle %x", ServiceHandle);
|
PanicAlert("Unknown service handle %x", ServiceHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _dbg_assert_(WII_IPC_WIIMOTE, ServiceHandle == 0x10000);
|
// _dbg_assert_(IOS_WIIMOTE, ServiceHandle == 0x10000);
|
||||||
|
|
||||||
u32 contState = ParseCont(pContinuationState);
|
u32 contState = ParseCont(pContinuationState);
|
||||||
|
|
||||||
|
@ -808,7 +805,7 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 Transact
|
||||||
// "test response: ");
|
// "test response: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size)
|
void WiimoteDevice::HandleSDP(u16 cid, u8* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
// Debugger::PrintDataBuffer(LogTypes::WIIMOTE, _pData, _Size, "HandleSDP: ");
|
// Debugger::PrintDataBuffer(LogTypes::WIIMOTE, _pData, _Size, "HandleSDP: ");
|
||||||
|
|
||||||
|
@ -819,9 +816,9 @@ void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size)
|
||||||
// SDP_ServiceSearchRequest
|
// SDP_ServiceSearchRequest
|
||||||
case 0x02:
|
case 0x02:
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_WIIMOTE, "!!! SDP_ServiceSearchRequest !!!");
|
WARN_LOG(IOS_WIIMOTE, "!!! SDP_ServiceSearchRequest !!!");
|
||||||
|
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, _Size == 13);
|
_dbg_assert_(IOS_WIIMOTE, _Size == 13);
|
||||||
|
|
||||||
u16 TransactionID = buffer.Read16(1);
|
u16 TransactionID = buffer.Read16(1);
|
||||||
u8* pServiceSearchPattern = buffer.GetPointer(5);
|
u8* pServiceSearchPattern = buffer.GetPointer(5);
|
||||||
|
@ -835,7 +832,7 @@ void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size)
|
||||||
// SDP_ServiceAttributeRequest
|
// SDP_ServiceAttributeRequest
|
||||||
case 0x04:
|
case 0x04:
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_WIIMOTE, "!!! SDP_ServiceAttributeRequest !!!");
|
WARN_LOG(IOS_WIIMOTE, "!!! SDP_ServiceAttributeRequest !!!");
|
||||||
|
|
||||||
u16 startAttrID, endAttrID;
|
u16 startAttrID, endAttrID;
|
||||||
u32 offset = 1;
|
u32 offset = 1;
|
||||||
|
@ -857,7 +854,7 @@ void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "WIIMOTE: Unknown SDP command %x", _pData[0]);
|
ERROR_LOG(IOS_WIIMOTE, "WIIMOTE: Unknown SDP command %x", _pData[0]);
|
||||||
PanicAlert("WIIMOTE: Unknown SDP command %x", _pData[0]);
|
PanicAlert("WIIMOTE: Unknown SDP command %x", _pData[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -874,8 +871,7 @@ void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size)
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLength,
|
void WiimoteDevice::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLength, u8* _pCommandData)
|
||||||
u8* _pCommandData)
|
|
||||||
{
|
{
|
||||||
u8 DataFrame[1024];
|
u8 DataFrame[1024];
|
||||||
u32 Offset = 0;
|
u32 Offset = 0;
|
||||||
|
@ -893,9 +889,9 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng
|
||||||
|
|
||||||
memcpy(&DataFrame[Offset], _pCommandData, _CommandLength);
|
memcpy(&DataFrame[Offset], _pCommandData, _CommandLength);
|
||||||
|
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, "Send ACL Command to CPU");
|
DEBUG_LOG(IOS_WIIMOTE, "Send ACL Command to CPU");
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Ident: 0x%02x", _Ident);
|
DEBUG_LOG(IOS_WIIMOTE, " Ident: 0x%02x", _Ident);
|
||||||
DEBUG_LOG(WII_IPC_WIIMOTE, " Code: 0x%02x", _Code);
|
DEBUG_LOG(IOS_WIIMOTE, " Code: 0x%02x", _Code);
|
||||||
|
|
||||||
// send ....
|
// send ....
|
||||||
m_pHost->SendACLPacket(GetConnectionHandle(), DataFrame, pHeader->length + sizeof(l2cap_hdr_t));
|
m_pHost->SendACLPacket(GetConnectionHandle(), DataFrame, pHeader->length + sizeof(l2cap_hdr_t));
|
||||||
|
@ -904,7 +900,7 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng
|
||||||
// "m_pHost->SendACLPacket: ");
|
// "m_pHost->SendACLPacket: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::ReceiveL2capData(u16 scid, const void* _pData, u32 _Size)
|
void WiimoteDevice::ReceiveL2capData(u16 scid, const void* _pData, u32 _Size)
|
||||||
{
|
{
|
||||||
// Allocate DataFrame
|
// Allocate DataFrame
|
||||||
u8 DataFrame[1024];
|
u8 DataFrame[1024];
|
||||||
|
@ -913,7 +909,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveL2capData(u16 scid, const void* _pData, u32 _S
|
||||||
Offset += sizeof(l2cap_hdr_t);
|
Offset += sizeof(l2cap_hdr_t);
|
||||||
|
|
||||||
// Check if we are already reporting on this channel
|
// Check if we are already reporting on this channel
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, DoesChannelExist(scid));
|
_dbg_assert_(IOS_WIIMOTE, DoesChannelExist(scid));
|
||||||
SChannel& rChannel = m_Channel[scid];
|
SChannel& rChannel = m_Channel[scid];
|
||||||
|
|
||||||
// Add an additional 4 byte header to the Wiimote report
|
// Add an additional 4 byte header to the Wiimote report
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "Common/CommonFuncs.h"
|
#include "Common/CommonFuncs.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/hci.h"
|
#include "Core/IOS/USB/Bluetooth/hci.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
|
@ -18,10 +18,13 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
class CWII_IPC_HLE_Device_usb_oh1_57e_305_emu;
|
namespace Device
|
||||||
|
{
|
||||||
|
class BluetoothEmu;
|
||||||
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* GetUsbPointer();
|
Device::BluetoothEmu* GetUsbPointer();
|
||||||
void SetUsbPointer(CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* ptr);
|
void SetUsbPointer(Device::BluetoothEmu* ptr);
|
||||||
|
|
||||||
class CBigEndianBuffer
|
class CBigEndianBuffer
|
||||||
{
|
{
|
||||||
|
@ -38,13 +41,11 @@ private:
|
||||||
u8* m_pBuffer;
|
u8* m_pBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWII_IPC_HLE_WiiMote
|
class WiimoteDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* _pHost, int _Number, bdaddr_t _BD,
|
WiimoteDevice(Device::BluetoothEmu* _pHost, int _Number, bdaddr_t _BD, bool ready = false);
|
||||||
bool ready = false);
|
|
||||||
|
|
||||||
virtual ~CWII_IPC_HLE_WiiMote() {}
|
|
||||||
void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
|
|
||||||
// ugly Host handling....
|
// ugly Host handling....
|
||||||
|
@ -99,7 +100,7 @@ private:
|
||||||
u16 lmp_subversion;
|
u16 lmp_subversion;
|
||||||
u8 m_LinkKey[HCI_KEY_SIZE];
|
u8 m_LinkKey[HCI_KEY_SIZE];
|
||||||
std::string m_Name;
|
std::string m_Name;
|
||||||
CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* m_pHost;
|
Device::BluetoothEmu* m_pHost;
|
||||||
|
|
||||||
struct SChannel
|
struct SChannel
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/IPC_HLE/WiiMote_HID_Attr.h"
|
#include "Core/IOS/USB/Bluetooth/WiimoteHIDAttr.h"
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size)
|
||||||
|
|
||||||
if (serviceHandle == 0x10001)
|
if (serviceHandle == 0x10001)
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_WIIMOTE, cont == 0x00);
|
_dbg_assert_(IOS_WIIMOTE, cont == 0x00);
|
||||||
_size = sizeof(packet4_0x10001);
|
_size = sizeof(packet4_0x10001);
|
||||||
return packet4_0x10001;
|
return packet4_0x10001;
|
||||||
}
|
}
|
|
@ -17,18 +17,20 @@
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/Debugger/Debugger_SymbolMap.h"
|
#include "Core/Debugger/Debugger_SymbolMap.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_hid.h"
|
#include "Core/IOS/USB/USB_HIDv4.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
#define MAX_DEVICE_DEVNUM 256
|
namespace Device
|
||||||
|
{
|
||||||
|
constexpr int MAX_DEVICE_DEVNUM = 256;
|
||||||
static u64 hidDeviceAliases[MAX_DEVICE_DEVNUM];
|
static u64 hidDeviceAliases[MAX_DEVICE_DEVNUM];
|
||||||
|
|
||||||
// Regular thread
|
// Regular thread
|
||||||
void CWII_IPC_HLE_Device_hid::checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid)
|
void USB_HIDv4::checkUsbUpdates(USB_HIDv4* hid)
|
||||||
{
|
{
|
||||||
timeval tv;
|
timeval tv;
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
|
@ -54,7 +56,7 @@ void CWII_IPC_HLE_Device_hid::checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_hid::handleUsbUpdates(struct libusb_transfer* transfer)
|
void USB_HIDv4::handleUsbUpdates(struct libusb_transfer* transfer)
|
||||||
{
|
{
|
||||||
s32 ret = IPC_EINVAL;
|
s32 ret = IPC_EINVAL;
|
||||||
u32 replyAddress = (u32)(size_t)transfer->user_data;
|
u32 replyAddress = (u32)(size_t)transfer->user_data;
|
||||||
|
@ -67,15 +69,14 @@ void CWII_IPC_HLE_Device_hid::handleUsbUpdates(struct libusb_transfer* transfer)
|
||||||
EnqueueReply(request, ret, 0, CoreTiming::FromThread::NON_CPU);
|
EnqueueReply(request, ret, 0, CoreTiming::FromThread::NON_CPU);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_hid::CWII_IPC_HLE_Device_hid(u32 _DeviceID, const std::string& _rDeviceName)
|
USB_HIDv4::USB_HIDv4(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
|
||||||
{
|
{
|
||||||
deviceCommandAddress = 0;
|
deviceCommandAddress = 0;
|
||||||
memset(hidDeviceAliases, 0, sizeof(hidDeviceAliases));
|
memset(hidDeviceAliases, 0, sizeof(hidDeviceAliases));
|
||||||
int ret = libusb_init(nullptr);
|
int ret = libusb_init(nullptr);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HID, "libusb_init failed with error: %d", ret);
|
ERROR_LOG(IOS_HID, "libusb_init failed with error: %d", ret);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -84,7 +85,7 @@ CWII_IPC_HLE_Device_hid::CWII_IPC_HLE_Device_hid(u32 _DeviceID, const std::strin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_hid::~CWII_IPC_HLE_Device_hid()
|
USB_HIDv4::~USB_HIDv4()
|
||||||
{
|
{
|
||||||
bool deinit_libusb = false;
|
bool deinit_libusb = false;
|
||||||
if (usb_thread_running)
|
if (usb_thread_running)
|
||||||
|
@ -104,7 +105,7 @@ CWII_IPC_HLE_Device_hid::~CWII_IPC_HLE_Device_hid()
|
||||||
libusb_exit(nullptr);
|
libusb_exit(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult USB_HIDv4::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
if (Core::g_want_determinism)
|
if (Core::g_want_determinism)
|
||||||
{
|
{
|
||||||
|
@ -157,7 +158,7 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(const IOSIOCtlRequest& request)
|
||||||
|
|
||||||
if (dev_handle == nullptr)
|
if (dev_handle == nullptr)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_HID, "Could not find handle: %X", dev_num);
|
INFO_LOG(IOS_HID, "Could not find handle: %X", dev_num);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
struct libusb_transfer* transfer = libusb_alloc_transfer(0);
|
struct libusb_transfer* transfer = libusb_alloc_transfer(0);
|
||||||
|
@ -170,7 +171,7 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(const IOSIOCtlRequest& request)
|
||||||
(void*)(size_t)request.address, /* no timeout */ 0);
|
(void*)(size_t)request.address, /* no timeout */ 0);
|
||||||
libusb_submit_transfer(transfer);
|
libusb_submit_transfer(transfer);
|
||||||
|
|
||||||
// DEBUG_LOG(WII_IPC_HID, "HID::IOCtl(Control)(%02X, %02X) (BufferIn: (%08x, %i),
|
// DEBUG_LOG(IOS_HID, "HID::IOCtl(Control)(%02X, %02X) (BufferIn: (%08x, %i),
|
||||||
// request.buffer_out:
|
// request.buffer_out:
|
||||||
// (%08x, %i)",
|
// (%08x, %i)",
|
||||||
// bmRequestType, bRequest, BufferIn, request.buffer_in_size, request.buffer_out,
|
// bmRequestType, bRequest, BufferIn, request.buffer_in_size, request.buffer_out,
|
||||||
|
@ -194,7 +195,7 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(const IOSIOCtlRequest& request)
|
||||||
|
|
||||||
if (dev_handle == nullptr)
|
if (dev_handle == nullptr)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_HID, "Could not find handle: %X", dev_num);
|
INFO_LOG(IOS_HID, "Could not find handle: %X", dev_num);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,52 +218,52 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(const IOSIOCtlRequest& request)
|
||||||
EnqueueReply(pending_request, -1);
|
EnqueueReply(pending_request, -1);
|
||||||
deviceCommandAddress = 0;
|
deviceCommandAddress = 0;
|
||||||
}
|
}
|
||||||
INFO_LOG(WII_IPC_HID, "HID::IOCtl(Shutdown) (BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
|
INFO_LOG(IOS_HID, "HID::IOCtl(Shutdown) (BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
|
||||||
request.buffer_in, request.buffer_in_size, request.buffer_out,
|
request.buffer_in, request.buffer_in_size, request.buffer_out,
|
||||||
request.buffer_out_size);
|
request.buffer_out_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_HID);
|
request.Log(GetDeviceName(), LogTypes::IOS_HID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDefaultReply(return_value);
|
return GetDefaultReply(return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWII_IPC_HLE_Device_hid::ClaimDevice(libusb_device_handle* dev)
|
bool USB_HIDv4::ClaimDevice(libusb_device_handle* dev)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if ((ret = libusb_kernel_driver_active(dev, 0)) == 1)
|
if ((ret = libusb_kernel_driver_active(dev, 0)) == 1)
|
||||||
{
|
{
|
||||||
if ((ret = libusb_detach_kernel_driver(dev, 0)) && ret != LIBUSB_ERROR_NOT_SUPPORTED)
|
if ((ret = libusb_detach_kernel_driver(dev, 0)) && ret != LIBUSB_ERROR_NOT_SUPPORTED)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HID, "libusb_detach_kernel_driver failed with error: %d", ret);
|
ERROR_LOG(IOS_HID, "libusb_detach_kernel_driver failed with error: %d", ret);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED)
|
else if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HID, "libusb_kernel_driver_active error ret = %d", ret);
|
ERROR_LOG(IOS_HID, "libusb_kernel_driver_active error ret = %d", ret);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = libusb_claim_interface(dev, 0)))
|
if ((ret = libusb_claim_interface(dev, 0)))
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HID, "libusb_claim_interface failed with error: %d", ret);
|
ERROR_LOG(IOS_HID, "libusb_claim_interface failed with error: %d", ret);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtlV(const IOSIOCtlVRequest& request)
|
IPCCommandResult USB_HIDv4::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
Dolphin_Debugger::PrintCallstack(LogTypes::WII_IPC_HID, LogTypes::LWARNING);
|
Dolphin_Debugger::PrintCallstack(LogTypes::IOS_HID, LogTypes::LWARNING);
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_HID);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_HID);
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_hid::ConvertDeviceToWii(WiiHIDDeviceDescriptor* dest,
|
void USB_HIDv4::ConvertDeviceToWii(WiiHIDDeviceDescriptor* dest,
|
||||||
const struct libusb_device_descriptor* src)
|
const struct libusb_device_descriptor* src)
|
||||||
{
|
{
|
||||||
dest->bLength = src->bLength;
|
dest->bLength = src->bLength;
|
||||||
|
@ -281,27 +282,27 @@ void CWII_IPC_HLE_Device_hid::ConvertDeviceToWii(WiiHIDDeviceDescriptor* dest,
|
||||||
dest->bNumConfigurations = src->bNumConfigurations;
|
dest->bNumConfigurations = src->bNumConfigurations;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_hid::ConvertConfigToWii(WiiHIDConfigDescriptor* dest,
|
void USB_HIDv4::ConvertConfigToWii(WiiHIDConfigDescriptor* dest,
|
||||||
const struct libusb_config_descriptor* src)
|
const struct libusb_config_descriptor* src)
|
||||||
{
|
{
|
||||||
memcpy(dest, src, sizeof(WiiHIDConfigDescriptor));
|
memcpy(dest, src, sizeof(WiiHIDConfigDescriptor));
|
||||||
dest->wTotalLength = Common::swap16(dest->wTotalLength);
|
dest->wTotalLength = Common::swap16(dest->wTotalLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_hid::ConvertInterfaceToWii(WiiHIDInterfaceDescriptor* dest,
|
void USB_HIDv4::ConvertInterfaceToWii(WiiHIDInterfaceDescriptor* dest,
|
||||||
const struct libusb_interface_descriptor* src)
|
const struct libusb_interface_descriptor* src)
|
||||||
{
|
{
|
||||||
memcpy(dest, src, sizeof(WiiHIDInterfaceDescriptor));
|
memcpy(dest, src, sizeof(WiiHIDInterfaceDescriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_hid::ConvertEndpointToWii(WiiHIDEndpointDescriptor* dest,
|
void USB_HIDv4::ConvertEndpointToWii(WiiHIDEndpointDescriptor* dest,
|
||||||
const struct libusb_endpoint_descriptor* src)
|
const struct libusb_endpoint_descriptor* src)
|
||||||
{
|
{
|
||||||
memcpy(dest, src, sizeof(WiiHIDEndpointDescriptor));
|
memcpy(dest, src, sizeof(WiiHIDEndpointDescriptor));
|
||||||
dest->wMaxPacketSize = Common::swap16(dest->wMaxPacketSize);
|
dest->wMaxPacketSize = Common::swap16(dest->wMaxPacketSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_hid::FillOutDevices(const IOSIOCtlRequest& request)
|
void USB_HIDv4::FillOutDevices(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
static u16 check = 1;
|
static u16 check = 1;
|
||||||
int OffsetBuffer = request.buffer_out;
|
int OffsetBuffer = request.buffer_out;
|
||||||
|
@ -312,7 +313,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(const IOSIOCtlRequest& request)
|
||||||
libusb_device** list;
|
libusb_device** list;
|
||||||
// libusb_device *found = nullptr;
|
// libusb_device *found = nullptr;
|
||||||
ssize_t cnt = libusb_get_device_list(nullptr, &list);
|
ssize_t cnt = libusb_get_device_list(nullptr, &list);
|
||||||
INFO_LOG(WII_IPC_HID, "Found %ld viable USB devices.", cnt);
|
INFO_LOG(IOS_HID, "Found %ld viable USB devices.", cnt);
|
||||||
for (d = 0; d < cnt; d++)
|
for (d = 0; d < cnt; d++)
|
||||||
{
|
{
|
||||||
libusb_device* device = list[d];
|
libusb_device* device = list[d];
|
||||||
|
@ -321,7 +322,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(const IOSIOCtlRequest& request)
|
||||||
if (dRet)
|
if (dRet)
|
||||||
{
|
{
|
||||||
// could not aquire the descriptor, no point in trying to use it.
|
// could not aquire the descriptor, no point in trying to use it.
|
||||||
WARN_LOG(WII_IPC_HID, "libusb_get_device_descriptor failed with error: %d", dRet);
|
WARN_LOG(IOS_HID, "libusb_get_device_descriptor failed with error: %d", dRet);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
OffsetStart = OffsetBuffer;
|
OffsetStart = OffsetBuffer;
|
||||||
|
@ -383,7 +384,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(const IOSIOCtlRequest& request)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (cRet)
|
if (cRet)
|
||||||
WARN_LOG(WII_IPC_HID, "libusb_get_config_descriptor failed with: %d", cRet);
|
WARN_LOG(IOS_HID, "libusb_get_config_descriptor failed with: %d", cRet);
|
||||||
deviceValid = false;
|
deviceValid = false;
|
||||||
OffsetBuffer = OffsetStart;
|
OffsetBuffer = OffsetStart;
|
||||||
}
|
}
|
||||||
|
@ -404,13 +405,12 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(const IOSIOCtlRequest& request)
|
||||||
if (devNum < 0)
|
if (devNum < 0)
|
||||||
{
|
{
|
||||||
// too many devices to handle.
|
// too many devices to handle.
|
||||||
ERROR_LOG(WII_IPC_HID,
|
ERROR_LOG(IOS_HID, "Exhausted device list, there are way too many usb devices plugged in.");
|
||||||
"Exhausted device list, there are way too many usb devices plugged in.");
|
|
||||||
OffsetBuffer = OffsetStart;
|
OffsetBuffer = OffsetStart;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_HID, "Found device with Vendor: %X Product: %X Devnum: %d", desc.idVendor,
|
INFO_LOG(IOS_HID, "Found device with Vendor: %X Product: %X Devnum: %d", desc.idVendor,
|
||||||
desc.idProduct, devNum);
|
desc.idProduct, devNum);
|
||||||
|
|
||||||
Memory::Write_U32(devNum, OffsetStart + 4); // write device num
|
Memory::Write_U32(devNum, OffsetStart + 4); // write device num
|
||||||
|
@ -423,7 +423,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(const IOSIOCtlRequest& request)
|
||||||
u16 check_cur = (u16)(hidDeviceAliases[i] >> 48);
|
u16 check_cur = (u16)(hidDeviceAliases[i] >> 48);
|
||||||
if (hidDeviceAliases[i] != 0 && check_cur != check)
|
if (hidDeviceAliases[i] != 0 && check_cur != check)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_HID, "Removing: device %d %hX %hX", i, check, check_cur);
|
INFO_LOG(IOS_HID, "Removing: device %d %hX %hX", i, check, check_cur);
|
||||||
std::lock_guard<std::mutex> lk(m_open_devices_mutex);
|
std::lock_guard<std::mutex> lk(m_open_devices_mutex);
|
||||||
if (m_open_devices.find(i) != m_open_devices.end())
|
if (m_open_devices.find(i) != m_open_devices.end())
|
||||||
{
|
{
|
||||||
|
@ -441,7 +441,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(const IOSIOCtlRequest& request)
|
||||||
Memory::Write_U32(0xFFFFFFFF, OffsetBuffer); // no more devices
|
Memory::Write_U32(0xFFFFFFFF, OffsetBuffer); // no more devices
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_device_handle* CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
libusb_device_handle* USB_HIDv4::GetDeviceByDevNum(u32 devNum)
|
||||||
{
|
{
|
||||||
libusb_device** list;
|
libusb_device** list;
|
||||||
libusb_device_handle* handle = nullptr;
|
libusb_device_handle* handle = nullptr;
|
||||||
|
@ -493,14 +493,14 @@ libusb_device_handle* CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
||||||
{
|
{
|
||||||
if (dRet)
|
if (dRet)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HID, "Dolphin does not have access to this device: Bus %03d Device "
|
ERROR_LOG(IOS_HID, "Dolphin does not have access to this device: Bus %03d Device "
|
||||||
"%03d: ID ????:???? (couldn't get id).",
|
"%03d: ID ????:???? (couldn't get id).",
|
||||||
bus, port);
|
bus, port);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(
|
ERROR_LOG(
|
||||||
WII_IPC_HID,
|
IOS_HID,
|
||||||
"Dolphin does not have access to this device: Bus %03d Device %03d: ID %04X:%04X.",
|
"Dolphin does not have access to this device: Bus %03d Device %03d: ID %04X:%04X.",
|
||||||
bus, port, desc.idVendor, desc.idProduct);
|
bus, port, desc.idVendor, desc.idProduct);
|
||||||
}
|
}
|
||||||
|
@ -512,21 +512,21 @@ libusb_device_handle* CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
||||||
{
|
{
|
||||||
// Max of one warning.
|
// Max of one warning.
|
||||||
has_warned_about_drivers = true;
|
has_warned_about_drivers = true;
|
||||||
WARN_LOG(WII_IPC_HID, "Please install the libusb drivers for the device %04X:%04X",
|
WARN_LOG(IOS_HID, "Please install the libusb drivers for the device %04X:%04X",
|
||||||
desc.idVendor, desc.idProduct);
|
desc.idVendor, desc.idProduct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HID, "libusb_open failed to open device with error = %d", ret);
|
ERROR_LOG(IOS_HID, "libusb_open failed to open device with error = %d", ret);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ClaimDevice(handle))
|
if (!ClaimDevice(handle))
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HID, "Could not claim the device for handle: %X", devNum);
|
ERROR_LOG(IOS_HID, "Could not claim the device for handle: %X", devNum);
|
||||||
libusb_close(handle);
|
libusb_close(handle);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -545,8 +545,7 @@ libusb_device_handle* CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CWII_IPC_HLE_Device_hid::GetAvailableDevNum(u16 idVendor, u16 idProduct, u8 bus, u8 port,
|
int USB_HIDv4::GetAvailableDevNum(u16 idVendor, u16 idProduct, u8 bus, u8 port, u16 check)
|
||||||
u16 check)
|
|
||||||
{
|
{
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
u64 unique_id = ((u64)idVendor << 32) | ((u64)idProduct << 16) | ((u64)bus << 8) | (u64)port;
|
u64 unique_id = ((u64)idVendor << 32) | ((u64)idProduct << 16) | ((u64)bus << 8) | (u64)port;
|
||||||
|
@ -573,5 +572,6 @@ int CWII_IPC_HLE_Device_hid::GetAvailableDevNum(u16 idVendor, u16 idProduct, u8
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -11,8 +11,8 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
// Forward declare things which we need from libusb header.
|
// Forward declare things which we need from libusb header.
|
||||||
// This prevents users of this file from indirectly pulling in libusb.
|
// This prevents users of this file from indirectly pulling in libusb.
|
||||||
|
@ -35,12 +35,14 @@ namespace HLE
|
||||||
#define HID_ID_MASK 0x0000FFFFFFFFFFFF
|
#define HID_ID_MASK 0x0000FFFFFFFFFFFF
|
||||||
#define MAX_HID_INTERFACES 1
|
#define MAX_HID_INTERFACES 1
|
||||||
|
|
||||||
class CWII_IPC_HLE_Device_hid : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class USB_HIDv4 : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_hid(u32 _DeviceID, const std::string& _rDeviceName);
|
USB_HIDv4(u32 _DeviceID, const std::string& _rDeviceName);
|
||||||
|
|
||||||
virtual ~CWII_IPC_HLE_Device_hid();
|
virtual ~USB_HIDv4();
|
||||||
|
|
||||||
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
|
@ -129,7 +131,7 @@ private:
|
||||||
const libusb_interface_descriptor* src);
|
const libusb_interface_descriptor* src);
|
||||||
void ConvertEndpointToWii(WiiHIDEndpointDescriptor* dest, const libusb_endpoint_descriptor* src);
|
void ConvertEndpointToWii(WiiHIDEndpointDescriptor* dest, const libusb_endpoint_descriptor* src);
|
||||||
|
|
||||||
static void checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid);
|
static void checkUsbUpdates(USB_HIDv4* hid);
|
||||||
static void LIBUSB_CALL handleUsbUpdates(libusb_transfer* transfer);
|
static void LIBUSB_CALL handleUsbUpdates(libusb_transfer* transfer);
|
||||||
|
|
||||||
libusb_device_handle* GetDeviceByDevNum(u32 devNum);
|
libusb_device_handle* GetDeviceByDevNum(u32 devNum);
|
||||||
|
@ -140,5 +142,6 @@ private:
|
||||||
std::thread usb_thread;
|
std::thread usb_thread;
|
||||||
bool usb_thread_running;
|
bool usb_thread_running;
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -11,7 +11,7 @@
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h" // Local core functions
|
#include "Core/Core.h" // Local core functions
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.h"
|
#include "Core/IOS/USB/USB_KBD.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -21,7 +21,9 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
CWII_IPC_HLE_Device_usb_kbd::SMessageData::SMessageData(u32 type, u8 modifiers, u8* pressed_keys)
|
namespace Device
|
||||||
|
{
|
||||||
|
USB_KBD::SMessageData::SMessageData(u32 type, u8 modifiers, u8* pressed_keys)
|
||||||
{
|
{
|
||||||
MsgType = Common::swap32(type);
|
MsgType = Common::swap32(type);
|
||||||
Unk1 = 0; // swapped
|
Unk1 = 0; // swapped
|
||||||
|
@ -36,15 +38,13 @@ CWII_IPC_HLE_Device_usb_kbd::SMessageData::SMessageData(u32 type, u8 modifiers,
|
||||||
|
|
||||||
// TODO: support in netplay/movies.
|
// TODO: support in netplay/movies.
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_kbd::CWII_IPC_HLE_Device_usb_kbd(u32 _DeviceID,
|
USB_KBD::USB_KBD(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
const std::string& _rDeviceName)
|
|
||||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
IOSReturnCode CWII_IPC_HLE_Device_usb_kbd::Open(const IOSOpenRequest& request)
|
IOSReturnCode USB_KBD::Open(const IOSOpenRequest& request)
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_HLE, "CWII_IPC_HLE_Device_usb_kbd: Open");
|
INFO_LOG(IOS, "USB_KBD: Open");
|
||||||
IniFile ini;
|
IniFile ini;
|
||||||
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||||
ini.GetOrCreateSection("USB Keyboard")->Get("Layout", &m_KeyboardLayout, KBD_LAYOUT_QWERTY);
|
ini.GetOrCreateSection("USB Keyboard")->Get("Layout", &m_KeyboardLayout, KBD_LAYOUT_QWERTY);
|
||||||
|
@ -62,7 +62,7 @@ IOSReturnCode CWII_IPC_HLE_Device_usb_kbd::Open(const IOSOpenRequest& request)
|
||||||
return IPC_SUCCESS;
|
return IPC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_usb_kbd::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult USB_KBD::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().m_WiiKeyboard && !Core::g_want_determinism && !m_MessageQueue.empty())
|
if (SConfig::GetInstance().m_WiiKeyboard && !Core::g_want_determinism && !m_MessageQueue.empty())
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_kbd::IOCtl(const IOSIOCtlRequest& reque
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
return GetDefaultReply(IPC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWII_IPC_HLE_Device_usb_kbd::IsKeyPressed(int _Key)
|
bool USB_KBD::IsKeyPressed(int _Key)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (GetAsyncKeyState(_Key) & 0x8000)
|
if (GetAsyncKeyState(_Key) & 0x8000)
|
||||||
|
@ -85,7 +85,7 @@ bool CWII_IPC_HLE_Device_usb_kbd::IsKeyPressed(int _Key)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_kbd::Update()
|
void USB_KBD::Update()
|
||||||
{
|
{
|
||||||
if (!SConfig::GetInstance().m_WiiKeyboard || Core::g_want_determinism || !m_is_active)
|
if (!SConfig::GetInstance().m_WiiKeyboard || Core::g_want_determinism || !m_is_active)
|
||||||
return;
|
return;
|
||||||
|
@ -165,7 +165,7 @@ void CWII_IPC_HLE_Device_usb_kbd::Update()
|
||||||
|
|
||||||
// Crazy ugly
|
// Crazy ugly
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesQWERTY[256] = {
|
u8 USB_KBD::m_KeyCodesQWERTY[256] = {
|
||||||
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x2A, // Backspace
|
0x2A, // Backspace
|
||||||
|
@ -239,7 +239,7 @@ u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesQWERTY[256] = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesAZERTY[256] = {
|
u8 USB_KBD::m_KeyCodesAZERTY[256] = {
|
||||||
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x2A, // Backspace
|
0x2A, // Backspace
|
||||||
|
@ -313,9 +313,10 @@ u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesAZERTY[256] = {
|
||||||
|
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesQWERTY[256] = {0};
|
u8 USB_KBD::m_KeyCodesQWERTY[256] = {0};
|
||||||
|
|
||||||
u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesAZERTY[256] = {0};
|
u8 USB_KBD::m_KeyCodesAZERTY[256] = {0};
|
||||||
#endif
|
#endif
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -8,17 +8,19 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
class CWII_IPC_HLE_Device_usb_kbd : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class USB_KBD : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_usb_kbd(u32 _DeviceID, const std::string& _rDeviceName);
|
USB_KBD(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
IOSReturnCode Open(const IOSOpenRequest& request) override;
|
IOSReturnCode Open(const IOSOpenRequest& request) override;
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
|
@ -61,5 +63,6 @@ private:
|
||||||
static u8 m_KeyCodesQWERTY[256];
|
static u8 m_KeyCodesQWERTY[256];
|
||||||
static u8 m_KeyCodesAZERTY[256];
|
static u8 m_KeyCodesAZERTY[256];
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_ven.h"
|
#include "Core/IOS/USB/USB_VEN.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
|
|
||||||
|
@ -10,19 +10,19 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
CWII_IPC_HLE_Device_usb_ven::CWII_IPC_HLE_Device_usb_ven(const u32 device_id,
|
namespace Device
|
||||||
const std::string& device_name)
|
{
|
||||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
USB_VEN::USB_VEN(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtlV(const IOSIOCtlVRequest& request)
|
IPCCommandResult USB_VEN::IOCtlV(const IOSIOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
request.Dump(GetDeviceName());
|
request.Dump(GetDeviceName());
|
||||||
return GetNoReply();
|
return GetNoReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult USB_VEN::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
request.Log(GetDeviceName(), LogTypes::OSHLE);
|
request.Log(GetDeviceName(), LogTypes::OSHLE);
|
||||||
|
|
||||||
|
@ -78,5 +78,6 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtl(const IOSIOCtlRequest& reque
|
||||||
}
|
}
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -7,17 +7,19 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
{
|
{
|
||||||
class CWII_IPC_HLE_Device_usb_ven final : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class USB_VEN final : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_usb_ven(u32 device_id, const std::string& device_name);
|
USB_VEN(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
IPCCommandResult IOCtlV(const IOSIOCtlVRequest& request) override;
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
|
@ -39,5 +41,6 @@ private:
|
||||||
USBV5_IOCTL_BULKMSG = 21
|
USBV5_IOCTL_BULKMSG = 21
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_wfsi.h"
|
#include "Core/IOS/WFS/WFSI.h"
|
||||||
|
|
||||||
#include <mbedtls/aes.h>
|
#include <mbedtls/aes.h>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
@ -14,8 +14,8 @@
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/IPC_HLE/ESFormats.h"
|
#include "Core/IOS/ES/Formats.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_wfssrv.h"
|
#include "Core/IOS/WFS/WFSSRV.h"
|
||||||
#include "DiscIO/NANDContentLoader.h"
|
#include "DiscIO/NANDContentLoader.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
|
@ -37,7 +37,7 @@ void ARCUnpacker::Extract(const WriteCallback& callback)
|
||||||
u32 fourcc = Common::swap32(m_whole_file.data());
|
u32 fourcc = Common::swap32(m_whole_file.data());
|
||||||
if (fourcc != 0x55AA382D)
|
if (fourcc != 0x55AA382D)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HLE, "ARCUnpacker: invalid fourcc (%08x)", fourcc);
|
ERROR_LOG(IOS, "ARCUnpacker: invalid fourcc (%08x)", fourcc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,12 +78,13 @@ void ARCUnpacker::Extract(const WriteCallback& callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_wfsi::CWII_IPC_HLE_Device_wfsi(u32 device_id, const std::string& device_name)
|
namespace Device
|
||||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
{
|
||||||
|
WFSI::WFSI(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_wfsi::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult WFSI::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
u32 return_error_code = IPC_SUCCESS;
|
u32 return_error_code = IPC_SUCCESS;
|
||||||
|
|
||||||
|
@ -94,12 +95,12 @@ IPCCommandResult CWII_IPC_HLE_Device_wfsi::IOCtl(const IOSIOCtlRequest& request)
|
||||||
u32 tmd_addr = Memory::Read_U32(request.buffer_in);
|
u32 tmd_addr = Memory::Read_U32(request.buffer_in);
|
||||||
u32 tmd_size = Memory::Read_U32(request.buffer_in + 4);
|
u32 tmd_size = Memory::Read_U32(request.buffer_in + 4);
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFSI_PREPARE_DEVICE");
|
INFO_LOG(IOS, "IOCTL_WFSI_PREPARE_DEVICE");
|
||||||
|
|
||||||
constexpr u32 MAX_TMD_SIZE = 0x4000;
|
constexpr u32 MAX_TMD_SIZE = 0x4000;
|
||||||
if (tmd_size > MAX_TMD_SIZE)
|
if (tmd_size > MAX_TMD_SIZE)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HLE, "IOCTL_WFSI_INIT: TMD size too large (%d)", tmd_size);
|
ERROR_LOG(IOS, "IOCTL_WFSI_INIT: TMD size too large (%d)", tmd_size);
|
||||||
return_error_code = IPC_EINVAL;
|
return_error_code = IPC_EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +137,7 @@ IPCCommandResult CWII_IPC_HLE_Device_wfsi::IOCtl(const IOSIOCtlRequest& request)
|
||||||
TMDReader::Content content_info;
|
TMDReader::Content content_info;
|
||||||
if (!m_tmd.FindContentById(content_id, &content_info))
|
if (!m_tmd.FindContentById(content_id, &content_info))
|
||||||
{
|
{
|
||||||
WARN_LOG(WII_IPC_HLE, "%s: Content id %08x not found", ioctl_name, content_id);
|
WARN_LOG(IOS, "%s: Content id %08x not found", ioctl_name, content_id);
|
||||||
return_error_code = -10003;
|
return_error_code = -10003;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +145,7 @@ IPCCommandResult CWII_IPC_HLE_Device_wfsi::IOCtl(const IOSIOCtlRequest& request)
|
||||||
memset(m_aes_iv, 0, sizeof(m_aes_iv));
|
memset(m_aes_iv, 0, sizeof(m_aes_iv));
|
||||||
m_aes_iv[0] = content_info.index >> 8;
|
m_aes_iv[0] = content_info.index >> 8;
|
||||||
m_aes_iv[1] = content_info.index & 0xFF;
|
m_aes_iv[1] = content_info.index & 0xFF;
|
||||||
INFO_LOG(WII_IPC_HLE, "%s: Content id %08x found at index %d", ioctl_name, content_id,
|
INFO_LOG(IOS, "%s: Content id %08x found at index %d", ioctl_name, content_id,
|
||||||
content_info.index);
|
content_info.index);
|
||||||
|
|
||||||
m_arc_unpacker.Reset();
|
m_arc_unpacker.Reset();
|
||||||
|
@ -161,8 +162,8 @@ IPCCommandResult CWII_IPC_HLE_Device_wfsi::IOCtl(const IOSIOCtlRequest& request)
|
||||||
u32 content_id = Memory::Read_U32(request.buffer_in + 0xC);
|
u32 content_id = Memory::Read_U32(request.buffer_in + 0xC);
|
||||||
u32 input_ptr = Memory::Read_U32(request.buffer_in + 0x10);
|
u32 input_ptr = Memory::Read_U32(request.buffer_in + 0x10);
|
||||||
u32 input_size = Memory::Read_U32(request.buffer_in + 0x14);
|
u32 input_size = Memory::Read_U32(request.buffer_in + 0x14);
|
||||||
INFO_LOG(WII_IPC_HLE, "%s: %08x bytes of data at %08x from content id %d", ioctl_name,
|
INFO_LOG(IOS, "%s: %08x bytes of data at %08x from content id %d", ioctl_name, content_id,
|
||||||
content_id, input_ptr, input_size);
|
input_ptr, input_size);
|
||||||
|
|
||||||
std::vector<u8> decrypted(input_size);
|
std::vector<u8> decrypted(input_size);
|
||||||
mbedtls_aes_crypt_cbc(&m_aes_ctx, MBEDTLS_AES_DECRYPT, input_size, m_aes_iv,
|
mbedtls_aes_crypt_cbc(&m_aes_ctx, MBEDTLS_AES_DECRYPT, input_size, m_aes_iv,
|
||||||
|
@ -178,17 +179,17 @@ IPCCommandResult CWII_IPC_HLE_Device_wfsi::IOCtl(const IOSIOCtlRequest& request)
|
||||||
const char* ioctl_name = request.request == IOCTL_WFSI_FINALIZE_PROFILE ?
|
const char* ioctl_name = request.request == IOCTL_WFSI_FINALIZE_PROFILE ?
|
||||||
"IOCTL_WFSI_FINALIZE_PROFILE" :
|
"IOCTL_WFSI_FINALIZE_PROFILE" :
|
||||||
"IOCTL_WFSI_FINALIZE_CONTENT";
|
"IOCTL_WFSI_FINALIZE_CONTENT";
|
||||||
INFO_LOG(WII_IPC_HLE, "%s", ioctl_name);
|
INFO_LOG(IOS, "%s", ioctl_name);
|
||||||
|
|
||||||
auto callback = [this](const std::string& filename, const std::vector<u8>& bytes) {
|
auto callback = [this](const std::string& filename, const std::vector<u8>& bytes) {
|
||||||
INFO_LOG(WII_IPC_HLE, "Extract: %s (%zd bytes)", filename.c_str(), bytes.size());
|
INFO_LOG(IOS, "Extract: %s (%zd bytes)", filename.c_str(), bytes.size());
|
||||||
|
|
||||||
std::string path = WFS::NativePath(m_base_extract_path + "/" + filename);
|
std::string path = WFS::NativePath(m_base_extract_path + "/" + filename);
|
||||||
File::CreateFullPath(path);
|
File::CreateFullPath(path);
|
||||||
File::IOFile f(path, "wb");
|
File::IOFile f(path, "wb");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HLE, "Could not extract %s to %s", filename.c_str(), path.c_str());
|
ERROR_LOG(IOS, "Could not extract %s to %s", filename.c_str(), path.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
f.WriteBytes(bytes.data(), bytes.size());
|
f.WriteBytes(bytes.data(), bytes.size());
|
||||||
|
@ -205,25 +206,25 @@ IPCCommandResult CWII_IPC_HLE_Device_wfsi::IOCtl(const IOSIOCtlRequest& request)
|
||||||
// Bytes 0-4: ??
|
// Bytes 0-4: ??
|
||||||
// Bytes 4-8: game id
|
// Bytes 4-8: game id
|
||||||
// Bytes 1c-1e: title id?
|
// Bytes 1c-1e: title id?
|
||||||
WARN_LOG(WII_IPC_HLE, "IOCTL_WFSI_DELETE_TITLE: unimplemented");
|
WARN_LOG(IOS, "IOCTL_WFSI_DELETE_TITLE: unimplemented");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_WFSI_IMPORT_TITLE:
|
case IOCTL_WFSI_IMPORT_TITLE:
|
||||||
WARN_LOG(WII_IPC_HLE, "IOCTL_WFSI_IMPORT_TITLE: unimplemented");
|
WARN_LOG(IOS, "IOCTL_WFSI_IMPORT_TITLE: unimplemented");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_WFSI_INIT:
|
case IOCTL_WFSI_INIT:
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFSI_INIT");
|
INFO_LOG(IOS, "IOCTL_WFSI_INIT");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_WFSI_SET_DEVICE_NAME:
|
case IOCTL_WFSI_SET_DEVICE_NAME:
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFSI_SET_DEVICE_NAME");
|
INFO_LOG(IOS, "IOCTL_WFSI_SET_DEVICE_NAME");
|
||||||
m_device_name = Memory::GetString(request.buffer_in);
|
m_device_name = Memory::GetString(request.buffer_in);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_WFSI_APPLY_TITLE_PROFILE:
|
case IOCTL_WFSI_APPLY_TITLE_PROFILE:
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFSI_APPLY_TITLE_PROFILE");
|
INFO_LOG(IOS, "IOCTL_WFSI_APPLY_TITLE_PROFILE");
|
||||||
|
|
||||||
m_base_extract_path = StringFromFormat(
|
m_base_extract_path = StringFromFormat(
|
||||||
"/vol/%s/_install/%c%c%c%c/content", m_device_name.c_str(),
|
"/vol/%s/_install/%c%c%c%c/content", m_device_name.c_str(),
|
||||||
|
@ -237,12 +238,13 @@ IPCCommandResult CWII_IPC_HLE_Device_wfsi::IOCtl(const IOSIOCtlRequest& request)
|
||||||
// TODO(wfs): Should be returning an error. However until we have
|
// TODO(wfs): Should be returning an error. However until we have
|
||||||
// everything properly stubbed it's easier to simulate the methods
|
// everything properly stubbed it's easier to simulate the methods
|
||||||
// succeeding.
|
// succeeding.
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_HLE, LogTypes::LWARNING);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS, LogTypes::LWARNING);
|
||||||
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDefaultReply(return_error_code);
|
return GetDefaultReply(return_error_code);
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -10,9 +10,9 @@
|
||||||
#include <mbedtls/aes.h>
|
#include <mbedtls/aes.h>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/IPC_HLE/ESFormats.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/ES/Formats.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
|
@ -33,10 +33,12 @@ private:
|
||||||
std::vector<u8> m_whole_file;
|
std::vector<u8> m_whole_file;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWII_IPC_HLE_Device_wfsi : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class WFSI : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_wfsi(u32 device_id, const std::string& device_name);
|
WFSI(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
|
|
||||||
|
@ -73,5 +75,6 @@ private:
|
||||||
IOCTL_WFSI_APPLY_TITLE_PROFILE = 0x89,
|
IOCTL_WFSI_APPLY_TITLE_PROFILE = 0x89,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_wfssrv.h"
|
#include "Core/IOS/WFS/WFSSRV.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -26,14 +26,14 @@ std::string NativePath(const std::string& wfs_path)
|
||||||
}
|
}
|
||||||
} // namespace WFS
|
} // namespace WFS
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_wfssrv::CWII_IPC_HLE_Device_usb_wfssrv(u32 device_id,
|
namespace Device
|
||||||
const std::string& device_name)
|
{
|
||||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
WFSSRV::WFSSRV(u32 device_id, const std::string& device_name) : Device(device_id, device_name)
|
||||||
{
|
{
|
||||||
m_device_name = "msc01";
|
m_device_name = "msc01";
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& request)
|
IPCCommandResult WFSSRV::IOCtl(const IOSIOCtlRequest& request)
|
||||||
{
|
{
|
||||||
int return_error_code = IPC_SUCCESS;
|
int return_error_code = IPC_SUCCESS;
|
||||||
|
|
||||||
|
@ -41,18 +41,18 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
||||||
{
|
{
|
||||||
case IOCTL_WFS_INIT:
|
case IOCTL_WFS_INIT:
|
||||||
// TODO(wfs): Implement.
|
// TODO(wfs): Implement.
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_INIT");
|
INFO_LOG(IOS, "IOCTL_WFS_INIT");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_WFS_DEVICE_INFO:
|
case IOCTL_WFS_DEVICE_INFO:
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_DEVICE_INFO");
|
INFO_LOG(IOS, "IOCTL_WFS_DEVICE_INFO");
|
||||||
Memory::Write_U64(16ull << 30, request.buffer_out); // 16GB storage.
|
Memory::Write_U64(16ull << 30, request.buffer_out); // 16GB storage.
|
||||||
Memory::Write_U8(4, request.buffer_out + 8);
|
Memory::Write_U8(4, request.buffer_out + 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_WFS_GET_DEVICE_NAME:
|
case IOCTL_WFS_GET_DEVICE_NAME:
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_GET_DEVICE_NAME");
|
INFO_LOG(IOS, "IOCTL_WFS_GET_DEVICE_NAME");
|
||||||
Memory::Write_U8(static_cast<u8>(m_device_name.size()), request.buffer_out);
|
Memory::Write_U8(static_cast<u8>(m_device_name.size()), request.buffer_out);
|
||||||
Memory::CopyToEmu(request.buffer_out + 1, m_device_name.data(), m_device_name.size());
|
Memory::CopyToEmu(request.buffer_out + 1, m_device_name.data(), m_device_name.size());
|
||||||
break;
|
break;
|
||||||
|
@ -60,14 +60,14 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
||||||
|
|
||||||
case IOCTL_WFS_ATTACH_DETACH_2:
|
case IOCTL_WFS_ATTACH_DETACH_2:
|
||||||
// TODO(wfs): Implement.
|
// TODO(wfs): Implement.
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_ATTACH_DETACH_2(%u)", request.request);
|
INFO_LOG(IOS, "IOCTL_WFS_ATTACH_DETACH_2(%u)", request.request);
|
||||||
Memory::Write_U32(1, request.buffer_out);
|
Memory::Write_U32(1, request.buffer_out);
|
||||||
Memory::Write_U32(0, request.buffer_out + 4); // device id?
|
Memory::Write_U32(0, request.buffer_out + 4); // device id?
|
||||||
Memory::Write_U32(0, request.buffer_out + 8);
|
Memory::Write_U32(0, request.buffer_out + 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_WFS_ATTACH_DETACH:
|
case IOCTL_WFS_ATTACH_DETACH:
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_ATTACH_DETACH(%u)", request.request);
|
INFO_LOG(IOS, "IOCTL_WFS_ATTACH_DETACH(%u)", request.request);
|
||||||
Memory::Write_U32(1, request.buffer_out);
|
Memory::Write_U32(1, request.buffer_out);
|
||||||
Memory::Write_U32(0, request.buffer_out + 4);
|
Memory::Write_U32(0, request.buffer_out + 4);
|
||||||
Memory::Write_U32(0, request.buffer_out + 8);
|
Memory::Write_U32(0, request.buffer_out + 8);
|
||||||
|
@ -76,18 +76,18 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
||||||
// TODO(wfs): Globbing is not really implemented, we just fake the one case
|
// TODO(wfs): Globbing is not really implemented, we just fake the one case
|
||||||
// (listing /vol/*) which is required to get the installer to work.
|
// (listing /vol/*) which is required to get the installer to work.
|
||||||
case IOCTL_WFS_GLOB_START:
|
case IOCTL_WFS_GLOB_START:
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_GLOB_START(%u)", request.request);
|
INFO_LOG(IOS, "IOCTL_WFS_GLOB_START(%u)", request.request);
|
||||||
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
||||||
Memory::CopyToEmu(request.buffer_out + 0x14, m_device_name.data(), m_device_name.size());
|
Memory::CopyToEmu(request.buffer_out + 0x14, m_device_name.data(), m_device_name.size());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_WFS_GLOB_NEXT:
|
case IOCTL_WFS_GLOB_NEXT:
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_GLOB_NEXT(%u)", request.request);
|
INFO_LOG(IOS, "IOCTL_WFS_GLOB_NEXT(%u)", request.request);
|
||||||
return_error_code = WFS_EEMPTY;
|
return_error_code = WFS_EEMPTY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_WFS_GLOB_END:
|
case IOCTL_WFS_GLOB_END:
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_GLOB_END(%u)", request.request);
|
INFO_LOG(IOS, "IOCTL_WFS_GLOB_END(%u)", request.request);
|
||||||
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -106,13 +106,13 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
||||||
|
|
||||||
if (!fd_obj->Open())
|
if (!fd_obj->Open())
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HLE, "IOCTL_WFS_OPEN(%s, %d): error opening file", path.c_str(), mode);
|
ERROR_LOG(IOS, "IOCTL_WFS_OPEN(%s, %d): error opening file", path.c_str(), mode);
|
||||||
ReleaseFileDescriptor(fd);
|
ReleaseFileDescriptor(fd);
|
||||||
return_error_code = -1; // TODO(wfs): proper error code.
|
return_error_code = -1; // TODO(wfs): proper error code.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_OPEN(%s, %d) -> %d", path.c_str(), mode, fd);
|
INFO_LOG(IOS, "IOCTL_WFS_OPEN(%s, %d) -> %d", path.c_str(), mode, fd);
|
||||||
Memory::Write_U16(fd, request.buffer_out + 0x14);
|
Memory::Write_U16(fd, request.buffer_out + 0x14);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
||||||
case IOCTL_WFS_CLOSE:
|
case IOCTL_WFS_CLOSE:
|
||||||
{
|
{
|
||||||
u16 fd = Memory::Read_U16(request.buffer_in + 0x4);
|
u16 fd = Memory::Read_U16(request.buffer_in + 0x4);
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_CLOSE(%d)", fd);
|
INFO_LOG(IOS, "IOCTL_WFS_CLOSE(%d)", fd);
|
||||||
ReleaseFileDescriptor(fd);
|
ReleaseFileDescriptor(fd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
||||||
FileDescriptor* fd_obj = FindFileDescriptor(fd);
|
FileDescriptor* fd_obj = FindFileDescriptor(fd);
|
||||||
if (fd_obj == nullptr)
|
if (fd_obj == nullptr)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HLE, "IOCTL_WFS_READ: invalid file descriptor %d", fd);
|
ERROR_LOG(IOS, "IOCTL_WFS_READ: invalid file descriptor %d", fd);
|
||||||
return_error_code = -1; // TODO(wfs): proper error code.
|
return_error_code = -1; // TODO(wfs): proper error code.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
||||||
}
|
}
|
||||||
fd_obj->position += read_bytes;
|
fd_obj->position += read_bytes;
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_HLE, "IOCTL_WFS_READ: read %zd bytes from FD %d (%s)", read_bytes, fd,
|
INFO_LOG(IOS, "IOCTL_WFS_READ: read %zd bytes from FD %d (%s)", read_bytes, fd,
|
||||||
fd_obj->path.c_str());
|
fd_obj->path.c_str());
|
||||||
return_error_code = static_cast<int>(read_bytes);
|
return_error_code = static_cast<int>(read_bytes);
|
||||||
break;
|
break;
|
||||||
|
@ -156,7 +156,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
||||||
default:
|
default:
|
||||||
// TODO(wfs): Should be returning -3. However until we have everything
|
// TODO(wfs): Should be returning -3. However until we have everything
|
||||||
// properly stubbed it's easier to simulate the methods succeeding.
|
// properly stubbed it's easier to simulate the methods succeeding.
|
||||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_HLE, LogTypes::LWARNING);
|
request.DumpUnknown(GetDeviceName(), LogTypes::IOS, LogTypes::LWARNING);
|
||||||
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -164,8 +164,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
||||||
return GetDefaultReply(return_error_code);
|
return GetDefaultReply(return_error_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWII_IPC_HLE_Device_usb_wfssrv::FileDescriptor*
|
WFSSRV::FileDescriptor* WFSSRV::FindFileDescriptor(u16 fd)
|
||||||
CWII_IPC_HLE_Device_usb_wfssrv::FindFileDescriptor(u16 fd)
|
|
||||||
{
|
{
|
||||||
if (fd >= m_fds.size() || !m_fds[fd].in_use)
|
if (fd >= m_fds.size() || !m_fds[fd].in_use)
|
||||||
{
|
{
|
||||||
|
@ -174,7 +173,7 @@ CWII_IPC_HLE_Device_usb_wfssrv::FindFileDescriptor(u16 fd)
|
||||||
return &m_fds[fd];
|
return &m_fds[fd];
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 CWII_IPC_HLE_Device_usb_wfssrv::GetNewFileDescriptor()
|
u16 WFSSRV::GetNewFileDescriptor()
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < m_fds.size(); ++i)
|
for (u32 i = 0; i < m_fds.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -187,7 +186,7 @@ u16 CWII_IPC_HLE_Device_usb_wfssrv::GetNewFileDescriptor()
|
||||||
return static_cast<u16>(m_fds.size() - 1);
|
return static_cast<u16>(m_fds.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_wfssrv::ReleaseFileDescriptor(u16 fd)
|
void WFSSRV::ReleaseFileDescriptor(u16 fd)
|
||||||
{
|
{
|
||||||
FileDescriptor* fd_obj = FindFileDescriptor(fd);
|
FileDescriptor* fd_obj = FindFileDescriptor(fd);
|
||||||
if (!fd_obj)
|
if (!fd_obj)
|
||||||
|
@ -203,7 +202,7 @@ void CWII_IPC_HLE_Device_usb_wfssrv::ReleaseFileDescriptor(u16 fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWII_IPC_HLE_Device_usb_wfssrv::FileDescriptor::Open()
|
bool WFSSRV::FileDescriptor::Open()
|
||||||
{
|
{
|
||||||
const char* mode_string;
|
const char* mode_string;
|
||||||
|
|
||||||
|
@ -221,11 +220,12 @@ bool CWII_IPC_HLE_Device_usb_wfssrv::FileDescriptor::Open()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_HLE, "WFSOpen: invalid mode %d", mode);
|
ERROR_LOG(IOS, "WFSOpen: invalid mode %d", mode);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return file.Open(WFS::NativePath(path), mode_string);
|
return file.Open(WFS::NativePath(path), mode_string);
|
||||||
}
|
}
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "DiscIO/Volume.h"
|
#include "DiscIO/Volume.h"
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
|
@ -22,10 +22,12 @@ namespace WFS
|
||||||
std::string NativePath(const std::string& wfs_path);
|
std::string NativePath(const std::string& wfs_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CWII_IPC_HLE_Device_usb_wfssrv : public IWII_IPC_HLE_Device
|
namespace Device
|
||||||
|
{
|
||||||
|
class WFSSRV : public Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWII_IPC_HLE_Device_usb_wfssrv(u32 device_id, const std::string& device_name);
|
WFSSRV(u32 device_id, const std::string& device_name);
|
||||||
|
|
||||||
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOSIOCtlRequest& request) override;
|
||||||
|
|
||||||
|
@ -77,5 +79,6 @@ private:
|
||||||
u16 GetNewFileDescriptor();
|
u16 GetNewFileDescriptor();
|
||||||
void ReleaseFileDescriptor(u16 fd);
|
void ReleaseFileDescriptor(u16 fd);
|
||||||
};
|
};
|
||||||
|
} // namespace Device
|
||||||
} // namespace HLE
|
} // namespace HLE
|
||||||
} // namespace IOS
|
} // namespace IOS
|
|
@ -1,42 +0,0 @@
|
||||||
// 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"
|
|
||||||
|
|
||||||
namespace IOS
|
|
||||||
{
|
|
||||||
namespace HLE
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IOSReturnCode CWII_IPC_HLE_Device_stub::Open(const IOSOpenRequest& request)
|
|
||||||
{
|
|
||||||
WARN_LOG(WII_IPC_HLE, "%s faking Open()", m_name.c_str());
|
|
||||||
m_is_active = true;
|
|
||||||
return IPC_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_stub::Close()
|
|
||||||
{
|
|
||||||
WARN_LOG(WII_IPC_HLE, "%s faking Close()", m_name.c_str());
|
|
||||||
m_is_active = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtl(const IOSIOCtlRequest& request)
|
|
||||||
{
|
|
||||||
WARN_LOG(WII_IPC_HLE, "%s faking IOCtl()", m_name.c_str());
|
|
||||||
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());
|
|
||||||
return GetDefaultReply(IPC_SUCCESS);
|
|
||||||
}
|
|
||||||
} // namespace HLE
|
|
||||||
} // namespace IOS
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||||
#include "Core/HW/WiimoteEmu/WiimoteHid.h"
|
#include "Core/HW/WiimoteEmu/WiimoteHid.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
#include "Core/NetPlayProto.h"
|
#include "Core/NetPlayProto.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
@ -580,7 +580,7 @@ bool BeginRecordingInput(int controllers)
|
||||||
s_bRecordingFromSaveState = true;
|
s_bRecordingFromSaveState = true;
|
||||||
|
|
||||||
// This is only done here if starting from save state because otherwise we won't have the
|
// This is only done here if starting from save state because otherwise we won't have the
|
||||||
// titleid. Otherwise it's set in WII_IPC_HLE_Device_es.cpp.
|
// titleid. Otherwise it's set in IOS::HLE::Device::ES.
|
||||||
// TODO: find a way to GetTitleDataPath() from Movie::Init()
|
// TODO: find a way to GetTitleDataPath() from Movie::Init()
|
||||||
if (SConfig::GetInstance().bWii)
|
if (SConfig::GetInstance().bWii)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "Core/HW/Sram.h"
|
#include "Core/HW/Sram.h"
|
||||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
#include "InputCommon/GCAdapter.h"
|
#include "InputCommon/GCAdapter.h"
|
||||||
#include "VideoCommon/OnScreenDisplay.h"
|
#include "VideoCommon/OnScreenDisplay.h"
|
||||||
|
|
|
@ -23,11 +23,11 @@ void InitializeWiiRoot(bool use_temporary)
|
||||||
s_temp_wii_root = File::CreateTempDir();
|
s_temp_wii_root = File::CreateTempDir();
|
||||||
if (s_temp_wii_root.empty())
|
if (s_temp_wii_root.empty())
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_FILEIO, "Could not create temporary directory");
|
ERROR_LOG(IOS_FILEIO, "Could not create temporary directory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File::CopyDir(File::GetSysDirectory() + WII_USER_DIR, s_temp_wii_root);
|
File::CopyDir(File::GetSysDirectory() + WII_USER_DIR, s_temp_wii_root);
|
||||||
WARN_LOG(WII_IPC_FILEIO, "Using temporary directory %s for minimal Wii FS",
|
WARN_LOG(IOS_FILEIO, "Using temporary directory %s for minimal Wii FS",
|
||||||
s_temp_wii_root.c_str());
|
s_temp_wii_root.c_str());
|
||||||
static bool s_registered;
|
static bool s_registered;
|
||||||
if (!s_registered)
|
if (!s_registered)
|
||||||
|
|
|
@ -129,24 +129,23 @@ EcWii::EcWii()
|
||||||
{
|
{
|
||||||
init = false;
|
init = false;
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "Successfully loaded keys.bin created by: %s", BootMiiKeysBin.creator);
|
INFO_LOG(IOS_ES, "Successfully loaded keys.bin created by: %s", BootMiiKeysBin.creator);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_ES,
|
ERROR_LOG(IOS_ES, "Failed to read keys.bin, check it is the correct size of %08zX bytes.",
|
||||||
"Failed to read keys.bin, check it is the correct size of %08zX bytes.",
|
|
||||||
sizeof(BootMiiKeysBin));
|
sizeof(BootMiiKeysBin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(WII_IPC_ES, "Failed to open keys.bin, maybe a permissions error or it is in use?");
|
ERROR_LOG(IOS_ES, "Failed to open keys.bin, maybe a permissions error or it is in use?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(
|
ERROR_LOG(
|
||||||
WII_IPC_ES,
|
IOS_ES,
|
||||||
"%s could not be found. Using default values. We recommend you grab keys.bin from BootMii.",
|
"%s could not be found. Using default values. We recommend you grab keys.bin from BootMii.",
|
||||||
keys_path.c_str());
|
keys_path.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "DolphinWX/DolphinSlider.h"
|
#include "DolphinWX/DolphinSlider.h"
|
||||||
#include "DolphinWX/WxEventUtils.h"
|
#include "DolphinWX/WxEventUtils.h"
|
||||||
#include "DolphinWX/WxUtils.h"
|
#include "DolphinWX/WxUtils.h"
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||||
#include "Core/HotkeyManager.h"
|
#include "Core/HotkeyManager.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.h"
|
#include "Core/IOS/USB/Bluetooth/BTReal.h"
|
||||||
#include "Core/NetPlayProto.h"
|
#include "Core/NetPlayProto.h"
|
||||||
#include "DolphinWX/Config/GCAdapterConfigDiag.h"
|
#include "DolphinWX/Config/GCAdapterConfigDiag.h"
|
||||||
#include "DolphinWX/ControllerConfigDiag.h"
|
#include "DolphinWX/ControllerConfigDiag.h"
|
||||||
|
@ -529,7 +529,7 @@ void ControllerConfigDiag::OnPassthroughScanButton(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
auto device = IOS::HLE::GetDeviceByName("/dev/usb/oh1/57e/305");
|
auto device = IOS::HLE::GetDeviceByName("/dev/usb/oh1/57e/305");
|
||||||
if (device != nullptr)
|
if (device != nullptr)
|
||||||
std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_usb_oh1_57e_305_base>(device)
|
std::static_pointer_cast<IOS::HLE::Device::BluetoothBase>(device)
|
||||||
->TriggerSyncButtonPressedEvent();
|
->TriggerSyncButtonPressedEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,8 +543,7 @@ void ControllerConfigDiag::OnPassthroughResetButton(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
auto device = IOS::HLE::GetDeviceByName("/dev/usb/oh1/57e/305");
|
auto device = IOS::HLE::GetDeviceByName("/dev/usb/oh1/57e/305");
|
||||||
if (device != nullptr)
|
if (device != nullptr)
|
||||||
std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_usb_oh1_57e_305_base>(device)
|
std::static_pointer_cast<IOS::HLE::Device::BluetoothBase>(device)->TriggerSyncButtonHeldEvent();
|
||||||
->TriggerSyncButtonHeldEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerConfigDiag::OnBalanceBoardChanged(wxCommandEvent& event)
|
void ControllerConfigDiag::OnBalanceBoardChanged(wxCommandEvent& event)
|
||||||
|
|
|
@ -46,8 +46,8 @@
|
||||||
#include "Core/HW/GCPad.h"
|
#include "Core/HW/GCPad.h"
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/HotkeyManager.h"
|
#include "Core/HotkeyManager.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
|
#include "Core/IOS/USB/Bluetooth/BTBase.h"
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
|
|
||||||
|
@ -1279,8 +1279,8 @@ void CFrame::ParseHotkeys()
|
||||||
{
|
{
|
||||||
auto device = IOS::HLE::GetDeviceByName("/dev/usb/oh1/57e/305");
|
auto device = IOS::HLE::GetDeviceByName("/dev/usb/oh1/57e/305");
|
||||||
if (device != nullptr)
|
if (device != nullptr)
|
||||||
std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_usb_oh1_57e_305_base>(device)
|
std::static_pointer_cast<IOS::HLE::Device::BluetoothBase>(device)->UpdateSyncButtonState(
|
||||||
->UpdateSyncButtonState(IsHotkey(HK_TRIGGER_SYNC_BUTTON, true));
|
IsHotkey(HK_TRIGGER_SYNC_BUTTON, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UseDebugger)
|
if (UseDebugger)
|
||||||
|
|
|
@ -42,10 +42,10 @@
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#include "Core/HotkeyManager.h"
|
#include "Core/HotkeyManager.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h"
|
#include "Core/IOS/STM/STM.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
@ -861,12 +861,8 @@ void CFrame::DoStop()
|
||||||
bool CFrame::TriggerSTMPowerEvent()
|
bool CFrame::TriggerSTMPowerEvent()
|
||||||
{
|
{
|
||||||
const auto stm = IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
|
const auto stm = IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
|
||||||
if (!stm ||
|
if (!stm || !std::static_pointer_cast<IOS::HLE::Device::STMEventHook>(stm)->HasHookInstalled())
|
||||||
!std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_stm_eventhook>(stm)
|
|
||||||
->HasHookInstalled())
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
Core::DisplayMessage("Shutting down", 30000);
|
Core::DisplayMessage("Shutting down", 30000);
|
||||||
// Unpause because gracefully shutting down needs the game to actually request a shutdown
|
// Unpause because gracefully shutting down needs the game to actually request a shutdown
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
#include "Core/IOS/IPC.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h"
|
#include "Core/IOS/STM/STM.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
||||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
|
|
||||||
#include "UICommon/UICommon.h"
|
#include "UICommon/UICommon.h"
|
||||||
|
@ -239,8 +239,7 @@ class PlatformX11 : public Platform
|
||||||
{
|
{
|
||||||
const auto stm = IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
|
const auto stm = IOS::HLE::GetDeviceByName("/dev/stm/eventhook");
|
||||||
if (!s_tried_graceful_shutdown.IsSet() && stm &&
|
if (!s_tried_graceful_shutdown.IsSet() && stm &&
|
||||||
std::static_pointer_cast<IOS::HLE::CWII_IPC_HLE_Device_stm_eventhook>(stm)
|
std::static_pointer_cast<IOS::HLE::Device::STMEventHook>(stm)->HasHookInstalled())
|
||||||
->HasHookInstalled())
|
|
||||||
{
|
{
|
||||||
ProcessorInterface::PowerButton_Tap();
|
ProcessorInterface::PowerButton_Tap();
|
||||||
s_tried_graceful_shutdown.Set();
|
s_tried_graceful_shutdown.Set();
|
||||||
|
|
Loading…
Reference in New Issue