Improve NetDll_XNetQosServiceLookup stub, implement NetDll_XNetQosRelease Needed for Saints Row 1 (TU1) to start up properly

This commit is contained in:
emoose 2021-01-04 15:55:19 +00:00 committed by Gliniak
parent 9785954a66
commit e2d3c07be0
1 changed files with 26 additions and 9 deletions

View File

@ -63,6 +63,25 @@ typedef struct {
in_addr aina[8];
} XNDNS;
typedef struct {
uint8_t flags;
uint8_t reserved;
xe::be<uint16_t> probes_xmit;
xe::be<uint16_t> probes_recv;
xe::be<uint16_t> data_len;
xe::be<uint32_t> data_ptr;
xe::be<uint16_t> rtt_min_in_msecs;
xe::be<uint16_t> rtt_med_in_msecs;
xe::be<uint32_t> up_bits_per_sec;
xe::be<uint32_t> down_bits_per_sec;
} XNQOSINFO;
typedef struct {
xe::be<uint32_t> count;
xe::be<uint32_t> count_pending;
XNQOSINFO info[1];
} XNQOS;
struct Xsockaddr_t {
xe::be<uint16_t> sa_family;
char sa_data[14];
@ -544,18 +563,16 @@ dword_result_t NetDll_XNetDnsRelease(dword_t caller, pointer_t<XNDNS> dns) {
}
DECLARE_XAM_EXPORT1(NetDll_XNetDnsRelease, kNetworking, kStub);
dword_result_t NetDll_XNetQosServiceLookup(dword_t caller, dword_t zero,
dword_result_t NetDll_XNetQosServiceLookup(dword_t caller, dword_t flags,
dword_t event_handle,
lpdword_t pqos) {
// TODO: actually implement this
// Set pqos as some games will try accessing it despite non-successful result
if (pqos) {
// TODO: XNQOS struct? seems to be 0x20 bytes
auto out_guest = kernel_memory()->SystemHeapAlloc(0x20);
auto out = kernel_memory()->TranslateVirtual<uint8_t*>(out_guest);
memset(out, 0, 0x20);
*pqos = out_guest;
auto qos_guest = kernel_memory()->SystemHeapAlloc(sizeof(XNQOS));
auto qos = kernel_memory()->TranslateVirtual<XNQOS*>(qos_guest);
qos->count = qos->count_pending = 0;
*pqos = qos_guest;
}
if (event_handle) {
auto ev =
kernel_state()->object_table()->LookupObject<XEvent>(event_handle);
@ -566,7 +583,7 @@ dword_result_t NetDll_XNetQosServiceLookup(dword_t caller, dword_t zero,
}
DECLARE_XAM_EXPORT1(NetDll_XNetQosServiceLookup, kNetworking, kStub);
dword_result_t NetDll_XNetQosRelease(dword_t caller, pointer_t<uint8_t> qos) {
dword_result_t NetDll_XNetQosRelease(dword_t caller, pointer_t<XNQOS> qos) {
if (!qos) {
return X_STATUS_INVALID_PARAMETER;
}