Remove unused OS name argument

This commit is contained in:
a2x 2024-04-01 19:09:44 +10:00
parent 11d99ac058
commit 4a10ad3ba6
2 changed files with 6 additions and 28 deletions

View File

@ -19,19 +19,15 @@ toolchain must be installed.
- For Linux: `config_linux.json`
- For Windows: `config_win.json`
When running the executable without providing an optional memflow connector name, it will default to using the
memflow-native cross-platform OS layer to read the game's memory. However, any existing memflow connectors should work
out of the box.
Just pass the `connector` and optional `connector-args` arguments to the program.
When running the executable without providing an optional memflow connector name, it will default to using the [memflow-native](https://github.com/memflow/memflow-native) cross-platform OS layer to read the memory of the game process. If you wish to use an existing memflow connector instead, pass the `connector` and optional `connector-args` arguments to the program.
E.g. `cs2-dumper.exe -c pcileech -a device=fpga -vvv`
E.g. `./cs2-dumper -c kvm -vvv`
### Available Arguments
- `-v...`: Increase logging verbosity. Can be specified multiple times.
- `-c, --connector <connector>`: The name of the memflow connector to use.
- `-a, --connector-args <connector-args>`: Additional arguments to supply to the connector.
- `-o, --os <os>`: The name of the target operating system.
- `-d, --directory <directory>`: The output directory to write the generated files to. Default: `output`.
- `-i, --indent-size <indent-size>`: The number of spaces to use per indentation level. Default: `4`.
- `-h, --help`: Print help.

View File

@ -26,7 +26,7 @@ fn main() -> Result<()> {
let start_time = Instant::now();
let matches = parse_args();
let (conn_name, conn_args, os_name, indent_size, out_dir) = extract_args(&matches)?;
let (conn_name, conn_args, indent_size, out_dir) = extract_args(&matches)?;
// Create the output directory if it doesn't exist.
fs::create_dir_all(&out_dir)?;
@ -38,7 +38,7 @@ fn main() -> Result<()> {
.builder()
.connector(&conn_name)
.args(conn_args)
.os(&os_name)
.os("win32")
.build()?
} else {
// Fallback to the native OS layer if no connector name was provided.
@ -85,13 +85,6 @@ fn parse_args() -> ArgMatches {
.short('a')
.required(false),
)
.arg(
Arg::new("os")
.help("The name of the target operating system.")
.long("os")
.short('o')
.required(false),
)
.arg(
Arg::new("directory")
.help("The output directory to write the generated files to.")
@ -113,9 +106,7 @@ fn parse_args() -> ArgMatches {
.get_matches()
}
fn extract_args(
matches: &ArgMatches,
) -> Result<(Option<String>, ConnectorArgs, String, usize, &PathBuf)> {
fn extract_args(matches: &ArgMatches) -> Result<(Option<String>, ConnectorArgs, usize, &PathBuf)> {
use std::str::FromStr;
let log_level = match matches.get_count("verbose") {
@ -144,17 +135,8 @@ fn extract_args(
.map(|s| ConnectorArgs::from_str(&s).expect("unable to parse connector arguments"))
.unwrap_or_default();
let os_name = matches
.get_one::<String>("os")
.map(|s| s.to_string())
.unwrap_or_else(|| match env::consts::OS {
"linux" => "linux".to_string(),
"windows" => "win32".to_string(),
os => panic!("unsupported os: {}", os),
});
let indent_size = *matches.get_one::<usize>("indent-size").unwrap();
let out_dir = matches.get_one::<PathBuf>("directory").unwrap();
Ok((conn_name, conn_args, os_name, indent_size, out_dir))
Ok((conn_name, conn_args, indent_size, out_dir))
}