From 4be2d972bb116196da834b8b98165905ee6ef5a4 Mon Sep 17 00:00:00 2001 From: jinsoul Date: Sun, 5 May 2024 22:33:37 -0500 Subject: [PATCH] Add rpunithm to configuration option in segatools.ini --- chuniio/src/lib.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/chuniio/src/lib.rs b/chuniio/src/lib.rs index 76fe300..de98a6e 100644 --- a/chuniio/src/lib.rs +++ b/chuniio/src/lib.rs @@ -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>> = 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(), + ) + } + } + }; + } } }