Fix indentation issues

This commit is contained in:
Pierre Bourdon 2013-08-25 02:41:02 +02:00
parent 5548e77438
commit 987f4945b5
9 changed files with 301 additions and 306 deletions

View File

@ -29,7 +29,7 @@
0x12: Mario Kart
0x14: Mario Kart: But only if we don't return a zeroed out buffer for the 0x12 question,
and instead answer for example 1 will this question appear.
*/
// =============
@ -57,10 +57,10 @@
std::string CWII_IPC_HLE_Device_es::m_ContentFile;
CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
, m_pContentLoader(NULL)
, m_TitleID(-1)
, AccessIdentID(0x6000000)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
, m_pContentLoader(NULL)
, m_TitleID(-1)
, AccessIdentID(0x6000000)
{
}
@ -392,10 +392,10 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
}
break;
case IOCTL_ES_SETUID:
{
_dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_SETUID no in buffer");
_dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0, "IOCTL_ES_SETUID has a payload, it shouldn't");
case IOCTL_ES_SETUID:
{
_dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_SETUID no in buffer");
_dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0, "IOCTL_ES_SETUID has a payload, it shouldn't");
// TODO: fs permissions based on this
u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
INFO_LOG(WII_IPC_ES, "IOCTL_ES_SETUID titleID: %08x/%08x", (u32)(TitleID>>32), (u32)TitleID);
@ -849,51 +849,52 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
Memory::Write_U32(ES_PARAMTER_SIZE_OR_ALIGNMENT , _CommandAddress + 0x4);
return true;
case IOCTL_ES_GETDEVICECERT: // (Input: none, Output: 384 bytes)
{
WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETDEVICECERT");
_dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1);
u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
EcWii &ec = EcWii::GetInstance();
get_ng_cert(destination, ec.getNgId(), ec.getNgKeyId(), ec.getNgPriv(), ec.getNgSig());
break;
}
case IOCTL_ES_GETDEVICECERT: // (Input: none, Output: 384 bytes)
{
WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETDEVICECERT");
_dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1);
u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
EcWii &ec = EcWii::GetInstance();
get_ng_cert(destination, ec.getNgId(), ec.getNgKeyId(), ec.getNgPriv(), ec.getNgSig());
}
break;
case IOCTL_ES_SIGN:
{
WARN_LOG(WII_IPC_ES, "IOCTL_ES_SIGN");
u8 *ap_cert_out = Memory::GetPointer(Buffer.PayloadBuffer[1].m_Address);
u8 *data = Memory::GetPointer(Buffer.InBuffer[0].m_Address);
u32 data_size = Buffer.InBuffer[0].m_Size;
u8 *sig_out = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
EcWii &ec = EcWii::GetInstance();
get_ap_sig_and_cert(sig_out, ap_cert_out, m_TitleID, data, data_size, ec.getNgPriv(), ec.getNgId());
{
WARN_LOG(WII_IPC_ES, "IOCTL_ES_SIGN");
u8 *ap_cert_out = Memory::GetPointer(Buffer.PayloadBuffer[1].m_Address);
u8 *data = Memory::GetPointer(Buffer.InBuffer[0].m_Address);
u32 data_size = Buffer.InBuffer[0].m_Size;
u8 *sig_out = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
EcWii &ec = EcWii::GetInstance();
get_ap_sig_and_cert(sig_out, ap_cert_out, m_TitleID, data, data_size, ec.getNgPriv(), ec.getNgId());
}
break;
}
case IOCTL_ES_GETBOOT2VERSION:
{
WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETBOOT2VERSION");
Memory::Write_U32(4, Buffer.PayloadBuffer[0].m_Address); // as of 26/02/2012, this was latest bootmii version
{
WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETBOOT2VERSION");
Memory::Write_U32(4, Buffer.PayloadBuffer[0].m_Address); // as of 26/02/2012, this was latest bootmii version
}
break;
}
// ===============================================================================================
// unsupported functions
// ===============================================================================================
// ===============================================================================================
// unsupported functions
// ===============================================================================================
case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes) bug crediar :D
WARN_LOG(WII_IPC_ES, "IOCTL_ES_DIGETTICKETVIEW: this looks really wrong...");
break;
case IOCTL_ES_GETOWNEDTITLECNT:
WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETOWNEDTITLECNT");
WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETOWNEDTITLECNT");
Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address);
break;
default:
WARN_LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter);
default:
WARN_LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter);
DumpCommands(_CommandAddress, 8, LogTypes::WII_IPC_ES);
INFO_LOG(WII_IPC_ES, "command.Parameter: 0x%08x", Buffer.Parameter);
break;

