1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//! NCS subcommand definitions
use clap::Subcommand;
use std::path::PathBuf;
#[derive(Subcommand)]
pub enum NcsCommand {
/// Scan a directory of decompressed NCS files and list types
Scan {
/// Directory containing decompressed .bin files
path: PathBuf,
/// Show only files matching this type
#[arg(short = 't', long)]
filter_type: Option<String>,
/// Show detailed info for each file
#[arg(short, long)]
verbose: bool,
/// Output as JSON
#[arg(long)]
json: bool,
},
/// Show content of a specific NCS file
Show {
/// Path to decompressed NCS file
path: PathBuf,
/// Show all strings (not just entry names)
#[arg(short, long)]
all_strings: bool,
/// Show raw hex dump
#[arg(long)]
hex: bool,
/// Output as JSON
#[arg(long)]
json: bool,
/// Output as TSV (tab-separated values)
#[arg(long)]
tsv: bool,
},
/// Search for NCS files containing a pattern
Search {
/// Directory to search
path: PathBuf,
/// Pattern to search for (case-insensitive)
pattern: String,
/// Search in all strings, not just entry names
#[arg(short, long)]
all: bool,
/// Maximum results to show
#[arg(short = 'n', long, default_value = "20")]
limit: usize,
},
/// Extract specific data types from NCS files
Extract {
/// Directory containing decompressed NCS files
path: PathBuf,
/// Type to extract (manufacturer, rarity, itempoollist, etc.)
#[arg(short = 't', long)]
extract_type: String,
/// Output file (stdout if not specified)
#[arg(short, long)]
output: Option<PathBuf>,
/// Output as JSON
#[arg(long)]
json: bool,
},
/// Show statistics about NCS files
Stats {
/// Directory containing decompressed NCS files
path: PathBuf,
/// Show format code breakdown
#[arg(short, long)]
formats: bool,
},
/// Decompress NCS data from a pak file or raw NCS
Decompress {
/// Input file (pak file or raw NCS)
input: PathBuf,
/// Output directory for decompressed files
#[arg(short, long)]
output: Option<PathBuf>,
/// Offset in file (for pak files)
#[arg(long)]
offset: Option<usize>,
/// Output raw binary instead of parsed TSV
#[arg(long)]
raw: bool,
/// Path to Oodle DLL for native decompression (Windows only)
///
/// Load the official Oodle DLL (e.g., oo2core_9_win64.dll) for full
/// compatibility. Only works on Windows.
#[cfg(target_os = "windows")]
#[arg(long, value_name = "DLL_PATH")]
oodle_dll: Option<PathBuf>,
/// External command for Oodle decompression (cross-platform)
///
/// Execute an external program for decompression. The command is invoked as:
/// <command> decompress <decompressed_size>
/// Compressed data is sent to stdin, decompressed data is read from stdout.
#[arg(long, value_name = "COMMAND")]
oodle_exec: Option<String>,
},
/// Debug binary structure of an NCS file
Debug {
/// Path to decompressed NCS file
path: PathBuf,
/// Show hex dump of binary section
#[arg(long)]
hex: bool,
/// Try to parse binary section with bit reader
#[arg(long)]
parse: bool,
/// Show all section offsets
#[arg(long)]
offsets: bool,
},
}