Skip to content

Commit cf181bb

Browse files
committed
resource_unpacker: fix base params unpacking
1 parent 677ea08 commit cf181bb

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/ui/file_unpacker.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,18 @@ impl ToolkitTabViewer<'_> {
215215
tx.send(UnpackerProgress { file_name: file_path.to_string_lossy().into(), progress: 0.0 }).unwrap();
216216

217217
let pickle = game_params_to_pickle(game_params_data).expect("failed to deserialize GameParams");
218-
let params_dict = match pickle {
219-
pickled::Value::Dict(mut params_dict) => {
220-
params_dict.remove(&HashableValue::String("".to_string())).expect("Could not find base game params with empty key")
221-
}
222-
pickled::Value::List(mut params_list) => params_list.remove(0),
223-
_other => {
224-
panic!("Unexpected GameParams root element type");
218+
let params_dict = if base_params {
219+
match pickle {
220+
pickled::Value::Dict(mut params_dict) => {
221+
params_dict.remove(&HashableValue::String("".to_string())).expect("Could not find base game params with empty key")
222+
}
223+
pickled::Value::List(mut params_list) => params_list.remove(0),
224+
_other => {
225+
panic!("Unexpected GameParams root element type");
226+
}
225227
}
228+
} else {
229+
pickle
226230
};
227231

228232
let mut file = BufWriter::new(File::create(&file_path).expect("failed to create GameParams.json file"));

0 commit comments

Comments
 (0)