View File

@ -28,112 +28,111 @@ public:
// This should only be cleared on power reset
static std::string m_ContentFile;
private:
enum
{
IOCTL_ES_ADDTICKET = 0x01,
IOCTL_ES_ADDTITLESTART = 0x02,
IOCTL_ES_ADDCONTENTSTART = 0x03,
IOCTL_ES_ADDCONTENTDATA = 0x04,
IOCTL_ES_ADDCONTENTFINISH = 0x05,
IOCTL_ES_ADDTITLEFINISH = 0x06,
IOCTL_ES_GETDEVICEID = 0x07,
IOCTL_ES_LAUNCH = 0x08,
IOCTL_ES_OPENCONTENT = 0x09,
IOCTL_ES_READCONTENT = 0x0A,
IOCTL_ES_CLOSECONTENT = 0x0B,
IOCTL_ES_GETOWNEDTITLECNT = 0x0C,
IOCTL_ES_GETOWNEDTITLES = 0x0D,
IOCTL_ES_GETTITLECNT = 0x0E,
IOCTL_ES_GETTITLES = 0x0F,
IOCTL_ES_GETTITLECONTENTSCNT = 0x10,
IOCTL_ES_GETTITLECONTENTS = 0x11,
IOCTL_ES_GETVIEWCNT = 0x12,
IOCTL_ES_GETVIEWS = 0x13,
IOCTL_ES_GETTMDVIEWCNT = 0x14,
IOCTL_ES_GETTMDVIEWS = 0x15,
IOCTL_ES_GETCONSUMPTION = 0x16,
IOCTL_ES_DELETETITLE = 0x17,
IOCTL_ES_DELETETICKET = 0x18,
// IOCTL_ES_DIGETTMDVIEWSIZE = 0x19,
// IOCTL_ES_DIGETTMDVIEW = 0x1A,
IOCTL_ES_DIGETTICKETVIEW = 0x1B,
IOCTL_ES_DIVERIFY = 0x1C,
IOCTL_ES_GETTITLEDIR = 0x1D,
IOCTL_ES_GETDEVICECERT = 0x1E,
IOCTL_ES_IMPORTBOOT = 0x1F,
IOCTL_ES_GETTITLEID = 0x20,
IOCTL_ES_SETUID = 0x21,
IOCTL_ES_DELETETITLECONTENT = 0x22,
IOCTL_ES_SEEKCONTENT = 0x23,
IOCTL_ES_OPENTITLECONTENT = 0x24,
// IOCTL_ES_LAUNCHBC = 0x25,
// IOCTL_ES_EXPORTTITLEINIT = 0x26,
// IOCTL_ES_EXPORTCONTENTBEGIN = 0x27,
// IOCTL_ES_EXPORTCONTENTDATA = 0x28,
// IOCTL_ES_EXPORTCONTENTEND = 0x29,
// IOCTL_ES_EXPORTTITLEDONE = 0x2A,
IOCTL_ES_ADDTMD = 0x2B,
IOCTL_ES_ENCRYPT = 0x2C,
IOCTL_ES_DECRYPT = 0x2D,
IOCTL_ES_GETBOOT2VERSION = 0x2E,
IOCTL_ES_ADDTITLECANCEL = 0x2F,
IOCTL_ES_SIGN = 0x30,
// IOCTL_ES_VERIFYSIGN = 0x31,
IOCTL_ES_GETSTOREDCONTENTCNT = 0x32,
IOCTL_ES_GETSTOREDCONTENTS = 0x33,
IOCTL_ES_GETSTOREDTMDSIZE = 0x34,
IOCTL_ES_GETSTOREDTMD = 0x35,
IOCTL_ES_GETSHAREDCONTENTCNT = 0x36,
IOCTL_ES_GETSHAREDCONTENTS = 0x37,
enum
{
IOCTL_ES_ADDTICKET = 0x01,
IOCTL_ES_ADDTITLESTART = 0x02,
IOCTL_ES_ADDCONTENTSTART = 0x03,
IOCTL_ES_ADDCONTENTDATA = 0x04,
IOCTL_ES_ADDCONTENTFINISH = 0x05,
IOCTL_ES_ADDTITLEFINISH = 0x06,
IOCTL_ES_GETDEVICEID = 0x07,
IOCTL_ES_LAUNCH = 0x08,
IOCTL_ES_OPENCONTENT = 0x09,
IOCTL_ES_READCONTENT = 0x0A,
IOCTL_ES_CLOSECONTENT = 0x0B,
IOCTL_ES_GETOWNEDTITLECNT = 0x0C,
IOCTL_ES_GETOWNEDTITLES = 0x0D,
IOCTL_ES_GETTITLECNT = 0x0E,
IOCTL_ES_GETTITLES = 0x0F,
IOCTL_ES_GETTITLECONTENTSCNT = 0x10,
IOCTL_ES_GETTITLECONTENTS = 0x11,
IOCTL_ES_GETVIEWCNT = 0x12,
IOCTL_ES_GETVIEWS = 0x13,
IOCTL_ES_GETTMDVIEWCNT = 0x14,
IOCTL_ES_GETTMDVIEWS = 0x15,
IOCTL_ES_GETCONSUMPTION = 0x16,
IOCTL_ES_DELETETITLE = 0x17,
IOCTL_ES_DELETETICKET = 0x18,
// IOCTL_ES_DIGETTMDVIEWSIZE = 0x19,
// IOCTL_ES_DIGETTMDVIEW = 0x1A,
IOCTL_ES_DIGETTICKETVIEW = 0x1B,
IOCTL_ES_DIVERIFY = 0x1C,
IOCTL_ES_GETTITLEDIR = 0x1D,
IOCTL_ES_GETDEVICECERT = 0x1E,
IOCTL_ES_IMPORTBOOT = 0x1F,
IOCTL_ES_GETTITLEID = 0x20,
IOCTL_ES_SETUID = 0x21,
IOCTL_ES_DELETETITLECONTENT = 0x22,
IOCTL_ES_SEEKCONTENT = 0x23,
IOCTL_ES_OPENTITLECONTENT = 0x24,
// IOCTL_ES_LAUNCHBC = 0x25,
// IOCTL_ES_EXPORTTITLEINIT = 0x26,
// IOCTL_ES_EXPORTCONTENTBEGIN = 0x27,
// IOCTL_ES_EXPORTCONTENTDATA = 0x28,
// IOCTL_ES_EXPORTCONTENTEND = 0x29,
// IOCTL_ES_EXPORTTITLEDONE = 0x2A,
IOCTL_ES_ADDTMD = 0x2B,
IOCTL_ES_ENCRYPT = 0x2C,
IOCTL_ES_DECRYPT = 0x2D,
IOCTL_ES_GETBOOT2VERSION = 0x2E,
IOCTL_ES_ADDTITLECANCEL = 0x2F,
IOCTL_ES_SIGN = 0x30,
// IOCTL_ES_VERIFYSIGN = 0x31,
IOCTL_ES_GETSTOREDCONTENTCNT = 0x32,
IOCTL_ES_GETSTOREDCONTENTS = 0x33,
IOCTL_ES_GETSTOREDTMDSIZE = 0x34,
IOCTL_ES_GETSTOREDTMD = 0x35,
IOCTL_ES_GETSHAREDCONTENTCNT = 0x36,
IOCTL_ES_GETSHAREDCONTENTS = 0x37,
IOCTL_ES_DELETESHAREDCONTENT = 0x38,
IOCTL_ES_CHECKKOREAREGION = 0x45,
};
};
enum EErrorCodes
{
ES_INVALID_TMD = -106, // or access denied
ES_READ_LESS_DATA_THAN_EXPECTED = -1009,
ES_WRITE_FAILURE = -1010,
ES_PARAMTER_SIZE_OR_ALIGNMENT = -1017,
ES_HASH_DOESNT_MATCH = -1022,
ES_MEM_ALLOC_FAILED = -1024,
ES_INCORRECT_ACCESS_RIGHT = -1026,
ES_NO_TICKET_INSTALLED = -1028,
ES_INSTALLED_TICKET_INVALID = -1029,
ES_INVALID_PARAMETR = -2008,
ES_SIGNATURE_CHECK_FAILED = -2011,
ES_HASH_SIZE_WRONG = -2014, // HASH !=20
};
enum EErrorCodes
{
ES_INVALID_TMD = -106, // or access denied
ES_READ_LESS_DATA_THAN_EXPECTED = -1009,
ES_WRITE_FAILURE = -1010,
ES_PARAMTER_SIZE_OR_ALIGNMENT = -1017,
ES_HASH_DOESNT_MATCH = -1022,
ES_MEM_ALLOC_FAILED = -1024,
ES_INCORRECT_ACCESS_RIGHT = -1026,
ES_NO_TICKET_INSTALLED = -1028,
ES_INSTALLED_TICKET_INVALID = -1029,
ES_INVALID_PARAMETR = -2008,
ES_SIGNATURE_CHECK_FAILED = -2011,
ES_HASH_SIZE_WRONG = -2014, // HASH !=20
};
struct SContentAccess
{
u32 m_Position;
const DiscIO::SNANDContent* m_pContent;
};
struct SContentAccess
{
u32 m_Position;
const DiscIO::SNANDContent* m_pContent;
};
typedef std::map<u32, SContentAccess> CContentAccessMap;
CContentAccessMap m_ContentAccessMap;
typedef std::map<u32, SContentAccess> CContentAccessMap;
CContentAccessMap m_ContentAccessMap;
typedef std::map<u64, const DiscIO::INANDContentLoader*> CTitleToContentMap;
CTitleToContentMap m_NANDContent;
typedef std::map<u64, const DiscIO::INANDContentLoader*> CTitleToContentMap;
CTitleToContentMap m_NANDContent;
const DiscIO::INANDContentLoader* m_pContentLoader;
const DiscIO::INANDContentLoader* m_pContentLoader;
std::vector<u64> m_TitleIDs;
u64 m_TitleID;
u32 AccessIdentID;
std::vector<u64> m_TitleIDs;
u64 m_TitleID;
u32 AccessIdentID;
static u8 *keyTable[11];
u64 GetCurrentTitleID() const;
u64 GetCurrentTitleID() const;
const DiscIO::INANDContentLoader& AccessContentDevice(u64 _TitleID);
bool IsValid(u64 _TitleID) const;
const DiscIO::INANDContentLoader& AccessContentDevice(u64 _TitleID);
bool IsValid(u64 _TitleID) const;
typedef struct ecc_cert_t
{

View File

@ -381,7 +381,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
OffsetBuffer += Align(wii_device.bLength, 4);
bool deviceValid = true;
for (c = 0; deviceValid && c < desc.bNumConfigurations; c++)
for (c = 0; deviceValid && c < desc.bNumConfigurations; c++)
{
struct libusb_config_descriptor *config = NULL;
int cRet = libusb_get_config_descriptor(device, c, &config);

View File

@ -43,21 +43,20 @@ public:
virtual bool IOCtlV(u32 _CommandAddress);
virtual bool IOCtl(u32 _CommandAddress);
private:
private:
enum
{
IOCTL_HID_GET_ATTACHED = 0x00,
IOCTL_HID_SET_SUSPEND = 0x01,
IOCTL_HID_CONTROL = 0x02,
IOCTL_HID_INTERRUPT_IN = 0x03,
IOCTL_HID_INTERRUPT_OUT = 0x04,
IOCTL_HID_GET_US_STRING = 0x05,
IOCTL_HID_OPEN = 0x06,
IOCTL_HID_SHUTDOWN = 0x07,
IOCTL_HID_CANCEL_INTERRUPT = 0x08,
};
{
IOCTL_HID_GET_ATTACHED = 0x00,
IOCTL_HID_SET_SUSPEND = 0x01,
IOCTL_HID_CONTROL = 0x02,
IOCTL_HID_INTERRUPT_IN = 0x03,
IOCTL_HID_INTERRUPT_OUT = 0x04,
IOCTL_HID_GET_US_STRING = 0x05,
IOCTL_HID_OPEN = 0x06,
IOCTL_HID_SHUTDOWN = 0x07,
IOCTL_HID_CANCEL_INTERRUPT = 0x08,
};
/* Device descriptor */
typedef struct
@ -119,11 +118,9 @@ private:
u8 pad[1];
} WiiHIDEndpointDescriptor;
u32 deviceCommandAddress;
void FillOutDevices(u32 BufferOut, u32 BufferOutSize);
int GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 bus, u8 port, u16 check);
bool ClaimDevice(libusb_device_handle * dev);
void ConvertDeviceToWii(WiiHIDDeviceDescriptor *dest, const struct libusb_device_descriptor *src);

