fix for failing to create shared memory (os error 3)

This commit is contained in:
beerpsi 2023-12-28 20:00:30 +07:00
parent 40a2062a28
commit 98e6f5cf76

View File

@ -110,6 +110,7 @@ cfg_if::cfg_if! {
pub static TIMEOUT: Duration = Duration::from_millis(20);
static mut INPUT_SHMEM: Option<Rc<Shmem>> = None;
const INPUT_SHMEM_OS_ID: &str = "fcfe5b1100568d65af167d81acbed71d";
#[no_mangle]
extern "system" fn DllMain(_dll_module: HINSTANCE, call_reason: DWORD, _reserved: LPVOID) -> BOOL {
@ -343,7 +344,7 @@ fn input_thread_proc() {
info!("Input thread started");
let mut shmem =
match create_shared_memory("Local\\ChuniIOInput", con_impl::INPUT_MEMORY_SIZE, true) {
match create_shared_memory(INPUT_SHMEM_OS_ID, con_impl::INPUT_MEMORY_SIZE, true) {
Ok(s) => s,
Err(e) => {
error!("Could not obtain shared memory for controller input: {e:#?}");
@ -366,7 +367,7 @@ fn input_thread_proc() {
}
fn create_input_shared_memory() -> HRESULT {
match create_shared_memory("Local\\ChuniIOInput", con_impl::INPUT_MEMORY_SIZE, false) {
match create_shared_memory(INPUT_SHMEM_OS_ID, con_impl::INPUT_MEMORY_SIZE, false) {
Ok(s) => {
unsafe { INPUT_SHMEM = Some(Rc::new(s)) };
S_OK