From afde40ab6c95e5c53e6c2072469165b86dd3fdb2 Mon Sep 17 00:00:00 2001 From: Cancerous Date: Mon, 19 Aug 2019 12:35:01 -0400 Subject: [PATCH] XAM fixes. Updated PR from Permanulled PR #1150. - [XAM] Stub XGI messages. - [XAM] Stub XLiveBase GetServiceInfo message. - [XAM] Stub error out of NetDll_WSARecvFrom. - [XAM] Stub XamSessionRefObjByHandle. Improves Aegis Wings, Jetpac, Metal Slug 3, and State of Decay. Co-authored-by: PermaNulled --- src/xenia/kernel/xam/apps/xgi_app.cc | 19 ++++++++++++++++--- src/xenia/kernel/xam/apps/xlivebase_app.cc | 18 ++++++++++++++---- src/xenia/kernel/xam/xam_net.cc | 6 ++++-- src/xenia/kernel/xam/xam_user.cc | 6 ++++-- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/xenia/kernel/xam/apps/xgi_app.cc b/src/xenia/kernel/xam/apps/xgi_app.cc index c77665209..771341cdb 100644 --- a/src/xenia/kernel/xam/apps/xgi_app.cc +++ b/src/xenia/kernel/xam/apps/xgi_app.cc @@ -2,7 +2,7 @@ ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** - * Copyright 2015 Ben Vanik. All rights reserved. * + * Copyright 2021 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ @@ -80,8 +80,10 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, return X_E_SUCCESS; } case 0x000B0011: { - // TODO(DrChat): Figure out what this is again - } break; + // TODO(PermaNull): reverse buffer contents. + XELOGD("XGISessionDelete"); + return X_STATUS_SUCCESS; + } case 0x000B0012: { assert_true(buffer_length == 0x14); uint32_t session_ptr = xe::load_and_swap(buffer + 0x0); @@ -95,6 +97,17 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, user_count, unk_0, user_index_array, private_slots_array); return X_E_SUCCESS; } + case 0x000B0014: { + // Gets Jetpac XBLA in game + // get high score table? + XELOGD("XGI_unknown"); + return X_STATUS_SUCCESS; + } + case 0x000B0015: { + // send high scores? + XELOGD("XGI_unknown"); + return X_STATUS_SUCCESS; + } case 0x000B0041: { assert_true(!buffer_length || buffer_length == 32); // 00000000 2789fecc 00000000 00000000 200491e0 00000000 200491f0 20049340 diff --git a/src/xenia/kernel/xam/apps/xlivebase_app.cc b/src/xenia/kernel/xam/apps/xlivebase_app.cc index d35692ca8..b8c72caf1 100644 --- a/src/xenia/kernel/xam/apps/xlivebase_app.cc +++ b/src/xenia/kernel/xam/apps/xlivebase_app.cc @@ -2,7 +2,7 @@ ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** - * Copyright 2015 Ben Vanik. All rights reserved. * + * Copyright 2021 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ @@ -41,18 +41,28 @@ X_HRESULT XLiveBaseApp::DispatchMessageSync(uint32_t message, xe::store_and_swap(buffer + 0, 1); // XONLINE_NAT_OPEN return X_E_SUCCESS; } + case 0x00058007: { + // Occurs if title calls XOnlineGetServiceInfo, expects dwServiceId + // and pServiceInfo. pServiceInfo should contain pointer to + // XONLINE_SERVICE_INFO structure. + XELOGD("CXLiveLogon::GetServiceInfo({:08X}, {:08X})", buffer_ptr, + buffer_length); + return 1229; // ERROR_CONNECTION_INVALID + } case 0x00058020: { // 0x00058004 is called right before this. // We should create a XamEnumerate-able empty list here, but I'm not // sure of the format. // buffer_length seems to be the same ptr sent to 0x00058004. - XELOGD("XLiveBaseFriendsCreateEnumerator({:08X}, {:08X}) unimplemented", + XELOGD("CXLiveFriends::Enumerate({:08X}, {:08X}) unimplemented", buffer_ptr, buffer_length); return X_E_FAIL; } case 0x00058023: { - XELOGD("XliveBaseUnk58023({:08X}, {:08X}) unimplemented", buffer_ptr, - buffer_length); + XELOGD( + "CXLiveMessaging::XMessageGameInviteGetAcceptedInfo({:08X}, {:08X}) " + "unimplemented", + buffer_ptr, buffer_length); return X_E_FAIL; } case 0x00058046: { diff --git a/src/xenia/kernel/xam/xam_net.cc b/src/xenia/kernel/xam/xam_net.cc index e1507cb00..fc3c83a24 100644 --- a/src/xenia/kernel/xam/xam_net.cc +++ b/src/xenia/kernel/xam/xam_net.cc @@ -2,7 +2,7 @@ ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * + * Copyright 2021 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ @@ -306,7 +306,9 @@ dword_result_t NetDll_WSARecvFrom(dword_t caller, dword_t socket, //} } - return 0; + // we're not going to be receiving packets any time soon + // return error so we don't wait on that - Cancerous + return -1; } DECLARE_XAM_EXPORT1(NetDll_WSARecvFrom, kNetworking, kStub); diff --git a/src/xenia/kernel/xam/xam_user.cc b/src/xenia/kernel/xam/xam_user.cc index 3e56e4632..096a59b11 100644 --- a/src/xenia/kernel/xam/xam_user.cc +++ b/src/xenia/kernel/xam/xam_user.cc @@ -780,8 +780,10 @@ DECLARE_XAM_EXPORT1(XamSessionCreateHandle, kUserProfiles, kStub); dword_result_t XamSessionRefObjByHandle(dword_t handle, lpdword_t obj_ptr) { assert_true(handle == 0xCAFEDEAD); - *obj_ptr = 0; - return X_ERROR_FUNCTION_FAILED; + // TODO(PermaNull): Implement this properly, + // For the time being returning 0xDEADF00D will prevent crashing. + *obj_ptr = 0xDEADF00D; + return X_ERROR_SUCCESS; } DECLARE_XAM_EXPORT1(XamSessionRefObjByHandle, kUserProfiles, kStub);