View File

@ -103,40 +103,40 @@ static int
_verify_certificate_callback (void *data, x509_cert *crt, int depth, int *flags)
{
char buf[1024];
((void) data);
((void) data);
std::string verify_info = StringFromFormat(
"Verify requested for (Depth %d):\n", depth);
x509parse_cert_info( buf, sizeof( buf ) - 1, "", crt );
x509parse_cert_info( buf, sizeof( buf ) - 1, "", crt );
verify_info += buf;
if ( ( (*flags) & BADCERT_EXPIRED ) != 0 )
verify_info += " ! server certificate has expired";
if ( ( (*flags) & BADCERT_EXPIRED ) != 0 )
verify_info += " ! server certificate has expired";
if ( ( (*flags) & BADCERT_REVOKED ) != 0 )
verify_info += " ! server certificate has been revoked";
if ( ( (*flags) & BADCERT_REVOKED ) != 0 )
verify_info += " ! server certificate has been revoked";
if ( ( (*flags) & BADCERT_CN_MISMATCH ) != 0 )
verify_info += " ! CN mismatch\n";
if ( ( (*flags) & BADCERT_CN_MISMATCH ) != 0 )
verify_info += " ! CN mismatch\n";
if ( ( (*flags) & BADCERT_NOT_TRUSTED ) != 0 )
verify_info += " ! self-signed or not signed by a trusted CA\n";
if ( ( (*flags) & BADCERT_NOT_TRUSTED ) != 0 )
verify_info += " ! self-signed or not signed by a trusted CA\n";
if ( ( (*flags) & BADCRL_NOT_TRUSTED ) != 0 )
verify_info += " ! CRL not trusted\n";
if ( ( (*flags) & BADCRL_NOT_TRUSTED ) != 0 )
verify_info += " ! CRL not trusted\n";
if ( ( (*flags) & BADCRL_EXPIRED ) != 0 )
verify_info += " ! CRL expired\n";
if ( ( (*flags) & BADCRL_EXPIRED ) != 0 )
verify_info += " ! CRL expired\n";
if ( ( (*flags) & BADCERT_OTHER ) != 0 )
verify_info += " ! other (unknown) flag\n";
if ( ( (*flags) & BADCERT_OTHER ) != 0 )
verify_info += " ! other (unknown) flag\n";
if ( ( *flags ) == 0 )
verify_info += " This certificate has no flags\n";
WARN_LOG(WII_IPC_SSL, "%s", verify_info.c_str() );
if ( ( *flags ) == 0 )
verify_info += " This certificate has no flags\n";
return( 0 );
WARN_LOG(WII_IPC_SSL, "%s", verify_info.c_str() );
return( 0 );
}
bool CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)

