[XAM] Assert struct sizes and misc struct adjustments
This commit is contained in:
@@ -574,7 +574,7 @@ X_STATUS Emulator::LaunchXexFile(const std::filesystem::path& path) {
|
||||
X_STATUS result = CompleteLaunch(path, fs_path);
|
||||
|
||||
if (XSUCCEEDED(result)) {
|
||||
kernel_state_->deployment_type_ = XDeploymentType::kHardDrive;
|
||||
kernel_state_->deployment_type_ = XDeploymentType::kInstalledToHDD;
|
||||
auto title_id = kernel_state_->title_id();
|
||||
if (!kernel::IsSystemTitle(title_id)) {
|
||||
// Assumption that any loaded game is loaded as a disc.
|
||||
@@ -613,7 +613,7 @@ X_STATUS Emulator::LaunchStfsContainer(const std::filesystem::path& path) {
|
||||
if (result == X_STATUS_NOT_FOUND && !cvars::launch_module.empty()) {
|
||||
return LaunchDefaultModule(path);
|
||||
}
|
||||
kernel_state_->deployment_type_ = XDeploymentType::kGoD;
|
||||
kernel_state_->deployment_type_ = XDeploymentType::kDownload;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -623,7 +623,7 @@ X_STATUS Emulator::LaunchDefaultModule(const std::filesystem::path& path) {
|
||||
X_STATUS result = CompleteLaunch(path, module_path);
|
||||
|
||||
if (XSUCCEEDED(result)) {
|
||||
kernel_state_->deployment_type_ = XDeploymentType::kHardDrive;
|
||||
kernel_state_->deployment_type_ = XDeploymentType::kInstalledToHDD;
|
||||
auto title_id = kernel_state_->title_id();
|
||||
if (!kernel::IsSystemTitle(title_id)) {
|
||||
// Assumption that any loaded game is loaded as a disc.
|
||||
|
||||
@@ -309,7 +309,7 @@ class KernelState {
|
||||
bool Restore(ByteStream* stream);
|
||||
|
||||
uint32_t notification_position_ = 2;
|
||||
XDeploymentType deployment_type_ = XDeploymentType::kUnknown;
|
||||
XDeploymentType deployment_type_ = XDeploymentType::kOther;
|
||||
|
||||
uint32_t GetKeTimestampBundle();
|
||||
|
||||
|
||||
@@ -97,8 +97,8 @@ X_HRESULT XamApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
static_cast<uint32_t>(data->device_type_ptr.get()));
|
||||
|
||||
switch (kernel_state_->deployment_type_) {
|
||||
case XDeploymentType::kGoD:
|
||||
case XDeploymentType::kHardDrive: {
|
||||
case XDeploymentType::kDownload:
|
||||
case XDeploymentType::kInstalledToHDD: {
|
||||
*device_type_ptr = DeviceType::HDD;
|
||||
} break;
|
||||
case XDeploymentType::kOpticalDisc: {
|
||||
@@ -123,11 +123,12 @@ X_HRESULT XamApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
return X_E_SUCCESS;
|
||||
}
|
||||
case 0x00022005: {
|
||||
struct message_data {
|
||||
struct XTITLE_GET_DEPLOYMENT_TYPE {
|
||||
xe::be<uint32_t> deployment_type_ptr;
|
||||
xe::be<uint32_t> overlapped_ptr;
|
||||
}* data = reinterpret_cast<message_data*>(buffer);
|
||||
assert_true(buffer_length == sizeof(message_data));
|
||||
}* data = reinterpret_cast<XTITLE_GET_DEPLOYMENT_TYPE*>(buffer);
|
||||
assert_true(!buffer_length ||
|
||||
buffer_length == sizeof(XTITLE_GET_DEPLOYMENT_TYPE));
|
||||
auto deployment_type =
|
||||
memory_->TranslateVirtual<uint32_t*>(data->deployment_type_ptr);
|
||||
*deployment_type = static_cast<uint32_t>(kernel_state_->deployment_type_);
|
||||
|
||||
@@ -25,9 +25,10 @@ namespace apps {
|
||||
*/
|
||||
|
||||
struct XGI_XUSER_ACHIEVEMENT {
|
||||
xe::be<uint32_t> user_idx;
|
||||
xe::be<uint32_t> user_index;
|
||||
xe::be<uint32_t> achievement_id;
|
||||
};
|
||||
static_assert_size(XGI_XUSER_ACHIEVEMENT, 0x8);
|
||||
|
||||
struct XGI_XUSER_GET_PROPERTY {
|
||||
xe::be<uint32_t> user_index;
|
||||
@@ -39,6 +40,7 @@ struct XGI_XUSER_GET_PROPERTY {
|
||||
xe::be<uint32_t> context_address;
|
||||
xe::be<uint32_t> property_address;
|
||||
};
|
||||
static_assert_size(XGI_XUSER_GET_PROPERTY, 0x20);
|
||||
|
||||
struct XGI_XUSER_SET_CONTEXT {
|
||||
xe::be<uint32_t> user_index;
|
||||
@@ -46,6 +48,7 @@ struct XGI_XUSER_SET_CONTEXT {
|
||||
xe::be<uint64_t> xuid;
|
||||
XUSER_CONTEXT context;
|
||||
};
|
||||
static_assert_size(XGI_XUSER_SET_CONTEXT, 0x18);
|
||||
|
||||
struct XGI_XUSER_SET_PROPERTY {
|
||||
xe::be<uint32_t> user_index;
|
||||
@@ -55,6 +58,7 @@ struct XGI_XUSER_SET_PROPERTY {
|
||||
xe::be<uint32_t> data_size;
|
||||
xe::be<uint32_t> data_address;
|
||||
};
|
||||
static_assert_size(XGI_XUSER_SET_PROPERTY, 0x20);
|
||||
|
||||
struct XUSER_STATS_VIEW {
|
||||
xe::be<uint32_t> ViewId;
|
||||
@@ -116,6 +120,8 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
return X_E_SUCCESS;
|
||||
}
|
||||
case 0x000B0007: {
|
||||
assert_true(!buffer_length ||
|
||||
buffer_length == sizeof(XGI_XUSER_SET_PROPERTY));
|
||||
const XGI_XUSER_SET_PROPERTY* xgi_property =
|
||||
reinterpret_cast<const XGI_XUSER_SET_PROPERTY*>(buffer);
|
||||
|
||||
@@ -144,7 +150,8 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
return X_E_SUCCESS;
|
||||
}
|
||||
case 0x000B0008: {
|
||||
assert_true(!buffer_length || buffer_length == 8);
|
||||
assert_true(!buffer_length ||
|
||||
buffer_length == sizeof(XGI_XUSER_ACHIEVEMENT));
|
||||
uint32_t achievement_count = xe::load_and_swap<uint32_t>(buffer + 0);
|
||||
uint32_t achievements_ptr = xe::load_and_swap<uint32_t>(buffer + 4);
|
||||
XELOGD("XGIUserWriteAchievements({:08X}, {:08X})", achievement_count,
|
||||
@@ -154,7 +161,7 @@ X_HRESULT XgiApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
|
||||
memory_->TranslateVirtual<XGI_XUSER_ACHIEVEMENT*>(achievements_ptr);
|
||||
for (uint32_t i = 0; i < achievement_count; i++, achievement++) {
|
||||
kernel_state_->achievement_manager()->EarnAchievement(
|
||||
achievement->user_idx, kernel_state_->title_id(),
|
||||
achievement->user_index, kernel_state_->title_id(),
|
||||
achievement->achievement_id);
|
||||
}
|
||||
return X_E_SUCCESS;
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
enum class X_USER_PROFILE_SETTING_SOURCE : uint32_t {
|
||||
NOT_SET = 0,
|
||||
NO_VALUE = 0,
|
||||
DEFAULT = 1, // Default value taken from default OS values.
|
||||
TITLE = 2, // Value written by title or OS.
|
||||
UNKNOWN = 3,
|
||||
PERMISSION_DENIED = 3,
|
||||
};
|
||||
|
||||
struct X_USER_PROFILE_SETTING {
|
||||
|
||||
@@ -25,11 +25,13 @@ struct XUSER_CONTEXT {
|
||||
xe::be<uint32_t> context_id;
|
||||
xe::be<uint32_t> value;
|
||||
};
|
||||
static_assert_size(XUSER_CONTEXT, 0x8);
|
||||
|
||||
struct XUSER_PROPERTY {
|
||||
xe::be<uint32_t> property_id;
|
||||
X_USER_DATA data;
|
||||
};
|
||||
static_assert_size(XUSER_PROPERTY, 0x18);
|
||||
|
||||
class Property : public UserData {
|
||||
public:
|
||||
|
||||
@@ -50,7 +50,7 @@ dword_result_t XamContentGetLicenseMask_entry(lpdword_t mask_ptr,
|
||||
// Remark: This cannot be reflected as on console. Xenia can boot games
|
||||
// directly and XBLA games can be repacked to ZAR. For these titles we must
|
||||
// provide some license. Normally it should fail for OpticalDisc type.
|
||||
if (kernel_state()->deployment_type_ != XDeploymentType::kUnknown) {
|
||||
if (kernel_state()->deployment_type_ != XDeploymentType::kOther) {
|
||||
// Each bit in the mask represents a granted license. Available licenses
|
||||
// seems to vary from game to game, but most appear to use bit 0 to
|
||||
// indicate if the game is purchased or not.
|
||||
|
||||
@@ -57,13 +57,14 @@ typedef struct {
|
||||
uint8_t abOnline[20]; // Online identification
|
||||
} XNADDR;
|
||||
|
||||
typedef struct {
|
||||
struct XNDNS {
|
||||
xe::be<int32_t> status;
|
||||
xe::be<uint32_t> cina;
|
||||
in_addr aina[8];
|
||||
} XNDNS;
|
||||
};
|
||||
static_assert_size(XNDNS, 0x28);
|
||||
|
||||
typedef struct {
|
||||
struct XNQOSINFO {
|
||||
uint8_t flags;
|
||||
uint8_t reserved;
|
||||
xe::be<uint16_t> probes_xmit;
|
||||
@@ -74,18 +75,20 @@ typedef struct {
|
||||
xe::be<uint16_t> rtt_med_in_msecs;
|
||||
xe::be<uint32_t> up_bits_per_sec;
|
||||
xe::be<uint32_t> down_bits_per_sec;
|
||||
} XNQOSINFO;
|
||||
};
|
||||
static_assert_size(XNQOSINFO, 0x18);
|
||||
|
||||
typedef struct {
|
||||
struct XNQOS {
|
||||
xe::be<uint32_t> count;
|
||||
xe::be<uint32_t> count_pending;
|
||||
XNQOSINFO info[1];
|
||||
} XNQOS;
|
||||
};
|
||||
|
||||
struct Xsockaddr_t {
|
||||
xe::be<uint16_t> sa_family;
|
||||
char sa_data[14];
|
||||
};
|
||||
static_assert_size(XNQOS, 0x20);
|
||||
|
||||
struct X_WSADATA {
|
||||
xe::be<uint16_t> version;
|
||||
@@ -96,6 +99,7 @@ struct X_WSADATA {
|
||||
xe::be<uint16_t> max_udpdg;
|
||||
xe::be<uint32_t> vendor_info_ptr;
|
||||
};
|
||||
static_assert_size(X_WSADATA, 0x190);
|
||||
|
||||
struct XWSABUF {
|
||||
xe::be<uint32_t> len;
|
||||
@@ -166,6 +170,7 @@ struct XNetStartupParams {
|
||||
uint8_t cfgQosSrvMaxSimultaneousResponses;
|
||||
uint8_t cfgQosPairWaitTimeInSeconds;
|
||||
};
|
||||
static_assert_size(XNetStartupParams, 0xD);
|
||||
|
||||
XNetStartupParams xnet_startup_params = {0};
|
||||
|
||||
|
||||
@@ -327,11 +327,10 @@ void XamNuiHudGetVersions_entry(lpqword_t unk1, lpqword_t unk2) {
|
||||
DECLARE_XAM_EXPORT1(XamNuiHudGetVersions, kNone, kImplemented);
|
||||
|
||||
// UI
|
||||
dword_result_t XamShowNuiTroubleshooterUI_entry(unknown_t unk1, unknown_t unk2,
|
||||
dword_t flag) {
|
||||
dword_result_t XamShowNuiTroubleshooterUI_entry(dword_t user_index,
|
||||
dword_t tracking_id,
|
||||
dword_t flags) {
|
||||
/* Notes:
|
||||
- unk1 is 0xFF - possibly user index?
|
||||
- unk2 appear to always be zero.
|
||||
- calls XamPackageManagerGetExperienceMode(&var) with var = 1
|
||||
- If returns less than zero or (var & 1) == 0 then get error message:
|
||||
- if XamPackageManagerGetExperienceMode = 0 then call XamShowMessageBoxUI
|
||||
@@ -339,8 +338,8 @@ dword_result_t XamShowNuiTroubleshooterUI_entry(unknown_t unk1, unknown_t unk2,
|
||||
returns 0
|
||||
- else XamShowNuiTroubleshooterUI returns 0x65b and call another func
|
||||
- else:
|
||||
- call XamNuiHudSetEngagedTrackingID(unk2) and doesn't care aboot return
|
||||
and set var2 = 2
|
||||
- call XamNuiHudSetEngagedTrackingID(tracking_id) and doesn't care aboot
|
||||
return and set var2 = 2
|
||||
- checks if (flag & 0x800000) == 0
|
||||
- if true call XamNuiGetDeviceStatus.
|
||||
- if XamNuiGetDeviceStatus != 0 set var2 = 3
|
||||
|
||||
@@ -107,10 +107,10 @@ DECLARE_XAM_EXPORT2(XamUserGetSigninState, kUserProfiles, kImplemented,
|
||||
|
||||
typedef struct {
|
||||
xe::be<uint64_t> xuid;
|
||||
xe::be<uint32_t> unk08; // maybe zero?
|
||||
xe::be<uint32_t> flags;
|
||||
xe::be<uint32_t> signin_state;
|
||||
xe::be<uint32_t> unk10; // ?
|
||||
xe::be<uint32_t> unk14; // ?
|
||||
xe::be<uint32_t> guest_num;
|
||||
xe::be<uint32_t> sponsor_user_index;
|
||||
char name[16];
|
||||
} X_USER_SIGNIN_INFO;
|
||||
static_assert_size(X_USER_SIGNIN_INFO, 40);
|
||||
|
||||
@@ -31,6 +31,7 @@ struct XSOCKADDR {
|
||||
xe::be<uint16_t> address_family;
|
||||
char sa_data[14];
|
||||
};
|
||||
static_assert_size(XSOCKADDR, 0x10);
|
||||
|
||||
struct N_XSOCKADDR {
|
||||
N_XSOCKADDR() {}
|
||||
@@ -54,6 +55,7 @@ struct XSOCKADDR_IN {
|
||||
// sin_zero is defined as __pad on Android, so prefixed here.
|
||||
char x_sin_zero[8];
|
||||
};
|
||||
static_assert_size(XSOCKADDR_IN, 0x10);
|
||||
|
||||
// Xenia native sockaddr_in
|
||||
struct N_XSOCKADDR_IN {
|
||||
|
||||
@@ -198,6 +198,7 @@ struct XAM_OVERLAPPED {
|
||||
xe::be<uint32_t> completion_context; // 0x14
|
||||
xe::be<uint32_t> extended_error; // 0x18
|
||||
};
|
||||
static_assert_size(XAM_OVERLAPPED, 0x1C);
|
||||
|
||||
inline uint32_t XOverlappedGetResult(void* ptr) {
|
||||
auto p = reinterpret_cast<uint32_t*>(ptr);
|
||||
@@ -411,7 +412,7 @@ struct X_IO_STATUS_BLOCK {
|
||||
struct X_EX_TITLE_TERMINATE_REGISTRATION {
|
||||
xe::be<uint32_t> notification_routine; // 0x0
|
||||
xe::be<uint32_t> priority; // 0x4
|
||||
X_LIST_ENTRY list_entry; // 0x8 ??
|
||||
X_LIST_ENTRY list_entry; // 0x8
|
||||
};
|
||||
static_assert_size(X_EX_TITLE_TERMINATE_REGISTRATION, 16);
|
||||
|
||||
@@ -636,9 +637,9 @@ enum X_MARKETPLACE_ENTRYPOINT : uint32_t {
|
||||
|
||||
enum class XDeploymentType : uint32_t {
|
||||
kOpticalDisc = 0,
|
||||
kHardDrive = 1, // Like extracted?
|
||||
kGoD = 2,
|
||||
kUnknown = 0xFF,
|
||||
kInstalledToHDD = 1, // Like extracted?
|
||||
kDownload = 2,
|
||||
kOther = 3,
|
||||
};
|
||||
|
||||
inline bool IsOfflineXUID(uint64_t xuid) { return ((xuid >> 60) & 0xF) == 0xE; }
|
||||
@@ -750,6 +751,7 @@ struct MESSAGEBOX_RESULT {
|
||||
xe::be<uint16_t> Passcode[4];
|
||||
};
|
||||
};
|
||||
static_assert_size(MESSAGEBOX_RESULT, 0x8);
|
||||
|
||||
// clang-format off
|
||||
|
||||
|
||||
Reference in New Issue
Block a user