some discoveries about ESH data types
This commit is contained in:
parent
628010e6c2
commit
561e4a4dd3
4 changed files with 30 additions and 1 deletions
21
format.txt
21
format.txt
|
|
@ -57,4 +57,23 @@ next zar = <zar> + 0x1A + unk5
|
|||
FString name
|
||||
uint32_t type
|
||||
uint32_t dataSize
|
||||
uint8_t data[dataSize]
|
||||
uint8_t data[dataSize]
|
||||
|
||||
esh data types
|
||||
1 - bool, 1 byte
|
||||
2 - float, 4 byte
|
||||
3 - int32_t/uint32_t
|
||||
4 - FString
|
||||
5 - entity? FString?
|
||||
8 - FString (Sprite)
|
||||
11 - esbin
|
||||
13 - frame, 48 bytes -- multiply all numbers by 4.0
|
||||
uint8_t unk1[36]
|
||||
float c
|
||||
float b
|
||||
float a
|
||||
14 - rect, 16 bytes
|
||||
int32_t top
|
||||
int32_t left
|
||||
int32_t right
|
||||
int32_t bottom
|
||||
|
|
@ -6,11 +6,13 @@ use super::stream::{ReadStream, WriteStream};
|
|||
use anyhow::Result;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ESHValue {
|
||||
pub data_type: u32,
|
||||
pub data: Vec<u8>
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ESH {
|
||||
pub tag: Tag,
|
||||
pub props: IndexMap<FString, ESHValue>,
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ impl<'a> ReadStream<'a> {
|
|||
Ok(self.as_bytes(size)?.to_vec())
|
||||
}
|
||||
|
||||
// "size" is not required to be actual size, it's only
|
||||
// a hint for Decoder::decode. Most of the structures are
|
||||
// dynamically determining their decoding and encoding sizes
|
||||
pub fn read<T: Decoder>(&mut self, size: usize) -> Result<T> {
|
||||
let val = T::decode(&self.raw, self.offset(), size)?;
|
||||
self.skip(val.get_enc_size());
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use super::fstring::FString;
|
|||
use super::raw::Raw;
|
||||
use super::sgd::SGD;
|
||||
use super::ssg::SSG;
|
||||
use super::esh::ESH;
|
||||
use super::stream::ReadStream;
|
||||
use super::tag::Tag;
|
||||
use anyhow::anyhow;
|
||||
|
|
@ -29,6 +30,10 @@ impl World {
|
|||
const WORLD_HDR_LEN: usize = 0x13;
|
||||
|
||||
pub fn test(&self) -> Result<()> {
|
||||
let mut rd = ReadStream::new(&self.data, 0x14AC);
|
||||
let esh: ESH = rd.read(0)?;
|
||||
dbg!(&esh);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue