IIDX 25/26 - Add the ability to leave a camera unassigned #245

Merged
JeffPaine4890 merged 15 commits from add-cam-skip into master 2023-04-10 22:44:52 +03:00
8 changed files with 83 additions and 17 deletions
+9 -3
View File
2
@@ -37,10 +37,16 @@ gfx.device_adapter=-1
# Disables the camera emulation
cam.disable_emu=false
# Override camera device ID 1 detection (copy from device manager, do not escape)
# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
cam.disable_camera1=false
# Disable camera 2. Use, i.e., if you have more than one camera but only want to map camera 1 ingame.
cam.disable_camera2=false
# Override camera device ID 1 detection (copy from device manager, do not escape) Leave blank to automatically detect
cam.device_id1=
# Override camera device ID 2 detection (copy from device manager, do not escape)
# Override camera device ID 2 detection (copy from device manager, do not escape) Leave blank to automatically detect
cam.device_id2=
# Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted readers)
@@ -50,4 +56,4 @@ io.disable_card_reader_emu=false
io.disable_bio2_emu=false
# Disables the poll limiter, warning very high CPU usage may arise
io.disable_poll_limiter=false
io.disable_poll_limiter=false
+9 -3
View File
2
@@ -37,10 +37,16 @@ gfx.device_adapter=-1
# Disables the camera emulation
cam.disable_emu=false
# Override camera device ID 1 detection (copy from device manager, do not escape)
# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
cam.disable_camera1=false
# Disable camera 2. Use, i.e., if you have more than one camera but only want to map camera 1 ingame.
cam.disable_camera2=false
# Override camera device ID 1 detection (copy from device manager, do not escape) Leave blank to automatically detect
cam.device_id1=
# Override camera device ID 2 detection (copy from device manager, do not escape)
# Override camera device ID 2 detection (copy from device manager, do not escape) Leave blank to automatically detect
cam.device_id2=
# Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted readers)
@@ -50,4 +56,4 @@ io.disable_card_reader_emu=false
io.disable_bio2_emu=false
# Disables the poll limiter, warning very high CPU usage may arise
io.disable_poll_limiter=false
io.disable_poll_limiter=false
+7 -1
View File
@@ -20,7 +20,13 @@ io.disable_file_hooks=false
io.tt_multiplier=1.0
# Disables the camera emulation
cam.disable_emu=false
cam.disable_emu=true
# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
cam.disable_camera1=false
# Disable camera 2. Use, i.e., if you have more than one camera but only want to map camera 1 ingame.
cam.disable_camera2=false
# Override camera device ID detection (copy from device manager, do not escape)
cam.device_id1=
+6
View File
@@ -22,6 +22,12 @@ io.tt_multiplier=1.0
# Disables the camera emulation
cam.disable_emu=true
# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
cam.disable_camera1=false
# Disable camera 2. Use, i.e., if you have more than one camera but only want to map camera 1 ingame.
cam.disable_camera2=false
# Override camera device ID detection (copy from device manager, do not escape)
cam.device_id1=
+6
View File
@@ -22,6 +22,12 @@ io.tt_multiplier=1.0
# Disables the camera emulation
cam.disable_emu=true
# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
cam.disable_camera1=true
# Disable camera 2. Use, i.e., if you have more than one camera but only want to map camera 1 ingame.
cam.disable_camera2=false
# Override camera device ID detection (copy from device manager, do not escape)
cam.device_id1=
+10 -1
View File
2
@@ -808,6 +808,14 @@ void camhook_init(struct camhook_config_cam *config_cam)
// fill before applying hooks
for (size_t i = 0; i < config_cam->num_devices; ++i) {
// Check if this camera is disabled first
if (config_cam->disable_camera[i]) {
// If so, pretend this camera is already assigned and move on
num_addressed_cams++;
num_located_cams++;
continue;
}
// If not, try to hook the camera
fill_cam_struct(&camData[i], config_cam->device_id[i]);
}
@@ -829,7 +837,8 @@ void camhook_init(struct camhook_config_cam *config_cam)
NULL, "Mf.dll", camhook_mf_syms, lengthof(camhook_mf_syms));
log_info("Inserted cam hooks for %d cams", (int) num_setup);
} else {
// If the user has manually disabled all cams, don't print this in the log
} else if (num_addressed_cams != config_cam->num_devices) {
log_info("No cams detected, not hooking");
}
}
+35 -9
View File
@@ -7,8 +7,18 @@
#define CAMHOOK_CONFIG_CAM_DISABLE_EMU_KEY "cam.disable_emu"
#define CAMHOOK_CONFIG_CAM_DEFAULT_DISABLE_EMU_VALUE false
// the following two arrays are based on CAMHOOK_CONFIG_CAM_MAX
// the following four arrays are based on CAMHOOK_CONFIG_CAM_MAX
// please insert more elements if more cams are added
const char *camhook_config_disable_camera[CAMHOOK_CONFIG_CAM_MAX] = {
"cam.disable_camera1",
"cam.disable_camera2",
};
const int camhook_config_disable_camera_default_values[CAMHOOK_CONFIG_CAM_MAX] = {
false,
false,
};
const char *camhook_config_device_id_keys[CAMHOOK_CONFIG_CAM_MAX] = {
"cam.device_id1",
"cam.device_id2",
@@ -28,6 +38,11 @@ void camhook_config_cam_init(struct cconfig *config, size_t num_cams)
"Disables the camera emulation");
for (size_t i = 0; i < num_cams; ++i) {
cconfig_util_set_bool(
config,
camhook_config_disable_camera[i],
camhook_config_disable_camera_default_values[i],
"Disable camera");
cconfig_util_set_str(
config,
camhook_config_device_id_keys[i],
@@ -56,17 +71,28 @@ void camhook_config_cam_get(
CAMHOOK_CONFIG_CAM_DEFAULT_DISABLE_EMU_VALUE);
}
for (size_t i = 0; i < num_cams; ++i) {
if (!cconfig_util_get_str(
if (!cconfig_util_get_bool(
config,
camhook_config_device_id_keys[i],
config_cam->device_id[i],
sizeof(config_cam->device_id[i]) - 1,
camhook_config_device_default_values[i])) {
camhook_config_disable_camera[i],
&config_cam->disable_camera[i],
camhook_config_disable_camera_default_values[i])) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%s'",
camhook_config_device_id_keys[i],
camhook_config_device_default_values[i]);
"to default '%d'",
camhook_config_disable_camera[i],
camhook_config_disable_camera_default_values[i]);
}
if (!cconfig_util_get_str(
config,
camhook_config_device_id_keys[i],
config_cam->device_id[i],
sizeof(config_cam->device_id[i]) - 1,
camhook_config_device_default_values[i])) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%s'",
camhook_config_device_id_keys[i],
camhook_config_device_default_values[i]);
}
}
}
+1
View File
@@ -11,6 +11,7 @@ struct camhook_config_cam {
bool disable_emu;
size_t num_devices;
char device_id[CAMHOOK_CONFIG_CAM_MAX][MAX_PATH];
bool disable_camera[CAMHOOK_CONFIG_CAM_MAX];
};
void camhook_config_cam_init(struct cconfig *config, size_t num_cams);