-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Nuklear render on hooked d3d9 app breaks when app displays a tooltip #911
Description
Hello all, I and my friend are really impressed with Nuklear's features, and so we decided to use it in a small PoC project. We have hooked the target app's Present and Reset.
When nuklear renders a panel we create, everything works, we can move it, resize it, minimize it, etc. But the problem happens when the app creates some sort of window to display a tooltip when you hover over certain elements of the app. The nuklear panel breaks, and by breaking, I mean these effects:
- Let's say that the panel location is originally at an offset of 50, 50 from the start of the app. When any of the app tooltip windows show up, the nuklear panel moves to an offset from the start of the tooltip window, instead of the main app.
- The nuklear panel slightly shrinks
- The title text of the nuklear panel is shown as just white squares instead of letters
- There's some Z-fighting between the nuklear panel and the app.
All of these effects disappear and the panel goes back to normal when I stop hovering over the element that displays the tooltip.
The panel we are drawing is just this:
if (nk_begin(g_nk_ctx, "Test", nk_rect(50, 50, 400, 800), NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_SCALABLE | NK_WINDOW_TITLE)) { } nk_end(g_nk_ctx);
Other important things to know:
We tried to draw a string using the normal d3d9 methods (DrawTextA), to see if maybe we got the same effect when we hover over a tooltip, but no, the string remained normal. So that's why we think it is something we are doing wrong with nuklear.
Order of things:
In our present hook, we have something like this:
- nk_d3d9_init (Only once)
- nk_input_end
- nk_begin
- nk_end
- nk_d3d9_render
- nk_input_begin
- Original Present
In our Reset hook, we have something like this:
- nk_free (If context is not null)
- nk_d3d9_release
- nk_d3d9_init
- Original Reset