Move insert for FTD2 to one place

This commit is contained in:
Lorenzooone 2025-03-26 14:02:26 +01:00
parent 781157987f
commit 6f0b42c877
6 changed files with 16 additions and 21 deletions

View File

@ -24,7 +24,6 @@ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows"))
#Just avoid using it, when possible...
set(USE_FTD3XX_FOR_N3DSXL_LOOPY 0)
endif()
set(FTDI_EEPROM OFF)
set(WINDOWS_ARM64 0)
set(WINDOWS_x86_32 0)
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)

View File

@ -39,6 +39,7 @@ struct FTD2CaptureReceivedData {
ftd2_async_callback_data cb_data;
};
void insert_device_ftd2_shared(std::vector<CaptureDevice> &devices_list, char* description, int debug_multiplier, std::string serial_number, void* descriptor, std::string path, std::string extra_particle);
int get_num_ftd2_device_types();
const std::string get_ftd2_fw_desc(int index);
const int get_ftd2_fw_index(int index);

View File

@ -1,6 +1,7 @@
#include "dscapture_ftd2_driver_acquisition.hpp"
#include "devicecapture.hpp"
#include "usb_generic.hpp"
#include "dscapture_ftd2_shared.hpp"
#include "dscapture_ftd2_general.hpp"
#include "dscapture_ftd2_compatibility.hpp"

View File

@ -18,8 +18,6 @@
#define REAL_SERIAL_NUMBER_SIZE 16
#define SERIAL_NUMBER_SIZE (REAL_SERIAL_NUMBER_SIZE+1)
#define ENABLE_AUDIO true
void list_devices_ftd2_driver(std::vector<CaptureDevice> &devices_list, std::vector<no_access_recap_data> &no_access_list) {
FT_STATUS ftStatus;
DWORD numDevs = 0;
@ -39,15 +37,7 @@ void list_devices_ftd2_driver(std::vector<CaptureDevice> &devices_list, std::vec
ftStatus = FT_GetDeviceInfoDetail(i, &Flags, &Type, &ID, NULL,
SerialNumber, Description, &ftHandle);
if((!FT_FAILED(ftStatus)) && (Flags & FT_FLAGS_HISPEED) && (Type == FT_DEVICE_232H))
{
for(int j = 0; j < get_num_ftd2_device_types(); j++) {
if(Description == get_ftd2_fw_desc(j)) {
for(int u = 0; u < debug_multiplier; u++)
devices_list.emplace_back(std::string(SerialNumber), "DS.2", "DS.2.d565", CAPTURE_CONN_FTD2, (void*)NULL, false, false, ENABLE_AUDIO, WIDTH_DS, HEIGHT_DS + HEIGHT_DS, get_max_samples(false), 0, 0, 0, 0, HEIGHT_DS, VIDEO_DATA_RGB16, get_ftd2_fw_index(j), false);
break;
}
}
}
insert_device_ftd2_shared(devices_list, Description, debug_multiplier, std::string(SerialNumber), NULL, "", "d");
}
}
}

View File

@ -13,8 +13,6 @@
#define DESCRIPTION_SIZE 128
#define SERIAL_NUMBER_SIZE 128
#define ENABLE_AUDIO true
#define FTDI_VID 0x0403
#define FT232H_PID 0x6014
@ -158,13 +156,7 @@ void list_devices_ftd2_libusb(std::vector<CaptureDevice> &devices_list, std::vec
}
if(is_already_inserted && (!insert_anyway))
continue;
for(int j = 0; j < get_num_ftd2_device_types(); j++) {
if(description == get_ftd2_fw_desc(j)) {
for(int u = 0; u < debug_multiplier; u++)
devices_list.emplace_back(serial_number, "DS.2", "DS.2.l565", CAPTURE_CONN_FTD2, (void*)curr_descriptor, false, false, ENABLE_AUDIO, WIDTH_DS, HEIGHT_DS + HEIGHT_DS, get_max_samples(false), 0, 0, 0, 0, HEIGHT_DS, VIDEO_DATA_RGB16, get_ftd2_fw_index(j), false, std::string(description));
break;
}
}
insert_device_ftd2_shared(devices_list, description, debug_multiplier, serial_number, (void*)curr_descriptor, std::string(description), "l");
}
if(perm_error)
no_access_list.emplace_back("ftd2_libusb");

View File

@ -26,6 +26,8 @@
#define TX_SPI_SIZE (1 << 16)
#define TX_SPI_OFFSET 3
#define ENABLE_AUDIO true
const uint8_t* ftd2_ds2_fws[] = {
ftd2_ds2_fw_1,
ftd2_ds2_fw_2,
@ -57,6 +59,16 @@ const int get_ftd2_fw_index(int index) {
return descriptions_firmware_ids[index];
}
void insert_device_ftd2_shared(std::vector<CaptureDevice> &devices_list, char* description, int debug_multiplier, std::string serial_number, void* descriptor, std::string path, std::string extra_particle) {
for(int j = 0; j < get_num_ftd2_device_types(); j++) {
if(description == get_ftd2_fw_desc(j)) {
for(int u = 0; u < debug_multiplier; u++)
devices_list.emplace_back(serial_number, "DS.2", "DS.2." + extra_particle + "565", CAPTURE_CONN_FTD2, descriptor, false, false, ENABLE_AUDIO, WIDTH_DS, HEIGHT_DS + HEIGHT_DS, get_max_samples(false), 0, 0, 0, 0, HEIGHT_DS, VIDEO_DATA_RGB16, get_ftd2_fw_index(j), false, path);
break;
}
}
}
void list_devices_ftd2_shared(std::vector<CaptureDevice> &devices_list, std::vector<no_access_recap_data> &no_access_list) {
list_devices_ftd2_compatibility(devices_list, no_access_list);
}