fix decompile template generation & decompilation + write correct data to final file
This commit is contained in:
parent
046df78a86
commit
6246558f18
12
src/main.rs
12
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<CompileStackInstruction>=dom.get_by_ref(dom.root().children()[0]).unwrap().children().into_iter().map(|&referent|CompileStackInstruction::TraverseReferent(referent)).collect();
|
||||
let mut stack:Vec<CompileStackInstruction>=dom.root().children().into_iter().map(|&referent|CompileStackInstruction::TraverseReferent(referent)).collect();
|
||||
while let Some(instruction)=stack.pop(){
|
||||
match instruction{
|
||||
CompileStackInstruction::TraverseReferent(item_ref)=>{
|
||||
@ -1542,11 +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)?);
|
||||
//write workspace:GetChildren()[1]
|
||||
let workspace_children=dom.root().children();
|
||||
if workspace_children.len()!=1{
|
||||
return Err(anyhow::Error::msg("there can only be one model"));
|
||||
}
|
||||
rbx_binary::to_writer(output, &dom, &[workspace_children[0]])?;
|
||||
//write inner objects
|
||||
rbx_binary::to_writer(output,&dom,dom.root().children())?;
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user