[Kernel] Recording more Xam app messages

- Recording more xam app messages for future reference
- Removed mistakes from messenger_app.h
- Added missing buffer_ptr, buffer_length to unknown message id logs
- transfer over netplay app messages
This commit is contained in:
The-Little-Wolf 2024-08-31 23:17:23 -07:00
parent b5d319834e
commit 4d1c0f97a3
7 changed files with 296 additions and 42 deletions

View File

@ -29,7 +29,8 @@ X_RESULT MessengerApp::DispatchMessageSync(uint32_t message,
case 0x00200002: {
// Used on start in blades dashboard v5759 (marketplace update) and
// possibly to 6717 with netplay
XELOGD("MessengerUnk200002, unimplemented");
XELOGD("MessengerUnk200002({:08X}, {:08X}), unimplemented", buffer_ptr,
buffer_length);
return X_E_FAIL;
}
}

View File

@ -7,8 +7,8 @@
******************************************************************************
*/
#ifndef XENIA_KERNEL_XAM_APPS_UNKNOWN_F7_APP_H_
#define XENIA_KERNEL_XAM_APPS_UNKNOWN_F7_APP_H_
#ifndef XENIA_KERNEL_XAM_APPS_MESSENGER_APP_H_
#define XENIA_KERNEL_XAM_APPS_MESSENGER_APP_H_
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xam/app_manager.h"
@ -31,4 +31,4 @@ class MessengerApp : public App {
} // namespace kernel
} // namespace xe
#endif // XENIA_KERNEL_XAM_APPS_UNKNOWN_FE_APP_H_
#endif XENIA_KERNEL_XAM_APPS_MESSENGER_APP_H_

View File

