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 3b12a67dc5..67bba04463 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -326,11 +326,24 @@ void ExecuteCommand(u32 _Address) if(pDevice->IsHardware()) { - // We have already opened this device, return -6 if(pDevice->IsOpened()) - Memory::Write_U32(/*u32(-6)*/DeviceID, _Address + 4); + { + if (pDevice->GetDeviceName().find("/dev/net/") != std::string::npos) + // AyuanX: /dev/net/XXX are more like events which don't need close so they can be reopened + // At least it is so for /dev/net/kd/request & /dev/net/ncd/manage + pDevice->Open(_Address, Mode); + else + // We have already opened this hardware, return -6 + + // AyuanX: TO_BE_VERIFIED + // -6 seems to be a bad number as in NET it means "Retry Again"(?) + // I guess -4 stands for "Already Opened"(?) + Memory::Write_U32(u32(-6), _Address + 4); + } else + { pDevice->Open(_Address, Mode); + } } else { 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 484dc71a67..8a0188128d 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 @@ -59,15 +59,18 @@ it failed) extern std::queue > g_ReplyQueueLater; - // ********************************************************************************** // Handle /dev/net/kd/request requests CWII_IPC_HLE_Device_net_kd_request::CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) -{} + , m_UserID("Dolphin-EMU") + // TODO: Dump the true ID from real Wii +{ +} CWII_IPC_HLE_Device_net_kd_request::~CWII_IPC_HLE_Device_net_kd_request() -{} +{ +} bool CWII_IPC_HLE_Device_net_kd_request::Open(u32 _CommandAddress, u32 _Mode) { @@ -123,7 +126,8 @@ bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress) break; case IOCTL_NWC24_REQUEST_GENERATED_USER_ID: // (Input: none, Output: 32 bytes) - PanicAlert("IOCTL_NWC24_REQUEST_GENERATED_USER_ID"); + INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_REQUEST_GENERATED_USER_ID"); + memcpy(Memory::GetPointer(BufferOut), m_UserID.c_str(), m_UserID.length() + 1); break; case IOCTL_NWC24_GET_SCHEDULAR_STAT: @@ -156,10 +160,12 @@ bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress) // Handle /dev/net/ncd/manage requests CWII_IPC_HLE_Device_net_ncd_manage::CWII_IPC_HLE_Device_net_ncd_manage(u32 _DeviceID, const std::string& _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) -{} +{ +} CWII_IPC_HLE_Device_net_ncd_manage::~CWII_IPC_HLE_Device_net_ncd_manage() -{} +{ +} bool CWII_IPC_HLE_Device_net_ncd_manage::Open(u32 _CommandAddress, u32 _Mode) { 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 41dbead2d9..08c7d2b26f 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 @@ -61,6 +61,9 @@ private: IOCTL_NWC24_SET_SCRIPT_MODE = 0x22, IOCTL_NWC24_REQUEST_SHUTDOWN = 0x28, }; + + // Max size 32 Bytes + std::string m_UserID; }; // **********************************************************************************