41 std::uint64_t size =
static_cast<std::uint64_t
>(profile.mappings.size());
42 ctx.
write64<std::endian::big>(
reinterpret_cast<const std::byte*
>(&size), 1);
45 for (
const auto& [key, value]: profile.mappings)
48 ctx.
write32<std::endian::big>(
reinterpret_cast<const std::byte*
>(&key), 1);
106 std::uint64_t size = 0;
107 ctx.
read64<std::endian::big>(
reinterpret_cast<std::byte*
>(&size), 1);
110 for (std::uint64_t i = 0; i < size; ++i)
114 ctx.
read32<std::endian::big>(
reinterpret_cast<std::byte*
>(&key), 1);
127 profile.
mappings.emplace(key, std::make_unique<input::gamepad_axis_mapping>(std::move(mapping)));
135 profile.
mappings.emplace(key, std::make_unique<input::gamepad_button_mapping>(std::move(mapping)));
143 profile.
mappings.emplace(key, std::make_unique<input::key_mapping>(std::move(mapping)));
151 profile.
mappings.emplace(key, std::make_unique<input::mouse_button_mapping>(std::move(mapping)));
159 profile.
mappings.emplace(key, std::make_unique<input::mouse_motion_mapping>(std::move(mapping)));
167 profile.
mappings.emplace(key, std::make_unique<input::mouse_scroll_mapping>(std::move(mapping)));
184 std::unique_ptr<control_profile> profile = std::make_unique<control_profile>();
An exception of this type is thrown when an error occurs during deserialization.
static std::unique_ptr< T > load(::resource_manager &resource_manager, deserialize_context &ctx)
Loads a resource.
Manages the loading, caching, and saving of resources.
An exception of this type is thrown when an error occurs during serialization.
dict< hash::fnv1a32_t > settings
Profile-specific settings.
std::multimap< hash::fnv1a32_t, std::unique_ptr< input::mapping > > mappings
Input mappings.
Provides access to a deserialization state.
std::size_t read32(std::byte *data, std::size_t count) noexcept(false)
Reads 32-bit (double word) data.
virtual std::size_t read8(std::byte *data, std::size_t count) noexcept(false)=0
Reads 8-bit (byte) data.
std::size_t read64(std::byte *data, std::size_t count) noexcept(false)
Reads 64-bit (quad word) data.
Specializations of deserializer define the deserialization process for a given type.
void deserialize(T &value, deserialize_context &ctx)
Deserializes a value.
32-bit FNV-1a hash value.
Provides access to a serialization state.
virtual std::size_t write8(const std::byte *data, std::size_t count) noexcept(false)=0
Writes 8-bit (byte) data.
std::size_t write32(const std::byte *data, std::size_t count) noexcept(false)
Writes 32-bit (double word) data.
std::size_t write64(const std::byte *data, std::size_t count) noexcept(false)
Writes 64-bit (quad word) data.
Specializations of serializer define the serialization process for a given type.
void serialize(const T &value, serialize_context &ctx)
Serializes a value.