elishacloud / dxwrapper

Fixes compatibility issues with older games running on Windows 10/11 by wrapping DirectX dlls. Also allows loading custom libraries with the file extension .asi into game processes.
zlib License
1.23k stars 90 forks source link

The surface is misaligned #221

Closed mr-mugp closed 12 months ago

mr-mugp commented 1 year ago

Dd7to9 $0 Z07%~AH@AJ@$9DDAOHSA

elishacloud commented 1 year ago

Yes, this happens on some games when using windowed mode in the game. Change the in-game settings to use fullscreen mode.

mr-mugp commented 1 year ago

Thanks for your efforts, and hope to see a fully supported window mode sooner

elishacloud commented 1 year ago

If the game is only using 2D DirectDraw and not Direct3D you could try enabling the following settings:

DdrawEmulateSurface = 1
DdrawWriteToGDI = 1
mr-mugp commented 1 year ago

Thanks, normal, but can't hook the game

elishacloud commented 1 year ago

You could also try setting these settings to your screen resolution:

DdrawOverridePrimaryWidth  = 0
DdrawOverridePrimaryHeight = 0
mr-mugp commented 1 year ago

Thanks, I tried it, Releases v1.0.6542.21 doesn't have this setting item?

elishacloud commented 1 year ago

Here is the latest release. Try just changing the ini settings to your display resolution. dxwrapper.zip

mr-mugp commented 1 year ago

If Gui is enabled, it will not enter d3d9.dll, and the original hook will become invalid image

mr-mugp commented 1 year ago

After turning on DdrawWriteToGDI=1, the ImGui in the DebugOverlay .cpp can also be displayed normally?

mr-mugp commented 1 year ago

Compiled with the 84e47b5 update, the problem is more complicated. Now I'm using 9d01079 with dxwnd.dll it's normal

elishacloud commented 1 year ago

Ok, try this update. I added basic window support. Note: when using in-game windowed mode you should enable DdrawUseNativeResolution.

Here is the update: dxwrapper.zip

mr-mugp commented 1 year ago

Thank you very much for your interest and continuous update This time the game window is normal, but there are still 5 problems.

  1. After the window is minimized, the mouse moves slowly
  2. When moving the game window, the ImGui of the hook does not follow the movement
  3. The mouse message received by ImGui is in the wrong position
  4. The game cannot open multiple windows and will be very stuck. After closing one window, everything else is gone
  5. When the window moves off-screen, the picture is compressed

This should be caused by SurfaceToWindows.

9d01079 is normal when used with dxwnd dxwrapper.ini
Dd7to9=1

dxwnd.ini
ver0=9 flag0=134348834 flagg0=1275068416 flagh0=20

mr-mugp commented 1 year ago
  1. After the window is minimized, the mouse moves slowly
  2. When moving the game window, the ImGui of the hook does not follow the movement
  3. The mouse message received by ImGui is in the wrong position
  4. The game cannot open multiple windows and will be very stuck. After closing one window, everything else is gone
  5. When the window moves off-screen, the picture is compressed

This should be caused by SurfaceToWindows.

9d01079 is normal when used with dxwnd dxwrapper.ini Dd7to9=1

dxwnd.ini ver0=9 flag0=134348834 flagg0=1275068416 flagh0=20

Thanks, 1. Problem solved

mr-mugp commented 1 year ago

1.The imgui window is always positioned relative to the desktop and does not follow the game movement 3M6IVK5S@BS(2A9@}$U}QG8

2.The game moves outside the left table, and the game screen does not go outside CNMT18_2OC HYW%N1`4(1{2

elishacloud commented 1 year ago

1.The imgui window is always positioned relative to the desktop and does not follow the game movement

  1. When moving the game window, the ImGui of the hook does not follow the movement

Yes, this is because of how the game and DirectDraw works, unrelated to dxwrapper. The game writes to the location of the surface where the window is located. So if you move the window then the game writes to the surface in a different location.

I can fix this by emulating the surface and then always writing to the real surface in the upper right hand corner of the surface. That is probably the right way to solve this issue.

  1. The mouse message received by ImGui is in the wrong position

This is related to the issue above. When I solve that one it should solve this one.

  1. The game cannot open multiple windows and will be very stuck. After closing one window, everything else is gone

Yes, dxwrapper always assumes that there is only one game window. This won't be solved very soon.

  1. When the window moves off-screen, the picture is compressed

This is probably something I am doing wrong. I will need to look into this more.

mr-mugp commented 1 year ago

Thank you very much, about point 4, it's already no problem, case DLL_PROCESS_DETACH:, causing other windows to crash, I'll just comment it out

elishacloud commented 1 year ago

case DLL_PROCESS_DETACH:, causing other windows to crash

Can you tell me which line(s) is causing this? Also, try adding this line to the ini file ResetScreenRes = 0.

elishacloud commented 1 year ago

The latest build should fix most of these issues. Here is the build: dxwrapper.zip

mr-mugp commented 1 year ago

It has been tested, very good, thank you very much for your efforts,

elishacloud commented 1 year ago

Ok, great. Let me know if there are any issues left here.

elishacloud commented 12 months ago

This issue is fixed with the latest release.