From 61eb3a7c2dd8053d83da91c67cbfa8f5352d3397 Mon Sep 17 00:00:00 2001 From: Cancerous Date: Mon, 19 Aug 2019 12:35:01 -0400 Subject: [PATCH 1/2] [kernel] Updated PR from Permanulled https://github.com/xenia-project/xenia/pull/1150/files#diff-358a33abb42660137d33300bbc8188c8R51 plus xgimessages to fix Jetpac XBLA gets AegisWings, Jetpac, and MetalSlug 3 in game --- src/xenia/kernel/xam/apps/xgi_app.cc | 17 +++++++++++++-- src/xenia/kernel/xam/apps/xlivebase_app.cc | 25 ++++++++++++++++++---- src/xenia/kernel/xam/user_profile.cc | 4 ++-- src/xenia/kernel/xam/xam_msg.cc | 5 +++++ 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/src/xenia/kernel/xam/apps/xgi_app.cc b/src/xenia/kernel/xam/apps/xgi_app.cc index c232dacd0..d0cd474fa 100644 --- a/src/xenia/kernel/xam/apps/xgi_app.cc +++ b/src/xenia/kernel/xam/apps/xgi_app.cc @@ -78,8 +78,11 @@ X_RESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, return X_STATUS_SUCCESS; } case 0x000B0011: { - // TODO(DrChat): Figure out what this is again - } break; + // TODO(PermaNull): reverse buffer contents. + //TEST + XELOGD("XGISessionDelete"); + return X_STATUS_SUCCESS; + } case 0x000B0012: { assert_true(buffer_length == 0x14); uint32_t session_ptr = xe::load_and_swap(buffer + 0x0); @@ -93,6 +96,16 @@ X_RESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, user_count, unk_0, user_index_array, private_slots_array); return X_STATUS_SUCCESS; } + case 0x000B0014: { + //TEST Gets Jetpac XBLA in game + XELOGD("XGI_unknown"); + return X_STATUS_SUCCESS; + } + case 0x000B0015: { + //TEST Gets Jetpac XBLA in game + 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 4d7a4fd8a..eb4b780be 100644 --- a/src/xenia/kernel/xam/apps/xlivebase_app.cc +++ b/src/xenia/kernel/xam/apps/xlivebase_app.cc @@ -41,20 +41,37 @@ X_RESULT XLiveBaseApp::DispatchMessageSync(uint32_t message, xe::store_and_swap(buffer + 0, 1); // XONLINE_NAT_OPEN return X_ERROR_SUCCESS; } + case 0x00058007: { + /* + Occurs if title calls XOnlineGetServiceInfo, expects dwServiceId + and pServiceInfo. pServiceInfo should contain pointer to + XONLINE_SERVICE_INFO structure. + */ + XELOGD("CXLiveLogon::GetServiceInfo(%.8X, %.8X)", 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(%.8X, %.8X) unimplemented", - buffer_ptr, buffer_length); + XELOGD("CXLiveFriends::Enumerate(%.8X, %.8X) unimplemented", buffer_ptr, + buffer_length); return X_STATUS_UNSUCCESSFUL; } case 0x00058023: { - XELOGD("XliveBaseUnk58023(%.8X, %.8X) unimplemented", buffer_ptr, - buffer_length); + XELOGD( + "CXLiveMessaging::XMessageGameInviteGetAcceptedInfo(%.8X, %.8X) " + "unimplemented", + buffer_ptr, buffer_length); return X_STATUS_UNSUCCESSFUL; } + case 0x00058046: { + XELOGD("CXLivePresence::InitializeTitle(%.8X,%.8X)", buffer_ptr, + buffer_length); + return X_ERROR_SUCCESS; + } } XELOGE( "Unimplemented XLIVEBASE message app=%.8X, msg=%.8X, arg1=%.8X, " diff --git a/src/xenia/kernel/xam/user_profile.cc b/src/xenia/kernel/xam/user_profile.cc index 6471b3d1e..2118d397a 100644 --- a/src/xenia/kernel/xam/user_profile.cc +++ b/src/xenia/kernel/xam/user_profile.cc @@ -18,8 +18,8 @@ namespace kernel { namespace xam { UserProfile::UserProfile() { - xuid_ = 0xBABEBABEBABEBABE; - name_ = "User"; + xuid_ = 0xE000BABEBABEBABE; + name_ = "XeniaUser"; // https://cs.rin.ru/forum/viewtopic.php?f=38&t=60668&hilit=gfwl+live&start=195 // https://github.com/arkem/py360/blob/master/py360/constants.py diff --git a/src/xenia/kernel/xam/xam_msg.cc b/src/xenia/kernel/xam/xam_msg.cc index 07d0be6c7..020868c87 100644 --- a/src/xenia/kernel/xam/xam_msg.cc +++ b/src/xenia/kernel/xam/xam_msg.cc @@ -12,6 +12,7 @@ #include "xenia/kernel/util/shim_utils.h" #include "xenia/kernel/xam/xam_private.h" #include "xenia/kernel/xevent.h" +#include "xenia/kernel/xthread.h" #include "xenia/xbox.h" namespace xe { @@ -47,11 +48,15 @@ dword_result_t XMsgStartIORequest(dword_t app, dword_t message, app, message, buffer, buffer_length); if (result == X_ERROR_NOT_FOUND) { XELOGE("XMsgStartIORequest: app %.8X undefined", (uint32_t)app); + XThread::SetLastError(X_ERROR_NOT_FOUND); } if (overlapped_ptr) { kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result); result = X_ERROR_IO_PENDING; } + if (result == X_ERROR_SUCCESS || X_ERROR_IO_PENDING) { + XThread::SetLastError(0); + } return result; } DECLARE_XAM_EXPORT1(XMsgStartIORequest, kNone, kImplemented); From 807fceefc13d34e6588a8f0a7f10abd7930bac45 Mon Sep 17 00:00:00 2001 From: Cancerous Date: Mon, 19 Aug 2019 14:41:43 -0400 Subject: [PATCH 2/2] add missed part of PR #1150 --- src/xenia/kernel/xam/xam_user.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xenia/kernel/xam/xam_user.cc b/src/xenia/kernel/xam/xam_user.cc index 03b72ebcd..ac3b19722 100644 --- a/src/xenia/kernel/xam/xam_user.cc +++ b/src/xenia/kernel/xam/xam_user.cc @@ -515,8 +515,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);