Add N3DS XL Loopy 3D Mode
Some checks are pending
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux32 flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux64 flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm32 flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm64 flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:macos name:macOS Apple Silicon os:macos-14]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 name:Windows VS2022 Win32 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 name:Windows VS2022 x64 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 name:Windows VS2022 ARM os:windows-2022]) (push) Waiting to run
CD / Create Pi Mono Setup (push) Blocked by required conditions
CD / Publishing (push) Blocked by required conditions

This commit is contained in:
Lorenzooone
2025-03-23 23:27:05 +01:00
parent 1e50e5d353
commit 642a9cfb79
24 changed files with 1213 additions and 149 deletions

View File

@@ -5,9 +5,11 @@
#include <chrono>
#include "capture_structs.hpp"
uint64_t ftd3_get_capture_size(bool is_3d_enabled);
uint64_t ftd3_get_capture_size(CaptureData* capture_data);
std::string ftd3_get_serial(std::string serial_string, int &curr_serial_extra_id);
void ftd3_insert_device(std::vector<CaptureDevice> &devices_list, std::string serial_string, int &curr_serial_extra_id, uint32_t usb_speed, bool is_driver);
void data_output_update(int inner_index, size_t read_data, CaptureData* capture_data, std::chrono::time_point<std::chrono::high_resolution_clock> &base_time);
bool ftd3_capture_3d_setup(CaptureData* capture_data, bool first_pass, bool& stored_3d_status);
#endif

View File

@@ -0,0 +1,44 @@
#ifndef __MAIN3DMENU_HPP
#define __MAIN3DMENU_HPP
#include "OptionSelectionMenu.hpp"
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#include "display_structs.hpp"
#include "capture_structs.hpp"
enum Main3DMenuOutAction{
MAIN_3D_MENU_NO_ACTION,
MAIN_3D_MENU_BACK,
MAIN_3D_MENU_REQUEST_3D_TOGGLE,
MAIN_3D_MENU_INTERLEAVED_TOGGLE,
MAIN_3D_MENU_SQUISH_TOP_TOGGLE,
MAIN_3D_MENU_SQUISH_BOTTOM_TOGGLE,
MAIN_3D_MENU_USB_SPEED_INFO,
MAIN_3D_MENU_DEVICE_INFO,
MAIN_3D_MENU_IMPLEMENTATION_INFO,
MAIN_3D_MENU_SECOND_SCREEN_POSITION_SETTINGS,
};
class Main3DMenu : public OptionSelectionMenu {
public:
Main3DMenu(bool font_load_success, sf::Font &text_font);
~Main3DMenu();
void prepare(float menu_scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info, DisplayData* display_data, CaptureStatus* status);
void insert_data(ScreenType stype);
Main3DMenuOutAction selected_index = Main3DMenuOutAction::MAIN_3D_MENU_NO_ACTION;
void reset_output_option();
protected:
bool is_option_selectable(int index, int action);
bool is_option_inc_dec(int index);
void set_output_option(int index, int action);
int get_num_options();
std::string get_string_option(int index, int action);
void class_setup();
private:
int *options_indexes;
int num_enabled_options;
};
#endif

View File

