Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regarding opening of two frames, which caused ImGui_implWin32_WndFrocHandler to be unable to accept messages #7948

Closed
Cylster-L opened this issue Sep 3, 2024 · 6 comments

Comments

@Cylster-L
Copy link

Version/Branch of Dear ImGui:

Version 1.XX, Branch: XXX (master/docking/etc.)

Back-ends:

imgui_impl_XXX.cpp + imgui_impl_XXX.cpp

Compiler, OS:

Windows10 + vs2019

Full config/build information:

Hello, I am working on a cheating plugin project for a single player game (ps: a DLL project for injecting into it), and my plugin requires an interface, so I used imgui. I want to use imgui to draw two locations, one under a specific element and the other at the top level. Of course, I found these two drawing locations, they are on the same thread, and I performed the following code operations separately in these two locations:
ImGui_ImplDX11_NewFrame(); ImGui_ImplWin32_NewFrame(); ImGui::NewFrame(); Render()//Draw different elements in different places ImGui::Render(); d3d11_device_context->OMSetRenderTargets(1, &_target_view, nullptr); ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
Then I want the top-level imgui to accept the message sent by ImGui_implWin32_WndFrocHandler, but two frames make this message invalid. I cannot click or move the top-level elements. How can I solve this problem? thank you.

Details:

My Issue/Question:

XXX (please provide as much context as possible)

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

` ImGui_ImplDX11_NewFrame(); 
ImGui_ImplWin32_NewFrame(); 
ImGui::NewFrame(); Render()//Draw different elements in different places 
ImGui::Render(); 
d3d11_device_context->OMSetRenderTargets(1, &_target_view, nullptr); ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData()); `  
@Cylster-L Cylster-L changed the title Regarding my opening of two frames, which caused ImGui_implWin32_WndFrocHandler to be unable to accept messages Regarding opening of two frames, which caused ImGui_implWin32_WndFrocHandler to be unable to accept messages Sep 3, 2024
@GamingMinds-DanielC
Copy link
Contributor

Issues related to cheating usually don't get support for obvious reasons. I guess it would be OK for single player games, but I see that you recently forked an injector for League of Legends. That doesn't look very single player to me.

#1586

@Cylster-L
Copy link
Author

Cylster-L commented Sep 3, 2024

Issues related to cheating usually don't get support for obvious reasons. I guess it would be OK for single player games, but I see that you recently forked an injector for League of Legends. That doesn't look very single player to me.

#1586

Yes, I recently worked on a League of Legends injector, but now I'm working on Black Myth: Wukong

@GamingMinds-DanielC
Copy link
Contributor

Well then. An ImGui context can't handle being used for two unrelated things like that. It needs submitted items to be consistent from frame to frame to make interaction possible. If you can't combine those two locations into a single frame, create (and initialize) two separate ImGui contexts. Switch between them as needed, submit only one frame for each context. You might need to feed inputs into both contexts at the same time.

@Cylster-L
Copy link
Author

Well then. An ImGui context can't handle being used for two unrelated things like that. It needs submitted items to be consistent from frame to frame to make interaction possible. If you can't combine those two locations into a single frame, create (and initialize) two separate ImGui contexts. Switch between them as needed, submit only one frame for each context. You might need to feed inputs into both contexts at the same time.

Thank you for your answer. The game crashes when I switch contexts, and I have been searching for the reason for a long time but cannot find it. Do you have any examples? Thank you very much

@GamingMinds-DanielC
Copy link
Contributor

Crashes must be something on your end. Might be a threading issue, ImGui is not thread safe.

@ocornut
Copy link
Owner

ocornut commented Sep 17, 2024

Yes, I recently worked on a League of Legends injector, but now I'm working on Black Myth: Wukong

That's a sorry but #1586 as per the rules.

@ocornut ocornut closed this as completed Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants