Merge branch 'master' of https://git.ne0ndrag0n.com/ashley/reskit into level-tool
commit
7a5bc41ce8
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "reskit"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
authors = ["ne0ndrag0n <ne0ndrag0n@users.noreply.github.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::{error::Error, fs::File, io::Read, convert::TryInto, collections::HashMap};
|
||||
use flate2::read::ZlibDecoder;
|
||||
use linked_hash_set::LinkedHashSet;
|
||||
use crate::reskit::{utility::{get_string, get_u8, skip, get_u32, get_i8, get_i32, get_u16, get_i16, print_info, sanitize_string}, soundtrack::types::{SampleFormat, PsgEnvelope, Note, Sample, PsgSettings, PatternRow, Effect, DcsgChannelMode, NoiseType, Instrument, InstrumentType, Fm2612Operator, Fm2612Settings, Channel, CombinedAssets}};
|
||||
use crate::reskit::{utility::{get_string, get_u8, skip, get_u32, get_i8, get_i32, get_u16, get_i16, print_info, sanitize_string, print_warning}, soundtrack::types::{SampleFormat, PsgEnvelope, Note, Sample, PsgSettings, PatternRow, Effect, DcsgChannelMode, NoiseType, Instrument, InstrumentType, Fm2612Operator, Fm2612Settings, Channel, CombinedAssets}};
|
||||
|
||||
const DMF_MAGIC_NUMBER: &'static str = ".DelekDefleMask.";
|
||||
const DMF_SUPPORTED_VERSION: u8 = 27;
|
||||
|
@ -669,7 +669,10 @@ impl DmfModule {
|
|||
let bitrate = match get_u8( bytes.by_ref() )? {
|
||||
8 => SampleFormat::Bits8,
|
||||
16 => SampleFormat::Bits16,
|
||||
invalid => return Err( format!( "invalid file: invalid bitrate {}", invalid ) )?
|
||||
invalid => {
|
||||
print_warning( &format!( "sample with invalid bitrate: {}", invalid ) );
|
||||
SampleFormat::Invalid
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -685,7 +688,10 @@ impl DmfModule {
|
|||
sample.data.push( get_i16( bytes.by_ref() )? );
|
||||
}
|
||||
|
||||
samples.push( sample );
|
||||
// Don't push no-names or invalid bitrates
|
||||
if sample.name != "" && !matches!( sample.bitrate, SampleFormat::Invalid ) {
|
||||
samples.push( sample );
|
||||
}
|
||||
}
|
||||
|
||||
Ok(
|
||||
|
|
|
@ -63,7 +63,8 @@ pub struct CombinedAssets {
|
|||
#[derive(Clone, PartialEq, Debug)]
|
||||
pub enum SampleFormat {
|
||||
Bits8,
|
||||
Bits16
|
||||
Bits16,
|
||||
Invalid
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
|
|
Loading…
Reference in New Issue