Add support for reduced output with Android port
Some checks failed
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) Has been cancelled
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) Has been cancelled
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) Has been cancelled
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) Has been cancelled
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) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 Win32 os:windows-2022]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 x64 os:windows-2022]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 ARM os:windows-2022]) (push) Has been cancelled
CD / Create Pi Mono Setup (push) Has been cancelled
CD / Publishing (push) Has been cancelled

This commit is contained in:
Lorenzooone 2025-05-27 00:21:18 +02:00
parent dec304c00b
commit 75b73d5952
6 changed files with 44 additions and 12 deletions

View File

@ -139,10 +139,12 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
else()
if(MSVC)
list(APPEND EXTRA_CXX_FLAGS "/DXLIB_BASED 1")
else()
list(APPEND EXTRA_CXX_FLAGS "-DXLIB_BASED 1")
if(NOT ${SFML_USE_DRM})
if(MSVC)
list(APPEND EXTRA_CXX_FLAGS "/DXLIB_BASED 1")
else()
list(APPEND EXTRA_CXX_FLAGS "-DXLIB_BASED 1")
endif()
endif()
endif()

View File

@ -2,7 +2,7 @@
SFML_EXTRACTED_TO_FOLDER=~
LIBUSB_EXTRACTED_TO_FOLDER=~
SFML_BRANCH_NAME=master
SFML_BRANCH_NAME=android_fullscreen_stuff
LIBUSB_BRANCH_NAME=android-rebase-2022-07
SFML_EXTRACTED_FOLDER=${SFML_EXTRACTED_TO_FOLDER}/SFML-${SFML_BRANCH_NAME}
LIBUSB_EXTRACTED_FOLDER=${LIBUSB_EXTRACTED_TO_FOLDER}/libusb-${LIBUSB_BRANCH_NAME}
@ -16,7 +16,7 @@ ANDROID_FOLDER=android
export LANG=C.UTF-8
(cd ${SFML_EXTRACTED_TO_FOLDER} ; rm -f ${SFML_BRANCH_NAME}.zip ; wget https://github.com/SFML/SFML/archive/refs/heads/${SFML_BRANCH_NAME}.zip ; unzip ${SFML_BRANCH_NAME}.zip)
(cd ${SFML_EXTRACTED_TO_FOLDER} ; rm -f ${SFML_BRANCH_NAME}.zip ; wget https://github.com/Lorenzooone/SFML/archive/refs/heads/${SFML_BRANCH_NAME}.zip ; unzip ${SFML_BRANCH_NAME}.zip)
(cd ${LIBUSB_EXTRACTED_TO_FOLDER} ; rm -f ${LIBUSB_BRANCH_NAME}.zip ; wget https://github.com/jagheterfredrik/libusb/archive/refs/heads/${LIBUSB_BRANCH_NAME}.zip ; unzip ${LIBUSB_BRANCH_NAME}.zip)
${BUILD_LIBS_COMMAND} ${LIBUSB_EXTRACTED_FOLDER} ${SFML_EXTRACTED_FOLDER} ${STL_CHOSEN} ${RELEASE_TYPE}

View File

@ -90,6 +90,8 @@ public:
void process_own_out_text_data(bool print_to_notification = true);
int load_data();
int save_data();
bool is_open();
bool has_focus();
bool open_capture();
bool close_capture();
bool scheduled_split();
@ -448,6 +450,7 @@ void get_par_size(float &width, float &height, float multiplier_factor, const PA
SecondScreen3DRelativePosition get_second_screen_pos(ScreenInfo* info, ScreenType stype);
bool should_do_output(FrontendData* frontend_data);
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);

View File

@ -265,6 +265,14 @@ void WindowScreen::end() {
this->display_lock.unlock();
}
bool WindowScreen::is_open() {
return this->m_win.isOpen();
}
bool WindowScreen::has_focus() {
return this->m_win.isOpen() && this->m_win.hasFocus();
}
void WindowScreen::after_thread_join() {
if(this->m_win.isOpen()) {
this->draw_lock->lock();

View File

@ -407,7 +407,7 @@ static bool handleAudioDeviceChanges(Audio &audio, AudioData *audio_data, std::o
return success;
}
static void soundCall(AudioData *audio_data, CaptureData* capture_data) {
static void soundCall(AudioData *audio_data, CaptureData* capture_data, volatile bool* can_do_output) {
std::int16_t (*out_buf)[MAX_SAMPLES_IN] = new std::int16_t[NUM_CONCURRENT_AUDIO_BUFFERS][MAX_SAMPLES_IN];
Audio audio(audio_data);
int audio_buf_counter = 0;
@ -419,7 +419,7 @@ static void soundCall(AudioData *audio_data, CaptureData* capture_data) {
std::chrono::time_point<std::chrono::high_resolution_clock> last_device_check_time = std::chrono::high_resolution_clock::now();
while(capture_data->status.running) {
if(capture_data->status.connected && capture_data->status.device.has_audio) {
if(capture_data->status.connected && capture_data->status.device.has_audio && (*can_do_output)) {
bool timed_out = !capture_data->status.audio_wait.timed_lock();
if(!capture_data->status.cooldown_curr_in) {
@ -520,7 +520,7 @@ static float get_time_multiplier(CaptureData* capture_data, bool should_ignore_d
}
}
static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data, bool created_proper_folder, override_all_data &override_data) {
static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data, bool created_proper_folder, override_all_data &override_data, volatile bool* can_do_output) {
VideoOutputData *out_buf;
double last_frame_time = 0.0;
FrontendData frontend_data;
@ -648,7 +648,10 @@ 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, video_data_type);
*can_do_output = should_do_output(&frontend_data);
if(*can_do_output)
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);
@ -806,6 +809,7 @@ int main(int argc, char **argv) {
int power_id = -1;
bool use_pud_up = true;
bool created_proper_folder = create_out_folder();
volatile bool can_do_output = true;
bool mono_app_default_value = false;
#ifdef ANDROID_COMPILATION
mono_app_default_value = true;
@ -928,9 +932,9 @@ int main(int argc, char **argv) {
std::thread capture_thread(captureCall, capture_data);
std::thread audio_thread;
if(!override_data.no_audio)
audio_thread = std::thread(soundCall, &audio_data, capture_data);
audio_thread = std::thread(soundCall, &audio_data, capture_data, &can_do_output);
int ret_val = mainVideoOutputCall(&audio_data, capture_data, created_proper_folder, override_data);
int ret_val = mainVideoOutputCall(&audio_data, capture_data, created_proper_folder, override_data, &can_do_output);
if(!override_data.no_audio)
audio_thread.join();
capture_thread.join();

View File

@ -1,4 +1,5 @@
#include "frontend.hpp"
#include "utils.hpp"
#include <cmath>
#include <thread>
#include <SFML/System.hpp>
@ -1039,6 +1040,20 @@ JoystickAction get_joystick_action(uint32_t joystickId, uint32_t joy_button) {
return JOY_ACTION_NONE;
}
bool should_do_output(FrontendData* frontend_data) {
#ifndef ANDROID_COMPILATION
return (frontend_data->joint_screen->m_info.window_enabled) || (frontend_data->bot_screen->m_info.window_enabled) || (frontend_data->top_screen->m_info.window_enabled);
#else
if(frontend_data->joint_screen->m_info.window_enabled)
return (!frontend_data->joint_screen->is_open()) || frontend_data->joint_screen->has_focus();
if(frontend_data->bot_screen->m_info.window_enabled)
return (!frontend_data->bot_screen->is_open()) || frontend_data->bot_screen->has_focus();
if(frontend_data->top_screen->m_info.window_enabled)
return (!frontend_data->top_screen->is_open()) || frontend_data->top_screen->has_focus();
return false;
#endif
}
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();