veeenu / hudhook

A videogame overlay framework written in Rust, supporting DirectX and OpenGL
MIT License
207 stars 30 forks source link

An issue with version 0.6.5 #172

Closed vsylva closed 8 months ago

vsylva commented 8 months ago

image

veeenu commented 8 months ago

Can you show me how to reproduce this? Are you setting ui.io_mut().keys_down[...] or ui.io_mut()[...] anywhere?

vsylva commented 8 months ago

Can you show me how to reproduce this? Are you setting ui.io_mut().keys_down[...] or ui.io_mut()[...] anywhere?

The code does not use igGetIO(), io(), or io_mut()(I have removed all the code related to io)

It runs fine on version 0.6.4. Strangely, in version 0.6.5, whenever I move the mouse outside the game window, an error pops up, causing the program to terminate

image

veeenu commented 8 months ago

There is probably some remnant of the previous system around, I'll look into it!

Edit: This is the assertion that gets triggered. https://github.com/imgui-rs/imgui-rs/blob/main/imgui-sys%2Fthird-party%2Fimgui-master%2Fimgui%2Fimgui.cpp#L1354

veeenu commented 8 months ago

Can you please implement some logging in your render loop's on_wnd_proc method (log the hex values of umsg, wparam and lparam) and paste/screenshot the log when the assertion gets triggered? I want to make sure what part of the code is leading to this.

vsylva commented 8 months ago

Can you please implement some logging in your render loop's on_wnd_proc method (log the hex values of umsg, wparam and lparam) and paste/screenshot the log when the assertion gets triggered? I want to make sure what part of the code is leading to this.

I set up an assertion hook, but it doesn't work💔

        std::panic::set_hook(Box::new(move |panic_info| {
            tracing::error!("umsg: {:X}", _umsg);
            tracing::error!("wparam: {:X}", _wparam.0);
            tracing::error!("lparam: {:X}", _lparam.0);

            tracing::error!("patnic_info: {}", panic_info);
        }));

So I can only capture a recent log snippet before the crash

2024-03-13T07:18:23.324448Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:24: umsg: FF
2024-03-13T07:18:23.324454Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:25: wparam: 0
2024-03-13T07:18:23.324459Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:26: lparam: 17A0815
2024-03-13T07:18:23.341118Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:24: umsg: FF
2024-03-13T07:18:23.341138Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:25: wparam: 0
2024-03-13T07:18:23.341147Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:26: lparam: E06047F
2024-03-13T07:18:23.357625Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:24: umsg: FF
2024-03-13T07:18:23.357673Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:25: wparam: 0
2024-03-13T07:18:23.357684Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:26: lparam: 17B0815
2024-03-13T07:18:23.357694Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:24: umsg: FF
2024-03-13T07:18:23.357700Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:25: wparam: 0
2024-03-13T07:18:23.357706Z ERROR ThreadId(02) xinput1_4::ui::renderloop: src\ui\renderloop.rs:26: lparam: 2E50773
veeenu commented 8 months ago

0xFF is WM_INPUT. Can you try commenting out these three lines? If that works, would you mind opening a PR with those just removed?

https://github.com/veeenu/hudhook/blob/f8fc75d4d7bbc3ade3ef9e5c4724940dd05d643a/src/renderer/input.rs#L61-L63

vsylva commented 8 months ago

0xFF is WM_INPUT. Can you try commenting out these three lines? If that works, would you mind opening a PR with those just removed?

https://github.com/veeenu/hudhook/blob/f8fc75d4d7bbc3ade3ef9e5c4724940dd05d643a/src/renderer/input.rs#L61-L63

Thank you! It looks good

veeenu commented 8 months ago

Closed by #175