Revert the threading of wii-network.

This rolls back to commit bca2cac640.
This commit is contained in:
skidau 2013-03-27 12:58:04 +11:00
parent ebf79a8865
commit d33c19b0cd
3 changed files with 817 additions and 1104 deletions

View File

@ -535,14 +535,14 @@ void ExecuteCommand(u32 _Address)
}
}
// It seems that the original hardware overwrites the command after it has been
// executed. We write 8 which is not any valid command, and what IOS does
Memory::Write_U32(8, _Address);
// IOS seems to write back the command that was responded to
Memory::Write_U32(Command, _Address + 8);
if (CmdSuccess)
{
// It seems that the original hardware overwrites the command after it has been
// executed. We write 8 which is not any valid command, and what IOS does
Memory::Write_U32(8, _Address);
// IOS seems to write back the command that was responded to
Memory::Write_U32(Command, _Address + 8);
// Ensure replies happen in order, fairly ugly
// Without this, tons of games fail now that DI commads have different reply delays
int reply_delay = pDevice ? pDevice->GetCmdDelay(_Address) : 0;

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,6 @@
#include <ws2tcpip.h>
#endif
#include "Timer.h"
#include "Thread.h"
#include "FileUtil.h"
// data layout of the network configuration file (/shared2/sys/net/02/config.dat)
@ -569,54 +568,6 @@ private:
}
};
class _tSocket
{
public:
bool running;
std::mutex m_mutex;
std::thread* thread;
_tSocket()
{
running = true;
}
bool getCommand(u32& commandAddress)
{
std::lock_guard<std::mutex> lk(m_mutex);
if (commands.empty())
return false;
commandAddress = commands.front();
commands.pop();
return true;
}
void addCommand(u32 commandAddress)
{
std::lock_guard<std::mutex> lk(m_mutex);
commands.push(commandAddress);
event.Set();
}
void StopAndJoin()
{
running = false;
event.Set();
thread->join();
delete thread;
thread = NULL;
}
void WaitForEvent()
{
event.Wait();
}
private:
Common::Event event;
std::queue<u32> commands;
};
//////////////////////////////////////////////////////////////////////////
class CWII_IPC_HLE_Device_net_ip_top : public IWII_IPC_HLE_Device
{
@ -634,11 +585,6 @@ private:
#ifdef _WIN32
WSADATA InitData;
#endif
std::map<u32, _tSocket*> socketMap;
std::mutex socketMapMutex;
void processSocket(u32 socket);
s32 processSocketIoctl(u32 CommandAddress, u32 socket);
s32 processSocketIoctlv(u32 CommandAddress, u32 socket);
enum
{
@ -683,39 +629,6 @@ private:
u32 ExecuteCommandV(SIOCtlVBuffer& CommandBuffer);
};
static int getNetErrorCode(int ret, std::string caller, bool isRW);
struct bind_params
{
u32 socket;
u32 has_name;
u8 name[28];
};
struct GC_sockaddr
{
u8 sa_len;
u8 sa_family;
s8 sa_data[14];
};
struct GC_in_addr
{
// this cannot be named s_addr under windows - collides with some crazy define.
u32 s_addr_;
};
struct GC_sockaddr_in
{
u8 sin_len;
u8 sin_family;
u16 sin_port;
struct GC_in_addr sin_addr;
s8 sin_zero[8];
};
// **********************************************************************************
// 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