Skip to content
This repository has been archived by the owner on Oct 6, 2024. It is now read-only.

Option To Disable Mouse Alterations #69

Open
atom0s opened this issue Apr 29, 2021 · 9 comments
Open

Option To Disable Mouse Alterations #69

atom0s opened this issue Apr 29, 2021 · 9 comments

Comments

@atom0s
Copy link

atom0s commented Apr 29, 2021

While using dgVoodoo 2 with some games, dgVoodoo will constantly attempt to hide the cursor which can lead to two issues:

  • The process can deadlock because dgVoodoo will get stuck in a while loop.
  • The mouse will not be visible making it impossible to play the game with the mouse.

For example, dgVoodoo can get stuck in a loop trying to set the cursor like so:

  if ( v4 == v5 )
  {
    if ( v3 )
    {
LABEL_9:
      SetCursor(*(HCURSOR *)(this + 2968));
      goto LABEL_11;
    }
  }
  else
  {
    if ( v3 )
    {
      while ( ShowCursor(1) < 0 )
        ;
      goto LABEL_9;
    }
    while ( ShowCursor(0) >= 0 )
      ;
  }

Games that also make use of custom cursors for important things are broken with this as dgVoodoo instead tries to either hide the cursor or default it to the IDC_ARROW icon.

An option to disable any call to SetCursor and ShowCursor inside of dgVoodoo itself and let the game control it fully would be nice to avoid this kind of issue.

A game that has all problems listed above for example would be Final Fantasy XI.

In one of my projects, we have a custom plugin to combat dgVoodoo's aggressive 'take-over' of the mouse to allow it to work again but would prefer this to be an option that can be disabled instead.

@dege-diosg
Copy link
Owner

Set the scaling mode to 'Unspecified', 'Stretched' or 'Centered' and the hw mouse emulation won't take place.
I already changed the ShowCursor code to something else anyway, but it's not yet released.

Cursor handling cannot be done by the game when the physical resolution of the display differs from the one that the game expects.
(Btw, dgVoodoo only tests if the cursor is visible and copies the current cursor bitmap for itself, while setting an empty bitmap for the physical one, but it doesn't intend to hide it logically.)

@atom0s
Copy link
Author

atom0s commented May 2, 2021

This happens with the scaling mode set to Unspecified already.

@dege-diosg
Copy link
Owner

Then the resolution must be forced (or integer scaling other than 1, or sg like that).
But, with default config with Unspecified scaling mode and Unforced resolution, dgVoodoo does not intervene into mouse handling. Any circumstances however, when the physical display resolution is not the same as the app can expect, forces hiding the physical cursor by replacing its bitmap.

Btw, what about the latest version? It doesn't call ShowCursor to detect the visibility of the cursor, only SetCursor is left to change its bitmap.

@atom0s
Copy link
Author

atom0s commented May 8, 2021

Then the resolution must be forced (or integer scaling other than 1, or sg like that).

Unless dgVoodoo is doing this itself, it shouldn't be. The game runs fullscreen or windowed natively without any extra hooking required/needed. (The game runs via Direct3D8 so voodoo is generally used to up-port to DX9+ as well as to 'fix' the game killing itself when IDirect3DDevice8::Reset is called. (This is an intentional thing with this game as it was used for anti-cheat purposes before they added a proper windowed mode themselves and never fixed it afterward.))

Downloaded and tested the newest version posted on the main site (2.74.1) and get the same results with the configuration file completely stock, or adjusted for what would be normal usage on this game. The mouse is still completely hidden by dgVoodoo.

Configuration settings I've toggled to test with:

  • General
    • Appearance - Fullscreen or Windowed
    • Appearance - Scaling Mode
    • Miscellanneous
      • Keep window aspect ratio.
      • Capture mouse.
  • DirectX
    • Resolution
    • Application controlled fullscreen/windowed state.

No matter what combination of settings are used, the mouse is force-hidden unless we manually hook the API calls ourselves and block dgVoodoo from having any control of it. The mouse aligns fine as well, and does not need voodoo trying to mess with it or trying to rescale it.

If possible can this just be a single checkbox option to completely disable Voodoo from touching any part of the mouse? This game does not it trying to alter any part of it.

@dege-diosg
Copy link
Owner

Ok, then I think I completely misunderstood the situation the entry is about, sorry.

So, we're talking about the D3DDevice8::ShowCursor call, not the general cursor hookup handler.
Indeed, that hides/shows the cursor according to the incoming bShow parameter.
I remember someone reported the same invisible cursor problem for a D3D9 game. Looking at the code, back then I changed the implementation for D3D9 but not for D3D8.

I think I'll fix it somehow for both instead of a new option.

@dege-diosg
Copy link
Owner

I changed the implementation of Device::ShowCursor.
I doesn't call ShowCursor anymore, mouse hiding/showing is based on setting an empty/non-empty bitmap for the physical cursor, and all is only in case if a non-NULL bitmap is set through Device::SetCursorProperties.
That's how it seems to work in MS D3D8/9.

@atom0s
Copy link
Author

atom0s commented May 11, 2021

Is there a different place to get/grab beta's or new updates outside of the main site or the Releases here to test this? Or just not pushed yet and will be in v2.74.2 later on?

@dege-diosg
Copy link
Owner

I publish WIP versions on my site when I'm in a developing period or have sg that'd be cool to test before releasing.
But now I only have a few bugfixings, so it's not released yet in any form.

Anyway, I attach here the spec-release version of the DX files with the cursor bug fixed. I think it's a 'would be cool to test' case.

Let me know if sg is still wrong with it.
dgVoodoo2_74_1_dbg_cursor.zip

@atom0s
Copy link
Author

atom0s commented May 13, 2021

So far with some basic testing seems to work properly. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants