sdvx: fix api touch in windowed mode (#862)

## Link to GitHub Issue or related Pull Request, if one exists
Fixes #858 

## Description of change
Fix orientation being wrong in windowed mode when API touch is used

Fix mouse no longer working when API client is in use.

This PR only affects windowed mode SDVX.

## Testing
This commit is contained in:
bicarus
2026-08-10 18:58:48 -07:00
committed by GitHub
parent 3da352488e
commit 13a171f199
2 changed files with 13 additions and 5 deletions
+7 -5
View File
@@ -55,10 +55,12 @@ namespace api::modules {
native_canvas_w = 0; native_canvas_w = 0;
native_canvas_h = 0; native_canvas_h = 0;
if (is_sdvx) { if (is_sdvx) {
// landscape API coordinates already match the primary screen orientation; // windowed and landscape API coordinates already match the primary screen orientation;
// portrait coordinates are rotated by apply_touch_errata // fullscreen portrait coordinates are rotated by apply_touch_errata
native_canvas_w = GRAPHICS_FS_ORIENTATION_SWAP ? 1920 : 1080; const bool landscape_coordinates =
native_canvas_h = GRAPHICS_FS_ORIENTATION_SWAP ? 1080 : 1920; GRAPHICS_WINDOWED || GRAPHICS_FS_ORIENTATION_SWAP;
native_canvas_w = landscape_coordinates ? 1920 : 1080;
native_canvas_h = landscape_coordinates ? 1080 : 1920;
} else if (avs::game::is_model("LDJ")) { } else if (avs::game::is_model("LDJ")) {
// TDJ subscreen; FHD models are upscaled to 1080p by apply_touch_errata // TDJ subscreen; FHD models are upscaled to 1080p by apply_touch_errata
native_canvas_w = is_tdj_fhd ? 1920 : 1280; native_canvas_w = is_tdj_fhd ? 1920 : 1280;
@@ -219,7 +221,7 @@ namespace api::modules {
// the target of the touch events so just assume it's the sub screen // the target of the touch events so just assume it's the sub screen
x = x_raw * 1920 / 1280; x = x_raw * 1920 / 1280;
y = y_raw * 1080 / 720; y = y_raw * 1080 / 720;
} else if (is_sdvx && !GRAPHICS_FS_ORIENTATION_SWAP) { } else if (is_sdvx && !GRAPHICS_WINDOWED && !GRAPHICS_FS_ORIENTATION_SWAP) {
// rotate API coordinates into SDVX's portrait touch space // rotate API coordinates into SDVX's portrait touch space
x = 1080 - y_raw; x = 1080 - y_raw;
y = x_raw; y = x_raw;
+6
View File
@@ -147,6 +147,12 @@ namespace nativetouch::transform {
return screen_to_game(window, position); return screen_to_game(window, position);
} }
// exception: sdvx windowed subscreen does not use the subscreen overlay transform
if (GRAPHICS_WINDOWED && window == SDVX_SUBSCREEN_WINDOW) {
POINT client_position = *position;
return screen_to_game_client(window, &client_position);
}
// if this game has a subscreen overlay that can transform touch input // if this game has a subscreen overlay that can transform touch input
// but the window is hidden or not under the cursor, reject mouse-as-touch // but the window is hidden or not under the cursor, reject mouse-as-touch
// (e.g., iidx/sdvx are rejected here, but nostalgia is allowed) // (e.g., iidx/sdvx are rejected here, but nostalgia is allowed)