Add rpunithm to configuration option in segatools.ini

This commit is contained in:
jinsoul 2024-05-05 22:33:37 -05:00
parent d699defa0b
commit 4be2d972bb

View File

@ -31,6 +31,11 @@ cfg_if::cfg_if! {
if #[cfg(any(chuni, chusanapp))] {
use std::{sync::{atomic::AtomicBool, RwLock}, thread};
use lazy_static::lazy_static;
use winapi::um::{winbase::GetPrivateProfileIntA};
use create::configuration::DeviceConfiguration;
use anyhow::Result;
use ::log::info;
use rusb::{DeviceHandle, GlobalContext};
@ -41,6 +46,26 @@ cfg_if::cfg_if! {
static DEVICE: RwLock<Option<DeviceHandle<GlobalContext>>> = RwLock::new(None);
static SLIDER_ACTIVE: AtomicBool = AtomicBool::new(false);
lazy_static! {
static ref CONFIGURATION: DeviceConfiguration = {
let chuniio = CString::new("chuniio").unwrap();
let rpunithm = CString::new("rpunithm").unwrap();
let cfg_file = CString::new(".\\segatools.ini").unwrap();
unsafe {
DeviceConfiguration {
rpunithm: GetPrivateProfileIntA(
chuniio.as_ptr(),
rpunithm.as_ptr(),
// default always 0, just in-case a regular yubideck user uses this chuniio and has no idea what a rpunithm is
0,
cfg_file.as_ptr(),
)
}
}
};
}
}
}