diff --git a/src/spice2x/games/popn/popn.cpp b/src/spice2x/games/popn/popn.cpp index ac3f0f1..0ae443e 100644 --- a/src/spice2x/games/popn/popn.cpp +++ b/src/spice2x/games/popn/popn.cpp @@ -19,11 +19,13 @@ #include "util/sysutils.h" #include "io.h" #include "util/deferlog.h" +#include "misc/nativetouchhook.h" #include "misc/wintouchemu.h" namespace games::popn { bool SHOW_PIKA_MONITOR_WARNING = false; + bool NATIVE_TOUCH = false; #if SPICE64 && !SPICE_XP @@ -670,9 +672,13 @@ namespace games::popn { // set third column to 0 and it will work with BIO2 if (!GRAPHICS_WINDOWED) { - wintouchemu::FORCE = true; - wintouchemu::INJECT_MOUSE_AS_WM_TOUCH = true; - wintouchemu::hook_title_ends("", "Main Screen", avs::game::DLL_INSTANCE); + if (NATIVE_TOUCH) { + nativetouchhook::hook(avs::game::DLL_INSTANCE); + } else { + wintouchemu::FORCE = true; + wintouchemu::INJECT_MOUSE_AS_WM_TOUCH = true; + wintouchemu::hook_title_ends("", "Main Screen", avs::game::DLL_INSTANCE); + } } sysutils::hook_EnumDisplayDevicesA(); diff --git a/src/spice2x/games/popn/popn.h b/src/spice2x/games/popn/popn.h index caebe6e..2e57706 100644 --- a/src/spice2x/games/popn/popn.h +++ b/src/spice2x/games/popn/popn.h @@ -22,6 +22,7 @@ namespace games::popn { #endif extern bool SHOW_PIKA_MONITOR_WARNING; + extern bool NATIVE_TOUCH; class POPNGame : public games::Game { public: diff --git a/src/spice2x/launcher/launcher.cpp b/src/spice2x/launcher/launcher.cpp index dea4527..b533c99 100644 --- a/src/spice2x/launcher/launcher.cpp +++ b/src/spice2x/launcher/launcher.cpp @@ -597,6 +597,9 @@ int main_implementation(int argc, char *argv[]) { if (options[launcher::Options::PopnSubMonitorOverride].is_active()) { sysutils::SECOND_MONITOR_OVERRIDE = options[launcher::Options::PopnSubMonitorOverride].value_text(); } + if (options[launcher::Options::PopnNativeTouch].value_bool()) { + games::popn::NATIVE_TOUCH = true; + } if (options[launcher::Options::LoadMetalGearArcadeModule].value_bool()) { attach_mga = true; } diff --git a/src/spice2x/launcher/options.cpp b/src/spice2x/launcher/options.cpp index 0862188..1142122 100644 --- a/src/spice2x/launcher/options.cpp +++ b/src/spice2x/launcher/options.cpp @@ -1008,6 +1008,18 @@ static const std::vector OPTION_DEFINITIONS = { .category = "Monitor", .picker = OptionPickerType::Monitor, }, + { + // PopnNativeTouch + .title = "Pop'n Music PikaPika Native Touch Handling", + .name = "popnnativetouch", + .desc = "Disables touch hooks and lets the game access a touch screen directly. " + "Requires a touch screen to be connected as a secondary monitor. " + "Touch input must be routed to the primary screen via Windows Tablet PC settings. " + "Enable this when you get duplicate touch inputs from an actual touch screen.", + .type = OptionType::Bool, + .game_name = "Pop'n Music", + .category = "Game Options (Advanced)", + }, { .title = "Force Load HELLO! Pop'n Music Module", .name = "hpm", diff --git a/src/spice2x/launcher/options.h b/src/spice2x/launcher/options.h index 6a3934d..49974c5 100644 --- a/src/spice2x/launcher/options.h +++ b/src/spice2x/launcher/options.h @@ -101,6 +101,7 @@ namespace launcher { PopnMusicForceSDMode, PopnNoSub, PopnSubMonitorOverride, + PopnNativeTouch, LoadHelloPopnMusicModule, LoadGitaDoraModule, GitaDoraTwoChannelAudio, diff --git a/src/spice2x/overlay/windows/config.cpp b/src/spice2x/overlay/windows/config.cpp index 1ff8bca..1a9683f 100644 --- a/src/spice2x/overlay/windows/config.cpp +++ b/src/spice2x/overlay/windows/config.cpp @@ -17,6 +17,7 @@ #include "external/imgui/misc/cpp/imgui_stdlib.h" #include "games/io.h" #include "games/sdvx/sdvx.h" +#include "games/popn/popn.h" #include "avs/core.h" #include "avs/ea3.h" #include "avs/game.h" @@ -283,18 +284,8 @@ namespace overlay::windows { // keypad buttons ImGui::TextUnformatted(""); - if (this->games_selected_name == "Beatmania IIDX") { - ImGui::Indent(INDENT); - ImGui::TextColored( - ImVec4(1, 0.5f, 0.5f, 1.f), - "WARNING: Lightning Model (TDJ) I/O will ignore the keypad!"); - ImGui::TextWrapped( - "Use Toggle Sub Screen button to show the overlay and use your mouse, " - "connect using SpiceCompanion app, or connect a touch screen to enter " - "the PIN."); - ImGui::Unindent(INDENT); - ImGui::TextUnformatted(""); - } + this->build_keypad_warning(); + auto keypad_buttons = games::get_buttons_keypads(this->games_selected_name); auto keypad_count = eamuse_get_game_keypads_name(); if (keypad_count == 1) { @@ -602,6 +593,34 @@ namespace overlay::windows { } } + void Config::build_keypad_warning() { + // not checking the -iidxtdj option here, we could do that in the future + const bool is_tdj = this->games_selected_name == "Beatmania IIDX"; + + // not using games::popn::is_pikapika_model() here since that always returns false on 32-bit + const bool is_popn = this->games_selected_name == "Pop'n Music" && avs::game::SPEC[0] == 'D'; + if (!is_tdj && !is_popn) { + return; + } + + ImGui::Indent(INDENT); + if (is_tdj) { + ImGui::TextColored( + ImVec4(1, 0.5f, 0.5f, 1.f), + "WARNING: Lightning Model (TDJ) I/O will ignore keypad number input!"); + } else if (is_popn) { + ImGui::TextColored( + ImVec4(1, 0.5f, 0.5f, 1.f), + "WARNING: PikaPika Pop-Kun model will ignore keypad number input!"); + } + ImGui::TextWrapped( + "Use Toggle Sub Screen button (Overlay tab) to show the overlay and use your mouse, " + "connect using SpiceCompanion app, or connect a touch screen to enter " + "the PIN."); + ImGui::Unindent(INDENT); + ImGui::TextUnformatted(""); + } + void Config::build_buttons(const std::string &name, std::vector