View File

@ -48,23 +48,23 @@ enum ssl_err_t
enum SSL_IOCTL
{
IOCTLV_NET_SSL_NEW = 0x01,
IOCTLV_NET_SSL_CONNECT = 0x02,
IOCTLV_NET_SSL_DOHANDSHAKE = 0x03,
IOCTLV_NET_SSL_READ = 0x04,
IOCTLV_NET_SSL_WRITE = 0x05,
IOCTLV_NET_SSL_SHUTDOWN = 0x06,
IOCTLV_NET_SSL_SETCLIENTCERT = 0x07,
IOCTLV_NET_SSL_SETCLIENTCERTDEFAULT = 0x08,
IOCTLV_NET_SSL_REMOVECLIENTCERT = 0x09,
IOCTLV_NET_SSL_SETROOTCA = 0x0A,
IOCTLV_NET_SSL_SETROOTCADEFAULT = 0x0B,
IOCTLV_NET_SSL_DOHANDSHAKEEX = 0x0C,
IOCTLV_NET_SSL_SETBUILTINROOTCA = 0x0D,
IOCTLV_NET_SSL_SETBUILTINCLIENTCERT = 0x0E,
IOCTLV_NET_SSL_DISABLEVERIFYOPTIONFORDEBUG = 0x0F,
IOCTLV_NET_SSL_DEBUGGETVERSION = 0x14,
IOCTLV_NET_SSL_DEBUGGETTIME = 0x15,
IOCTLV_NET_SSL_NEW = 0x01,
IOCTLV_NET_SSL_CONNECT = 0x02,
IOCTLV_NET_SSL_DOHANDSHAKE = 0x03,
IOCTLV_NET_SSL_READ = 0x04,
IOCTLV_NET_SSL_WRITE = 0x05,
IOCTLV_NET_SSL_SHUTDOWN = 0x06,
IOCTLV_NET_SSL_SETCLIENTCERT = 0x07,
IOCTLV_NET_SSL_SETCLIENTCERTDEFAULT = 0x08,
IOCTLV_NET_SSL_REMOVECLIENTCERT = 0x09,
IOCTLV_NET_SSL_SETROOTCA = 0x0A,
IOCTLV_NET_SSL_SETROOTCADEFAULT = 0x0B,
IOCTLV_NET_SSL_DOHANDSHAKEEX = 0x0C,
IOCTLV_NET_SSL_SETBUILTINROOTCA = 0x0D,
IOCTLV_NET_SSL_SETBUILTINCLIENTCERT = 0x0E,
IOCTLV_NET_SSL_DISABLEVERIFYOPTIONFORDEBUG = 0x0F,
IOCTLV_NET_SSL_DEBUGGETVERSION = 0x14,
IOCTLV_NET_SSL_DEBUGGETTIME = 0x15,
};
typedef struct {
@ -83,23 +83,21 @@ class CWII_IPC_HLE_Device_net_ssl : public IWII_IPC_HLE_Device
{
public:
CWII_IPC_HLE_Device_net_ssl(u32 _DeviceID, const std::string& _rDeviceName);
CWII_IPC_HLE_Device_net_ssl(u32 _DeviceID, const std::string& _rDeviceName);
virtual ~CWII_IPC_HLE_Device_net_ssl();
virtual ~CWII_IPC_HLE_Device_net_ssl();
virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool Close(u32 _CommandAddress, bool _bForce);
virtual bool Close(u32 _CommandAddress, bool _bForce);
virtual bool IOCtl(u32 _CommandAddress);
virtual bool IOCtlV(u32 _CommandAddress);
virtual bool IOCtlV(u32 _CommandAddress);
int getSSLFreeID();
static WII_SSL _SSL[NET_SSL_MAXINSTANCES];
private:
u32 ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize);
u32 ExecuteCommandV(u32 _Parameter, SIOCtlVBuffer CommandBuffer);
};

