diff --git a/src/spice2x/games/popn/popn.cpp b/src/spice2x/games/popn/popn.cpp index b3dbea9..006d49b 100644 --- a/src/spice2x/games/popn/popn.cpp +++ b/src/spice2x/games/popn/popn.cpp @@ -232,6 +232,7 @@ namespace games::popn { // TODO: is this what the game expects for subscreen? // TODO: what if there are 3+ monitors? targetName->outputTechnology = DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HDMI; + targetName->connectorInstance = 0; } break; } @@ -634,6 +635,8 @@ namespace games::popn { wintouchemu::hook_title_ends("", "Main Screen", avs::game::DLL_INSTANCE); } + sysutils::hook_EnumDisplayDevicesA(); + #endif } diff --git a/src/spice2x/launcher/launcher.cpp b/src/spice2x/launcher/launcher.cpp index 3eccc51..ad6789c 100644 --- a/src/spice2x/launcher/launcher.cpp +++ b/src/spice2x/launcher/launcher.cpp @@ -594,6 +594,9 @@ int main_implementation(int argc, char *argv[]) { GRAPHICS_FORCE_SINGLE_ADAPTER = true; GRAPHICS_PREVENT_SECONDARY_WINDOW = true; } + if (options[launcher::Options::PopnSubMonitorOverride].is_active()) { + sysutils::SECOND_MONITOR_OVERRIDE = options[launcher::Options::PopnSubMonitorOverride].value_text(); + } 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 172952b..66c6e28 100644 --- a/src/spice2x/launcher/options.cpp +++ b/src/spice2x/launcher/options.cpp @@ -997,6 +997,17 @@ static const std::vector OPTION_DEFINITIONS = { .game_name = "Pop'n Music", .category = "Game Options", }, + { + // PopnSubMonitorOverride + .title = "Pop'n Music PikaPika Subscreen Monitor Override", + .name = "popnsubmonitor", + .desc = "If you have three or more monitors, this option can be set to tell the game which monitor is the subscreen.", + .type = OptionType::Text, + .setting_name = "\\\\.\\DISPLAY3", + .game_name = "Pop'n Music", + .category = "Monitor", + .picker = OptionPickerType::Monitor, + }, { .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 92e6388..bf1d03d 100644 --- a/src/spice2x/launcher/options.h +++ b/src/spice2x/launcher/options.h @@ -100,6 +100,7 @@ namespace launcher { PopnMusicForceHDMode, PopnMusicForceSDMode, PopnNoSub, + PopnSubMonitorOverride, LoadHelloPopnMusicModule, LoadGitaDoraModule, GitaDoraTwoChannelAudio, diff --git a/src/spice2x/util/sysutils.cpp b/src/spice2x/util/sysutils.cpp index 4182508..0ceb621 100644 --- a/src/spice2x/util/sysutils.cpp +++ b/src/spice2x/util/sysutils.cpp @@ -576,7 +576,13 @@ namespace sysutils { } void hook_EnumDisplayDevicesA() { - EnumDisplayDevicesA_orig = detour::iat_try( - "EnumDisplayDevicesA", EnumDisplayDevicesA_hook, avs::game::DLL_INSTANCE); + // the goal is to trick DX9 into thinking that some monitors are not attached + // so we need to trampoline hook at user32 instead of IAT at game level + log_misc("sysutils", "hooking EnumDisplayDevicesA to hide if there are more than 3 monitors..."); + detour::trampoline_try( + "user32.dll", + "EnumDisplayDevicesA", + (void*)EnumDisplayDevicesA_hook, + (void**)&EnumDisplayDevicesA_orig); } }