Trait convey_rs::ReadSaveFileBytes
source · pub trait ReadSaveFileBytes: ReadBytesExt + Seek {
Show 36 methods
// Provided methods
fn read_quaternion<E: ByteOrder>(&mut self) -> Result<Quaternion<f32>> { ... }
fn read_quaternion_double<E: ByteOrder>(
&mut self,
) -> Result<Quaternion<f64>> { ... }
fn read_vector2d_double<E: ByteOrder>(&mut self) -> Result<Vector2D<f64>> { ... }
fn read_vector2d_int<E: ByteOrder>(&mut self) -> Result<Vector2D<i32>> { ... }
fn read_vector<E: ByteOrder>(&mut self) -> Result<Vector<f32>> { ... }
fn read_vector_double<E: ByteOrder>(&mut self) -> Result<Vector<f64>> { ... }
fn read_vector_int<E: ByteOrder>(&mut self) -> Result<Vector<i32>> { ... }
fn read_vector4_double<E: ByteOrder>(&mut self) -> Result<Vector4<f64>> { ... }
fn read_vector4_int<E: ByteOrder>(&mut self) -> Result<Vector4<i32>> { ... }
fn read_color<E: ByteOrder>(&mut self) -> Result<Color<f32>> { ... }
fn read_color_byte(&mut self) -> Result<Color<u8>> { ... }
fn read_hex<E: ByteOrder>(&mut self, len: usize) -> Result<String> { ... }
fn read_length_prefixed_string<E: ByteOrder>(&mut self) -> Result<String> { ... }
fn seek_length_prefixed_string<E: ByteOrder>(&mut self) -> Result<()> { ... }
fn read_header<E: ByteOrder>(&mut self) -> Result<Header> { ... }
fn read_chunk<E: ByteOrder>(&mut self) -> Result<Vec<u8>> { ... }
fn read_chunks<E: ByteOrder>(
&mut self,
stop_byte: u64,
) -> Result<Vec<Vec<u8>>> { ... }
fn read_partitions<E: ByteOrder>(&mut self) -> Result<Partitions> { ... }
fn read_object_reference<E: ByteOrder>(
&mut self,
object: &mut impl ObjectReferrable,
map_name: &String,
) -> Result<()> { ... }
fn read_component_header<E: ByteOrder>(
&mut self,
map_name: &String,
) -> Result<ComponentHeader> { ... }
fn read_actor_header<E: ByteOrder>(
&mut self,
map_name: &String,
) -> Result<ActorHeader> { ... }
fn read_level_object_header<E: ByteOrder>(
&mut self,
map_name: &String,
) -> Result<ObjectHeader> { ... }
fn read_property_guid<E: ByteOrder>(&mut self) -> Result<Option<String>> { ... }
fn read_fin_network_trace<E: ByteOrder>(
&mut self,
) -> Result<FINNetworkTrace> { ... }
fn read_fingput1_buffer_pixel<E: ByteOrder>(
&mut self,
) -> Result<FINGPUT1BufferPixel> { ... }
fn read_fin_lua_processor_state_storage<E: ByteOrder>(
&mut self,
header: &Header,
parent_type: Option<&String>,
) -> Result<FINLuaProcessorStateStorage> { ... }
fn read_array_property_struct<E: ByteOrder>(
&mut self,
num_elements: i32,
header: &Header,
) -> Result<(ArrayPropertyStruct, Vec<ArrayPropertyStructValue>)> { ... }
fn read_array_property<E: ByteOrder>(
&mut self,
property_name: &String,
header: &Header,
) -> Result<ArrayProperty> { ... }
fn read_map_property<E: ByteOrder>(
&mut self,
property_name: &String,
parent_type: Option<&String>,
header: &Header,
) -> Result<MapProperty> { ... }
fn read_set_property<E: ByteOrder>(
&mut self,
parent_type: Option<&String>,
header: &Header,
) -> Result<SetProperty> { ... }
fn read_struct_property<E: ByteOrder>(
&mut self,
parent_type: Option<&String>,
header: &Header,
) -> Result<(String, StructPropertyValue)> { ... }
fn read_text_property<E: ByteOrder>(
&mut self,
build_version: i32,
) -> Result<TextProperty> { ... }
fn read_property<E: ByteOrder>(
&mut self,
header: &Header,
parent_type: Option<&String>,
) -> Result<Option<Property>> { ... }
fn read_object<E: ByteOrder>(
&mut self,
object_header: &ObjectHeader,
header: &Header,
) -> Result<Object> { ... }
fn read_level<E: ByteOrder>(
&mut self,
level_index: i32,
is_last_level: bool,
header: &Header,
) -> Result<Level> { ... }
fn read_levels<E: ByteOrder>(
&mut self,
header: &Header,
) -> Result<Vec<Level>> { ... }
}Expand description
Extends byteorder’s ReadBytesExt (which itself extends io::Read)
and io::Seek to build a robust byte reader with many great
utility functions needed to support the custom save file format
Provided Methods§
sourcefn read_quaternion<E: ByteOrder>(&mut self) -> Result<Quaternion<f32>>
fn read_quaternion<E: ByteOrder>(&mut self) -> Result<Quaternion<f32>>
Reads a quaternion with values as 32-bit floats
sourcefn read_quaternion_double<E: ByteOrder>(&mut self) -> Result<Quaternion<f64>>
fn read_quaternion_double<E: ByteOrder>(&mut self) -> Result<Quaternion<f64>>
Reads a quaternion with values as 64-bit floats
sourcefn read_vector2d_double<E: ByteOrder>(&mut self) -> Result<Vector2D<f64>>
fn read_vector2d_double<E: ByteOrder>(&mut self) -> Result<Vector2D<f64>>
Reads a 2D vector with values as 64-bit floats
sourcefn read_vector2d_int<E: ByteOrder>(&mut self) -> Result<Vector2D<i32>>
fn read_vector2d_int<E: ByteOrder>(&mut self) -> Result<Vector2D<i32>>
Reads a 2D vector with values as 32-bit integers
sourcefn read_vector<E: ByteOrder>(&mut self) -> Result<Vector<f32>>
fn read_vector<E: ByteOrder>(&mut self) -> Result<Vector<f32>>
Reads a 3D vector with values as 32-bit floats
sourcefn read_vector_double<E: ByteOrder>(&mut self) -> Result<Vector<f64>>
fn read_vector_double<E: ByteOrder>(&mut self) -> Result<Vector<f64>>
Reads a 3D vector with values as 64-bit floats
sourcefn read_vector_int<E: ByteOrder>(&mut self) -> Result<Vector<i32>>
fn read_vector_int<E: ByteOrder>(&mut self) -> Result<Vector<i32>>
Reads a 3D vector with values as 32-bit integers
sourcefn read_vector4_double<E: ByteOrder>(&mut self) -> Result<Vector4<f64>>
fn read_vector4_double<E: ByteOrder>(&mut self) -> Result<Vector4<f64>>
Reads a 4D vector with values as 64-bit floats
sourcefn read_vector4_int<E: ByteOrder>(&mut self) -> Result<Vector4<i32>>
fn read_vector4_int<E: ByteOrder>(&mut self) -> Result<Vector4<i32>>
Reads a 4D vector with values as 32-bit integers
sourcefn read_color<E: ByteOrder>(&mut self) -> Result<Color<f32>>
fn read_color<E: ByteOrder>(&mut self) -> Result<Color<f32>>
Reads an RGB color with alpha channel with values as 32-bit floats
sourcefn read_color_byte(&mut self) -> Result<Color<u8>>
fn read_color_byte(&mut self) -> Result<Color<u8>>
Reads an RGB color with alpha channel with values as bytes
sourcefn read_hex<E: ByteOrder>(&mut self, len: usize) -> Result<String>
fn read_hex<E: ByteOrder>(&mut self, len: usize) -> Result<String>
Reads a specified number of bytes and attempts to parse them as a UTF-16 string
sourcefn read_length_prefixed_string<E: ByteOrder>(&mut self) -> Result<String>
fn read_length_prefixed_string<E: ByteOrder>(&mut self) -> Result<String>
Reads a string whose length and encoding are specified by a prefixed byte:
- If the length byte is > 0, the following string is UTF-8 encoded
- If the length byte is < 0, the following string is UTF-16 encoded
- If it == 0, the string is empty
The string is terminated by a null termination byte (/0) which is removed
sourcefn seek_length_prefixed_string<E: ByteOrder>(&mut self) -> Result<()>
fn seek_length_prefixed_string<E: ByteOrder>(&mut self) -> Result<()>
Similar to the above except the string is skipped over instead of parsed; used for unknown or redundant fields
sourcefn read_header<E: ByteOrder>(&mut self) -> Result<Header>
fn read_header<E: ByteOrder>(&mut self) -> Result<Header>
Reads the file header; some of its fields, particularly the file version and the map name, are used to drive conditional parsing in other areas
sourcefn read_chunk<E: ByteOrder>(&mut self) -> Result<Vec<u8>>
fn read_chunk<E: ByteOrder>(&mut self) -> Result<Vec<u8>>
Reads a chunk header and its compressed body, performing some assertions on some fixed, well-known values
sourcefn read_chunks<E: ByteOrder>(&mut self, stop_byte: u64) -> Result<Vec<Vec<u8>>>
fn read_chunks<E: ByteOrder>(&mut self, stop_byte: u64) -> Result<Vec<Vec<u8>>>
Reads a chunk at a time until reaching the specified stop byte (which is the end of the file)
sourcefn read_partitions<E: ByteOrder>(&mut self) -> Result<Partitions>
fn read_partitions<E: ByteOrder>(&mut self) -> Result<Partitions>
Reads the partition objects which start the main body and come before the level data
sourcefn read_object_reference<E: ByteOrder>(
&mut self,
object: &mut impl ObjectReferrable,
map_name: &String,
) -> Result<()>
fn read_object_reference<E: ByteOrder>( &mut self, object: &mut impl ObjectReferrable, map_name: &String, ) -> Result<()>
Given a type which implements ObjectReferrable, reads a level name and
a path name and sets one or both on the given object
NOTE: Mutates the given object
sourcefn read_component_header<E: ByteOrder>(
&mut self,
map_name: &String,
) -> Result<ComponentHeader>
fn read_component_header<E: ByteOrder>( &mut self, map_name: &String, ) -> Result<ComponentHeader>
Reads an object of type Component’s header
sourcefn read_actor_header<E: ByteOrder>(
&mut self,
map_name: &String,
) -> Result<ActorHeader>
fn read_actor_header<E: ByteOrder>( &mut self, map_name: &String, ) -> Result<ActorHeader>
Reads an object of type Actor’s header
sourcefn read_level_object_header<E: ByteOrder>(
&mut self,
map_name: &String,
) -> Result<ObjectHeader>
fn read_level_object_header<E: ByteOrder>( &mut self, map_name: &String, ) -> Result<ObjectHeader>
Reads an object header for a level object by reading a 32-bit integer to determine the header type and then calling the corresponding function
sourcefn read_property_guid<E: ByteOrder>(&mut self) -> Result<Option<String>>
fn read_property_guid<E: ByteOrder>(&mut self) -> Result<Option<String>>
Reads a byte flag to determine if the following 16 bytes will be a hex-represented GUID
sourcefn read_fin_network_trace<E: ByteOrder>(&mut self) -> Result<FINNetworkTrace>
fn read_fin_network_trace<E: ByteOrder>(&mut self) -> Result<FINNetworkTrace>
Reads a FicsIt-Network Network trace
sourcefn read_fingput1_buffer_pixel<E: ByteOrder>(
&mut self,
) -> Result<FINGPUT1BufferPixel>
fn read_fingput1_buffer_pixel<E: ByteOrder>( &mut self, ) -> Result<FINGPUT1BufferPixel>
Reads a FicsIt-Network GPUT buffer pixel
sourcefn read_fin_lua_processor_state_storage<E: ByteOrder>(
&mut self,
header: &Header,
parent_type: Option<&String>,
) -> Result<FINLuaProcessorStateStorage>
fn read_fin_lua_processor_state_storage<E: ByteOrder>( &mut self, header: &Header, parent_type: Option<&String>, ) -> Result<FINLuaProcessorStateStorage>
sourcefn read_array_property_struct<E: ByteOrder>(
&mut self,
num_elements: i32,
header: &Header,
) -> Result<(ArrayPropertyStruct, Vec<ArrayPropertyStructValue>)>
fn read_array_property_struct<E: ByteOrder>( &mut self, num_elements: i32, header: &Header, ) -> Result<(ArrayPropertyStruct, Vec<ArrayPropertyStructValue>)>
Reads an array property whose element is of type struct
sourcefn read_array_property<E: ByteOrder>(
&mut self,
property_name: &String,
header: &Header,
) -> Result<ArrayProperty>
fn read_array_property<E: ByteOrder>( &mut self, property_name: &String, header: &Header, ) -> Result<ArrayProperty>
Reads an array property
sourcefn read_map_property<E: ByteOrder>(
&mut self,
property_name: &String,
parent_type: Option<&String>,
header: &Header,
) -> Result<MapProperty>
fn read_map_property<E: ByteOrder>( &mut self, property_name: &String, parent_type: Option<&String>, header: &Header, ) -> Result<MapProperty>
Reads a map property
sourcefn read_set_property<E: ByteOrder>(
&mut self,
parent_type: Option<&String>,
header: &Header,
) -> Result<SetProperty>
fn read_set_property<E: ByteOrder>( &mut self, parent_type: Option<&String>, header: &Header, ) -> Result<SetProperty>
Reads a set property
sourcefn read_struct_property<E: ByteOrder>(
&mut self,
parent_type: Option<&String>,
header: &Header,
) -> Result<(String, StructPropertyValue)>
fn read_struct_property<E: ByteOrder>( &mut self, parent_type: Option<&String>, header: &Header, ) -> Result<(String, StructPropertyValue)>
Reads a struct property
sourcefn read_text_property<E: ByteOrder>(
&mut self,
build_version: i32,
) -> Result<TextProperty>
fn read_text_property<E: ByteOrder>( &mut self, build_version: i32, ) -> Result<TextProperty>
Reads a text property
sourcefn read_property<E: ByteOrder>(
&mut self,
header: &Header,
parent_type: Option<&String>,
) -> Result<Option<Property>>
fn read_property<E: ByteOrder>( &mut self, header: &Header, parent_type: Option<&String>, ) -> Result<Option<Property>>
Reads a property
sourcefn read_object<E: ByteOrder>(
&mut self,
object_header: &ObjectHeader,
header: &Header,
) -> Result<Object>
fn read_object<E: ByteOrder>( &mut self, object_header: &ObjectHeader, header: &Header, ) -> Result<Object>
Reads an object by reading its meta followed by its properties and validating its supposed size against actual size and seeking past any gap
Object Safety§
Implementors§
impl<R: Read + Seek> ReadSaveFileBytes for R
Auto-implements the above trait for all types which also implement both
io::Read and io::Seek