mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-06 08:30:42 -07:00
touch: make native touch the default for iidx/sdvx/popn (#820)
## Link to GitHub Issue or related Pull Request, if one exists Fixes #814 ## Description of change Remove iidx/sdvx/popon `native touch` options. Remove dead code in wintouchemu that deals with these games. Native touch is now at feature-parity with wintouchemu. Native touch options work better with touch screens, while rawinput-based wintouchemu has compat issues on some touchscreens. For these subscreen games deprecate the usage of wintouchemu and make them use native touch stack by default. ### For future consideration Gitadora - not sure what to do with this one. We only use wintouchemu for the single window case. For all other configurations, the game accepts mouse and touch input without any hooks, so perhaps nothing needs to be done here. Nostalgia - consider moving away from wintouchemu and adopt native touch hook here as well. ## Testing WIP
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include "launcher/options.h"
|
||||
#include "touch/touch.h"
|
||||
#include "touch/native/nativetouchhook.h"
|
||||
#include "misc/wintouchemu.h"
|
||||
#include "misc/eamuse.h"
|
||||
#include "util/detour.h"
|
||||
#include "util/deferlog.h"
|
||||
@@ -63,7 +62,6 @@ namespace games::iidx {
|
||||
bool TDJ_MODE = false;
|
||||
bool FORCE_720P = false;
|
||||
bool DISABLE_ESPEC_IO = false;
|
||||
bool NATIVE_TOUCH = false;
|
||||
std::optional<std::string> SOUND_OUTPUT_DEVICE = std::nullopt;
|
||||
std::optional<std::string> SOUND_OUTPUT_DEVICE_IN_EFFECT = std::nullopt;
|
||||
std::optional<std::string> ASIO_DRIVER = std::nullopt;
|
||||
@@ -350,13 +348,7 @@ namespace games::iidx {
|
||||
// need to hook `avs2-core.dll` so AVS win32fs operations go through rom hook
|
||||
devicehook_init(avs::core::DLL_INSTANCE);
|
||||
|
||||
if (NATIVE_TOUCH) {
|
||||
nativetouch::hook(avs::game::DLL_INSTANCE);
|
||||
} else {
|
||||
wintouchemu::FORCE = true;
|
||||
wintouchemu::INJECT_MOUSE_AS_WM_TOUCH = true;
|
||||
wintouchemu::hook_title_ends("beatmania IIDX", "main", avs::game::DLL_INSTANCE);
|
||||
}
|
||||
nativetouch::hook(avs::game::DLL_INSTANCE);
|
||||
}
|
||||
|
||||
// insert BI2X hooks
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace games::iidx {
|
||||
extern bool TDJ_MODE;
|
||||
extern bool FORCE_720P;
|
||||
extern bool DISABLE_ESPEC_IO;
|
||||
extern bool NATIVE_TOUCH;
|
||||
extern std::optional<std::string> SOUND_OUTPUT_DEVICE;
|
||||
extern std::optional<std::string> ASIO_DRIVER;
|
||||
extern uint8_t DIGITAL_TT_SENS;
|
||||
|
||||
@@ -3,14 +3,10 @@
|
||||
#include <thread>
|
||||
|
||||
#include "windows.h"
|
||||
#include "cfg/screen_resize.h"
|
||||
#include "games/io.h"
|
||||
#include "games/iidx/iidx.h"
|
||||
#include "hooks/graphics/graphics.h"
|
||||
#include "launcher/shutdown.h"
|
||||
#include "misc/eamuse.h"
|
||||
#include "overlay/overlay.h"
|
||||
#include "overlay/windows/generic_sub.h"
|
||||
#include "touch/native/inject.h"
|
||||
#include "touch/touch.h"
|
||||
#include "util/logging.h"
|
||||
@@ -114,15 +110,6 @@ namespace games::iidx::poke {
|
||||
nativetouch::inject::inject_synthetic_touch({ touch.x, touch.y }, down);
|
||||
}
|
||||
|
||||
void clear_touch_points(std::vector<TouchPoint> *touch_points) {
|
||||
std::vector<DWORD> touch_ids;
|
||||
for (auto &touch : *touch_points) {
|
||||
touch_ids.emplace_back(touch.id);
|
||||
}
|
||||
touch_remove_points(&touch_ids);
|
||||
touch_points->clear();
|
||||
}
|
||||
|
||||
void enable() {
|
||||
|
||||
// check if already running
|
||||
@@ -140,19 +127,14 @@ namespace games::iidx::poke {
|
||||
|
||||
std::vector<TouchPoint> touch_points;
|
||||
std::vector<uint16_t> last_keypad_state = {0, 0};
|
||||
const bool use_native = games::iidx::NATIVE_TOUCH;
|
||||
|
||||
// set variable to false to stop
|
||||
while (THREAD_RUNNING) {
|
||||
|
||||
// clean up touch from last frame
|
||||
if (touch_points.size() > 0) {
|
||||
if (use_native) {
|
||||
inject_native_touch_points(touch_points, false);
|
||||
touch_points.clear();
|
||||
} else {
|
||||
clear_touch_points(&touch_points);
|
||||
}
|
||||
inject_native_touch_points(touch_points, false);
|
||||
touch_points.clear();
|
||||
}
|
||||
|
||||
for (int unit = 0; unit < 2; unit++) {
|
||||
@@ -177,40 +159,15 @@ namespace games::iidx::poke {
|
||||
|
||||
float x = x_iter->second / 1920.0;
|
||||
float y = y_iter->second / 1080.0;
|
||||
if (use_native) {
|
||||
if (GRAPHICS_WINDOWED) {
|
||||
if (SPICETOUCH_TOUCH_WIDTH <= 0 || SPICETOUCH_TOUCH_HEIGHT <= 0) {
|
||||
continue;
|
||||
}
|
||||
x = SPICETOUCH_TOUCH_X + x * SPICETOUCH_TOUCH_WIDTH;
|
||||
y = SPICETOUCH_TOUCH_Y + y * SPICETOUCH_TOUCH_HEIGHT;
|
||||
} else {
|
||||
x = x_iter->second;
|
||||
y = y_iter->second;
|
||||
}
|
||||
} else if (GRAPHICS_IIDX_WSUB) {
|
||||
// Scale to windowed subscreen
|
||||
x *= GRAPHICS_WSUB_WIDTH;
|
||||
y *= GRAPHICS_WSUB_HEIGHT;
|
||||
} else if (GENERIC_SUB_WINDOW_FULLSIZE || !overlay::OVERLAY->get_active()) {
|
||||
// Overlay is not present, scale to main screen
|
||||
if (GRAPHICS_WINDOWED) {
|
||||
x *= SPICETOUCH_TOUCH_WIDTH;
|
||||
y *= SPICETOUCH_TOUCH_HEIGHT;
|
||||
} else {
|
||||
x *= ImGui::GetIO().DisplaySize.x;
|
||||
y *= ImGui::GetIO().DisplaySize.y;
|
||||
if (GRAPHICS_WINDOWED) {
|
||||
if (SPICETOUCH_TOUCH_WIDTH <= 0 || SPICETOUCH_TOUCH_HEIGHT <= 0) {
|
||||
continue;
|
||||
}
|
||||
x = SPICETOUCH_TOUCH_X + x * SPICETOUCH_TOUCH_WIDTH;
|
||||
y = SPICETOUCH_TOUCH_Y + y * SPICETOUCH_TOUCH_HEIGHT;
|
||||
} else {
|
||||
// Overlay subscreen
|
||||
x = (GENERIC_SUB_WINDOW_X + x * GENERIC_SUB_WINDOW_WIDTH);
|
||||
y = (GENERIC_SUB_WINDOW_Y + y * GENERIC_SUB_WINDOW_HEIGHT);
|
||||
|
||||
// Scale to window size ratio
|
||||
if (GRAPHICS_WINDOWED) {
|
||||
x *= SPICETOUCH_TOUCH_WIDTH / ImGui::GetIO().DisplaySize.x;
|
||||
y *= SPICETOUCH_TOUCH_HEIGHT / ImGui::GetIO().DisplaySize.y;
|
||||
}
|
||||
x = x_iter->second;
|
||||
y = y_iter->second;
|
||||
}
|
||||
|
||||
TouchPoint tp {
|
||||
@@ -231,11 +188,7 @@ namespace games::iidx::poke {
|
||||
} // for all units
|
||||
|
||||
if (touch_points.size() > 0) {
|
||||
if (use_native) {
|
||||
inject_native_touch_points(touch_points, true);
|
||||
} else {
|
||||
touch_write_points(&touch_points);
|
||||
}
|
||||
inject_native_touch_points(touch_points, true);
|
||||
}
|
||||
|
||||
// slow down
|
||||
@@ -243,11 +196,7 @@ namespace games::iidx::poke {
|
||||
}
|
||||
|
||||
if (!touch_points.empty()) {
|
||||
if (use_native) {
|
||||
inject_native_touch_points(touch_points, false);
|
||||
} else {
|
||||
clear_touch_points(&touch_points);
|
||||
}
|
||||
inject_native_touch_points(touch_points, false);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user