View File

@ -99,8 +99,8 @@ void WiiSocket::setFd(s32 s)
// TODO: Remove on completion of async
#ifdef _WIN32
u_long iMode = 1;
int ioctlret = ioctlsocket(fd, FIONBIO, &iMode);
u_long iMode = 1;
int ioctlret = ioctlsocket(fd, FIONBIO, &iMode);
u32 millis = 3000;
#else
int flags;

View File

@ -169,7 +169,7 @@ private:
public:
WiiSocket() : fd(-1), nonBlock(false) {}
~WiiSocket();
void operator=(WiiSocket const&); // Don't implement
void operator=(WiiSocket const&); // Don't implement
};
@ -208,9 +208,9 @@ public:
}
private:
WiiSockMan() {}; // Constructor? (the {} brackets) are needed here.
WiiSockMan(WiiSockMan const&); // Don't Implement
void operator=(WiiSockMan const&); // Don't implement
WiiSockMan() {}; // Constructor? (the {} brackets) are needed here.
WiiSockMan(WiiSockMan const&); // Don't Implement
void operator=(WiiSockMan const&); // Don't implement
std::unordered_map<s32, WiiSocket> WiiSockets;
};

View File

@ -30,9 +30,9 @@
#include <stdlib.h>
typedef struct pollfd {
int fd; /* file desc to poll */
int events; /* events of interest on fd */
int revents; /* events that occurred on fd */
int fd; /* file desc to poll */
int events; /* events of interest on fd */
int revents; /* events that occurred on fd */
} pollfd_t;
#define EINVAL 22
@ -55,112 +55,112 @@ typedef struct pollfd {
inline int poll(struct pollfd *pollSet, int pollCount, int pollTimeout)
{
struct timeval tv;
struct timeval *tvp;
fd_set readFDs, writeFDs, exceptFDs;
fd_set *readp, *writep, *exceptp;
struct pollfd *pollEnd, *p;
int selected;
int result;
int maxFD;
struct timeval tv;
struct timeval *tvp;
fd_set readFDs, writeFDs, exceptFDs;
fd_set *readp, *writep, *exceptp;
struct pollfd *pollEnd, *p;
int selected;
int result;
int maxFD;
if (!pollSet) {
pollEnd = NULL;
readp = NULL;
writep = NULL;
exceptp = NULL;
maxFD = 0;
}
else {
pollEnd = pollSet + pollCount;
readp = &readFDs;
writep = &writeFDs;
exceptp = &exceptFDs;
if (!pollSet) {
pollEnd = NULL;
readp = NULL;
writep = NULL;
exceptp = NULL;
maxFD = 0;
}
else {
pollEnd = pollSet + pollCount;
readp = &readFDs;
writep = &writeFDs;
exceptp = &exceptFDs;
FD_ZERO(readp);
FD_ZERO(writep);
FD_ZERO(exceptp);
// Find the biggest fd in the poll set
maxFD = 0;
for (p = pollSet; p < pollEnd; p++) {
if (p->fd > maxFD) maxFD = p->fd;
}
// Transcribe flags from the poll set to the fd sets
for (p = pollSet; p < pollEnd; p++) {
if (p->fd < 0) {
// Negative fd checks nothing and always reports zero
} else {
if (p->events & POLLIN) FD_SET(p->fd, readp);
if (p->events & POLLOUT) FD_SET(p->fd, writep);
if (p->events != 0) FD_SET(p->fd, exceptp);
// POLLERR is never set coming in; poll() always reports errors
// But don't report if we're not listening to anything at all.
}
}
}
// poll timeout is in milliseconds. Convert to struct timeval.
// poll timeout == -1 : wait forever : select timeout of NULL
// poll timeout == 0 : return immediately : select timeout of zero
if (pollTimeout >= 0) {
tv.tv_sec = pollTimeout / 1000;
tv.tv_usec = (pollTimeout % 1000) * 1000;
tvp = &tv;
} else {
tvp = NULL;
}
selected = select(maxFD+1, readp, writep, exceptp, tvp);
FD_ZERO(readp);
FD_ZERO(writep);
FD_ZERO(exceptp);
// Find the biggest fd in the poll set
maxFD = 0;
for (p = pollSet; p < pollEnd; p++) {
if (p->fd > maxFD) maxFD = p->fd;
}
if (selected < 0) {
// Error during select
result = -1;
}
else if (selected > 0) {
// Select found something
// Transcribe result from fd sets to poll set.
// Also count the number of selected fds. poll returns the
// number of ready fds; select returns the number of bits set.
int polled = 0;
for (p = pollSet; p < pollEnd; p++) {
p->revents = 0;
if (p->fd < 0) {
// Negative fd always reports zero
} else {
int isToRead = FD_ISSET(p->fd, readp);
if ((p->events & POLLIN) && isToRead) {
p->revents |= POLLIN;
}
int isToWrite = FD_ISSET(p->fd, writep);
if ((p->events & POLLOUT) && isToWrite) {
p->revents |= POLLOUT;
}
int isToError = FD_ISSET(p->fd, exceptp);
if ((p->events != 0) && isToError) {
p->revents |= POLLERR;
}
if (p->revents) polled++;
}
// Transcribe flags from the poll set to the fd sets
for (p = pollSet; p < pollEnd; p++) {
if (p->fd < 0) {
// Negative fd checks nothing and always reports zero
} else {
if (p->events & POLLIN) FD_SET(p->fd, readp);
if (p->events & POLLOUT) FD_SET(p->fd, writep);
if (p->events != 0) FD_SET(p->fd, exceptp);
// POLLERR is never set coming in; poll() always reports errors
// But don't report if we're not listening to anything at all.
}
}
}
result = polled;
}
else {
// selected == 0, select timed out before anything happened
// Clear all result bits and return zero.
for (p = pollSet; p < pollEnd; p++) {
p->revents = 0;
}
result = 0;
}
return result;
// poll timeout is in milliseconds. Convert to struct timeval.
// poll timeout == -1 : wait forever : select timeout of NULL
// poll timeout == 0 : return immediately : select timeout of zero
if (pollTimeout >= 0) {
tv.tv_sec = pollTimeout / 1000;
tv.tv_usec = (pollTimeout % 1000) * 1000;
tvp = &tv;
} else {
tvp = NULL;
}
selected = select(maxFD+1, readp, writep, exceptp, tvp);
if (selected < 0) {
// Error during select
result = -1;
}
else if (selected > 0) {
// Select found something
// Transcribe result from fd sets to poll set.
// Also count the number of selected fds. poll returns the
// number of ready fds; select returns the number of bits set.
int polled = 0;
for (p = pollSet; p < pollEnd; p++) {
p->revents = 0;
if (p->fd < 0) {
// Negative fd always reports zero
} else {
int isToRead = FD_ISSET(p->fd, readp);
if ((p->events & POLLIN) && isToRead) {
p->revents |= POLLIN;
}
int isToWrite = FD_ISSET(p->fd, writep);
if ((p->events & POLLOUT) && isToWrite) {
p->revents |= POLLOUT;
}
int isToError = FD_ISSET(p->fd, exceptp);
if ((p->events != 0) && isToError) {
p->revents |= POLLERR;
}
if (p->revents) polled++;
}
}
result = polled;
}
else {
// selected == 0, select timed out before anything happened
// Clear all result bits and return zero.
for (p = pollSet; p < pollEnd; p++) {
p->revents = 0;
}
result = 0;
}
return result;
}
#ifdef _MSC_VER