Files
spice2x-r3d/src/spice2x/hooks/graphics/backends/d3d9/d3d9_gfdm.h
T
bicarusandGitHub a2e508208c gitadora: fix synthetic touch (mouse and api) (#867)
## Link to GitHub Issue or related Pull Request, if one exists
#0

## Description of change
Fix mouse and touch API handling for gitadora.

* hook native touch in every arena window mode (previously only using
wintouchemu for 1 windowed mode)
* publish the touch window (SMALL panel, or the main window drawing the
overlay) and only attach injection there
* route touch on the SMALL window straight through instead of the
overlay transform, and accept the mouse only there
* fix spiceapi by forcing 800x1280 touch canvas size
* run API capture before the subscreen present to fix api not showing
sub image


## Testing
Test:

gitadora 1/2/4 windowed mode, fullscreen

iidx /sdvx / popn windowed/fullscreen for regressions
2026-08-16 01:43:20 -07:00

81 lines
3.2 KiB
C++

#pragma once
#include <array>
#include <d3d9.h>
#include "games/gitadora/gitadora.h"
inline constexpr UINT GFDM_SIDE_WIDTH = 1080;
inline constexpr UINT GFDM_SIDE_HEIGHT = 1920;
inline constexpr UINT GFDM_SMALL_WIDTH = games::gitadora::ARENA_SUBSCREEN_WIDTH;
inline constexpr UINT GFDM_SMALL_HEIGHT = games::gitadora::ARENA_SUBSCREEN_HEIGHT;
inline constexpr UINT GFDM_LOGICAL_HEAD_COUNT = 4;
inline constexpr UINT GFDM_NATIVE_SMALL_SWAPCHAIN = 1;
struct GfdmTwoHeadDeviceState {
explicit GfdmTwoHeadDeviceState(
D3DPRESENT_PARAMETERS *presentation_parameters,
D3DDISPLAYMODEEX *fullscreen_display_modes,
UINT logical_small_swapchain = 2)
: presentation_parameters(presentation_parameters),
fullscreen_display_modes(fullscreen_display_modes),
logical_small_swapchain(logical_small_swapchain) {}
void use_native_parameters() {
presentation_parameters = native_presentation_parameters.data();
fullscreen_display_modes = source_fullscreen_display_modes != nullptr
? native_fullscreen_display_modes.data()
: nullptr;
}
std::array<D3DPRESENT_PARAMETERS, 2> native_presentation_parameters {};
std::array<D3DDISPLAYMODEEX, 2> native_fullscreen_display_modes {};
std::array<D3DPRESENT_PARAMETERS, 2> recovery_parameters {};
std::array<D3DDISPLAYMODEEX, 2> recovery_modes {};
D3DPRESENT_PARAMETERS *presentation_parameters;
D3DDISPLAYMODEEX *fullscreen_display_modes;
D3DDISPLAYMODEEX *const source_fullscreen_display_modes = fullscreen_display_modes;
UINT logical_small_swapchain;
bool recovery_candidate = false;
};
bool gfdm_two_head_exclusive();
bool is_fake_subscreen_adapter(UINT adapter);
void get_fake_subscreen_display_mode(UINT adapter, D3DDISPLAYMODE *mode);
void get_fake_subscreen_display_mode_ex(UINT adapter, D3DDISPLAYMODEEX *mode);
HRESULT graphics_d3d9_gfdm_select_two_head_group_parameters(
const D3DPRESENT_PARAMETERS *logical_presentation_parameters,
const D3DDISPLAYMODEEX *logical_fullscreen_display_modes,
D3DPRESENT_PARAMETERS *native_presentation_parameters,
D3DDISPLAYMODEEX *native_fullscreen_display_modes,
UINT *logical_small_swapchain,
const char *operation);
HRESULT graphics_d3d9_gfdm_remap_two_head_group_parameters(
D3DPRESENT_PARAMETERS *presentation_parameters,
D3DDISPLAYMODEEX *fullscreen_display_modes,
const char *operation);
void graphics_d3d9_gfdm_align_two_head_refresh_to_desktop(
IDirect3D9Ex *d3d,
UINT master_adapter,
D3DPRESENT_PARAMETERS *presentation_parameters,
D3DDISPLAYMODEEX *fullscreen_display_modes,
const char *operation);
HRESULT validate_gfdm_two_head_exclusive(
IDirect3D9 *d3d,
UINT adapter,
D3DDEVTYPE device_type,
DWORD behavior_flags,
const D3DPRESENT_PARAMETERS *presentation_parameters);
HRESULT graphics_d3d9_gfdm_recover_two_head_present_mode(
IDirect3D9Ex *d3d,
IDirect3DDevice9Ex *device,
UINT master_adapter,
const D3DPRESENT_PARAMETERS *desired_parameters,
const D3DDISPLAYMODEEX *desired_modes);