diff --git a/internal/pipeline/extract.go b/internal/pipeline/extract.go index 673e1e7..f718f90 100644 --- a/internal/pipeline/extract.go +++ b/internal/pipeline/extract.go @@ -103,8 +103,23 @@ func extractArchiveResources(p *project.Project, archive erf.Archive, desired ma overwrittenCount := 0 skippedCount := 0 + ignored := make(map[string]bool) + for _, ext := range p.Config.Extract.IgnoreExtensions { + ignored[ext] = true + } + for _, resource := range archive.Resources { - target, data, err := extractedFile(p, resource) + ext, ok := erf.ExtensionForResourceType(resource.Type) + if !ok { + failures = append(failures, fmt.Errorf("unsupported resource type 0x%04X for %s", resource.Type, resource.Name)) + continue + } + if ignored[ext] { + skippedCount++ + continue + } + + target, data, err := extractedFile(p, resource, ext) if err != nil { failures = append(failures, err) continue @@ -129,11 +144,7 @@ func extractArchiveResources(p *project.Project, archive erf.Archive, desired ma return writtenCount, overwrittenCount, skippedCount, failures } -func extractedFile(p *project.Project, resource erf.Resource) (string, []byte, error) { - extension, ok := erf.ExtensionForResourceType(resource.Type) - if !ok { - return "", nil, fmt.Errorf("unsupported resource type 0x%04X for %s", resource.Type, resource.Name) - } +func extractedFile(p *project.Project, resource erf.Resource, extension string) (string, []byte, error) { resref := strings.ToLower(resource.Name) switch extension { diff --git a/internal/project/project.go b/internal/project/project.go index f9da07e..474273a 100644 --- a/internal/project/project.go +++ b/internal/project/project.go @@ -33,6 +33,7 @@ type Config struct { Paths PathConfig `json:"paths"` HAKs []HAKConfig `json:"haks"` TopData TopDataConfig `json:"topdata"` + Extract ExtractConfig `json:"extract"` } type ModuleConfig struct { @@ -64,6 +65,10 @@ type TopDataConfig struct { Assets string `json:"assets"` } +type ExtractConfig struct { + IgnoreExtensions []string `json:"ignore_extensions"` +} + type Inventory struct { SourceFiles []string ScriptFiles []string diff --git a/nwn-tool b/nwn-tool index 15e2f5c..a62b258 100755 Binary files a/nwn-tool and b/nwn-tool differ