mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-06 16:40:41 -07:00
iidx: don't hook legacy camera unless requested (#856)
## Link to GitHub Issue or related Pull Request, if one exists Fixes #855 ## Description of change Legacy camera hooks are specifically for IIDX 25/26 and they only perform redirection of device discovery (emulates USB vendor/device ID and USB port). It has very limited use since most cameras are practically unusable in IIDX 25/26. Don't enable it, unless explicitly requested by the user. New truth table for `-iidxcabcams` : | Mode | `-iidx` off (cab setup) | `-iidx` on | |---|---|---| | `auto` | Native cameras enabled (same as `on`) | Cameras disabled (same as `off`) | | `off` | Cameras disabled | Cameras disabled | | `on` | Native cameras enabled | Native cameras enabled | | `legacy` | Native cameras enabled | IIDX 25/26 discovery emulation enabled | ## Testing
This commit is contained in:
@@ -58,7 +58,7 @@ namespace games::iidx {
|
|||||||
|
|
||||||
// settings
|
// settings
|
||||||
bool FLIP_CAMS = false;
|
bool FLIP_CAMS = false;
|
||||||
std::optional<bool> DISABLE_CAMS;
|
cab_camera_access_mode CAB_CAMERA_ACCESS = cab_camera_access_mode::automatic;
|
||||||
bool TDJ_CAMERA = false;
|
bool TDJ_CAMERA = false;
|
||||||
bool TDJ_CAMERA_PREFER_16_9 = true;
|
bool TDJ_CAMERA_PREFER_16_9 = true;
|
||||||
bool TDJ_MODE = false;
|
bool TDJ_MODE = false;
|
||||||
@@ -424,10 +424,7 @@ namespace games::iidx {
|
|||||||
"RegQueryValueExA", RegQueryValueExA_hook, avs::game::DLL_INSTANCE);
|
"RegQueryValueExA", RegQueryValueExA_hook, avs::game::DLL_INSTANCE);
|
||||||
|
|
||||||
// check if cam hook should be enabled
|
// check if cam hook should be enabled
|
||||||
if (!DISABLE_CAMS.has_value()) {
|
if (CAB_CAMERA_ACCESS == cab_camera_access_mode::legacy) {
|
||||||
log_fatal("iidx", "assertion failure - DISABLE_CAMS not set during attach");
|
|
||||||
}
|
|
||||||
if (!DISABLE_CAMS.value()) {
|
|
||||||
init_legacy_camera_hook(FLIP_CAMS);
|
init_legacy_camera_hook(FLIP_CAMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,20 +451,11 @@ namespace games::iidx {
|
|||||||
SetEnvironmentVariable("SCREEN_MODE", SCREEN_MODE.value().c_str());
|
SetEnvironmentVariable("SCREEN_MODE", SCREEN_MODE.value().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for cab camera access for the second time (first time was in launcher.cpp)
|
// auto with iidx module means turn off camera (non-cab use)
|
||||||
// this time, we are inside -iidx module hook, which means the user is likely NOT on a cab
|
if (CAB_CAMERA_ACCESS == cab_camera_access_mode::automatic) {
|
||||||
// therefore, start with cams OFF by default, and allow user to forcibly override to ON
|
|
||||||
if (!games::iidx::DISABLE_CAMS.has_value()) {
|
|
||||||
games::iidx::DISABLE_CAMS = true;
|
|
||||||
if (options->at(launcher::Options::IIDXCabCamAccess).is_active() &&
|
|
||||||
options->at(launcher::Options::IIDXCabCamAccess).value_text() == "on") {
|
|
||||||
games::iidx::DISABLE_CAMS = false;
|
|
||||||
}
|
|
||||||
if (games::iidx::DISABLE_CAMS.value()) {
|
|
||||||
log_misc("iidx", "CONNECT_CAMERA env var set to 0");
|
log_misc("iidx", "CONNECT_CAMERA env var set to 0");
|
||||||
SetEnvironmentVariable("CONNECT_CAMERA", "0");
|
SetEnvironmentVariable("CONNECT_CAMERA", "0");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// windowed subscreen, enabled by default, unless turned off by user
|
// windowed subscreen, enabled by default, unless turned off by user
|
||||||
if (GRAPHICS_WINDOWED && !options->at(launcher::Options::spice2x_IIDXNoSub).value_bool() && TDJ_MODE) {
|
if (GRAPHICS_WINDOWED && !options->at(launcher::Options::spice2x_IIDXNoSub).value_bool() && TDJ_MODE) {
|
||||||
|
|||||||
@@ -11,6 +11,13 @@
|
|||||||
|
|
||||||
namespace games::iidx {
|
namespace games::iidx {
|
||||||
|
|
||||||
|
enum class cab_camera_access_mode {
|
||||||
|
automatic,
|
||||||
|
off,
|
||||||
|
on,
|
||||||
|
legacy,
|
||||||
|
};
|
||||||
|
|
||||||
enum class iidx_aio_emulation_state {
|
enum class iidx_aio_emulation_state {
|
||||||
unknown,
|
unknown,
|
||||||
bi2a_com2,
|
bi2a_com2,
|
||||||
@@ -20,7 +27,7 @@ namespace games::iidx {
|
|||||||
// settings
|
// settings
|
||||||
|
|
||||||
extern bool FLIP_CAMS;
|
extern bool FLIP_CAMS;
|
||||||
extern std::optional<bool> DISABLE_CAMS;
|
extern cab_camera_access_mode CAB_CAMERA_ACCESS;
|
||||||
extern bool TDJ_CAMERA;
|
extern bool TDJ_CAMERA;
|
||||||
extern bool TDJ_CAMERA_PREFER_16_9;
|
extern bool TDJ_CAMERA_PREFER_16_9;
|
||||||
extern std::optional<std::string> TDJ_CAMERA_OVERRIDE;
|
extern std::optional<std::string> TDJ_CAMERA_OVERRIDE;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <assert.h>
|
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <cfg/configurator.h>
|
#include <cfg/configurator.h>
|
||||||
@@ -524,22 +523,25 @@ int main_implementation(int argc, char *argv[]) {
|
|||||||
games::iidx::FLIP_CAMS = true;
|
games::iidx::FLIP_CAMS = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IIDX CONNECT_CAMERA logic here for cases where user is running without -iidx module
|
// Resolve the IIDX camera policy here so it also applies without the -iidx module.
|
||||||
// for now, we assume that user may be running on a cab
|
const auto &cab_camera_access = options[launcher::Options::IIDXCabCamAccess];
|
||||||
// (games::iidx::DISABLE_CAMS starts out as false unless user overrides)
|
if (cab_camera_access.is_active()) {
|
||||||
// we will check again in IIDX module with a different default
|
const auto value = cab_camera_access.value_text();
|
||||||
assert(!games::iidx::DISABLE_CAMS.has_value());
|
if (value == "off") {
|
||||||
if (options[launcher::Options::IIDXDisableCameras].value_bool()) {
|
games::iidx::CAB_CAMERA_ACCESS = games::iidx::cab_camera_access_mode::off;
|
||||||
games::iidx::DISABLE_CAMS = true;
|
} else if (value == "on") {
|
||||||
|
games::iidx::CAB_CAMERA_ACCESS = games::iidx::cab_camera_access_mode::on;
|
||||||
|
} else if (value == "legacy") {
|
||||||
|
games::iidx::CAB_CAMERA_ACCESS = games::iidx::cab_camera_access_mode::legacy;
|
||||||
}
|
}
|
||||||
if (options[launcher::Options::IIDXCabCamAccess].is_active() &&
|
}
|
||||||
options[launcher::Options::IIDXCabCamAccess].value_text() == "off") {
|
|
||||||
games::iidx::DISABLE_CAMS = true;
|
if (options[launcher::Options::IIDXDisableCameras].value_bool()) {
|
||||||
|
games::iidx::CAB_CAMERA_ACCESS = games::iidx::cab_camera_access_mode::off;
|
||||||
}
|
}
|
||||||
if (options[launcher::Options::IIDXCamHook].value_bool()) {
|
if (options[launcher::Options::IIDXCamHook].value_bool()) {
|
||||||
games::iidx::TDJ_CAMERA = true;
|
games::iidx::TDJ_CAMERA = true;
|
||||||
// Disable legacy behaviour to avoid conflict
|
games::iidx::CAB_CAMERA_ACCESS = games::iidx::cab_camera_access_mode::off;
|
||||||
games::iidx::DISABLE_CAMS = true;
|
|
||||||
}
|
}
|
||||||
// CONNECT_CAMERA env var will be set once logging is enabled
|
// CONNECT_CAMERA env var will be set once logging is enabled
|
||||||
|
|
||||||
@@ -1717,14 +1719,13 @@ int main_implementation(int argc, char *argv[]) {
|
|||||||
GRAPHICS_FS_ORIENTATION_SWAP = true;
|
GRAPHICS_FS_ORIENTATION_SWAP = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// apply an explicit off outside of the -iidx module so it also works on cabinets.
|
||||||
// for cab usage - set environment variables (outside of -iidx module)
|
if (games::iidx::CAB_CAMERA_ACCESS == games::iidx::cab_camera_access_mode::off &&
|
||||||
if (games::iidx::DISABLE_CAMS.has_value() &&
|
|
||||||
games::iidx::DISABLE_CAMS.value() &&
|
|
||||||
!cfg::CONFIGURATOR_STANDALONE) {
|
!cfg::CONFIGURATOR_STANDALONE) {
|
||||||
log_misc("launcher::iidx", "CONNECT_CAMERA env var set to 0");
|
log_misc("launcher::iidx", "CONNECT_CAMERA env var set to 0");
|
||||||
SetEnvironmentVariable("CONNECT_CAMERA", "0");
|
SetEnvironmentVariable("CONNECT_CAMERA", "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (games::iidx::SOUND_OUTPUT_DEVICE.has_value() &&
|
if (games::iidx::SOUND_OUTPUT_DEVICE.has_value() &&
|
||||||
games::iidx::SOUND_OUTPUT_DEVICE.value() != "auto" &&
|
games::iidx::SOUND_OUTPUT_DEVICE.value() != "auto" &&
|
||||||
!cfg::CONFIGURATOR_STANDALONE) {
|
!cfg::CONFIGURATOR_STANDALONE) {
|
||||||
|
|||||||
@@ -640,17 +640,21 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
// IIDXCabCamAccess
|
// IIDXCabCamAccess
|
||||||
.title = "IIDX Use Official AC Cams",
|
.title = "IIDX Official AC Camera Access",
|
||||||
.name = "iidxcabcams",
|
.name = "iidxcabcams",
|
||||||
.desc = "For IIDX25+, allow direct access to cameras from real arcade cabinets. "
|
.desc = "Controls how the game accesses USB cameras for IIDX 25+.\n\n"
|
||||||
"Only turn this on if you have OFFICIAL arcade cameras connected to the correct USB ports. Default: auto.",
|
"auto (default): use [off] when the IIDX module is enabled; otherwise, use [on].\n\n"
|
||||||
|
"on: game discovers and directly accesses cameras; requires official cameras on correct USB ports.\n\n"
|
||||||
|
"legacy: for IIDX 25/26 only; allow camera access with emulated discovery.\n\n"
|
||||||
|
"off: prevent game from accessing USB cameras.",
|
||||||
.type = OptionType::Enum,
|
.type = OptionType::Enum,
|
||||||
.game_name = "Beatmania IIDX",
|
.game_name = "Beatmania IIDX",
|
||||||
.category = "Cab Peripherals",
|
.category = "Cab Peripherals",
|
||||||
.elements = {
|
.elements = {
|
||||||
{"auto", ""},
|
{"auto", ""},
|
||||||
|
{"on", ""},
|
||||||
|
{"legacy", ""},
|
||||||
{"off", ""},
|
{"off", ""},
|
||||||
{"on", ""}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user