From 142d2042437856f0e85273fff9de36571c63bc2c Mon Sep 17 00:00:00 2001 From: Lorenzooone Date: Sat, 3 Jan 2026 02:50:51 +0100 Subject: [PATCH] Add support for horizontal input 3DS video feed --- include/hw_defs.hpp | 18 ++++++++++++++---- source/WindowScreen.cpp | 11 ++++++----- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/hw_defs.hpp b/include/hw_defs.hpp index a592f36..2d96fbb 100755 --- a/include/hw_defs.hpp +++ b/include/hw_defs.hpp @@ -59,22 +59,32 @@ #define IN_VIDEO_SIZE_3DS_3D (IN_VIDEO_WIDTH_3DS_3D * IN_VIDEO_HEIGHT_3DS_3D) #define IN_VIDEO_BPP_SIZE_3DS_3D 24 +// Use this setup to make copying fast... +#define IN_VIDEO_WIDTH_3DS_ROT TOP_WIDTH_3DS +#define IN_VIDEO_WIDTH_3DS_BOT_ROT BOT_WIDTH_3DS +#define IN_VIDEO_HEIGHT_3DS_ROT (HEIGHT_3DS * 2) +#define IN_VIDEO_SIZE_3DS_ROT (IN_VIDEO_WIDTH_3DS_ROT * IN_VIDEO_HEIGHT_3DS_ROT) + +#define IN_VIDEO_WIDTH_3DS_3D_ROT TOP_WIDTH_3DS +#define IN_VIDEO_HEIGHT_3DS_3D_ROT (HEIGHT_3DS * 3) +#define IN_VIDEO_SIZE_3DS_3D_ROT (IN_VIDEO_WIDTH_3DS_3D_ROT * IN_VIDEO_HEIGHT_3DS_3D_ROT) + #define IN_VIDEO_WIDTH_DS WIDTH_DS #define IN_VIDEO_HEIGHT_DS (HEIGHT_DS + HEIGHT_DS) #define IN_VIDEO_SIZE_DS (IN_VIDEO_WIDTH_DS * IN_VIDEO_HEIGHT_DS) #define IN_VIDEO_BPP_SIZE_DS_BASIC 15 #define IN_VIDEO_BPP_SIZE_DS_BLENDING 18 -#define MAX_IN_VIDEO_WIDTH IN_VIDEO_WIDTH_DS +#define MAX_IN_VIDEO_WIDTH IN_VIDEO_WIDTH_3DS_ROT #define MAX_IN_VIDEO_HEIGHT IN_VIDEO_HEIGHT_3DS_3D #define MAX_IN_VIDEO_SIZE (MAX_IN_VIDEO_WIDTH * MAX_IN_VIDEO_HEIGHT) #define MAX_IN_VIDEO_BPP_SIZE IN_VIDEO_BPP_SIZE_3DS -#define MAX_IN_VIDEO_WIDTH_TOP IN_VIDEO_WIDTH_DS +#define MAX_IN_VIDEO_WIDTH_TOP IN_VIDEO_WIDTH_3DS_ROT #define MAX_IN_VIDEO_HEIGHT_TOP (TOP_WIDTH_3DS + TOP_WIDTH_3DS) -#define MAX_IN_VIDEO_WIDTH_SINGLE_TOP IN_VIDEO_WIDTH_DS +#define MAX_IN_VIDEO_WIDTH_SINGLE_TOP IN_VIDEO_WIDTH_3DS_ROT #define MAX_IN_VIDEO_HEIGHT_SINGLE_TOP TOP_WIDTH_3DS -#define MAX_IN_VIDEO_WIDTH_BOTTOM IN_VIDEO_WIDTH_DS +#define MAX_IN_VIDEO_WIDTH_BOTTOM IN_VIDEO_WIDTH_3DS_BOT_ROT #define MAX_IN_VIDEO_HEIGHT_BOTTOM BOT_WIDTH_3DS // 1096 is the value when things are ideal. However, it can actually happen that the transfer isn't 100% on time. diff --git a/source/WindowScreen.cpp b/source/WindowScreen.cpp index 02cabf3..66ed392 100755 --- a/source/WindowScreen.cpp +++ b/source/WindowScreen.cpp @@ -1056,7 +1056,7 @@ void WindowScreen::display_data_to_window(bool actually_draw, bool is_debug) { this->m_out_rect_bot.to_process_tex = &this->m_out_rect_bot.out_tex; this->m_out_rect_bot.to_backup_tex = &this->m_out_rect_bot.backup_tex; this->post_texture_conversion_processing(out_rect_bot, this->m_out_rect_bot.to_process_tex, this->m_out_rect_bot.to_backup_tex, in_rect_bot, actually_draw, false, is_debug); - bool has_to_do_top_right_screen = get_3d_enabled(this->capture_status) && ((!this->display_data->interleaved_3d) || (!this->shared_texture_available)) && (this->m_stype != ScreenType::BOTTOM) && is_size_valid(out_rect_top.getSize()); + bool has_to_do_top_right_screen = get_3d_enabled(this->capture_status) && (this->m_stype != ScreenType::BOTTOM) && is_size_valid(out_rect_top.getSize()); if(has_to_do_top_right_screen) { out_rect_top_right.setTextureRect(out_rect_top.getTextureRect()); this->m_out_rect_top_right.to_process_tex = &this->m_out_rect_top_right.out_tex; @@ -1069,7 +1069,7 @@ void WindowScreen::display_data_to_window(bool actually_draw, bool is_debug) { else this->m_win.clear(); this->window_bg_processing(); - bool needs_to_glue_textures_3d = has_to_do_top_right_screen && this->display_data->interleaved_3d && (!this->shared_texture_available); + bool needs_to_glue_textures_3d = has_to_do_top_right_screen && this->display_data->interleaved_3d; if(needs_to_glue_textures_3d) { float x_divisor = 2.0f; float y_divisor = 1.0f; @@ -1865,9 +1865,10 @@ void WindowScreen::crop() { if(is_3d_interleaved && (!this->shared_texture_available)) top_screen_size.x /= 2.0f; this->resize_in_rect(this->m_in_rect_top, starting_in_rect_x, starting_in_rect_y, (int)top_screen_size.x, (int)top_screen_size.y); - if(is_3d_interleaved && (!this->shared_texture_available)) { - int second_screen_x_starting_pos = std::max(0, ((int)((*crops)[*crop_value]->top_x * x_multiplier)) - TOP_WIDTH_3DS); - this->resize_in_rect(this->m_in_rect_top_right, second_screen_x_starting_pos, starting_in_rect_y, (int)top_screen_size.x, (int)top_screen_size.y); + if(is_3d_interleaved) { + int second_screen_x_starting_pos = std::max((int)this->get_pos_x_screen_inside_in_tex(true, true), ((int)((*crops)[*crop_value]->top_x * x_multiplier)) - TOP_WIDTH_3DS); + int second_screen_y_starting_pos = (int)(this->get_pos_y_screen_inside_in_tex(true, true) + (*crops)[*crop_value]->top_y); + this->resize_in_rect(this->m_in_rect_top_right, second_screen_x_starting_pos, second_screen_y_starting_pos, (int)top_screen_size.x, (int)top_screen_size.y); } } this->loaded_operations.call_screen_settings_update = true;