From 658266aa8964be60b451267d1100addd8eccf613 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 24 Jan 2024 16:58:46 -0800 Subject: [PATCH] fix decompile template generation & decompilation + write correct data to final file --- src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4a0a142..4f11e93 100644 --- a/src/main.rs +++ b/src/main.rs @@ -858,7 +858,7 @@ async fn write_files(config:WriteConfig,mut context:DecompiledContext)->AResult< file.push("template"); assert!(file.set_extension("rbxlx")); let output=std::io::BufWriter::new(std::fs::File::create(file)?); - rbx_xml::to_writer_default(output,&context.dom,&[context.dom.root_ref()])?; + rbx_xml::to_writer_default(output,&context.dom,context.dom.root().children())?; } Ok(()) @@ -1469,7 +1469,7 @@ async fn compile(config:CompileConfig)->AResult<()>{ //add in scripts and models let mut folder=config.input_folder.clone(); folder.push("src"); - let mut stack:Vec=dom.get_by_ref(dom.root().children()[0]).unwrap().children().into_iter().map(|&referent|CompileStackInstruction::TraverseReferent(referent)).collect(); + let mut stack:Vec=dom.root().children().into_iter().map(|&referent|CompileStackInstruction::TraverseReferent(referent)).collect(); while let Some(instruction)=stack.pop(){ match instruction{ CompileStackInstruction::TraverseReferent(item_ref)=>{ @@ -1542,6 +1542,7 @@ async fn compile(config:CompileConfig)->AResult<()>{ output_place.push("place.rbxl"); } let output=std::io::BufWriter::new(std::fs::File::create(output_place)?); - rbx_binary::to_writer(output,&dom,&[dom.root_ref()])?; + //write inner objects + rbx_binary::to_writer(output,&dom,dom.root().children())?; Ok(()) }