@@ -18,6 +18,7 @@ enum RelPosMenuOutAction{
class RelativePositionMenu {
public:
RelativePositionMenu();
RelativePositionMenu(bool font_load_success, sf::Font &text_font);
~RelativePositionMenu();
bool poll(SFEvent &event_data);
@@ -29,7 +30,7 @@ public:
void insert_data();
RelPosMenuOutAction selected_index = RelPosMenuOutAction::REL_POS_MENU_NO_ACTION;
BottomRelativePosition selected_confirm_value = BOT_REL_POS_END;
private:
protected:
struct RelPosMenuData {
int option_selected = -1;
int menu_width;
@@ -39,7 +40,11 @@ private:
};
RelPosMenuData future_data;
TextRectangle **labels;
bool *selectable_labels;
int num_vertical_slices;
int num_elements_per_screen;
int num_elements_displayed_per_screen;
int num_options_per_screen;
int elements_start_id;
int min_elements_text_scaling_factor;
@@ -52,10 +57,23 @@ private:
sf::Color menu_color;
std::string title;
int num_elements_per_screen;
void initialize(bool font_load_success, sf::Font &text_font);
void prepare_options();
void base_prepare(float menu_scaling_factor, int view_size_x, int view_size_y);
void prepare_text_slices(int x_multiplier, int x_divisor, int y_multiplier, int y_divisor, int index, float text_scaling_factor, bool center = false);
virtual bool is_option_selectable(int index);
virtual void set_output_option(int index);
virtual std::string get_string_option(int index);
virtual void class_setup();
virtual void option_slice_prepare(int i, int index, int num_vertical_slices, float text_scaling_factor);
virtual bool is_option_element(int option);
virtual bool is_option_left(int index);
virtual bool is_option_right(int index);
virtual bool is_option_above(int index);
virtual bool is_option_below(int index);
private:
int num_title_back_x_elements;
int num_elements_displayed_per_screen;
int num_vertical_slices;
int title_back_x_start_id;
int back_x_id;
int title_id;
@@ -63,26 +81,16 @@ private:
std::chrono::time_point<std::chrono::high_resolution_clock> last_action_time;
const float action_timeout = 0.1;
int option_selected = -1;
bool *selectable_labels;
RelPosMenuData loaded_data;
sf::RectangleShape menu_rectangle = sf::RectangleShape(sf::Vector2f(1, 1));
bool is_option_selectable(int index);
void set_output_option(int index);
std::string get_string_option(int index);
void class_setup();
void prepare_options();
void base_prepare(float menu_scaling_factor, int view_size_x, int view_size_y);
void after_class_setup_connected_values();
void prepare_text_slices(int x_multiplier, int x_divisor, int y_multiplier, int y_divisor, int index, float text_scaling_factor, bool center = false);
bool can_execute_action();
void up_code(bool is_simple);
void down_code(bool is_simple);
void left_code();
void right_code();
void option_selection_handling();
bool is_option_element(int option);
void set_default_cursor_position();
void decrement_selected_option(bool is_simple);
void increment_selected_option(bool is_simple);

View File

@@ -0,0 +1,48 @@
#ifndef __SECOND_SCREEN_3D_RELPOSMENU_HPP
#define __SECOND_SCREEN_3D_RELPOSMENU_HPP
#include <SFML/Graphics.hpp>
#include <chrono>
#include "TextRectangle.hpp"
#include "display_structs.hpp"
#include "event_structs.hpp"
#include "RelativePositionMenu.hpp"
#define BACK_X_OUTPUT_OPTION -1
enum SecondScreen3DRelPosMenuOutAction{
SECOND_SCREEN_3D_REL_POS_MENU_NO_ACTION,
SECOND_SCREEN_3D_REL_POS_MENU_BACK,
SECOND_SCREEN_3D_REL_POS_MENU_TOGGLE_MATCH,
SECOND_SCREEN_3D_REL_POS_MENU_CONFIRM,
};
class SecondScreen3DRelativePositionMenu : public RelativePositionMenu {
public:
SecondScreen3DRelativePositionMenu(bool font_load_success, sf::Font &text_font);
~SecondScreen3DRelativePositionMenu();
std::chrono::time_point<std::chrono::high_resolution_clock> last_input_processed_time;
void reset_output_option();
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo* info);
void insert_data(ScreenType stype);
SecondScreen3DRelPosMenuOutAction selected_index = SecondScreen3DRelPosMenuOutAction::SECOND_SCREEN_3D_REL_POS_MENU_NO_ACTION;
SecondScreen3DRelativePosition selected_confirm_value = SECOND_SCREEN_3D_REL_POS_END;
protected:
bool is_option_selectable(int index);
void set_output_option(int index);
std::string get_string_option(int index);
void class_setup();
void option_slice_prepare(int i, int index, int num_vertical_slices, float text_scaling_factor);
bool is_option_element(int option);
bool is_option_left(int index);
bool is_option_right(int index);
bool is_option_above(int index);
bool is_option_below(int index);
private:
std::string setTextOptionBool(int index, bool value);
std::string get_false_option(int index);
int pos_y_subtractor;
};
#endif

View File

@@ -41,6 +41,7 @@ enum VideoMenuOutAction{
VIDEO_MENU_CHANGE_TITLEBAR,
VIDEO_MENU_VIDEO_EFFECTS_SETTINGS,
VIDEO_MENU_SEPARATOR_SETTINGS,
VIDEO_MENU_3D_SETTINGS,
};
class VideoMenu : public OptionSelectionMenu {

View File

@@ -27,5 +27,7 @@ std::string get_name_of_device(CaptureStatus* capture_status, bool use_long = fa
int get_usb_speed_of_device(CaptureStatus* capture_status);
bool get_device_can_do_3d(CaptureStatus* capture_status);
bool get_device_3d_implemented(CaptureStatus* capture_status);
bool get_3d_enabled(CaptureStatus* capture_status);
bool is_usb_speed_of_device_enough_3d(CaptureStatus* capture_status);
bool get_3d_enabled(CaptureStatus* capture_status, bool skip_requested_3d_check = false);
bool update_3d_enabled(CaptureStatus* capture_status);
#endif

View File

@@ -24,8 +24,9 @@
enum ScreenType { TOP, BOTTOM, JOINT };
enum BottomRelativePosition { UNDER_TOP, LEFT_TOP, ABOVE_TOP, RIGHT_TOP, BOT_REL_POS_END };
enum SecondScreen3DRelativePosition { UNDER_FIRST, LEFT_FIRST, ABOVE_FIRST, RIGHT_FIRST, SECOND_SCREEN_3D_REL_POS_END };
enum NonIntegerScalingModes { SMALLER_PRIORITY, INVERSE_PROPORTIONAL_PRIORITY, EQUAL_PRIORITY, PROPORTIONAL_PRIORITY, BIGGER_PRIORITY, END_NONINT_SCALE_MODES };
enum CurrMenuType { DEFAULT_MENU_TYPE, CONNECT_MENU_TYPE, MAIN_MENU_TYPE, VIDEO_MENU_TYPE, AUDIO_MENU_TYPE, CROP_MENU_TYPE, TOP_PAR_MENU_TYPE, BOTTOM_PAR_MENU_TYPE, ROTATION_MENU_TYPE, OFFSET_MENU_TYPE, BFI_MENU_TYPE, LOAD_MENU_TYPE, SAVE_MENU_TYPE, RESOLUTION_MENU_TYPE, EXTRA_MENU_TYPE, STATUS_MENU_TYPE, LICENSES_MENU_TYPE, RELATIVE_POS_MENU_TYPE, SHORTCUTS_MENU_TYPE, ACTION_SELECTION_MENU_TYPE, SCALING_RATIO_MENU_TYPE, ISN_MENU_TYPE, VIDEO_EFFECTS_MENU_TYPE, INPUT_MENU_TYPE, AUDIO_DEVICE_MENU_TYPE, SEPARATOR_MENU_TYPE, COLOR_CORRECTION_MENU_TYPE };
enum CurrMenuType { DEFAULT_MENU_TYPE, CONNECT_MENU_TYPE, MAIN_MENU_TYPE, VIDEO_MENU_TYPE, AUDIO_MENU_TYPE, CROP_MENU_TYPE, TOP_PAR_MENU_TYPE, BOTTOM_PAR_MENU_TYPE, ROTATION_MENU_TYPE, OFFSET_MENU_TYPE, BFI_MENU_TYPE, LOAD_MENU_TYPE, SAVE_MENU_TYPE, RESOLUTION_MENU_TYPE, EXTRA_MENU_TYPE, STATUS_MENU_TYPE, LICENSES_MENU_TYPE, RELATIVE_POS_MENU_TYPE, SHORTCUTS_MENU_TYPE, ACTION_SELECTION_MENU_TYPE, SCALING_RATIO_MENU_TYPE, ISN_MENU_TYPE, VIDEO_EFFECTS_MENU_TYPE, INPUT_MENU_TYPE, AUDIO_DEVICE_MENU_TYPE, SEPARATOR_MENU_TYPE, COLOR_CORRECTION_MENU_TYPE, MAIN_3D_MENU_TYPE, SECOND_SCREEN_RELATIVE_POS_MENU_TYPE };
enum InputColorspaceMode { FULL_COLORSPACE, DS_COLORSPACE, GBA_COLORSPACE, INPUT_COLORSPACE_END };
enum FrameBlendingMode { NO_FRAME_BLENDING, FULL_FRAME_BLENDING, DS_3D_BOTH_SCREENS_FRAME_BLENDING, FRAME_BLENDING_END };
@@ -44,6 +45,8 @@ struct ScreenInfo {
double scaling;
bool is_fullscreen;
BottomRelativePosition bottom_pos;
SecondScreen3DRelativePosition second_screen_pos;
bool match_bottom_pos_and_second_screen_pos;
float subscreen_offset, subscreen_attached_offset, total_offset_x, total_offset_y;
int top_rotation, bot_rotation;
bool show_mouse;
@@ -76,6 +79,8 @@ struct ScreenInfo {
InputColorspaceMode in_colorspace_bot;
FrameBlendingMode frame_blending_top;
FrameBlendingMode frame_blending_bot;
bool squish_3d_top;
bool squish_3d_bot;
bool window_enabled;
int initial_pos_x;
int initial_pos_y;

View File

@@ -36,6 +36,8 @@
#include "AudioDeviceMenu.hpp"
#include "SeparatorMenu.hpp"
#include "ColorCorrectionMenu.hpp"
#include "Main3DMenu.hpp"
#include "SecondScreen3DRelativePositionMenu.hpp"
#include "display_structs.hpp"
#include "event_structs.hpp"
#include "shaders_list.hpp"
@@ -99,16 +101,20 @@ private:
bool use_non_int_scaling;
int rotation;
const PARData *par;
bool divide_3d_par;
};
bool created_proper_folder;
CaptureStatus* capture_status;
std::string win_title;
sf::RenderWindow m_win;
int m_width, m_height;
int m_width_no_manip, m_height_no_manip;
int m_window_width, m_window_height;
int m_prepare_load;
int m_prepare_save;
bool last_connected_status;
bool last_enabled_3d;
bool last_interleaved_3d;
bool m_prepare_open;
bool m_prepare_quit;
bool m_scheduled_split;
@@ -160,6 +166,8 @@ private:
AudioDeviceMenu *audio_device_menu;
SeparatorMenu *separator_menu;
ColorCorrectionMenu *color_correction_menu;
Main3DMenu *main_3d_menu;
SecondScreen3DRelativePositionMenu *second_screen_3d_relpos_menu;
std::vector<const CropData*> possible_crops;
std::vector<const CropData*> possible_crops_ds;
std::vector<const CropData*> possible_crops_with_games;
@@ -192,8 +200,8 @@ private:
volatile bool is_thread_done;
bool was_last_frame_null;
sf::RectangleShape m_in_rect_top, m_in_rect_bot;
out_rect_data m_out_rect_top, m_out_rect_bot;
sf::RectangleShape m_in_rect_top, m_in_rect_bot, m_in_rect_top_right;
out_rect_data m_out_rect_top, m_out_rect_bot, m_out_rect_top_right;
ScreenType m_stype;
const ShaderColorEmulationData* sent_shader_color_data;
@@ -237,6 +245,9 @@ private:
void fast_poll_change();
void padding_change();
void game_crop_enable_change();
void request_3d_change();
void interleaved_3d_change();
void squish_3d_change(bool is_top);
void audio_device_change(audio_output_device_data new_device_data);
void is_nitro_capture_type_change(bool positive);
void is_nitro_capture_speed_change(bool positive);
@@ -264,6 +275,8 @@ private:
void separator_windowed_multiplier_change(bool positive);
void separator_fullscreen_multiplier_change(bool positive);
void color_correction_value_change(int new_color_correction_value);
void second_screen_3d_pos_change(int new_second_screen_3d_pos);
void second_screen_3d_match_bottom_pos_change();
bool query_reset_request();
void reset_held_times(bool force = true);
void poll_window(bool do_everything);
@@ -278,16 +291,20 @@ private:
int _choose_color_emulation_shader(bool is_top);
int _choose_shader(PossibleShaderTypes shader_type, bool is_top);
int choose_shader(PossibleShaderTypes shader_type, bool is_top);
void apply_shader_to_texture(out_rect_data &rect_data, PossibleShaderTypes shader_type, bool is_top);
bool apply_shaders_to_input(out_rect_data &rect_data, const sf::RectangleShape &final_in_rect, bool is_top);
void apply_shader_to_texture(sf::RectangleShape &rect_data, sf::RenderTexture &tex_data, PossibleShaderTypes shader_type, bool is_top);
bool apply_shaders_to_input(sf::RectangleShape &rect_data, sf::RenderTexture &tex_data, const sf::RectangleShape &final_in_rect, bool is_top);
void pre_texture_conversion_processing();
void post_texture_conversion_processing(out_rect_data &rect_data, const sf::RectangleShape &in_rect, bool actually_draw, bool is_top, bool is_debug);
void post_texture_conversion_processing(sf::RectangleShape &rect_data, sf::RenderTexture &tex_data, const sf::RectangleShape &in_rect, bool actually_draw, bool is_top, bool is_debug);
void draw_rect_to_window(const sf::RectangleShape &out_rect, bool is_top);
void window_bg_processing();
void display_data_to_window(bool actually_draw, bool is_debug = false);
void window_render_call();
void set_position_screens(sf::Vector2f &curr_top_screen_size, sf::Vector2f &curr_bot_screen_size, int offset_x, int offset_y, int max_x, int max_y, int separator_size_x, int separator_size_y, bool do_work = true);
float get_max_float_screen_multiplier(ResizingScreenData *own_screen, int width_limit, int height_limit, int other_rotation, bool is_two_screens_merged = false);
bool get_divide_3d_par(bool is_top, ScreenInfo* info);
sf::Vector2u get_3d_size_multiplier(ScreenInfo* info);
sf::Vector2u get_desk_mode_3d_multiplied(ScreenInfo* info);
sf::Vector2f get_3d_offset_out_rect(ScreenInfo* info, bool is_second_screen);
int prepare_screen_ratio(ResizingScreenData *own_screen, int width_limit, int height_limit, int other_rotation);
float get_ratio_compared_other_screen(ResizingScreenData *own_screen, ResizingScreenData* other_screen, float other_scaling);
bool can_non_integerly_scale();
@@ -339,6 +356,8 @@ private:
void setup_input_menu(bool reset_data = true);
void setup_separator_menu(bool reset_data = true);
void setup_color_correction_menu(bool reset_data = true);
void setup_main_3d_menu(bool reset_data = true);
void setup_second_screen_3d_relpos_menu(bool reset_data = true);
void update_connection();
};
@@ -367,8 +386,9 @@ void reset_screen_info(ScreenInfo &info);
bool load_screen_info(std::string key, std::string value, std::string base, ScreenInfo &info);
std::string save_screen_info(std::string base, const ScreenInfo &info);
const PARData* get_base_par();
void get_par_size(int &width, int &height, float multiplier_factor, const PARData *correction_factor);
void get_par_size(float &width, float &height, float multiplier_factor, const PARData *correction_factor);
void get_par_size(int &width, int &height, float multiplier_factor, const PARData *correction_factor, bool divide_3d_par);
void get_par_size(float &width, float &height, float multiplier_factor, const PARData *correction_factor, bool divide_3d_par);
SecondScreen3DRelativePosition get_second_screen_pos(ScreenInfo* info, ScreenType stype);
void update_output(FrontendData* frontend_data, double frame_time = 0.0, VideoOutputData *out_buf = NULL);
void update_connected_3ds_ds(FrontendData* frontend_data, const CaptureDevice &old_cc_device, const CaptureDevice &new_cc_device);
void update_connected_specific_settings(FrontendData* frontend_data, const CaptureDevice &cc_device);