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
This commit is contained in:
@@ -1520,6 +1520,10 @@ void graphics_d3d9_on_present(
|
||||
graphics_d3d9_process_screenshot(device, wrapped_device);
|
||||
}
|
||||
|
||||
// API capture always includes the overlay; it must run before the subscreen present
|
||||
// below, which leaves the arena SMALL back buffer black
|
||||
graphics_d3d9_process_capture(device, wrapped_device);
|
||||
|
||||
// for IIDX TDJ / SDVX UFC, handle subscreen
|
||||
const bool is_vm = games::sdvx::is_valkyrie_model();
|
||||
const bool is_tdj = avs::game::is_model("LDJ") && games::iidx::TDJ_MODE;
|
||||
@@ -1533,9 +1537,6 @@ void graphics_d3d9_on_present(
|
||||
if (is_mfc) {
|
||||
wintouchemu::update();
|
||||
}
|
||||
|
||||
// API capture always includes the overlay
|
||||
graphics_d3d9_process_capture(device, wrapped_device);
|
||||
}
|
||||
|
||||
void update_backbuffer_dimensions(D3DPRESENT_PARAMETERS *params) {
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
|
||||
#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 = 800;
|
||||
inline constexpr UINT GFDM_SMALL_HEIGHT = 1280;
|
||||
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;
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "util/utils.h"
|
||||
#include "misc/wintouchemu.h"
|
||||
#include "touch/native/inject.h"
|
||||
#include "touch/native/nativetouchhook.h"
|
||||
#include "util/time.h"
|
||||
#include "rawinput/rawinput.h"
|
||||
|
||||
@@ -216,6 +217,18 @@ static void gitadora_remember_window(HWND hWnd, const std::string &window_name)
|
||||
} else if (window_name == "SMALL") {
|
||||
GFDM_SUBSCREEN_WINDOW = hWnd;
|
||||
}
|
||||
|
||||
// touch belongs to the SMALL panel when it exists, otherwise to the main window
|
||||
// that draws the subscreen overlay
|
||||
const bool hosts_touch = window_name == "SMALL" ||
|
||||
(window_name == "GITADORA" && !graphics_gitadora_has_dedicated_subscreen());
|
||||
if (nativetouch::is_hooked() && hWnd != nullptr && hosts_touch) {
|
||||
nativetouch::inject::set_preferred_injection_window(hWnd);
|
||||
}
|
||||
}
|
||||
|
||||
bool graphics_gitadora_has_dedicated_subscreen() {
|
||||
return GFDM_SUBSCREEN_WINDOW != nullptr;
|
||||
}
|
||||
|
||||
bool graphics_gitadora_prepare_two_head_device_window(
|
||||
@@ -731,6 +744,11 @@ static HWND WINAPI CreateWindowExA_hook(DWORD dwExStyle, LPCSTR lpClassName, LPC
|
||||
if (GRAPHICS_WINDOWED && !GRAPHICS_PREVENT_SECONDARY_WINDOWS) {
|
||||
graphics_hook_subscreen_window(GFDM_SUBSCREEN_WINDOW);
|
||||
}
|
||||
|
||||
// the dedicated SMALL window is the touch panel; mouse and API touch target it
|
||||
if (nativetouch::is_hooked() && result != nullptr) {
|
||||
nativetouch::inject::register_and_attach_window(result);
|
||||
}
|
||||
}
|
||||
if (is_gfdm_window && GRAPHICS_WINDOWED && !GRAPHICS_PREVENT_SECONDARY_WINDOWS) {
|
||||
gitadora_force_window_style(result);
|
||||
@@ -1320,7 +1338,9 @@ void graphics_hook_window(HWND hWnd, D3DPRESENT_PARAMETERS *pPresentationParamet
|
||||
const bool native_touch_overlay =
|
||||
(games::iidx::NATIVE_TOUCH && games::iidx::TDJ_MODE && !GRAPHICS_IIDX_WSUB) ||
|
||||
(games::popn::NATIVE_TOUCH &&
|
||||
games::popn::is_pikapika_model() && GRAPHICS_PREVENT_SECONDARY_WINDOWS);
|
||||
games::popn::is_pikapika_model() && GRAPHICS_PREVENT_SECONDARY_WINDOWS) ||
|
||||
(games::gitadora::NATIVE_TOUCH &&
|
||||
games::gitadora::is_arena_model() && GRAPHICS_PREVENT_SECONDARY_WINDOWS);
|
||||
if (native_touch_overlay) {
|
||||
nativetouch::inject::register_and_attach_window(hWnd);
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ extern bool D3D9_DEVICE_HOOK_DISABLE;
|
||||
|
||||
void graphics_init();
|
||||
void graphics_hook_window(HWND hWnd, D3DPRESENT_PARAMETERS *pPresentationParameters);
|
||||
bool graphics_gitadora_has_dedicated_subscreen();
|
||||
// The native GITADORA two-head D3D9 group uses the game's named SMALL
|
||||
// device window for the native physical SMALL head. The game requests
|
||||
// D3DCREATE_NOWINDOWCHANGES, so this host must be made borderless and sized
|
||||
|
||||
Reference in New Issue
Block a user