From 73c7546114a302bcc30615165848f0a0a92b7230 Mon Sep 17 00:00:00 2001 From: gibbed Date: Sun, 27 May 2018 19:43:05 -0500 Subject: [PATCH] [Kernel] Fix return of XamUserGetXUID and XamUserGetSigninInfo. --- src/xenia/kernel/xam/xam_user.cc | 30 +++++++++++++++--------------- src/xenia/xbox.h | 2 ++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/xenia/kernel/xam/xam_user.cc b/src/xenia/kernel/xam/xam_user.cc index ca946bc42..84ada718a 100644 --- a/src/xenia/kernel/xam/xam_user.cc +++ b/src/xenia/kernel/xam/xam_user.cc @@ -21,16 +21,16 @@ namespace xe { namespace kernel { namespace xam { -dword_result_t XamUserGetXUID(dword_t user_index, dword_t unk, - lpqword_t xuid_ptr) { +X_HRESULT_result_t XamUserGetXUID(dword_t user_index, dword_t unk, + lpqword_t xuid_ptr) { if (user_index) { - return X_ERROR_NO_SUCH_USER; + return X_E_NO_SUCH_USER; } const auto& user_profile = kernel_state()->user_profile(); if (xuid_ptr) { *xuid_ptr = user_profile->xuid(); } - return X_ERROR_SUCCESS; + return X_E_SUCCESS; } DECLARE_XAM_EXPORT(XamUserGetXUID, ExportTag::kUserProfiles | ExportTag::kImplemented); @@ -63,22 +63,22 @@ typedef struct { } X_USER_SIGNIN_INFO; static_assert_size(X_USER_SIGNIN_INFO, 40); -dword_result_t XamUserGetSigninInfo(dword_t user_index, dword_t flags, - pointer_t info) { +X_HRESULT_result_t XamUserGetSigninInfo(dword_t user_index, dword_t flags, + pointer_t info) { if (!info) { - return X_ERROR_INVALID_PARAMETER; + return X_E_INVALIDARG; } std::memset(info, 0, sizeof(X_USER_SIGNIN_INFO)); - if (user_index == 0) { - const auto& user_profile = kernel_state()->user_profile(); - info->xuid = user_profile->xuid(); - info->signin_state = user_profile->signin_state(); - std::strncpy(info->name, user_profile->name().data(), 15); - return X_ERROR_SUCCESS; - } else { - return X_ERROR_NO_SUCH_USER; + if (user_index) { + return X_E_NO_SUCH_USER; } + + const auto& user_profile = kernel_state()->user_profile(); + info->xuid = user_profile->xuid(); + info->signin_state = user_profile->signin_state(); + std::strncpy(info->name, user_profile->name().data(), 15); + return X_E_SUCCESS; } DECLARE_XAM_EXPORT(XamUserGetSigninInfo, ExportTag::kUserProfiles | ExportTag::kImplemented); diff --git a/src/xenia/xbox.h b/src/xenia/xbox.h index 65c54cdbc..d5e83778e 100644 --- a/src/xenia/xbox.h +++ b/src/xenia/xbox.h @@ -110,6 +110,8 @@ typedef uint32_t X_HRESULT; #define X_E_FALSE static_cast(0x80000000L) #define X_E_SUCCESS X_HRESULT_FROM_WIN32(X_ERROR_SUCCESS) #define X_E_INVALIDARG X_HRESULT_FROM_WIN32(X_ERROR_INVALID_PARAMETER) +#define X_E_DEVICE_NOT_CONNECTED X_HRESULT_FROM_WIN32(X_ERROR_DEVICE_NOT_CONNECTED) +#define X_E_NO_SUCH_USER X_HRESULT_FROM_WIN32(X_ERROR_NO_SUCH_USER) // MEM_*, used by NtAllocateVirtualMemory #define X_MEM_COMMIT 0x00001000