@ -14,6 +14,11 @@
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xenumerator.h"
// Notes:
// - Messages ids that start with 0x00021xxx are UI calls
// - Messages ids that start with 0x00023xxx are used for the user profile
// - Messages ids that start with 0x0002Bxxx are used for the Kinect
namespace xe {
namespace kernel {
namespace xam {
@ -88,10 +93,6 @@ X_HRESULT XamApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
(uint32_t)data->unk_48);
return X_E_SUCCESS;
}
case 0x00021012: {
XELOGD("XamApp(0x00021012)");
return X_E_SUCCESS;
}
case 0x00022005: {
struct message_data {
xe::be<uint32_t> deployment_type_ptr;
@ -105,6 +106,13 @@ X_HRESULT XamApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
data->deployment_type_ptr.get(), data->overlapped_ptr.get());
return X_E_SUCCESS;
}
case 0x0002B003: {
// Games used in:
// 4D5309C9
XELOGD("XamUnk2B003({:08X}, {:08X}), unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
}
XELOGE(
"Unimplemented XAM message app={:08X}, msg={:08X}, arg1={:08X}, "

View File

@ -16,12 +16,43 @@ namespace xe {
namespace kernel {
namespace xam {
namespace apps {
/*
* Most of the structs below were found in the Source SDK, provided as stubs.
* Specifically, they can be found in the Source 2007 SDK and the Alien Swarm
* Source SDK. Both are available on Steam for free. A GitHub mirror of the
* Alien Swarm SDK can be found here:
* https://github.com/NicolasDe/AlienSwarm/blob/master/src/common/xbox/xboxstubs.h
*/
struct X_XUSER_ACHIEVEMENT {
xe::be<uint32_t> user_idx;
xe::be<uint32_t> achievement_id;
};
struct XUSER_STATS_VIEW {
xe::be<uint32_t> ViewId;
xe::be<uint32_t> TotalViewRows;
xe::be<uint32_t> NumRows;
xe::be<uint32_t> pRows;
};
struct XUSER_STATS_COLUMN {
xe::be<uint16_t> ColumnId;
X_USER_DATA Value;
};
struct XUSER_STATS_RESET {
xe::be<uint32_t> user_index;
xe::be<uint32_t> view_id;
};
struct XUSER_ANID {
xe::be<uint32_t> user_index;
xe::be<uint32_t> cchAnIdBuffer;
xe::be<uint32_t> pszAnIdBuffer;
xe::be<uint32_t> value_const; // 1
};
XgiApp::XgiApp(KernelState* kernel_state) : App(kernel_state, 0xFB) {}
// http://mb.mirage.org/bugzilla/xliveless/main.c
@ -108,6 +139,8 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
return X_E_SUCCESS;
}
case 0x000B0010: {
XELOGD("XSessionCreate({:08X}, {:08X}), implemented in netplay",
buffer_ptr, buffer_length);
assert_true(!buffer_length || buffer_length == 28);
// Sequence:
// - XamSessionCreateHandle
@ -130,8 +163,8 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
return X_E_SUCCESS;
}
case 0x000B0011: {
// TODO(PermaNull): reverse buffer contents.
XELOGD("XGISessionDelete");
XELOGD("XGISessionDelete({:08X}, {:08X}), implemented in netplay",
buffer_ptr, buffer_length);
return X_STATUS_SUCCESS;
}
case 0x000B0012: {
@ -147,19 +180,30 @@ 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 0x000B0013: {
XELOGD(
"XGISessionLeaveLocal({:08X}, {:08X}), implemented by netplay build",
buffer_ptr, buffer_length);
assert_true(buffer_length == 0x14);
return X_E_FAIL;
}
case 0x000B0014: {
// Gets 584107FB in game.
// get high score table?
XELOGD("XGI_unknown");
XELOGD("XSessionStart({:08X}), implemented in netplay", buffer_ptr);
return X_STATUS_SUCCESS;
}
case 0x000B0015: {
// send high scores?
XELOGD("XGI_unknown");
XELOGD("XSessionEnd({:08X}, {:08X}), implemented in netplay", buffer_ptr,
buffer_length);
return X_STATUS_SUCCESS;
}
case 0x000B0021: {
struct XLeaderboard {
XELOGD("XUserReadStats");
struct XUserReadStats {
xe::be<uint32_t> titleId;
xe::be<uint32_t> xuids_count;
xe::be<uint32_t> xuids_guest_address;
@ -167,24 +211,29 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
xe::be<uint32_t> specs_guest_address;
xe::be<uint32_t> results_size;
xe::be<uint32_t> results_guest_address;
}* data = reinterpret_cast<XLeaderboard*>(buffer);
}* data = reinterpret_cast<XUserReadStats*>(buffer);
if (!data->results_guest_address) {
return 1;
}
return X_E_SUCCESS;
}
case 0x000B0036: {
// Called after opening xbox live arcade and clicking on xbox live v5759
// to 5787 and called after clicking xbox live in the game library from
// v6683 to v6717
XELOGD("XGIUnkB0036, unimplemented");
XELOGD("XGIUnkB0036({:08X}, {:08X}), unimplemented", buffer_ptr,
buffer_length);
return X_E_FAIL;
}
case 0x000B003D: {
// Games used in:
// - 5451082a (netplay build).
XELOGD("XGIUnkB003D, unimplemented");
return X_E_FAIL;
// Used in 5451082A, 5553081E
// XUserGetCachedANID
// Used in 5451082A, 5553081E
XELOGI("XUserGetANID({:08X}, {:08X}), implemented in netplay", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x000B0041: {
assert_true(!buffer_length || buffer_length == 32);
@ -209,10 +258,11 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
}
xe::store_and_swap<uint32_t>(context + 4, value);
}
return X_E_FAIL;
return X_E_SUCCESS;
}
case 0x000B0071: {
XELOGD("XGI 0x000B0071, unimplemented");
XELOGD("XGIUnkB0071({:08X}, {:08X}), unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
}

View File

@ -28,20 +28,138 @@ X_HRESULT XLiveBaseApp::DispatchMessageSync(uint32_t message,
// NOTE: buffer_length may be zero or valid.
auto buffer = memory_->TranslateVirtual(buffer_ptr);
switch (message) {
case 0x00050008: {
// Required to be successful for 534507D4
// Guess:
// XStorageDownloadToMemory -> XStorageDownloadToMemoryGetProgress
XELOGD(
"XStorageDownloadToMemoryGetProgress({:08x}, {:08x}), unimplemented",
buffer_ptr, buffer_length);
return X_E_SUCCESS;
}
case 0x00050009: {
// Fixes Xbox Live error for 513107D9
XELOGD("XStorageDownloadToMemory({:08X}, {:08X}), unimplemented",
buffer_ptr, buffer_length);
return XStorageDownloadToMemory(buffer_ptr);
}
case 0x0005000A: {
XELOGD("XStorageEnumerate({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x0005000B: {
// Fixes Xbox Live error for 43430821
XELOGD("XStorageUploadFromMemory({:08X}, {:08X}), unimplemented",
buffer_ptr, buffer_length);
return XStorageUploadFromMemory(buffer_ptr);
}
case 0x0005000E: {
// Before every call there is a call to XUserFindUsers
// Success stub:
// 584113E8 successfully creates session.
// 58410B5D craches.
XELOGD("XUserFindUsersResponseSize({:08X}, {:08X}) unimplemented",
buffer_ptr, buffer_length);
return X_E_FAIL;
}
case 0x0005000F: {
// 41560855 included from TU 7
// Attempts to set a dvar for ui_email_address but fails on
// WideCharToMultiByte
//
// 4D530AA5 encounters "Failed to retrieve account credentials".
XELOGD("_XAccountGetUserInfo({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_ERROR_FUNCTION_FAILED;
}
case 0x00050010: {
XELOGD("XAccountGetUserInfo({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_ERROR_FUNCTION_FAILED;
}
case 0x00050036: {
XELOGD("XOnlineQuerySearch({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00050038: {
// 4D5307D3
// 4D5307D1
XELOGD("XOnlineQuerySearch({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00050077: {
// Called on blades dashboard v1888
// Current Balance in sub menus:
// All New Demos and Trailers
// More Videos and Downloads
XELOGD("XLiveBaseUnk50077({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00050079: {
// Fixes Xbox Live error for 454107DB
XELOGD("XLiveBaseUnk50079({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x0005008B: {
// Called on blades dashboard v1888
// Fixes accessing marketplace Featured Downloads.
XELOGD("XLiveBaseUnk5008B({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x0005008C: {
// Called on startup of blades dashboard v1888 to v2858
XELOGD("XLiveBaseUnk5008C, unimplemented");
XELOGD("XLiveBaseUnk5008C({:08X}, {:08X}), unimplemented", buffer_ptr,
buffer_length);
return X_E_FAIL;
}
case 0x0005008F: {
// Called on blades dashboard v1888
// Fixes accessing marketplace sub menus:
// All New Demos and Trailers
// More Videos and Downloads
XELOGD("XLiveBaseUnk5008F({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00050090: {
// Called on blades dashboard v1888
// Fixes accessing marketplace Game Downloads->All Games->Xbox Live Arcade
// sub menu.
XELOGD("XLiveBaseUnk50090({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00050091: {
// Called on blades dashboard v1888
// Fixes accessing marketplace Game Downloads.
XELOGD("XLiveBaseUnk50091({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00050094: {
// Called on startup of blades dashboard v4532 to v4552
XELOGD("XLiveBaseUnk50094, unimplemented");
XELOGD("XLiveBaseUnk50094({:08X}, {:08X}), unimplemented", buffer_ptr,
buffer_length);
return X_E_FAIL;
}
case 0x00050097: {
// Called on blades dashboard v1888
// Fixes accessing marketplace Memberships.
XELOGD("XLiveBaseUnk50097({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00058003: {
// Called on startup of dashboard (netplay build)
XELOGD("XLiveBaseLogonGetHR, unimplemented");
return X_E_SUCCESS;
// Always receives a buffer ptr and buffer length of zero
XELOGD("XLiveBaseLogonGetHR, implemented by netplay build");
return 0x00151000L; // X_ONLINE_E_LOGON_NO_NETWORK_CONNECTION
}
case 0x00058004: {
// Called on startup, seems to just return a bool in the buffer.
@ -64,6 +182,22 @@ X_HRESULT XLiveBaseApp::DispatchMessageSync(uint32_t message,
buffer_length);
return 0x80151802; // ERROR_CONNECTION_INVALID
}
case 0x00058009: {
XELOGD("XContentGetMarketplaceCounts({:08X}, {:08X}) unimplemented",
buffer_ptr, buffer_length);
return X_E_SUCCESS;
}
case 0x0005800E: {
// Fixes Xbox Live error for 513107D9
XELOGD("XUserMuteListQuery({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00058017: {
XELOGD("XUserFindUsers({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00058020: {
// 0x00058004 is called right before this.
// We should create a XamEnumerate-able empty list here, but I'm not
@ -75,31 +209,68 @@ X_HRESULT XLiveBaseApp::DispatchMessageSync(uint32_t message,
}
case 0x00058023: {
XELOGD(
"CXLiveMessaging::XMessageGameInviteGetAcceptedInfo({:08X}, {:08X}) "
"CXLiveMessaging::XMessageGameInviteGetAcceptedInfo({:08X}, "
"{:08X}) "
"unimplemented",
buffer_ptr, buffer_length);
return X_E_FAIL;
}
case 0x00058032: {
XELOGD("XGetTaskProgress({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00058037: {
XELOGD("XPresenceInitialize({:08X}, {:08X})", buffer_ptr, buffer_length);
// Used in older games such as Crackdown, FM2, Saints Row 1
XELOGD("XPresenceInitializeLegacy({:08X}, {:08X})", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
case 0x00058046: {
// Used in newer games such as Forza 4, MW3, FH2
//
// Required to be successful for 4D530910 to detect signed-in profile
// Doesn't seem to set anything in the given buffer, probably only takes
// input
XELOGD("XLiveBaseUnk58046({:08X}, {:08X}) unimplemented", buffer_ptr,
// Doesn't seem to set anything in the given buffer, probably only
// takes input
XELOGD("XPresenceInitialize({:08X}, {:08X}) unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
}
XELOGE(
"Unimplemented XLIVEBASE message app={:08X}, msg={:08X}, arg1={:08X}, "
"Unimplemented XLIVEBASE message app={:08X}, msg={:08X}, "
"arg1={:08X}, "
"arg2={:08X}",
app_id(), message, buffer_ptr, buffer_length);
return X_E_FAIL;
}
X_HRESULT XLiveBaseApp::XStorageDownloadToMemory(uint32_t buffer_ptr) {
// 41560817, 513107D5, 513107D9 has issues with X_E_FAIL.
// 513107D5, 513107D9 prefer X_ERROR_FUNCTION_FAILED.
if (!buffer_ptr) {
return X_E_INVALIDARG;
}
// 415607DD has issues with X_E_SUCCESS and X_ERROR_FUNCTION_FAILED.
// 41560834 fails on memcpy due to dwBytesTotal corruption.
// if (kernel_state()->title_id() == 0x415607DD ||
// kernel_state()->title_id() == 0x41560834) {
// return X_E_FAIL;
// }
return X_E_SUCCESS;
}
X_HRESULT XLiveBaseApp::XStorageUploadFromMemory(uint32_t buffer_ptr) {
if (!buffer_ptr) {
return X_E_INVALIDARG;
}
return X_E_SUCCESS;
}
} // namespace apps
} // namespace xam
} // namespace kernel

View File

@ -24,6 +24,25 @@ class XLiveBaseApp : public App {
X_HRESULT DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
uint32_t buffer_length) override;
private:
X_HRESULT XPresenceInitialize(uint32_t buffer_length);
X_HRESULT XPresenceSubscribe(uint32_t buffer_length);
X_HRESULT XPresenceUnsubscribe(uint32_t buffer_length);
X_HRESULT XPresenceCreateEnumerator(uint32_t buffer_length);
X_HRESULT GetServiceInfo(uint32_t service_id, uint32_t service_info);
X_HRESULT CreateFriendsEnumerator(uint32_t buffer_args);
void UpdateFriendPresence(const uint32_t user_index);
void UpdatePresenceXUIDs(const std::vector<uint64_t>& xuids,
const uint32_t user_index);
X_HRESULT XStringVerify(uint32_t buffer_ptr, uint32_t buffer_length);
X_HRESULT XStorageDownloadToMemory(uint32_t buffer_ptr);
X_HRESULT XStorageUploadFromMemory(uint32_t buffer_ptr);
X_HRESULT XStorageBuildServerPath(uint32_t buffer_ptr);
X_HRESULT Unk58024(uint32_t buffer_length);
X_HRESULT Unk5801C(uint32_t buffer_length);
};
} // namespace apps

View File

@ -439,8 +439,9 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
case 0x0007002B: {
// Called on the NXE and Kinect dashboard after clicking on the picture,
// video, and music library
XELOGD("XMPUnk7002B, unimplemented");
return X_E_FAIL;
XELOGD("XMPUnk7002B({:08X}, {:08X}), unimplemented", buffer_ptr,
buffer_length);
return X_E_INVALIDARG;
}
case 0x0007002E: {
assert_true(!buffer_length || buffer_length == 12);
@ -462,8 +463,9 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
}
case 0x0007002F: {
// Called on the start up of all dashboard versions before kinect
XELOGD("XMPUnk7002F, unimplemented");
return X_E_FAIL;
XELOGD("XMPUnk7002F({:08X}, {:08X}), unimplemented", buffer_ptr,
buffer_length);
return X_E_INVALIDARG;
}
case 0x0007003D: {
// XMPCaptureOutput
@ -485,16 +487,19 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
}
case 0x00070044: {
// Called on the start up of all dashboard versions before kinect
// When it returns X_E_FAIL you can access the music player up to version
// 5787
XELOGD("XMPUnk70044, unimplemented");
return X_E_FAIL;
// When it returns X_E_INVALIDARG you can access the music player up to
// version 5787
XELOGD("XMPUnk70044({:08X}, {:08X}), unimplemented", buffer_ptr,
buffer_length);
return X_E_INVALIDARG;
}
case 0x00070053: {
// Called on the blades dashboard after clicking on the picture,
// video, and music library
XELOGD("XMPUnk70053, unimplemented");
return X_E_FAIL;
// video, and music library in rapid succession then freezes
// it only recieves buffer
XELOGD("XMPUnk70053({:08X}, {:08X}), unimplemented", buffer_ptr,
buffer_length);
return X_E_SUCCESS;
}
}
XELOGE(