mod args; mod color; use color::Color; use libc::{c_int, c_void}; use std::process; const VERSION: &str = "2.0.0"; extern "C" { fn nmseffect_set_autodecrypt(_: c_int) -> c_void; fn nmseffect_set_clearscr(_: c_int) -> c_void; static mut foregroundColor: c_int; } #[no_mangle] pub extern "C" fn rust_main() { println!("Hello from rust"); let args = match args::parse_arguments() { Ok(args) => args, Err(e) => { println!("{e}"); process::exit(1); } }; println!("{:?}", args); if args.version { println!("nms version {VERSION}"); process::exit(0); } if let Some(color) = args.foreground { let color = Color::try_from(color).unwrap_or_default(); let n = color as c_int; unsafe { foregroundColor = n; } } if args.clear_screen { unsafe { nmseffect_set_clearscr(1); } } if args.autodecrypt { unsafe { nmseffect_set_autodecrypt(1); } } }