touch: avoid calling is_touch_available too early (#289)

## Link to GitHub Issue, if one exists
Fixes #120 

## Description of change
Don't call `is_touch_available` in launcher before RawInput stack is
initialized. This causes us to incorrectly fall back to the Win7/Win8
touch handler.

The desired behavior is to use rawinput touch by default for all games,
unless overridden by the user via `-wintouch`.

Add a bunch of logging so we can spot who's calling
`is_touch_available`.

As a side effect, a handful of games that previously used Win7/8 touch
will now use RawInput touch instead. If this causes any issues, they can
turn `-wintouch` on to force Win7/8 touch logic again.

## Compiling
👍 

## Testing
Test:

* RB
* -wintouch
* TDJ, UFC subscreen and native touch
* overlay, especially in multi-mon
This commit is contained in:
bicarus-dev
2025-04-04 21:31:18 -07:00
committed by GitHub
parent bd6c8d3f3c
commit ae06652148
9 changed files with 46 additions and 51 deletions
+14 -39
View File
@@ -217,6 +217,7 @@ int main_implementation(int argc, char *argv[]) {
bool attach_qks = false;
bool attach_mfg = false;
bool attach_museca = false;
bool show_cursor_if_no_touch = false;
// misc settings
size_t user_heap_size = 0;
@@ -1291,11 +1292,7 @@ int main_implementation(int argc, char *argv[]) {
avs::game::DLL_NAME = "system.dll";
attach_io = true;
attach_shogikai = true;
// automatically show cursor when no touchscreen is available
if (!is_touch_available()) {
GRAPHICS_SHOW_CURSOR = true;
}
show_cursor_if_no_touch = true;
break;
}
@@ -1338,12 +1335,7 @@ int main_implementation(int argc, char *argv[]) {
// game crash fix
easrv_maint = false;
// automatically show cursor when no touchscreen is available
if (!is_touch_available()) {
GRAPHICS_SHOW_CURSOR = true;
}
show_cursor_if_no_touch = true;
break;
}
@@ -1458,12 +1450,7 @@ int main_implementation(int argc, char *argv[]) {
avs::game::DLL_NAME = "nostalgia.dll";
attach_io = true;
attach_nostalgia = true;
// automatically show cursor when no touchscreen is available
if (!is_touch_available()) {
GRAPHICS_SHOW_CURSOR = true;
}
show_cursor_if_no_touch = true;
break;
}
@@ -1569,12 +1556,7 @@ int main_implementation(int argc, char *argv[]) {
avs::game::DLL_NAME = "arknck.dll";
attach_io = true;
attach_we = true;
// automatically show cursor when no touchscreen is available
if (!is_touch_available()) {
GRAPHICS_SHOW_CURSOR = true;
}
show_cursor_if_no_touch = true;
break;
}
@@ -1607,10 +1589,7 @@ int main_implementation(int argc, char *argv[]) {
avs::game::DLL_NAME = "kamunity.dll";
attach_io = true;
attach_ccj = true;
// automatically show cursor when no touchscreen is available
if (!is_touch_available()) {
GRAPHICS_SHOW_CURSOR = true;
}
show_cursor_if_no_touch = true;
break;
}
@@ -1619,10 +1598,7 @@ int main_implementation(int argc, char *argv[]) {
avs::game::DLL_NAME = "kamunity.dll";
attach_io = true;
attach_qks = true;
// automatically show cursor when no touchscreen is available
if (!is_touch_available()) {
GRAPHICS_SHOW_CURSOR = true;
}
show_cursor_if_no_touch = true;
break;
}
@@ -1632,10 +1608,7 @@ int main_implementation(int argc, char *argv[]) {
attach_io = true;
attach_mfg = true;
launcher::signal::USE_VEH_WORKAROUND = true;
// automatically show cursor when no touchscreen is available
if (!is_touch_available()) {
GRAPHICS_SHOW_CURSOR = true;
}
show_cursor_if_no_touch = true;
break;
}
@@ -1644,10 +1617,7 @@ int main_implementation(int argc, char *argv[]) {
avs::game::DLL_NAME = "kamunity.dll";
attach_io = true;
attach_bc = true;
// automatically show cursor when no touchscreen is available
if (!is_touch_available()) {
GRAPHICS_SHOW_CURSOR = true;
}
show_cursor_if_no_touch = true;
break;
}
@@ -1843,6 +1813,11 @@ int main_implementation(int argc, char *argv[]) {
// print devices
RI_MGR->devices_print();
// for certain games, show cursor if no touch is available (must be called after RI_MGR is available)
if (show_cursor_if_no_touch && !is_touch_available("launcher::main_implementation")) {
GRAPHICS_SHOW_CURSOR = true;
}
// cardio
if (cardio_enabled) {
cardio_runner_start(true);