[Kernel] Added support for writing/reading GPD files
This breaks settings in games that are using them and savefiles in games that use settings to store progress
This commit is contained in:
committed by
Radosław Gliński
parent
ccf7adf015
commit
1110cdd372
61
src/xenia/kernel/xam/user_property.h
Normal file
61
src/xenia/kernel/xam/user_property.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2024 Xenia Canary. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_XAM_USER_PROPERTY_H_
|
||||
#define XENIA_KERNEL_XAM_USER_PROPERTY_H_
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "xenia/kernel/xam/user_data.h"
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xam {
|
||||
|
||||
// This structure is here because context is a one type of property.
|
||||
struct XUSER_CONTEXT {
|
||||
xe::be<uint32_t> context_id;
|
||||
xe::be<uint32_t> value;
|
||||
};
|
||||
|
||||
struct XUSER_PROPERTY {
|
||||
xe::be<uint32_t> property_id;
|
||||
X_USER_DATA data;
|
||||
};
|
||||
|
||||
class Property : public UserData {
|
||||
public:
|
||||
Property();
|
||||
Property(const Property& property);
|
||||
|
||||
Property(uint32_t property_id, UserDataTypes setting_data);
|
||||
// Ctor used while guest is creating property.
|
||||
Property(uint32_t property_id, uint32_t value_size, uint8_t* value_ptr);
|
||||
// Ctor used for deserialization
|
||||
Property(const uint8_t* serialized_data, size_t data_size);
|
||||
~Property();
|
||||
|
||||
const AttributeKey GetPropertyId() const { return property_id_; }
|
||||
|
||||
bool IsValid() const { return property_id_.value != 0; }
|
||||
bool IsContext() const { return data_.type == X_USER_DATA_TYPE::CONTEXT; }
|
||||
void WriteToGuest(XUSER_PROPERTY* property) const;
|
||||
std::vector<uint8_t> Serialize() const;
|
||||
|
||||
private:
|
||||
AttributeKey property_id_ = {};
|
||||
};
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user