[XAM] Added is_system_property util to UserData
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "xenia/kernel/util/game_info_database.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/kernel/xam/user_data.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
@@ -86,7 +87,7 @@ std::string GameInfoDatabase::GetLocalizedString(const uint32_t id,
|
||||
|
||||
GameInfoDatabase::Context GameInfoDatabase::GetContext(
|
||||
const uint32_t id) const {
|
||||
Context context = {};
|
||||
Context context = {.id = xam::kInvalidContextId};
|
||||
|
||||
if (!is_valid_) {
|
||||
return context;
|
||||
@@ -100,13 +101,14 @@ GameInfoDatabase::Context GameInfoDatabase::GetContext(
|
||||
context.id = xdbf_context->id;
|
||||
context.default_value = xdbf_context->default_value;
|
||||
context.max_value = xdbf_context->max_value;
|
||||
context.is_system = xam::UserData::is_system_property(xdbf_context->id);
|
||||
context.description = GetLocalizedString(xdbf_context->string_id);
|
||||
return context;
|
||||
}
|
||||
|
||||
GameInfoDatabase::Property GameInfoDatabase::GetProperty(
|
||||
const uint32_t id) const {
|
||||
Property property = {};
|
||||
Property property = {.id = xam::kInvalidPropertyId};
|
||||
|
||||
if (!is_valid_) {
|
||||
return property;
|
||||
@@ -119,6 +121,7 @@ GameInfoDatabase::Property GameInfoDatabase::GetProperty(
|
||||
|
||||
property.id = xdbf_property->id;
|
||||
property.data_size = xdbf_property->data_size;
|
||||
property.is_system = xam::UserData::is_system_property(xdbf_property->id);
|
||||
property.description = GetLocalizedString(xdbf_property->string_id);
|
||||
return property;
|
||||
}
|
||||
|
||||
@@ -32,12 +32,14 @@ class GameInfoDatabase {
|
||||
uint32_t id;
|
||||
uint32_t max_value;
|
||||
uint32_t default_value;
|
||||
bool is_system;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
struct Property {
|
||||
uint32_t id;
|
||||
uint32_t data_size;
|
||||
bool is_system;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ namespace xam {
|
||||
union AttributeKey {
|
||||
uint32_t value;
|
||||
struct {
|
||||
uint32_t id : 14;
|
||||
uint32_t unk : 2;
|
||||
uint32_t id : 16;
|
||||
uint32_t size : 12;
|
||||
uint32_t type : 4;
|
||||
};
|
||||
@@ -134,6 +133,11 @@ class UserData {
|
||||
static X_USER_DATA_TYPE get_type(uint32_t id) {
|
||||
return static_cast<X_USER_DATA_TYPE>(id >> 28);
|
||||
}
|
||||
|
||||
static bool is_system_property(uint32_t id) {
|
||||
return (id & kPropertyScopeMask);
|
||||
}
|
||||
|
||||
static uint16_t get_max_size(uint32_t id) {
|
||||
return static_cast<uint16_t>(id >> 16) & kMaxUserDataSize;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user