From d5ec7b4d6199b287b0ebbb270f11de140101c944 Mon Sep 17 00:00:00 2001 From: Lorenzooone Date: Wed, 30 Apr 2025 21:45:15 +0200 Subject: [PATCH] Add support for having different video output types selectable --- include/frontend.hpp | 5 +++-- source/WindowScreen.cpp | 5 +++-- source/cc3dsfs.cpp | 4 +++- source/frontend.cpp | 14 +++++++------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/include/frontend.hpp b/include/frontend.hpp index ff01759..507dc92 100755 --- a/include/frontend.hpp +++ b/include/frontend.hpp @@ -76,7 +76,7 @@ public: void display_thread(); void end(); void after_thread_join(); - void draw(double frame_time, VideoOutputData* out_buf); + void draw(double frame_time, VideoOutputData* out_buf, InputVideoDataType video_data_type); void setup_connection_menu(std::vector *devices_list, bool reset_data = true); int check_connection_menu_result(); void end_connection_menu(); @@ -115,6 +115,7 @@ private: bool divide_3d_par; }; OutTextData own_out_text_data; + InputVideoDataType curr_video_data_type; InputVideoDataType last_update_texture_data_type; PossibleSoftwareConvTypes texture_software_based_conv; bool created_proper_folder; @@ -431,7 +432,7 @@ void get_par_size(float &width, float &height, float multiplier_factor, const PA 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_output(FrontendData* frontend_data, double frame_time = 0.0, VideoOutputData *out_buf = NULL, InputVideoDataType video_data_type = VIDEO_DATA_RGB); 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); diff --git a/source/WindowScreen.cpp b/source/WindowScreen.cpp index c90e91a..60c57e1 100755 --- a/source/WindowScreen.cpp +++ b/source/WindowScreen.cpp @@ -271,7 +271,7 @@ void WindowScreen::after_thread_join() { } } -void WindowScreen::draw(double frame_time, VideoOutputData* out_buf) { +void WindowScreen::draw(double frame_time, VideoOutputData* out_buf, InputVideoDataType video_data_type) { FPSArrayInsertElement(&in_fps, frame_time); if(!this->done_display) return; @@ -316,6 +316,7 @@ void WindowScreen::draw(double frame_time, VideoOutputData* out_buf) { memset(this->saved_buf, 0, sizeof(VideoOutputData)); this->was_last_frame_null = true; } + this->curr_video_data_type = video_data_type; loaded_info = m_info; m_info.initial_pos_x = DEFAULT_NO_POS_WINDOW_VALUE; m_info.initial_pos_y = DEFAULT_NO_POS_WINDOW_VALUE; @@ -648,7 +649,7 @@ bool WindowScreen::single_update_texture(unsigned int m_texture, InputVideoDataT } void WindowScreen::execute_single_update_texture(bool &manually_converted, bool do_full, bool is_top, bool is_second) { - InputVideoDataType video_data_type = this->capture_status->device.video_data_type; + InputVideoDataType video_data_type = this->curr_video_data_type; size_t top_width = TOP_WIDTH_3DS; size_t top_height = HEIGHT_3DS; size_t single_top_width = TOP_WIDTH_3DS; diff --git a/source/cc3dsfs.cpp b/source/cc3dsfs.cpp index e963899..1153eda 100755 --- a/source/cc3dsfs.cpp +++ b/source/cc3dsfs.cpp @@ -563,6 +563,7 @@ static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data, else if(frontend_data.shared_data.input_data.fast_poll) poll_timeout = LOW_POLL_DIVISOR; VideoOutputData *chosen_buf = out_buf; + InputVideoDataType video_data_type = VIDEO_DATA_RGB; bool blank_out = false; bool is_connected = capture_data->status.connected; if(is_connected != last_connected) { @@ -586,6 +587,7 @@ static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data, if(capture_data->status.cooldown_curr_in || (!capture_data->status.connected)) blank_out = true; else { + video_data_type = data_buffer->buffer_video_data_type; bool conversion_success = convertVideoToOutput(out_buf, endianness, data_buffer, &capture_data->status, frontend_data.display_data.interleaved_3d); if(!conversion_success) UpdateOutText(out_text_data, "", "Video conversion failed...", TEXT_KIND_NORMAL); @@ -619,7 +621,7 @@ static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data, if(frontend_data.shared_data.input_data.fast_poll) poll_all_windows(&frontend_data, poll_everything, polled); - update_output(&frontend_data, last_frame_time, chosen_buf); + update_output(&frontend_data, last_frame_time, chosen_buf, video_data_type); if(!frontend_data.shared_data.input_data.fast_poll) poll_all_windows(&frontend_data, poll_everything, polled); diff --git a/source/frontend.cpp b/source/frontend.cpp index 053f369..2b06e98 100755 --- a/source/frontend.cpp +++ b/source/frontend.cpp @@ -1039,7 +1039,7 @@ JoystickAction get_joystick_action(uint32_t joystickId, uint32_t joy_button) { return JOY_ACTION_NONE; } -void update_output(FrontendData* frontend_data, double frame_time, VideoOutputData *out_buf) { +void update_output(FrontendData* frontend_data, double frame_time, VideoOutputData *out_buf, InputVideoDataType video_data_type) { if(frontend_data->reload) { frontend_data->top_screen->reload(); frontend_data->bot_screen->reload(); @@ -1048,17 +1048,17 @@ void update_output(FrontendData* frontend_data, double frame_time, VideoOutputDa } // Make sure the window is closed before showing split/non-split if(!frontend_data->joint_screen->m_info.window_enabled) - frontend_data->joint_screen->draw(frame_time, out_buf); + frontend_data->joint_screen->draw(frame_time, out_buf, video_data_type); if(!frontend_data->top_screen->m_info.window_enabled) - frontend_data->top_screen->draw(frame_time, out_buf); + frontend_data->top_screen->draw(frame_time, out_buf, video_data_type); if(!frontend_data->bot_screen->m_info.window_enabled) - frontend_data->bot_screen->draw(frame_time, out_buf); + frontend_data->bot_screen->draw(frame_time, out_buf, video_data_type); if(frontend_data->joint_screen->m_info.window_enabled) - frontend_data->joint_screen->draw(frame_time, out_buf); + frontend_data->joint_screen->draw(frame_time, out_buf, video_data_type); if(frontend_data->top_screen->m_info.window_enabled) - frontend_data->top_screen->draw(frame_time, out_buf); + frontend_data->top_screen->draw(frame_time, out_buf, video_data_type); if(frontend_data->bot_screen->m_info.window_enabled) - frontend_data->bot_screen->draw(frame_time, out_buf); + frontend_data->bot_screen->draw(frame_time, out_buf, video_data_type); } static bool are_cc_device_screens_same(const CaptureDevice &old_cc_device, const CaptureDevice &new_cc_device) {