-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to read save file for Medieval Dynasty #103
Comments
Missing property seems to either be a |
Thanks, that got me further, but it's still not working and this looks weird.
Here is the corresponding section from the save file: Collapsed because of wall of text
It looks like this should be a map of booleans, but it's clearly not. What's going on there? |
@trumank explained to me, that ByteProperties can have an additional label, in case an named Enum is used. More about it can be read here trumank/uesave-rs#41 (comment) |
This library supports "namespaced" bytes, you could try something like: diff --git a/src/properties/map_property.rs b/src/properties/map_property.rs
index 203fc9a..7723e06 100644
--- a/src/properties/map_property.rs
+++ b/src/properties/map_property.rs
@@ -457,7 +457,11 @@ impl MapProperty {
for _ in 0..element_count {
let properties_stack = &mut options.properties_stack;
let key_stack_entry = ScopedStackEntry::new(properties_stack, "Key".to_string());
- let key = Property::new(cursor, &key_type, false, options, None)?;
+ let suggested_length = match key_type.as_ref() {
+ "ByteProperty" => Some(u32::MAX),
+ _ => None,
+ };
+ let key = Property::new(cursor, &key_type, false, options, suggested_length)?;
drop(key_stack_entry);
let properties_stack = &mut options.properties_stack; |
UE5 file format version 1012 ( https://github.com/EpicGames/UnrealEngine/commit/9fb9d5f0f12bb2d46fbab507141394680d699d4e |
On closer inspection, the provided save file does not have |
This approach works more reliably: diff --git a/src/properties/map_property.rs b/src/properties/map_property.rs
index 87faedd..766a336 100644
--- a/src/properties/map_property.rs
+++ b/src/properties/map_property.rs
@@ -453,23 +453,35 @@ impl MapProperty {
}
}
- impl_read_header!(options, key_type, value_type);
+ impl_read_header!(options, length, key_type, value_type);
#[inline]
fn read_body<R: Read + Seek>(
cursor: &mut R,
options: &mut PropertyOptions,
+ length: u32,
key_type: String,
value_type: String,
) -> Result<Self, Error> {
let allocation_flags = cursor.read_u32::<LittleEndian>()?;
let element_count = cursor.read_u32::<LittleEndian>()?;
+ let suggested_length = match key_type.as_ref() {
+ "ByteProperty" => {
+ if length == 8 + (2 * element_count) {
+ Some(1)
+ } else {
+ Some(u32::MAX)
+ }
+ }
+ _ => None,
+ };
+
let mut map = HashableIndexMap::with_capacity(element_count as usize);
for _ in 0..element_count {
let properties_stack = &mut options.properties_stack;
let key_stack_entry = ScopedStackEntry::new(properties_stack, "Key".to_string());
- let key = Property::new(cursor, &key_type, false, options, None)?;
+ let key = Property::new(cursor, &key_type, false, options, suggested_length)?;
drop(key_stack_entry);
let properties_stack = &mut options.properties_stack; |
I want to build a save editor for Medieval Dynasty and use this library for it.
When trying to load a save I'm missing a hint though and I cannot figure out, how to fix this.
Error:
Err(Deserialize(MissingHint("StructProperty", "LandscapeData.MapProperty.Value.StructProperty", 1789)))
This should be the correct section:
Here's my save file:
Autosave.zip
The text was updated successfully, but these errors were encountered: