User experience/quality of life improvements

master
Ashley N. 2023-09-02 21:37:27 -04:00
parent 362a0e0fe7
commit 8e0bff1992
2 changed files with 10 additions and 3 deletions

View File

@ -20,13 +20,14 @@ pub fn run_command() -> Result<(), Box<dyn Error>> {
TileOrder::Sprite => "sprite" TileOrder::Sprite => "sprite"
} }
), ),
Tools::Soundtrack { input_files, output_directory, input_format: _, output_format: _, source_file_format: _, artifact_output_directory } => { Tools::Soundtrack { input_files, output_directory, input_format: _, output_format: _, source_file_format: _, source_file_output_directory, artifact_output_directory } => {
if input_files.is_empty() { if input_files.is_empty() {
return Err( "no input files (see `reskit soundtrack --help` for more info)" )?; return Err( "no input files (see `reskit soundtrack --help` for more info)" )?;
} }
let output_directory = if output_directory.ends_with( "/" ) { output_directory.to_string() } else { format!( "{}/", output_directory ) }; let output_directory = if output_directory.ends_with( "/" ) { output_directory.to_string() } else { format!( "{}/", output_directory ) };
let artifact_output_directory = if artifact_output_directory.ends_with( "/" ) { artifact_output_directory.to_string() } else { format!( "{}/", artifact_output_directory ) }; let artifact_output_directory = if artifact_output_directory.ends_with( "/" ) { artifact_output_directory.to_string() } else { format!( "{}/", artifact_output_directory ) };
let source_file_output_directory = if source_file_output_directory.ends_with( "/" ) { source_file_output_directory.to_string() } else { format!( "{}/", source_file_output_directory ) };
let modules: Vec<DmfModule> = input_files.iter().map( | filename | Ok( DmfModule::from_file( &filename )? ) ).collect::<Result<Vec<DmfModule>, Box<dyn Error>>>()?; let modules: Vec<DmfModule> = input_files.iter().map( | filename | Ok( DmfModule::from_file( &filename )? ) ).collect::<Result<Vec<DmfModule>, Box<dyn Error>>>()?;
@ -58,9 +59,11 @@ pub fn run_command() -> Result<(), Box<dyn Error>> {
// Output the shared artifacts used by all ESF sequences // Output the shared artifacts used by all ESF sequences
println!( "Writing sequence artifacts..." ); println!( "Writing sequence artifacts..." );
let shared_artifacts = combined_asset_list.to_bytes()?; let shared_artifacts = combined_asset_list.to_bytes()?;
println!( "Writing sequence artifact {}", format!( "{}music.asm", artifact_output_directory ) ); println!( "Writing sequence artifact {}", format!( "{}music.asm", source_file_output_directory ) );
let mut file = File::create( format!( "{}music.asm", artifact_output_directory ) )?; let mut file = File::create( format!( "{}music.asm", source_file_output_directory ) )?;
file.write_all( &shared_artifacts )?; file.write_all( &shared_artifacts )?;
print_good( "all files converted successfully" );
} }
}; };

View File

@ -84,6 +84,10 @@ pub enum Tools {
#[arg(long, value_enum, default_value_t=ArtifactListFormat::Asmx)] #[arg(long, value_enum, default_value_t=ArtifactListFormat::Asmx)]
source_file_format: ArtifactListFormat, source_file_format: ArtifactListFormat,
/// Output directory for the source file
#[arg(long, default_value_t=String::from("./"))]
source_file_output_directory: String,
/// Directory to output artifacts (instruments and samples) /// Directory to output artifacts (instruments and samples)
#[arg(long, default_value_t=String::from( "./" ))] #[arg(long, default_value_t=String::from( "./" ))]
artifact_output_directory: String artifact_output_directory: String