More args in rust

This commit is contained in:
Greg Shuflin 2023-07-23 03:19:40 -07:00
parent 78fb4ecbfc
commit c334492ea9
2 changed files with 14 additions and 6 deletions

View File

@ -2,8 +2,11 @@ mod args;
use libc::{c_int, c_void};
const VERSION: &str = "2.0.0";
extern "C" {
fn nmseffect_set_autodecrypt(_: c_int) -> c_void;
fn nmseffect_set_clearscr(_: c_int) -> c_void;
}
#[no_mangle]
@ -12,6 +15,17 @@ pub extern "C" fn rust_main() {
let args = args::parse_arguments().unwrap();
if args.version {
println!("nms version {VERSION}");
std::process::exit(0);
}
if args.clear_screen {
unsafe {
nmseffect_set_clearscr(1);
}
}
if args.autodecrypt {
unsafe {
nmseffect_set_autodecrypt(1);

View File

@ -35,12 +35,6 @@ int main(int argc, char *argv[])
case 's':
nmseffect_set_maskblank(1);
break;
case 'c':
nmseffect_set_clearscr(1);
break;
case 'v':
printf("nms version " VERSION "\n");
return EXIT_SUCCESS;
case '?':
if (isprint(optopt))
{