Skip to content

Commit d127ee8

Browse files
committed
Remove length check for remaining data when Importing items. This fixes the error when importing items created in other editors.
1 parent 46ce96e commit d127ee8

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

bl3_save_edit_core/src/bl3_item.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,11 @@ impl Bl3Item {
347347

348348
let rerolled = if serial_version >= 4 { bits.eat(8)? } else { 0 };
349349

350-
if bits.len() > 7 || bits.bitslice().count_ones() > 0 {
350+
if bits.len() > 7 {
351+
warn!("Remaining data length for item was more than expected. Expected length of 7 or less but found length of: {}.", bits.len());
352+
}
353+
354+
if bits.bitslice().count_ones() > 0 {
351355
bail!("Could not fully parse the item data, there was unexpected data left.")
352356
}
353357

bl3_save_edit_core/src/bl3_profile/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ mod tests {
321321

322322
assert_eq!(bl3_profile.profile_data.bank_items().len(), 399);
323323
assert_eq!(bl3_profile.profile_data.lost_loot_items().len(), 13);
324-
assert_eq!(bl3_profile.profile_data.character_skins_unlocked(), 212);
325-
assert_eq!(bl3_profile.profile_data.character_heads_unlocked(), 144);
326-
assert_eq!(bl3_profile.profile_data.echo_themes_unlocked(), 57);
324+
assert_eq!(bl3_profile.profile_data.character_skins_unlocked(), 204);
325+
assert_eq!(bl3_profile.profile_data.character_heads_unlocked(), 136);
326+
assert_eq!(bl3_profile.profile_data.echo_themes_unlocked(), 55);
327327
assert_eq!(bl3_profile.profile_data.profile_emotes_unlocked(), 72);
328328
assert_eq!(bl3_profile.profile_data.room_decorations_unlocked(), 93);
329-
assert_eq!(bl3_profile.profile_data.weapon_skins_unlocked(), 27);
330-
assert_eq!(bl3_profile.profile_data.weapon_trinkets_unlocked(), 68);
329+
assert_eq!(bl3_profile.profile_data.weapon_skins_unlocked(), 23);
330+
assert_eq!(bl3_profile.profile_data.weapon_trinkets_unlocked(), 63);
331331
}
332332

333333
#[test]
@@ -437,12 +437,12 @@ mod tests {
437437

438438
assert_eq!(bl3_profile.profile_data.bank_items().len(), 2000);
439439
assert_eq!(bl3_profile.profile_data.lost_loot_items().len(), 0);
440-
assert_eq!(bl3_profile.profile_data.character_skins_unlocked(), 212);
441-
assert_eq!(bl3_profile.profile_data.character_heads_unlocked(), 144);
442-
assert_eq!(bl3_profile.profile_data.echo_themes_unlocked(), 57);
440+
assert_eq!(bl3_profile.profile_data.character_skins_unlocked(), 204);
441+
assert_eq!(bl3_profile.profile_data.character_heads_unlocked(), 136);
442+
assert_eq!(bl3_profile.profile_data.echo_themes_unlocked(), 55);
443443
assert_eq!(bl3_profile.profile_data.profile_emotes_unlocked(), 64);
444444
assert_eq!(bl3_profile.profile_data.room_decorations_unlocked(), 94);
445-
assert_eq!(bl3_profile.profile_data.weapon_skins_unlocked(), 28);
446-
assert_eq!(bl3_profile.profile_data.weapon_trinkets_unlocked(), 68);
445+
assert_eq!(bl3_profile.profile_data.weapon_skins_unlocked(), 24);
446+
assert_eq!(bl3_profile.profile_data.weapon_trinkets_unlocked(), 63);
447447
}
448448
}

0 commit comments

Comments
 (0)