summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorbushing <bushing@gmail.com>2008-12-29 02:17:22 +0000
committerbushing <bushing@gmail.com>2008-12-29 02:17:22 +0000
commit0c81a2c8c08bc73cf2290064c71e771f53bde70b (patch)
tree131af3d611f258a3cc56729d9384efd61a635387 /Source/Core
parent6a9f8e766c10be4d4350a063ee185b22e8ca4dfc (diff)
implement lots of wii HLE stuff. :)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1713 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp4
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp6
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h2
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h12
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp122
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h21
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp7
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h1
8 files changed, 164 insertions, 11 deletions
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp
index 74963a925f..1e8cc24eca 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp
@@ -164,6 +164,10 @@ IWII_IPC_HLE_Device* CreateDevice(u32 _DeviceID, const std::string& _rDeviceName
{
pDevice = new CWII_IPC_HLE_Device_net_ncd_manage(_DeviceID, _rDeviceName);
}
+ else if (_rDeviceName.c_str() == std::string("/dev/net/ip/top"))
+ {
+ pDevice = new CWII_IPC_HLE_Device_net_ip_top(_DeviceID, _rDeviceName);
+ }
else if (_rDeviceName.c_str() == std::string("/dev/es"))
{
pDevice = new CWII_IPC_HLE_Device_es(_DeviceID, _rDeviceName);
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp
index e71cda2097..47c26cde80 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp
@@ -51,6 +51,12 @@ bool CWII_IPC_HLE_Device_di::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
+bool CWII_IPC_HLE_Device_di::Close(u32 _CommandAddress)
+{
+ Memory::Write_U32(0, _CommandAddress+4);
+ return true;
+}
+
bool CWII_IPC_HLE_Device_di::IOCtl(u32 _CommandAddress)
{
LOGV(WII_IPC_DVD, 1, "*******************************");
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h
index b77db611d9..565f587540 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h
@@ -34,6 +34,8 @@ public:
virtual ~CWII_IPC_HLE_Device_di();
bool Open(u32 _CommandAddress, u32 _Mode);
+ bool Close(u32 _CommandAddress);
+
bool IOCtl(u32 _CommandAddress);
bool IOCtlV(u32 _CommandAddress);
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h
index a8217eec2a..3c13b6f05d 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h
@@ -204,6 +204,18 @@ public:
}
break;
+ case IOCTL_ES_GETSTOREDTMDSIZE:
+ {
+ u64 TitleId = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
+ u32 OutBuffer = Memory::Read_U32(Buffer.PayloadBuffer[0].m_Address);
+
+ Memory::Write_U32(0, OutBuffer);
+ printf("ES_GetStoredTmdSize(%llx)\n", TitleId);
+ LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es command:"
+ " IOCTL_ES_GETSTOREDTMDSIZE: 0x%x", OutBuffer);
+ }
+ break;
+
default:
_dbg_assert_msg_(WII_IPC_HLE, 0, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter);
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
index 9ae15cca2c..688851b777 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
@@ -54,6 +54,45 @@
#include "WII_IPC_HLE_Device_net.h"
+#define IOCTL_NWC24_STARTUP 0x06
+enum {
+ IOCTL_SO_ACCEPT = 1,
+ IOCTL_SO_BIND,
+ IOCTL_SO_CLOSE,
+ IOCTL_SO_CONNECT,
+ IOCTL_SO_FCNTL,
+ IOCTL_SO_GETPEERNAME, // todo
+ IOCTL_SO_GETSOCKNAME, // todo
+ IOCTL_SO_GETSOCKOPT, // todo 8
+ IOCTL_SO_SETSOCKOPT,
+ IOCTL_SO_LISTEN,
+ IOCTL_SO_POLL, // todo b
+ IOCTLV_SO_RECVFROM,
+ IOCTLV_SO_SENDTO,
+ IOCTL_SO_SHUTDOWN, // todo e
+ IOCTL_SO_SOCKET,
+ IOCTL_SO_GETHOSTID,
+ IOCTL_SO_GETHOSTBYNAME,
+ IOCTL_SO_GETHOSTBYADDR,// todo
+ IOCTLV_SO_GETNAMEINFO, // todo 13
+ IOCTL_SO_UNK14, // todo
+ IOCTL_SO_INETATON, // todo
+ IOCTL_SO_INETPTON, // todo
+ IOCTL_SO_INETNTOP, // todo
+ IOCTLV_SO_GETADDRINFO, // todo
+ IOCTL_SO_SOCKATMARK, // todo
+ IOCTLV_SO_UNK1A, // todo
+ IOCTLV_SO_UNK1B, // todo
+ IOCTLV_SO_GETINTERFACEOPT, // todo
+ IOCTLV_SO_SETINTERFACEOPT, // todo
+ IOCTL_SO_SETINTERFACE, // todo
+ IOCTL_SO_STARTUP, // 0x1f
+ IOCTL_SO_ICMPSOCKET = 0x30, // todo
+ IOCTLV_SO_ICMPPING, // todo
+ IOCTL_SO_ICMPCANCEL, // todo
+ IOCTL_SO_ICMPCLOSE // todo
+};
+
// **********************************************************************************
// Handle /dev/net/kd/request requests
@@ -119,6 +158,9 @@ s32 CWII_IPC_HLE_Device_net_kd_request::ExecuteCommand(u32 _Parameter, u32 _Buff
//Memory::Write_U32(0, _BufferOut);
return -1;
break;
+ case IOCTL_NWC24_STARTUP:
+ return 0;
+
case 0xf: // NWC24iRequestGenerateUserId (Input: none, Output: 32 bytes)
//Memory::Write_U32(0, _BufferOut);
return -1;
@@ -150,6 +192,11 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
+bool CWII_IPC_HLE_Device_net_ncd_manage::Close(u32 _CommandAddress)
+{
+ Memory::Write_U32(0, _CommandAddress + 4);
+ return true;
+}
bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress)
{
@@ -168,4 +215,79 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress)
Memory::Write_U32(ReturnValue, _CommandAddress+4);
return true;
+}
+
+// **********************************************************************************
+// Handle /dev/net/ip/top requests
+
+CWII_IPC_HLE_Device_net_ip_top::CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName)
+ : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
+{}
+
+CWII_IPC_HLE_Device_net_ip_top::~CWII_IPC_HLE_Device_net_ip_top()
+{}
+
+bool CWII_IPC_HLE_Device_net_ip_top::Open(u32 _CommandAddress, u32 _Mode)
+{
+ Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
+ return true;
+}
+
+bool CWII_IPC_HLE_Device_net_ip_top::Close(u32 _CommandAddress)
+{
+ Memory::Write_U32(0, _CommandAddress + 4);
+ return true;
+}
+
+bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
+{
+ u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
+ u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
+ u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
+ u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
+ u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
+
+ printf("%s - Command(0x%08x) BufferIn(0x%08x, 0x%x) BufferOut(0x%08x, 0x%x)\n", GetDeviceName().c_str(), Command, BufferIn, BufferInSize, BufferOut, BufferOutSize);
+
+ u32 ReturnValue = ExecuteCommand(Command, BufferIn, BufferInSize, BufferOut, BufferOutSize);
+ Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
+
+ return true;
+}
+
+s32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize)
+{
+ // Clean the location of the output buffer to zeroes as a safety precaution */
+ Memory::Memset(_BufferOut, 0, _BufferOutSize);
+
+ switch(_Command)
+ {
+ case IOCTL_SO_GETHOSTID: return 127 << 24 | 1;
+
+ default:
+ _dbg_assert_msg_(WII_IPC_NET, 0, "/dev/net/ip/top::IOCtl request 0x%x (BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
+ _Command, _BufferIn, _BufferInSize, _BufferOut, _BufferOutSize);
+ break;
+ }
+
+ // We return a success for any potential unknown requests
+ return 0;
+}
+
+bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 _CommandAddress)
+{
+ u32 ReturnValue = 0;
+
+ SIOCtlVBuffer CommandBuffer(_CommandAddress);
+
+ switch(CommandBuffer.Parameter)
+ {
+ default:
+ LOG(WII_IPC_NET, "NET_IP_TOP IOCtlV: %i", CommandBuffer.Parameter);
+ break;
+ }
+
+ Memory::Write_U32(ReturnValue, _CommandAddress+4);
+
+ return true;
} \ No newline at end of file
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h
index ecabb2824f..89f63e118f 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h
@@ -94,19 +94,17 @@ public:
class CWII_IPC_HLE_Device_net_ip_top : public IWII_IPC_HLE_Device
{
public:
- CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName) :
- IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
- {}
+ CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName);
- virtual ~CWII_IPC_HLE_Device_net_ip_top() {}
-
- virtual bool Open(u32 _CommandAddress, u32 _Mode)
- {
- LOG(WII_IPC_NET, "%s - IOCtl: Open", GetDeviceName().c_str());
- Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
- return true;
- }
+ virtual ~CWII_IPC_HLE_Device_net_ip_top();
+ virtual bool Open(u32 _CommandAddress, u32 _Mode);
+ virtual bool Close(u32 _CommandAddress);
+ virtual bool IOCtl(u32 _CommandAddress);
+ virtual bool IOCtlV(u32 _CommandAddress);
+
+private:
+ s32 ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize);
};
// **************************************************************************************
@@ -119,6 +117,7 @@ public:
virtual ~CWII_IPC_HLE_Device_net_ncd_manage();
virtual bool Open(u32 _CommandAddress, u32 _Mode);
+ virtual bool Close(u32 _CommandAddress);
virtual bool IOCtlV(u32 _CommandAddress);
};
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
index f1bbe9fc0f..d9db553d7b 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
@@ -48,6 +48,13 @@ CWII_IPC_HLE_Device_sdio_slot0::Open(u32 _CommandAddress, u32 _Mode)
return true;
}
+bool
+CWII_IPC_HLE_Device_sdio_slot0::Close(u32 _CommandAddress)
+{
+ LOG(WII_IPC_SD, "SD: Close");
+ Memory::Write_U32(0, _CommandAddress + 0x4);
+ return true;
+}
// __________________________________________________________________________________________________
// The front SD slot
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h
index 112782bc01..9fdf181cdc 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h
@@ -37,6 +37,7 @@ public:
virtual ~CWII_IPC_HLE_Device_sdio_slot0();
bool Open(u32 _CommandAddress, u32 _Mode);
+ bool Close(u32 _CommandAddress);
bool IOCtl(u32 _CommandAddress);
bool IOCtlV(u32 _CommandAddress);