[Kernel/XAM] 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 Rick Gibbed
parent 40bbf704e0
commit 57764f6bea
1 changed files with 44 additions and 4 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];
@ -542,14 +561,35 @@ 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 out_ptr) {
// Non-zero is error.
return 1;
lpdword_t pqos) {
// Set pqos as some games will try accessing it despite non-successful result
if (pqos) {
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);
assert_not_null(ev);
ev->Set(0, false);
}
return 0;
}
DECLARE_XAM_EXPORT1(NetDll_XNetQosServiceLookup, kNetworking, kStub);
dword_result_t NetDll_XNetQosRelease(dword_t caller, pointer_t<XNQOS> qos) {
if (!qos) {
return X_STATUS_INVALID_PARAMETER;
}
kernel_memory()->SystemHeapFree(qos.guest_address());
return 0;
}
DECLARE_XAM_EXPORT1(NetDll_XNetQosRelease, kNetworking, kStub);
dword_result_t NetDll_XNetQosListen(dword_t caller, lpvoid_t id, lpvoid_t data,
dword_t data_size, dword_t r7,
dword_t flags) {