diff --git a/include/Menus/ConnectionMenu.hpp b/include/Menus/ConnectionMenu.hpp index f6a0509..6fbd1b7 100755 --- a/include/Menus/ConnectionMenu.hpp +++ b/include/Menus/ConnectionMenu.hpp @@ -18,6 +18,7 @@ public: protected: void set_output_option(int index, int action); size_t get_num_options(); + float get_option_text_factor(int index); std::string get_string_option(int index, int action); void class_setup(); private: diff --git a/include/Menus/USBConflictResolutionMenu.hpp b/include/Menus/USBConflictResolutionMenu.hpp index a3e66ef..47cb427 100644 --- a/include/Menus/USBConflictResolutionMenu.hpp +++ b/include/Menus/USBConflictResolutionMenu.hpp @@ -14,6 +14,7 @@ enum USBConflictResolutionMenuOutAction{ USBCONRESO_MENU_BACK, USBCONRESO_MENU_NISE_DS, USBCONRESO_MENU_OPTI_O3DS, + USBCONRESO_MENU_OPTI_N3DSV2, USBCONRESO_MENU_OPTI_O2DS, }; diff --git a/source/CaptureDeviceSpecific/Optimize_3DS/cypress_optimize_3ds_communications.cpp b/source/CaptureDeviceSpecific/Optimize_3DS/cypress_optimize_3ds_communications.cpp index f1b157b..a243b8e 100644 --- a/source/CaptureDeviceSpecific/Optimize_3DS/cypress_optimize_3ds_communications.cpp +++ b/source/CaptureDeviceSpecific/Optimize_3DS/cypress_optimize_3ds_communications.cpp @@ -129,6 +129,64 @@ static const cyop_device_usb_device cypress_optimize_new_3ds_instantiated_device } }; +static const cyop_device_usb_device cypress_optimize_new_3dsv2_generic_device = { +.name = "FX2> Opt. N3DSv2", .long_name = "EZ-USB FX2LPO -> Optimize New 3DSv2", +.device_type = CYPRESS_OPTIMIZE_NEW_3DSV2_BLANK_DEVICE, +.firmware_to_load = optimize_new_3ds_fw, .firmware_size = optimize_new_3ds_fw_len, +.fpga_pl_565 = NULL, .fpga_pl_565_size = 0, +.fpga_pl_888 = NULL, .fpga_pl_888_size = 0, +.is_new_device = true, .has_eeprom = false, +.is_old_firmware = false, .is_o2ds = false, +.next_device = CYPRESS_OPTIMIZE_NEW_3DSV2_INSTANTIATED_DEVICE, +.has_bcd_device_serial = false, +.index_in_allowed_scan = CC_OPTIMIZE_N3DSV2, +.usb_device_info = { + .vid = 0x04B4, .pid = 0x8613, + .default_config = 1, .default_interface = 0, + .bulk_timeout = 500, + .ep_ctrl_bulk_in = 0, .ep_ctrl_bulk_out = 0, + .ep_bulk_in = 0, + .max_usb_packet_size = CYPRESS_BASE_USB_PACKET_LIMIT, + .do_pipe_clear_reset = false, + .alt_interface = 1, + .full_data = &cypress_optimize_new_3dsv2_generic_device, + .get_serial_requires_setup = false, + .get_serial_fn = cypress_optimize_3ds_get_serial, + .create_device_fn = cypress_optimize_3ds_create_device, + .bcd_device_mask = 0x0000, + .bcd_device_wanted_value = 0x0000 +} +}; + +static const cyop_device_usb_device cypress_optimize_new_3dsv2_instantiated_device = { +.name = "Opt. N3DSv2", .long_name = "Optimize New 3DSv2", +.device_type = CYPRESS_OPTIMIZE_NEW_3DSV2_INSTANTIATED_DEVICE, +.firmware_to_load = NULL, .firmware_size = 0, +.fpga_pl_565 = optimize_new_3ds_565_fpga_pl, .fpga_pl_565_size = optimize_new_3ds_565_fpga_pl_len, +.fpga_pl_888 = optimize_new_3ds_888_fpga_pl, .fpga_pl_888_size = optimize_new_3ds_888_fpga_pl_len, +.is_new_device = true, .has_eeprom = false, +.is_old_firmware = false, .is_o2ds = false, +.next_device = CYPRESS_OPTIMIZE_NEW_3DSV2_INSTANTIATED_DEVICE, +.has_bcd_device_serial = true, +.index_in_allowed_scan = CC_OPTIMIZE_N3DSV2, +.usb_device_info = { + .vid = 0x04B4, .pid = 0x1004, + .default_config = 1, .default_interface = 0, + .bulk_timeout = 500, + .ep_ctrl_bulk_in = 1 | LIBUSB_ENDPOINT_IN, .ep_ctrl_bulk_out = 1 | LIBUSB_ENDPOINT_OUT, + .ep_bulk_in = 2 | LIBUSB_ENDPOINT_IN, + .max_usb_packet_size = CYPRESS_OPTIMIZE_NEW_3DS_USB_PACKET_LIMIT, + .do_pipe_clear_reset = true, + .alt_interface = 0, + .full_data = &cypress_optimize_new_3dsv2_instantiated_device, + .get_serial_requires_setup = false, + .get_serial_fn = cypress_optimize_3ds_get_serial, + .create_device_fn = cypress_optimize_3ds_create_device, + .bcd_device_mask = 0xFF00, + .bcd_device_wanted_value = OPTIMIZE_NEW_3DSV2_WANTED_VALUE_BASE +} +}; + static const cyop_device_usb_device cypress_optimize_old_3ds_generic_device = { .name = "FX2> Opt. O3DS", .long_name = "EZ-USB FX2LP -> Optimize Old 3DS", .device_type = CYPRESS_OPTIMIZE_OLD_3DS_BLANK_DEVICE, @@ -250,6 +308,8 @@ static const cyop_device_usb_device* all_usb_cyop_device_devices_desc[] = { &cypress_optimize_new_3ds_instantiated_device, &cypress_optimize_old_3ds_generic_device, &cypress_optimize_old_3ds_instantiated_device, + &cypress_optimize_new_3dsv2_generic_device, + &cypress_optimize_new_3dsv2_instantiated_device, &cypress_optimize_old_old_2ds_generic_device, &cypress_optimize_old_old_2ds_instantiated_device, }; @@ -618,7 +678,7 @@ static int read_device_id_serial(cy_device_device_handlers* handlers, const cyop int ret = cypress_ctrl_bulk_out_transfer(handlers, get_cy_usb_info(device), first_buffer, sizeof(first_buffer), &transferred); if(ret < 0) return ret; - if(device->is_new_device || device->is_old_firmware) { + if((device->is_new_device && device->has_eeprom) || device->is_old_firmware) { ret = read_first_unk_value(handlers, device, value32); if(ret < 0) return ret; @@ -753,7 +813,7 @@ int capture_start(cy_device_device_handlers* handlers, const cyop_device_usb_dev ret = start_command_send(handlers, device); if(ret < 0) return ret; - if(device->is_new_device) { + if(device->is_new_device && device->has_eeprom) { uint8_t eeprom_data[OPTIMIZE_EEPROM_NEW_SIZE]; ret = read_device_eeprom(handlers, device, eeprom_data, OPTIMIZE_EEPROM_NEW_SIZE); if(ret < 0) diff --git a/source/Menus/ConnectionMenu.cpp b/source/Menus/ConnectionMenu.cpp index db8290e..a467de6 100755 --- a/source/Menus/ConnectionMenu.cpp +++ b/source/Menus/ConnectionMenu.cpp @@ -36,6 +36,14 @@ void ConnectionMenu::set_output_option(int index, int action) { this->selected_index = index; } +float ConnectionMenu::get_option_text_factor(int index) { + if(index < 0) + return 1.0f; + if(index >= ((int)this->get_num_options())) + return 1.0f; + return 0.85f; +} + size_t ConnectionMenu::get_num_options() { return this->devices_list->size(); } diff --git a/source/Menus/Optimize3DSMenu.cpp b/source/Menus/Optimize3DSMenu.cpp index 2df8f3e..cd7f202 100644 --- a/source/Menus/Optimize3DSMenu.cpp +++ b/source/Menus/Optimize3DSMenu.cpp @@ -253,7 +253,7 @@ static std::string get_data_format_name(bool request_low_bw_format) { } float Optimize3DSMenu::get_option_text_factor(int index) { - if(index <= 0) + if(index < 0) return 1.0f; if(index >= ((int)this->num_enabled_options)) return 1.0f; diff --git a/source/Menus/OptionSelectionMenu.cpp b/source/Menus/OptionSelectionMenu.cpp index 3b8d7cc..aefc0b4 100755 --- a/source/Menus/OptionSelectionMenu.cpp +++ b/source/Menus/OptionSelectionMenu.cpp @@ -496,7 +496,7 @@ void OptionSelectionMenu::draw(float scaling_factor, sf::RenderTarget &window) { void OptionSelectionMenu::prepare_text_slices(int x_multiplier, int x_divisor, int y_multiplier, int y_divisor, int index, float text_scaling_factor, bool center) { int elem_index = index - this->elements_start_id; int start = this->num_options_per_screen * this->future_data.page; - this->labels[index]->setTextFactor(text_scaling_factor * this->get_option_text_factor((elem_index / this->single_option_multiplier) + start)); + this->labels[index]->setTextFactor(text_scaling_factor * this->get_option_text_factor((elem_index / this->single_option_multiplier) + start)); // This is wrong... int x_base_pos = (this->future_data.menu_width * x_multiplier) / x_divisor; int y_base_pos = (this->future_data.menu_height * y_multiplier) / y_divisor; int x_size = ((this->future_data.menu_width * (x_multiplier + 1)) / x_divisor) - x_base_pos; diff --git a/source/Menus/USBConflictResolutionMenu.cpp b/source/Menus/USBConflictResolutionMenu.cpp index 8b973cc..7a31caa 100644 --- a/source/Menus/USBConflictResolutionMenu.cpp +++ b/source/Menus/USBConflictResolutionMenu.cpp @@ -35,13 +35,13 @@ struct USBConflictResolutionMenuOptionInfo { }; static const USBConflictResolutionMenuOptionInfo warning_nise_opti_conflict_0 = { -.base_name = "There are three capture cards", +.base_name = "There are four capture cards", .false_name = "", .exists = EXISTENCE_VALUE_CONFLICT_NISE, .is_selectable = false, .is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = USBCONRESO_MENU_NO_ACTION, .out_action = USBCONRESO_MENU_NO_ACTION}; static const USBConflictResolutionMenuOptionInfo warning_nise_opti_conflict_0_alt = { -.base_name = "There are two capture cards", +.base_name = "There are three capture cards", .false_name = "", .exists = EXISTENCE_VALUE_CONFLICT_NISE_OPTI_O3DS && (!EXISTENCE_VALUE_CONFLICT_NISE), .is_selectable = false, .is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = USBCONRESO_MENU_NO_ACTION, .out_action = USBCONRESO_MENU_NO_ACTION}; @@ -53,13 +53,13 @@ static const USBConflictResolutionMenuOptionInfo warning_nise_opti_conflict_1 = .out_action = USBCONRESO_MENU_NO_ACTION}; static const USBConflictResolutionMenuOptionInfo warning_nise_opti_conflict_2 = { -.base_name = "You can disable two to make", +.base_name = "You can disable three to make", .false_name = "", .exists = EXISTENCE_VALUE_CONFLICT_NISE, .is_selectable = false, .is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = USBCONRESO_MENU_NO_ACTION, .out_action = USBCONRESO_MENU_NO_ACTION}; static const USBConflictResolutionMenuOptionInfo warning_nise_opti_conflict_2_alt = { -.base_name = "You can disable one to make", +.base_name = "You can disable two to make", .false_name = "", .exists = EXISTENCE_VALUE_CONFLICT_NISE_OPTI_O3DS && (!EXISTENCE_VALUE_CONFLICT_NISE), .is_selectable = false, .is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = USBCONRESO_MENU_NO_ACTION, .out_action = USBCONRESO_MENU_NO_ACTION}; @@ -82,6 +82,12 @@ static const USBConflictResolutionMenuOptionInfo optimize_o3ds_disable_option = .is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = USBCONRESO_MENU_NO_ACTION, .out_action = USBCONRESO_MENU_OPTI_O3DS}; +static const USBConflictResolutionMenuOptionInfo optimize_n3dsv2_disable_option = { +.base_name = "Disable Opt. N3DSv2", +.false_name = "Enable Opt. N3DSv2", .exists = EXISTENCE_VALUE_CONFLICT_NISE_OPTI_O3DS, .is_selectable = true, +.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = USBCONRESO_MENU_NO_ACTION, +.out_action = USBCONRESO_MENU_OPTI_N3DSV2}; + static const USBConflictResolutionMenuOptionInfo optimize_o2ds_disable_option = { .base_name = "Disable Opt. O2DS Late 2014", .false_name = "Enable Opt. O2DS Late 2014", .exists = EXISTENCE_VALUE_CONFLICT_NISE_OPTI_O3DS, .is_selectable = true, @@ -96,6 +102,7 @@ static const USBConflictResolutionMenuOptionInfo* pollable_options[] = { &warning_nise_opti_conflict_2_alt, &warning_nise_opti_conflict_3, &optimize_o3ds_disable_option, +&optimize_n3dsv2_disable_option, &optimize_o2ds_disable_option, &nisetro_ds_disable_option, }; @@ -111,7 +118,7 @@ USBConflictResolutionMenu::~USBConflictResolutionMenu() { } void USBConflictResolutionMenu::class_setup() { - this->num_options_per_screen = 6; + this->num_options_per_screen = 4; this->min_elements_text_scaling_factor = num_options_per_screen + 2; this->width_factor_menu = 16; this->width_divisor_menu = 9; @@ -208,6 +215,9 @@ void USBConflictResolutionMenu::prepare(float menu_scaling_factor, int view_size case USBCONRESO_MENU_OPTI_O2DS: this->labels[index]->setText(this->setTextOptionBool(real_index, capture_status->devices_allowed_scan[CC_OPTIMIZE_O_O2DS])); break; + case USBCONRESO_MENU_OPTI_N3DSV2: + this->labels[index]->setText(this->setTextOptionBool(real_index, capture_status->devices_allowed_scan[CC_OPTIMIZE_N3DSV2])); + break; default: break; } diff --git a/source/WindowScreen_Menu.cpp b/source/WindowScreen_Menu.cpp index 6409fe1..9eda881 100755 --- a/source/WindowScreen_Menu.cpp +++ b/source/WindowScreen_Menu.cpp @@ -2469,6 +2469,9 @@ void WindowScreen::poll(bool do_everything) { case USBCONRESO_MENU_OPTI_O3DS: this->devices_allowed_change(CC_OPTIMIZE_O3DS); break; + case USBCONRESO_MENU_OPTI_N3DSV2: + this->devices_allowed_change(CC_OPTIMIZE_N3DSV2); + break; case USBCONRESO_MENU_OPTI_O2DS: this->devices_allowed_change(CC_OPTIMIZE_O_O2DS); break; diff --git a/source/cc3dsfs.cpp b/source/cc3dsfs.cpp index e8f7fe8..79c6ac0 100755 --- a/source/cc3dsfs.cpp +++ b/source/cc3dsfs.cpp @@ -45,6 +45,7 @@ struct override_all_data { bool auto_close = false; bool force_disable_nisetro_ds = false; bool force_disable_optimize_old_3ds = false; + bool force_disable_optimize_new_3ds_v2 = false; bool force_disable_optimize_old_old_2ds = false; bool auto_save = true; int loaded_profile = STARTUP_FILE_INDEX; @@ -263,6 +264,11 @@ static bool load(const std::string path, const std::string name, ScreenInfo &top continue; } + if(key == "optimize_n3dsv2_scan_for") { + capture_status->devices_allowed_scan[CC_OPTIMIZE_N3DSV2] = std::stoi(value); + continue; + } + if(key == "optimize_oo2ds_scan_for") { capture_status->devices_allowed_scan[CC_OPTIMIZE_O_O2DS] = std::stoi(value); continue; @@ -395,6 +401,7 @@ static bool save(const std::string path, const std::string name, const std::stri file << "partner_ctr_ac_adapter_connected=" << capture_status->device_specific_status.partner_ctr_status.ac_adapter_connected << std::endl; file << "partner_ctr_ac_adapter_charging=" << capture_status->device_specific_status.partner_ctr_status.ac_adapter_charging << std::endl; file << "optimize_o3ds_scan_for=" << capture_status->devices_allowed_scan[CC_OPTIMIZE_O3DS] << std::endl; + file << "optimize_n3dsv2_scan_for=" << capture_status->devices_allowed_scan[CC_OPTIMIZE_N3DSV2] << std::endl; file << "optimize_oo2ds_scan_for=" << capture_status->devices_allowed_scan[CC_OPTIMIZE_O_O2DS] << std::endl; file << "nisetro_ds_scan_for=" << capture_status->devices_allowed_scan[CC_NISETRO_DS] << std::endl; file << audio_data->save_audio_data(); @@ -631,6 +638,7 @@ static void populate_force_disable_ccs(bool* force_cc_disables, override_all_dat force_cc_disables[i] = false; force_cc_disables[CC_NISETRO_DS] = override_data.force_disable_nisetro_ds; force_cc_disables[CC_OPTIMIZE_O3DS] = override_data.force_disable_optimize_old_3ds; + force_cc_disables[CC_OPTIMIZE_N3DSV2] = override_data.force_disable_optimize_new_3ds_v2; force_cc_disables[CC_OPTIMIZE_O_O2DS] = override_data.force_disable_optimize_old_old_2ds; } @@ -1040,6 +1048,8 @@ int main(int argc, char **argv) { continue; if(parse_existence_arg(i, argv, override_data.force_disable_optimize_old_3ds, true, "--no_opt_o3ds_cc")) continue; + if(parse_existence_arg(i, argv, override_data.force_disable_optimize_new_3ds_v2, true, "--no_opt_n3ds2_cc")) + continue; if(parse_existence_arg(i, argv, override_data.force_disable_optimize_old_old_2ds, true, "--no_opt_o2ds_cc")) continue; if(parse_int_arg(i, argc, argv, override_data.loaded_profile, "--profile")) @@ -1099,6 +1109,7 @@ int main(int argc, char **argv) { ActualConsoleOutText(" --auto_close Automatically closes the software on disconnect."); ActualConsoleOutText(" --no_nisetro Force disables Nisetro DS(i) Capture Card."); ActualConsoleOutText(" --no_opt_o3ds_cc Force disables Optimize Old 3DS Capture Card."); + ActualConsoleOutText(" --no_opt_n3ds2_cc Force disables Optimize New 3DS V2 Capture Card."); ActualConsoleOutText(" --no_opt_o2ds_cc Force disables Optimize Old 2DS 2014 Capture Card."); ActualConsoleOutText(" --profile Loads the profile with the specified ID at startup"); ActualConsoleOutText(" instead of the default one. When the program closes,");