From 919f7403e265b803989eccdeee4d9d42ac4c18d2 Mon Sep 17 00:00:00 2001 From: The-Little-Wolf <116989599+The-Little-Wolf@users.noreply.github.com> Date: Sun, 3 Nov 2024 09:25:25 -0800 Subject: [PATCH] [Xam/UI] - Implement XamShowMarketplaceUIEx & XamShowForcedNameChangeUI Xam version 4548 and up XamShowMarketplaceUI transfers its params to XamShowMarketplaceUIEx. --- src/xenia/kernel/xam/xam_ui.cc | 86 ++++++++++++++++++++++++++++++---- src/xenia/xbox.h | 13 +++++ 2 files changed, 91 insertions(+), 8 deletions(-) diff --git a/src/xenia/kernel/xam/xam_ui.cc b/src/xenia/kernel/xam/xam_ui.cc index 02e112176..b1d766999 100644 --- a/src/xenia/kernel/xam/xam_ui.cc +++ b/src/xenia/kernel/xam/xam_ui.cc @@ -1135,9 +1135,11 @@ dword_result_t XamGetDashContext_entry(const ppc_context_t& ctx) { DECLARE_XAM_EXPORT1(XamGetDashContext, kNone, kImplemented); -dword_result_t XamShowMarketplaceUI_entry(dword_t user_index, dword_t ui_type, - qword_t offer_id, - dword_t content_types) { +// https://gitlab.com/GlitchyScripts/xlivelessness/-/blob/master/xlivelessness/xlive/xdefs.hpp?ref_type=heads#L1235 +X_HRESULT xeXShowMarketplaceUIEx(dword_t user_index, dword_t ui_type, + qword_t offer_id, dword_t content_types, + unknown_t unk5, unknown_t unk6, unknown_t unk7, + unknown_t unk8) { // ui_type: // 0 - view all content for the current title // 1 - view content specified by offer id @@ -1172,15 +1174,59 @@ dword_result_t XamShowMarketplaceUI_entry(dword_t user_index, dword_t ui_type, cxxopts::OptionNames buttons; switch (ui_type) { - case 0: + case X_MARKETPLACE_ENTRYPOINT::ContentList: desc = "Game requested to open marketplace page with all content for the " "current title ID."; break; - case 1: + case X_MARKETPLACE_ENTRYPOINT::ContentItem: desc = fmt::format( "Game requested to open marketplace page for offer ID 0x{:016X}.", - static_cast(offer_id)); + static_cast(offer_id)); + break; + case X_MARKETPLACE_ENTRYPOINT::MembershipList: + desc = fmt::format( + "Game requested to open marketplace page with all xbox live " + "memberships 0x{:016X}.", + static_cast(offer_id)); + break; + case X_MARKETPLACE_ENTRYPOINT::MembershipItem: + desc = fmt::format( + "Game requested to open marketplace page for an xbox live " + "memberships 0x{:016X}.", + static_cast(offer_id)); + break; + case X_MARKETPLACE_ENTRYPOINT::ContentList_Background: + // Used when accessing microsoft points + desc = fmt::format( + "Xbox Marketplace requested access to Microsoft Points offer page " + "0x{:016X}.", + static_cast(offer_id)); + break; + case X_MARKETPLACE_ENTRYPOINT::ContentItem_Background: + // Used when accessing credit card information and calls + // XamShowCreditCardUI + desc = fmt::format( + "Xbox Marketplace requested access to credit card information page " + "0x{:016X}.", + static_cast(offer_id)); + break; + case X_MARKETPLACE_ENTRYPOINT::ForcedNameChangeV1: + // Used by XamShowForcedNameChangeUI v1888 + desc = fmt::format("Changing gamertag currently not implemented"); + break; + case X_MARKETPLACE_ENTRYPOINT::ForcedNameChangeV2: + // Used by XamShowForcedNameChangeUI NXE and up + desc = fmt::format("Changing gamertag currently not implemented"); + break; + case X_MARKETPLACE_ENTRYPOINT::ProfileNameChange: + // Used by dashboard when selecting change gamertag in profile menu + desc = fmt::format("Changing gamertag currently not implemented"); + break; + case X_MARKETPLACE_ENTRYPOINT::ActiveDownloads: + // Used in profile tabs when clicking active downloads + desc = fmt::format( + "There are no current plans to download files from xbox servers"); break; default: desc = fmt::format("Unknown marketplace op {:d}", @@ -1193,11 +1239,11 @@ dword_result_t XamShowMarketplaceUI_entry(dword_t user_index, dword_t ui_type, "installed manually using File -> Install Content."; switch (ui_type) { - case 0: + case X_MARKETPLACE_ENTRYPOINT::ContentList: default: buttons.push_back("OK"); break; - case 1: + case X_MARKETPLACE_ENTRYPOINT::ContentItem: desc += "\n\nTo start trial games in full mode, set license_mask to 1 in " "Xenia config file.\n\nDo you wish to change license_mask to 1 for " @@ -1212,8 +1258,26 @@ dword_result_t XamShowMarketplaceUI_entry(dword_t user_index, dword_t ui_type, return xeXamDispatchDialogAsync( new MessageBoxDialog(imgui_drawer, title, desc, buttons, 0), close); } + +dword_result_t XamShowMarketplaceUI_entry(dword_t user_index, dword_t ui_type, + qword_t offer_id, + dword_t content_types, unknown_t unk5, + unknown_t unk6) { + return xeXShowMarketplaceUIEx(user_index, ui_type, offer_id, content_types, + unk5, 0, 0, unk6); +} DECLARE_XAM_EXPORT1(XamShowMarketplaceUI, kUI, kSketchy); +dword_result_t XamShowMarketplaceUIEx_entry(dword_t user_index, dword_t ui_type, + qword_t offer_id, + dword_t content_types, + unknown_t unk5, unknown_t unk6, + unknown_t unk7, unknown_t unk8) { + return xeXShowMarketplaceUIEx(user_index, ui_type, offer_id, content_types, + unk5, unk6, unk7, unk8); +} +DECLARE_XAM_EXPORT1(XamShowMarketplaceUIEx, kUI, kSketchy); + dword_result_t XamShowMarketplaceDownloadItemsUI_entry( dword_t user_index, dword_t ui_type, lpqword_t offers, dword_t num_offers, lpdword_t hresult_ptr, pointer_t overlapped) { @@ -1287,6 +1351,12 @@ dword_result_t XamShowMarketplaceDownloadItemsUI_entry( } DECLARE_XAM_EXPORT1(XamShowMarketplaceDownloadItemsUI, kUI, kSketchy); +dword_result_t XamShowForcedNameChangeUI_entry(dword_t user_index) { + // Changes from 6 to 8 past NXE + return xeXShowMarketplaceUIEx(user_index, 6, 0, 0xffffffff, 0, 0, 0, 0); +} +DECLARE_XAM_EXPORT1(XamShowForcedNameChangeUI, kUI, kImplemented); + bool xeDrawProfileContent(ui::ImGuiDrawer* imgui_drawer, const uint64_t xuid, const uint8_t user_index, const X_XAMACCOUNTINFO* account, diff --git a/src/xenia/xbox.h b/src/xenia/xbox.h index f0517df46..05d95a6ec 100644 --- a/src/xenia/xbox.h +++ b/src/xenia/xbox.h @@ -540,6 +540,19 @@ const static std::map XContentTypeMap = { {XContentType::kCommunityGame, "Community Game"}, }; +enum X_MARKETPLACE_ENTRYPOINT : uint32_t { + ContentList = 0, + ContentItem = 1, + MembershipList = 2, + MembershipItem = 3, + ContentList_Background = 4, + ContentItem_Background = 5, + ForcedNameChangeV1 = 6, + ForcedNameChangeV2 = 8, + ProfileNameChange = 9, + ActiveDownloads = 12 +}; + enum class XDeploymentType : uint32_t { kOpticalDisc = 0, kHardDrive = 1, // Like extracted?