Dalamud icon indicating copy to clipboard operation
Dalamud copied to clipboard

Add a new "Hybrid" Dalamud load method

Open marzent opened this issue 4 months ago • 3 comments

This doesn't have any functional impact on entrypoint.

For the legacy dll injection method, this suspends the main thread for a tiny while after the game window is created, but is still showing only a black screen. With "wait for plugins" enabled, it will block there similarly to how entrypoint blocks at the games entrypoint now, allowing TitleEdit for example to work reliably there now.

The new hybrid option is similar to the dll injection method, however it sets a breakpoint at the games entrypoint, suspends the games main thread and then detaches itself, resulting in behaviour similar to entrypoint without using assembly or touching the stack of the original entrypoint and rewriting large parts of it, before it continues execution.

Also it moves all of the heavy lifting for this new mode back into managed Dalamud.Injector (theoretically everything, including the entry point calculation can be moved back into Injector, but it would be two functions doing the same thing being implemented in different languages, and calling from c++ into c# is much more problematic there)

This makes, at least on my system, "wait for plugins" work reliably with wine now, with both DllInject and Hybrid.

marzent avatar Feb 18 '24 09:02 marzent