mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-04-23 05:17:38 -05:00
Add Input Method Toggles
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 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 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 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
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 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 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 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:
parent
0bc6615772
commit
c101bcf903
|
|
@ -478,7 +478,7 @@ if(MSVC)
|
|||
else()
|
||||
set_source_files_properties(source/conversions.cpp PROPERTIES COMPILE_OPTIONS "-O3")
|
||||
endif()
|
||||
add_executable(${OUTPUT_NAME} source/cc3dsfs.cpp source/utils.cpp source/audio_data.cpp source/audio.cpp source/frontend.cpp source/TextRectangle.cpp source/WindowScreen.cpp source/WindowScreen_Menu.cpp source/devicecapture.cpp source/conversions.cpp source/ExtraButtons.cpp source/Menus/ConnectionMenu.cpp source/Menus/OptionSelectionMenu.cpp source/Menus/MainMenu.cpp source/Menus/VideoMenu.cpp source/Menus/CropMenu.cpp source/Menus/PARMenu.cpp source/Menus/RotationMenu.cpp source/Menus/OffsetMenu.cpp source/Menus/AudioMenu.cpp source/Menus/BFIMenu.cpp source/Menus/RelativePositionMenu.cpp source/Menus/ResolutionMenu.cpp source/Menus/FileConfigMenu.cpp source/Menus/ExtraSettingsMenu.cpp source/Menus/StatusMenu.cpp source/Menus/LicenseMenu.cpp source/WindowCommands.cpp source/Menus/ShortcutMenu.cpp source/Menus/ActionSelectionMenu.cpp source/Menus/ScalingRatioMenu.cpp source/Menus/ISNitroMenu.cpp source/Menus/VideoEffectsMenu.cpp source/CaptureDataBuffers.cpp ${TOOLS_DATA_DIR}/font_ttf.cpp ${TOOLS_DATA_DIR}/shaders_list.cpp ${SOURCE_CPP_EXTRA_FILES})
|
||||
add_executable(${OUTPUT_NAME} source/cc3dsfs.cpp source/utils.cpp source/audio_data.cpp source/audio.cpp source/frontend.cpp source/TextRectangle.cpp source/WindowScreen.cpp source/WindowScreen_Menu.cpp source/devicecapture.cpp source/conversions.cpp source/ExtraButtons.cpp source/Menus/ConnectionMenu.cpp source/Menus/OptionSelectionMenu.cpp source/Menus/MainMenu.cpp source/Menus/VideoMenu.cpp source/Menus/CropMenu.cpp source/Menus/PARMenu.cpp source/Menus/RotationMenu.cpp source/Menus/OffsetMenu.cpp source/Menus/AudioMenu.cpp source/Menus/BFIMenu.cpp source/Menus/RelativePositionMenu.cpp source/Menus/ResolutionMenu.cpp source/Menus/FileConfigMenu.cpp source/Menus/ExtraSettingsMenu.cpp source/Menus/StatusMenu.cpp source/Menus/LicenseMenu.cpp source/WindowCommands.cpp source/Menus/ShortcutMenu.cpp source/Menus/ActionSelectionMenu.cpp source/Menus/ScalingRatioMenu.cpp source/Menus/ISNitroMenu.cpp source/Menus/VideoEffectsMenu.cpp source/CaptureDataBuffers.cpp source/Menus/InputMenu.cpp ${TOOLS_DATA_DIR}/font_ttf.cpp ${TOOLS_DATA_DIR}/shaders_list.cpp ${SOURCE_CPP_EXTRA_FILES})
|
||||
|
||||
|
||||
if(NOT ("${EXTRA_DEPENDENCIES}" STREQUAL ""))
|
||||
|
|
|
|||
39
include/Menus/InputMenu.hpp
Normal file
39
include/Menus/InputMenu.hpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef __INPUTMENU_HPP
|
||||
#define __INPUTMENU_HPP
|
||||
|
||||
#include "OptionSelectionMenu.hpp"
|
||||
#include <chrono>
|
||||
|
||||
#include "TextRectangle.hpp"
|
||||
#include "sfml_gfx_structs.hpp"
|
||||
#include "display_structs.hpp"
|
||||
|
||||
enum InputMenuOutAction{
|
||||
INPUT_MENU_NO_ACTION,
|
||||
INPUT_MENU_BACK,
|
||||
INPUT_MENU_SHORTCUT_SETTINGS,
|
||||
INPUT_MENU_TOGGLE_BUTTONS,
|
||||
INPUT_MENU_TOGGLE_JOYSTICK,
|
||||
INPUT_MENU_TOGGLE_KEYBOARD,
|
||||
INPUT_MENU_TOGGLE_MOUSE,
|
||||
INPUT_MENU_TOGGLE_FAST_POLL,
|
||||
};
|
||||
|
||||
class InputMenu : public OptionSelectionMenu {
|
||||
public:
|
||||
InputMenu(bool font_load_success, sf::Font &text_font);
|
||||
~InputMenu();
|
||||
void prepare(float scaling_factor, int view_size_x, int view_size_y, InputData* input_data);
|
||||
void insert_data(bool enabled_shortcuts, bool enabled_extra_buttons);
|
||||
InputMenuOutAction selected_index = InputMenuOutAction::INPUT_MENU_NO_ACTION;
|
||||
void reset_output_option();
|
||||
protected:
|
||||
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
|
||||
|
|
@ -24,8 +24,9 @@ enum MainMenuOutAction{
|
|||
MAIN_MENU_LICENSES,
|
||||
MAIN_MENU_EXTRA_SETTINGS,
|
||||
MAIN_MENU_SHUTDOWN,
|
||||
MAIN_MENU_SHORTCUT_SETTINGS,
|
||||
//MAIN_MENU_SHORTCUT_SETTINGS,
|
||||
MAIN_MENU_ISN_SETTINGS,
|
||||
MAIN_MENU_INPUT_SETTINGS,
|
||||
};
|
||||
|
||||
class MainMenu : public OptionSelectionMenu {
|
||||
|
|
@ -33,7 +34,7 @@ public:
|
|||
MainMenu(bool font_load_success, sf::Font &text_font);
|
||||
~MainMenu();
|
||||
void prepare(float scaling_factor, int view_size_x, int view_size_y, bool connected);
|
||||
void insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_mode, bool enable_shortcuts, CaptureConnectionType cc_type, bool connected);
|
||||
void insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_mode, CaptureConnectionType cc_type, bool connected);
|
||||
MainMenuOutAction selected_index = MainMenuOutAction::MAIN_MENU_NO_ACTION;
|
||||
void reset_output_option();
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ enum VideoMenuOutAction{
|
|||
VIDEO_MENU_TOP_ROTATION_INC,
|
||||
VIDEO_MENU_BOTTOM_ROTATION_DEC,
|
||||
VIDEO_MENU_BOTTOM_ROTATION_INC,
|
||||
VIDEO_MENU_FAST_POLL,
|
||||
//VIDEO_MENU_FAST_POLL,
|
||||
VIDEO_MENU_NON_INT_SCALING,
|
||||
VIDEO_MENU_SCALING_RATIO_SETTINGS,
|
||||
VIDEO_MENU_CHANGE_TITLEBAR,
|
||||
|
|
@ -46,7 +46,7 @@ class VideoMenu : public OptionSelectionMenu {
|
|||
public:
|
||||
VideoMenu(bool font_load_success, sf::Font &text_font);
|
||||
~VideoMenu();
|
||||
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info, bool fast_poll, ScreenType screen_type);
|
||||
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info, ScreenType screen_type);
|
||||
void insert_data(ScreenType s_type, bool is_fullscreen, bool can_have_titlebar);
|
||||
VideoMenuOutAction selected_index = VideoMenuOutAction::VIDEO_MENU_NO_ACTION;
|
||||
void reset_output_option();
|
||||
|
|
|
|||
|
|
@ -4,11 +4,12 @@
|
|||
#include "utils.hpp"
|
||||
#include "hw_defs.hpp"
|
||||
#include "shaders_list.hpp"
|
||||
#include "WindowCommands.hpp"
|
||||
|
||||
enum ScreenType { TOP, BOTTOM, JOINT };
|
||||
enum BottomRelativePosition { UNDER_TOP, LEFT_TOP, ABOVE_TOP, RIGHT_TOP, BOT_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 };
|
||||
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 };
|
||||
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 };
|
||||
|
||||
|
|
@ -51,10 +52,27 @@ struct ScreenInfo {
|
|||
struct DisplayData {
|
||||
bool split;
|
||||
bool mono_app_mode;
|
||||
bool fast_poll;
|
||||
bool last_connected_ds;
|
||||
};
|
||||
|
||||
struct ExtraButtonShortcuts {
|
||||
const WindowCommand *enter_shortcut;
|
||||
const WindowCommand *page_up_shortcut;
|
||||
};
|
||||
|
||||
struct InputData {
|
||||
bool fast_poll;
|
||||
bool enable_controller_input;
|
||||
bool enable_keyboard_input;
|
||||
bool enable_mouse_input;
|
||||
bool enable_buttons_input;
|
||||
ExtraButtonShortcuts extra_button_shortcuts;
|
||||
};
|
||||
|
||||
struct SharedData {
|
||||
InputData input_data;
|
||||
};
|
||||
|
||||
struct ALIGNED(8) VideoOutputData {
|
||||
uint8_t screen_data[MAX_IN_VIDEO_SIZE][3];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,5 +39,6 @@ void init_extra_buttons_poll(int page_up_id, int page_down_id, int enter_id, int
|
|||
void end_extra_buttons_poll();
|
||||
void extra_buttons_poll(std::queue<SFEvent> &events_queue);
|
||||
std::string get_extra_button_name(sf::Keyboard::Key corresponding_key);
|
||||
bool are_extra_buttons_usable();
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
#include "ScalingRatioMenu.hpp"
|
||||
#include "ISNitroMenu.hpp"
|
||||
#include "VideoEffectsMenu.hpp"
|
||||
#include "InputMenu.hpp"
|
||||
#include "display_structs.hpp"
|
||||
#include "WindowCommands.hpp"
|
||||
#include "event_structs.hpp"
|
||||
#include "shaders_list.hpp"
|
||||
|
||||
|
|
@ -47,16 +47,11 @@ struct FPSArray {
|
|||
int index;
|
||||
};
|
||||
|
||||
struct ExtraButtonShortcuts {
|
||||
const WindowCommand *enter_shortcut;
|
||||
const WindowCommand *page_up_shortcut;
|
||||
};
|
||||
|
||||
class WindowScreen {
|
||||
public:
|
||||
ScreenInfo m_info;
|
||||
|
||||
WindowScreen(ScreenType stype, CaptureStatus* capture_status, DisplayData* display_data, AudioData* audio_data, ExtraButtonShortcuts* extra_button_shortcuts, ConsumerMutex *draw_lock, bool created_proper_folder);
|
||||
WindowScreen(ScreenType stype, CaptureStatus* capture_status, DisplayData* display_data, SharedData* shared_data, AudioData* audio_data, ConsumerMutex *draw_lock, bool created_proper_folder);
|
||||
~WindowScreen();
|
||||
|
||||
void build();
|
||||
|
|
@ -115,8 +110,8 @@ private:
|
|||
bool font_load_success;
|
||||
double frame_time;
|
||||
DisplayData* display_data;
|
||||
SharedData* shared_data;
|
||||
AudioData* audio_data;
|
||||
ExtraButtonShortcuts* extra_button_shortcuts;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> last_mouse_action_time;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> last_window_creation_time;
|
||||
HeldTime touch_right_click_action;
|
||||
|
|
@ -155,6 +150,7 @@ private:
|
|||
ISNitroMenu *is_nitro_menu;
|
||||
ScalingRatioMenu *scaling_ratio_menu;
|
||||
VideoEffectsMenu *video_effects_menu;
|
||||
InputMenu *input_menu;
|
||||
std::vector<const CropData*> possible_crops;
|
||||
std::vector<const CropData*> possible_crops_ds;
|
||||
std::vector<const CropData*> possible_crops_with_games;
|
||||
|
|
@ -239,6 +235,7 @@ private:
|
|||
void rotation_change(int &value, bool right);
|
||||
void ratio_change(bool top_priority, bool cycle = false);
|
||||
void bfi_change();
|
||||
void input_toggle_change(bool &target);
|
||||
void bottom_pos_change(int new_bottom_pos);
|
||||
void non_int_scaling_change(bool target_top);
|
||||
void non_int_mode_change(bool positive);
|
||||
|
|
@ -246,7 +243,7 @@ private:
|
|||
void input_colorspace_mode_change(bool positive);
|
||||
void frame_blending_mode_change(bool positive);
|
||||
bool query_reset_request();
|
||||
void reset_held_times();
|
||||
void reset_held_times(bool force = true);
|
||||
void poll_window(bool do_everything);
|
||||
bool common_poll(SFEvent &event_data);
|
||||
bool main_poll(SFEvent &event_data);
|
||||
|
|
@ -309,6 +306,7 @@ private:
|
|||
void setup_scaling_ratio_menu(bool reset_data = true);
|
||||
void setup_is_nitro_menu(bool reset_data = true);
|
||||
void setup_video_effects_menu(bool reset_data = true);
|
||||
void setup_input_menu(bool reset_data = true);
|
||||
void update_connection();
|
||||
};
|
||||
|
||||
|
|
@ -317,6 +315,7 @@ struct FrontendData {
|
|||
WindowScreen *bot_screen;
|
||||
WindowScreen *joint_screen;
|
||||
DisplayData display_data;
|
||||
SharedData shared_data;
|
||||
bool reload;
|
||||
};
|
||||
|
||||
|
|
@ -326,6 +325,8 @@ void FPSArrayInsertElement(FPSArray *array, double frame_time);
|
|||
void insert_basic_crops(std::vector<const CropData*> &crop_vector, ScreenType s_type, bool is_ds, bool allow_game_specific);
|
||||
void insert_basic_pars(std::vector<const PARData*> &par_vector);
|
||||
void reset_display_data(DisplayData *display_data);
|
||||
void reset_input_data(InputData* input_data);
|
||||
void reset_shared_data(SharedData* shared_data);
|
||||
void reset_fullscreen_info(ScreenInfo &info);
|
||||
void reset_screen_info(ScreenInfo &info);
|
||||
bool load_screen_info(std::string key, std::string value, std::string base, ScreenInfo &info);
|
||||
|
|
@ -339,5 +340,6 @@ void screen_display_thread(WindowScreen *screen);
|
|||
std::string get_name_non_int_mode(NonIntegerScalingModes input);
|
||||
std::string get_name_frame_blending_mode(FrameBlendingMode input);
|
||||
std::string get_name_input_colorspace_mode(InputColorspaceMode input);
|
||||
bool is_input_data_valid(InputData* input_data, bool consider_buttons);
|
||||
void default_sleep(float wanted_ms = -1);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -112,6 +112,10 @@ void init_extra_buttons_poll(int page_up_id, int page_down_id, int enter_id, int
|
|||
pi_power.initialize(power_id, sf::Keyboard::Key::Escape, true, 30.0, 30.0, use_pud_up, "Power");
|
||||
}
|
||||
|
||||
bool are_extra_buttons_usable() {
|
||||
return (pi_enter.get_name() != "") && (pi_page_down.get_name() != "");
|
||||
}
|
||||
|
||||
void end_extra_buttons_poll() {
|
||||
for(int i = 0; i < sizeof(pi_buttons) / sizeof(pi_buttons[0]); i++)
|
||||
pi_buttons[i]->end();
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ void BFIMenu::class_setup() {
|
|||
this->min_text_size = 0.3;
|
||||
this->max_width_slack = 1.1;
|
||||
this->menu_color = sf::Color(30, 30, 60, 192);
|
||||
this->title = "Offset Settings";
|
||||
this->title = "BFI Settings";
|
||||
this->show_back_x = true;
|
||||
this->show_x = false;
|
||||
this->show_title = true;
|
||||
|
|
|
|||
141
source/Menus/InputMenu.cpp
Normal file
141
source/Menus/InputMenu.cpp
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
#include "InputMenu.hpp"
|
||||
|
||||
#define NUM_TOTAL_MENU_OPTIONS (sizeof(pollable_options)/sizeof(pollable_options[0]))
|
||||
|
||||
struct InputMenuOptionInfo {
|
||||
const std::string base_name;
|
||||
const std::string false_name;
|
||||
const InputMenuOutAction out_action;
|
||||
};
|
||||
|
||||
static const InputMenuOptionInfo input_menu_toggle_buttons_option = {
|
||||
.base_name = "Disable Buttons", .false_name = "Enable Buttons",
|
||||
.out_action = INPUT_MENU_TOGGLE_BUTTONS};
|
||||
|
||||
static const InputMenuOptionInfo input_menu_toggle_controller_option = {
|
||||
.base_name = "Disable Controllers", .false_name = "Enable Controllers",
|
||||
.out_action = INPUT_MENU_TOGGLE_JOYSTICK};
|
||||
|
||||
static const InputMenuOptionInfo input_menu_toggle_keyboard_option = {
|
||||
.base_name = "Disable Keyboard", .false_name = "Enable Keyboard",
|
||||
.out_action = INPUT_MENU_TOGGLE_KEYBOARD};
|
||||
|
||||
static const InputMenuOptionInfo input_menu_toggle_mouse_option = {
|
||||
.base_name = "Disable Mouse", .false_name = "Enable Mouse",
|
||||
.out_action = INPUT_MENU_TOGGLE_MOUSE};
|
||||
|
||||
static const InputMenuOptionInfo input_menu_toggle_fast_poll_option = {
|
||||
.base_name = "Disable Slow Poll", .false_name = "Enable Slow Poll",
|
||||
.out_action = INPUT_MENU_TOGGLE_FAST_POLL};
|
||||
|
||||
static const InputMenuOptionInfo input_menu_shortcut_option = {
|
||||
.base_name = "Shortcut Settings", .false_name = "",
|
||||
.out_action = INPUT_MENU_SHORTCUT_SETTINGS};
|
||||
|
||||
static const InputMenuOptionInfo* pollable_options[] = {
|
||||
&input_menu_shortcut_option,
|
||||
&input_menu_toggle_fast_poll_option,
|
||||
&input_menu_toggle_controller_option,
|
||||
&input_menu_toggle_keyboard_option,
|
||||
&input_menu_toggle_mouse_option,
|
||||
&input_menu_toggle_buttons_option,
|
||||
};
|
||||
|
||||
InputMenu::InputMenu(bool font_load_success, sf::Font &text_font) : OptionSelectionMenu(){
|
||||
this->options_indexes = new int[NUM_TOTAL_MENU_OPTIONS];
|
||||
this->initialize(font_load_success, text_font);
|
||||
this->num_enabled_options = 0;
|
||||
}
|
||||
|
||||
InputMenu::~InputMenu() {
|
||||
delete []this->options_indexes;
|
||||
}
|
||||
|
||||
void InputMenu::class_setup() {
|
||||
this->num_options_per_screen = 5;
|
||||
this->min_elements_text_scaling_factor = num_options_per_screen + 2;
|
||||
this->width_factor_menu = 16;
|
||||
this->width_divisor_menu = 9;
|
||||
this->base_height_factor_menu = 12;
|
||||
this->base_height_divisor_menu = 6;
|
||||
this->min_text_size = 0.3;
|
||||
this->max_width_slack = 1.1;
|
||||
this->menu_color = sf::Color(30, 30, 60, 192);
|
||||
this->title = "Input Settings";
|
||||
this->show_back_x = true;
|
||||
this->show_x = false;
|
||||
this->show_title = true;
|
||||
}
|
||||
|
||||
void InputMenu::insert_data(bool enabled_shortcuts, bool enabled_extra_buttons) {
|
||||
this->num_enabled_options = 0;
|
||||
for(int i = 0; i < NUM_TOTAL_MENU_OPTIONS; i++) {
|
||||
bool valid = true;
|
||||
InputMenuOutAction out_action = pollable_options[i]->out_action;
|
||||
if((out_action == INPUT_MENU_SHORTCUT_SETTINGS) && (!enabled_shortcuts))
|
||||
valid = false;
|
||||
if((out_action == INPUT_MENU_TOGGLE_BUTTONS) && (!(enabled_shortcuts || enabled_extra_buttons)))
|
||||
valid = false;
|
||||
if(valid) {
|
||||
this->options_indexes[this->num_enabled_options] = i;
|
||||
this->num_enabled_options++;
|
||||
}
|
||||
}
|
||||
this->prepare_options();
|
||||
}
|
||||
|
||||
void InputMenu::reset_output_option() {
|
||||
this->selected_index = InputMenuOutAction::INPUT_MENU_NO_ACTION;
|
||||
}
|
||||
|
||||
void InputMenu::set_output_option(int index, int action) {
|
||||
if(index == BACK_X_OUTPUT_OPTION)
|
||||
this->selected_index = INPUT_MENU_BACK;
|
||||
else
|
||||
this->selected_index = pollable_options[this->options_indexes[index]]->out_action;
|
||||
}
|
||||
|
||||
int InputMenu::get_num_options() {
|
||||
return this->num_enabled_options;
|
||||
}
|
||||
|
||||
std::string InputMenu::get_string_option(int index, int action) {
|
||||
if(action == FALSE_ACTION)
|
||||
return pollable_options[this->options_indexes[index]]->false_name;
|
||||
return pollable_options[this->options_indexes[index]]->base_name;
|
||||
}
|
||||
|
||||
void InputMenu::prepare(float menu_scaling_factor, int view_size_x, int view_size_y, InputData* input_data) {
|
||||
int num_pages = this->get_num_pages();
|
||||
if(this->future_data.page >= num_pages)
|
||||
this->future_data.page = num_pages - 1;
|
||||
int start = this->future_data.page * this->num_options_per_screen;
|
||||
for(int i = 0; i < this->num_options_per_screen + 1; i++) {
|
||||
int index = (i * this->single_option_multiplier) + this->elements_start_id;
|
||||
if(!this->future_enabled_labels[index])
|
||||
continue;
|
||||
int real_index = start + i;
|
||||
int option_index = this->options_indexes[real_index];
|
||||
switch(pollable_options[option_index]->out_action) {
|
||||
case INPUT_MENU_TOGGLE_BUTTONS:
|
||||
this->labels[index]->setText(this->setTextOptionBool(real_index, input_data->enable_buttons_input));
|
||||
break;
|
||||
case INPUT_MENU_TOGGLE_JOYSTICK:
|
||||
this->labels[index]->setText(this->setTextOptionBool(real_index, input_data->enable_controller_input));
|
||||
break;
|
||||
case INPUT_MENU_TOGGLE_KEYBOARD:
|
||||
this->labels[index]->setText(this->setTextOptionBool(real_index, input_data->enable_keyboard_input));
|
||||
break;
|
||||
case INPUT_MENU_TOGGLE_MOUSE:
|
||||
this->labels[index]->setText(this->setTextOptionBool(real_index, input_data->enable_mouse_input));
|
||||
break;
|
||||
case INPUT_MENU_TOGGLE_FAST_POLL:
|
||||
this->labels[index]->setText(this->setTextOptionBool(real_index, input_data->fast_poll));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this->base_prepare(menu_scaling_factor, view_size_x, view_size_y);
|
||||
}
|
||||
|
|
@ -72,6 +72,13 @@ static const MainMenuOptionInfo audio_settings_option = {
|
|||
.enabled_normal_mode = true, .enabled_mono_mode = true, .is_cc_specific = false,
|
||||
.out_action = MAIN_MENU_AUDIO_SETTINGS};
|
||||
|
||||
static const MainMenuOptionInfo input_settings_option = {
|
||||
.base_name = "Input Settings", .false_name = "",
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.enabled_normal_mode = true, .enabled_mono_mode = true, .is_cc_specific = false,
|
||||
.out_action = MAIN_MENU_INPUT_SETTINGS};
|
||||
|
||||
static const MainMenuOptionInfo save_profiles_option = {
|
||||
.base_name = "Save Profile", .false_name = "",
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
|
|
@ -107,12 +114,14 @@ static const MainMenuOptionInfo extra_settings_option = {
|
|||
.enabled_normal_mode = false, .enabled_mono_mode = true, .is_cc_specific = false,
|
||||
.out_action = MAIN_MENU_EXTRA_SETTINGS};
|
||||
|
||||
/*
|
||||
static const MainMenuOptionInfo shortcut_option = {
|
||||
.base_name = "Shortcuts", .false_name = "",
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.enabled_normal_mode = true, .enabled_mono_mode = true, .is_cc_specific = false,
|
||||
.out_action = MAIN_MENU_SHORTCUT_SETTINGS};
|
||||
*/
|
||||
|
||||
static const MainMenuOptionInfo shutdown_option = {
|
||||
.base_name = "Shutdown", .false_name = "",
|
||||
|
|
@ -136,9 +145,10 @@ static const MainMenuOptionInfo* pollable_options[] = {
|
|||
&split_screens_option,
|
||||
&video_settings_option,
|
||||
&audio_settings_option,
|
||||
&input_settings_option,
|
||||
&save_profiles_option,
|
||||
&load_profiles_option,
|
||||
&shortcut_option,
|
||||
//&shortcut_option,
|
||||
&status_option,
|
||||
&isn_settings_option,
|
||||
&licenses_option,
|
||||
|
|
@ -179,7 +189,7 @@ static bool check_cc_specific_option(const MainMenuOptionInfo* option, CaptureCo
|
|||
return false;
|
||||
}
|
||||
|
||||
void MainMenu::insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_mode, bool enable_shortcut, CaptureConnectionType cc_type, bool connected) {
|
||||
void MainMenu::insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_mode, CaptureConnectionType cc_type, bool connected) {
|
||||
this->num_enabled_options = 0;
|
||||
for(int i = 0; i < NUM_TOTAL_MENU_OPTIONS; i++) {
|
||||
bool valid = true;
|
||||
|
|
@ -199,8 +209,8 @@ void MainMenu::insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_
|
|||
valid = valid && pollable_options[i]->enabled_normal_mode;
|
||||
if(pollable_options[i]->is_cc_specific)
|
||||
valid = valid && connected && check_cc_specific_option(pollable_options[i], cc_type);
|
||||
if((pollable_options[i]->out_action == MAIN_MENU_SHORTCUT_SETTINGS) && (!enable_shortcut))
|
||||
valid = false;
|
||||
//if((pollable_options[i]->out_action == MAIN_MENU_SHORTCUT_SETTINGS) && (!enable_shortcut))
|
||||
// valid = false;
|
||||
if(valid) {
|
||||
this->options_indexes[this->num_enabled_options] = i;
|
||||
this->num_enabled_options++;
|
||||
|
|
|
|||
|
|
@ -144,12 +144,14 @@ static const VideoMenuOptionInfo bottom_one_rotation_option = {
|
|||
.is_inc = true, .dec_str = "Left", .inc_str = "Right", .inc_out_action = VIDEO_MENU_BOTTOM_ROTATION_INC,
|
||||
.out_action = VIDEO_MENU_BOTTOM_ROTATION_DEC};
|
||||
|
||||
/*
|
||||
static const VideoMenuOptionInfo fast_poll_option = {
|
||||
.base_name = "Disable Slow Poll", .false_name = "Enable Slow Poll",
|
||||
.active_fullscreen = true, .active_windowed_screen = true, .requires_titlebar_possible = false,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.is_inc = false, .dec_str = "", .inc_str = "", .inc_out_action = VIDEO_MENU_NO_ACTION,
|
||||
.out_action = VIDEO_MENU_FAST_POLL};
|
||||
*/
|
||||
|
||||
static const VideoMenuOptionInfo allow_game_crops_option = {
|
||||
.base_name = "Disable Game Crops", .false_name = "Enable Game Crops",
|
||||
|
|
@ -196,7 +198,7 @@ static const VideoMenuOptionInfo* pollable_options[] = {
|
|||
&vsync_option,
|
||||
&async_option,
|
||||
&blur_option,
|
||||
&fast_poll_option,
|
||||
//&fast_poll_option,
|
||||
&small_screen_offset_option,
|
||||
&offset_settings_option,
|
||||
&rotation_settings_option,
|
||||
|
|
@ -294,7 +296,7 @@ bool VideoMenu::is_option_inc_dec(int index) {
|
|||
return pollable_options[this->options_indexes[index]]->is_inc;
|
||||
}
|
||||
|
||||
void VideoMenu::prepare(float menu_scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info, bool fast_poll, ScreenType screen_type) {
|
||||
void VideoMenu::prepare(float menu_scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info, ScreenType screen_type) {
|
||||
int num_pages = this->get_num_pages();
|
||||
if(this->future_data.page >= num_pages)
|
||||
this->future_data.page = num_pages - 1;
|
||||
|
|
@ -333,9 +335,9 @@ void VideoMenu::prepare(float menu_scaling_factor, int view_size_x, int view_siz
|
|||
case VIDEO_MENU_BOTTOM_ROTATION_DEC:
|
||||
this->labels[index]->setText(this->setTextOptionInt(real_index, info->bot_rotation));
|
||||
break;
|
||||
case VIDEO_MENU_FAST_POLL:
|
||||
this->labels[index]->setText(this->setTextOptionBool(real_index, fast_poll));
|
||||
break;
|
||||
//case VIDEO_MENU_FAST_POLL:
|
||||
// this->labels[index]->setText(this->setTextOptionBool(real_index, fast_poll));
|
||||
// break;
|
||||
case VIDEO_MENU_GAMES_CROPPING:
|
||||
this->labels[index]->setText(this->setTextOptionBool(real_index, info->allow_games_crops));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ struct shader_and_data {
|
|||
|
||||
static std::vector<shader_and_data> usable_shaders;
|
||||
|
||||
WindowScreen::WindowScreen(ScreenType stype, CaptureStatus* capture_status, DisplayData* display_data, AudioData* audio_data, ExtraButtonShortcuts* extra_button_shortcuts, ConsumerMutex *draw_lock, bool created_proper_folder) {
|
||||
WindowScreen::WindowScreen(ScreenType stype, CaptureStatus* capture_status, DisplayData* display_data, SharedData* shared_data, AudioData* audio_data, ConsumerMutex *draw_lock, bool created_proper_folder) {
|
||||
this->draw_lock = draw_lock;
|
||||
this->m_stype = stype;
|
||||
insert_basic_crops(this->possible_crops, this->m_stype, false, false);
|
||||
|
|
@ -55,8 +55,8 @@ WindowScreen::WindowScreen(ScreenType stype, CaptureStatus* capture_status, Disp
|
|||
this->m_in_rect_top.setTexture(&this->in_tex);
|
||||
this->m_in_rect_bot.setTexture(&this->in_tex);
|
||||
this->display_data = display_data;
|
||||
this->shared_data = shared_data;
|
||||
this->audio_data = audio_data;
|
||||
this->extra_button_shortcuts = extra_button_shortcuts;
|
||||
this->last_window_creation_time = std::chrono::high_resolution_clock::now();
|
||||
this->last_mouse_action_time = std::chrono::high_resolution_clock::now();
|
||||
this->last_draw_time = std::chrono::high_resolution_clock::now();
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ static float check_held_diff(std::chrono::time_point<std::chrono::high_resolutio
|
|||
}
|
||||
|
||||
static bool is_shortcut_valid() {
|
||||
return (get_extra_button_name(sf::Keyboard::Key::Enter) != "") || (get_extra_button_name(sf::Keyboard::Key::PageUp) != "");
|
||||
return ((get_extra_button_name(sf::Keyboard::Key::Enter) != "") || (get_extra_button_name(sf::Keyboard::Key::PageUp) != ""));
|
||||
}
|
||||
|
||||
void FPSArrayInit(FPSArray *array) {
|
||||
|
|
@ -111,6 +111,7 @@ void WindowScreen::init_menus() {
|
|||
this->scaling_ratio_menu = new ScalingRatioMenu(this->font_load_success, this->text_font);
|
||||
this->is_nitro_menu = new ISNitroMenu(this->font_load_success, this->text_font);
|
||||
this->video_effects_menu = new VideoEffectsMenu(this->font_load_success, this->text_font);
|
||||
this->input_menu = new InputMenu(this->font_load_success, this->text_font);
|
||||
}
|
||||
|
||||
void WindowScreen::destroy_menus() {
|
||||
|
|
@ -134,6 +135,7 @@ void WindowScreen::destroy_menus() {
|
|||
delete this->scaling_ratio_menu;
|
||||
delete this->is_nitro_menu;
|
||||
delete this->video_effects_menu;
|
||||
delete this->input_menu;
|
||||
}
|
||||
|
||||
void WindowScreen::set_close(int ret_val) {
|
||||
|
|
@ -174,8 +176,8 @@ void WindowScreen::blur_change() {
|
|||
}
|
||||
|
||||
void WindowScreen::fast_poll_change() {
|
||||
this->display_data->fast_poll = !this->display_data->fast_poll;
|
||||
this->print_notification_on_off("Slow Poll", this->display_data->fast_poll);
|
||||
this->shared_data->input_data.fast_poll = !this->shared_data->input_data.fast_poll;
|
||||
this->print_notification_on_off("Slow Poll", this->shared_data->input_data.fast_poll);
|
||||
}
|
||||
|
||||
void WindowScreen::is_nitro_capture_type_change(bool positive) {
|
||||
|
|
@ -336,6 +338,14 @@ void WindowScreen::bfi_change() {
|
|||
this->print_notification_on_off("BFI", this->m_info.bfi);
|
||||
}
|
||||
|
||||
void WindowScreen::input_toggle_change(bool &target) {
|
||||
target = !target;
|
||||
if(!is_input_data_valid(&this->shared_data->input_data, are_extra_buttons_usable()))
|
||||
target = !target;
|
||||
if(!is_input_data_valid(&this->shared_data->input_data, are_extra_buttons_usable()))
|
||||
this->shared_data->input_data.enable_keyboard_input = true;
|
||||
}
|
||||
|
||||
void WindowScreen::bottom_pos_change(int new_bottom_pos) {
|
||||
BottomRelativePosition cast_new_bottom_pos = static_cast<BottomRelativePosition>(new_bottom_pos % BottomRelativePosition::BOT_REL_POS_END);
|
||||
if(cast_new_bottom_pos != this->m_info.bottom_pos) {
|
||||
|
|
@ -664,7 +674,19 @@ void WindowScreen::setup_main_menu(bool reset_data, bool skip_setup_check) {
|
|||
this->curr_menu = MAIN_MENU_TYPE;
|
||||
if(reset_data)
|
||||
this->main_menu->reset_data();
|
||||
this->main_menu->insert_data(this->m_stype, this->m_info.is_fullscreen, this->display_data->mono_app_mode, is_shortcut_valid(), this->capture_status->device.cc_type, this->capture_status->connected);
|
||||
this->main_menu->insert_data(this->m_stype, this->m_info.is_fullscreen, this->display_data->mono_app_mode, this->capture_status->device.cc_type, this->capture_status->connected);
|
||||
this->last_menu_change_time = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
}
|
||||
|
||||
void WindowScreen::setup_input_menu(bool reset_data) {
|
||||
if(!this->can_setup_menu())
|
||||
return;
|
||||
if(this->curr_menu != INPUT_MENU_TYPE) {
|
||||
this->curr_menu = INPUT_MENU_TYPE;
|
||||
if(reset_data)
|
||||
this->input_menu->reset_data();
|
||||
this->input_menu->insert_data(is_shortcut_valid(), are_extra_buttons_usable());
|
||||
this->last_menu_change_time = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
}
|
||||
|
|
@ -880,13 +902,13 @@ void WindowScreen::setup_shortcuts_menu(bool reset_data) {
|
|||
this->possible_buttons_ptrs.clear();
|
||||
this->possible_buttons_extras.clear();
|
||||
if(get_extra_button_name(sf::Keyboard::Key::Enter) != "") {
|
||||
this->possible_buttons_ptrs.push_back(&extra_button_shortcuts->enter_shortcut);
|
||||
this->possible_buttons_names.push_back(get_extra_button_name(sf::Keyboard::Key::Enter) + " Button: " + extra_button_shortcuts->enter_shortcut->name);
|
||||
this->possible_buttons_ptrs.push_back(&this->shared_data->input_data.extra_button_shortcuts.enter_shortcut);
|
||||
this->possible_buttons_names.push_back(get_extra_button_name(sf::Keyboard::Key::Enter) + " Button: " + this->shared_data->input_data.extra_button_shortcuts.enter_shortcut->name);
|
||||
this->possible_buttons_extras.push_back(true);
|
||||
}
|
||||
if(get_extra_button_name(sf::Keyboard::Key::PageUp) != "") {
|
||||
this->possible_buttons_ptrs.push_back(&extra_button_shortcuts->page_up_shortcut);
|
||||
this->possible_buttons_names.push_back(get_extra_button_name(sf::Keyboard::Key::PageUp) + " Button: " + extra_button_shortcuts->page_up_shortcut->name);
|
||||
this->possible_buttons_ptrs.push_back(&this->shared_data->input_data.extra_button_shortcuts.page_up_shortcut);
|
||||
this->possible_buttons_names.push_back(get_extra_button_name(sf::Keyboard::Key::PageUp) + " Button: " + this->shared_data->input_data.extra_button_shortcuts.page_up_shortcut->name);
|
||||
this->possible_buttons_extras.push_back(true);
|
||||
}
|
||||
this->shortcut_menu->insert_data(this->possible_buttons_names);
|
||||
|
|
@ -987,9 +1009,9 @@ bool WindowScreen::no_menu_poll(SFEvent &event_data) {
|
|||
switch(event_data.code) {
|
||||
case sf::Keyboard::Key::Enter:
|
||||
if(event_data.is_extra) {
|
||||
consumed = this->can_execute_cmd(extra_button_shortcuts->enter_shortcut, true, false);
|
||||
consumed = this->can_execute_cmd(this->shared_data->input_data.extra_button_shortcuts.enter_shortcut, true, false);
|
||||
if(consumed)
|
||||
this->execute_cmd(extra_button_shortcuts->enter_shortcut->cmd);
|
||||
this->execute_cmd(this->shared_data->input_data.extra_button_shortcuts.enter_shortcut->cmd);
|
||||
}
|
||||
else
|
||||
this->setup_main_menu();
|
||||
|
|
@ -1002,9 +1024,9 @@ bool WindowScreen::no_menu_poll(SFEvent &event_data) {
|
|||
break;
|
||||
case sf::Keyboard::Key::PageUp:
|
||||
if(event_data.is_extra){
|
||||
consumed = this->can_execute_cmd(extra_button_shortcuts->page_up_shortcut, true, false);
|
||||
consumed = this->can_execute_cmd(this->shared_data->input_data.extra_button_shortcuts.page_up_shortcut, true, false);
|
||||
if(consumed)
|
||||
this->execute_cmd(extra_button_shortcuts->page_up_shortcut->cmd);
|
||||
this->execute_cmd(this->shared_data->input_data.extra_button_shortcuts.page_up_shortcut->cmd);
|
||||
}
|
||||
else
|
||||
consumed = false;
|
||||
|
|
@ -1296,8 +1318,8 @@ void WindowScreen::poll(bool do_everything) {
|
|||
this->setup_extra_menu();
|
||||
done = true;
|
||||
break;
|
||||
case MAIN_MENU_SHORTCUT_SETTINGS:
|
||||
this->setup_shortcuts_menu();
|
||||
case MAIN_MENU_INPUT_SETTINGS:
|
||||
this->setup_input_menu();
|
||||
done = true;
|
||||
break;
|
||||
case MAIN_MENU_ISN_SETTINGS:
|
||||
|
|
@ -1412,9 +1434,9 @@ void WindowScreen::poll(bool do_everything) {
|
|||
case VIDEO_MENU_BLUR:
|
||||
this->blur_change();
|
||||
break;
|
||||
case VIDEO_MENU_FAST_POLL:
|
||||
this->fast_poll_change();
|
||||
break;
|
||||
//case VIDEO_MENU_FAST_POLL:
|
||||
// this->fast_poll_change();
|
||||
// break;
|
||||
case VIDEO_MENU_PADDING:
|
||||
this->padding_change();
|
||||
break;
|
||||
|
|
@ -1746,7 +1768,7 @@ void WindowScreen::poll(bool do_everything) {
|
|||
if(this->shortcut_menu->poll(event_data)) {
|
||||
switch(this->shortcut_menu->selected_index) {
|
||||
case SHORTCUT_MENU_BACK:
|
||||
this->setup_main_menu(false);
|
||||
this->setup_input_menu(false);
|
||||
done = true;
|
||||
break;
|
||||
case SHORTCUT_MENU_NO_ACTION:
|
||||
|
|
@ -1905,6 +1927,41 @@ void WindowScreen::poll(bool do_everything) {
|
|||
continue;
|
||||
}
|
||||
break;
|
||||
case INPUT_MENU_TYPE:
|
||||
if(this->input_menu->poll(event_data)) {
|
||||
switch(this->input_menu->selected_index) {
|
||||
case INPUT_MENU_BACK:
|
||||
this->setup_main_menu(false);
|
||||
done = true;
|
||||
break;
|
||||
case INPUT_MENU_NO_ACTION:
|
||||
break;
|
||||
case INPUT_MENU_SHORTCUT_SETTINGS:
|
||||
this->setup_shortcuts_menu();
|
||||
done = true;
|
||||
break;
|
||||
case INPUT_MENU_TOGGLE_BUTTONS:
|
||||
this->input_toggle_change(this->shared_data->input_data.enable_buttons_input);
|
||||
break;
|
||||
case INPUT_MENU_TOGGLE_JOYSTICK:
|
||||
this->input_toggle_change(this->shared_data->input_data.enable_controller_input);
|
||||
break;
|
||||
case INPUT_MENU_TOGGLE_KEYBOARD:
|
||||
this->input_toggle_change(this->shared_data->input_data.enable_keyboard_input);
|
||||
break;
|
||||
case INPUT_MENU_TOGGLE_MOUSE:
|
||||
this->input_toggle_change(this->shared_data->input_data.enable_mouse_input);
|
||||
break;
|
||||
case INPUT_MENU_TOGGLE_FAST_POLL:
|
||||
this->fast_poll_change();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this->input_menu->reset_output_option();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1972,6 +2029,7 @@ int WindowScreen::get_ret_val() {
|
|||
}
|
||||
|
||||
bool WindowScreen::query_reset_request() {
|
||||
this->reset_held_times(false);
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> curr_time = std::chrono::high_resolution_clock::now();
|
||||
if(check_held_diff(curr_time, this->right_click_action) > this->bad_resolution_timeout)
|
||||
return true;
|
||||
|
|
@ -1990,14 +2048,21 @@ bool WindowScreen::query_reset_request() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void WindowScreen::reset_held_times() {
|
||||
check_held_reset(false, this->right_click_action);
|
||||
check_held_reset(false, this->enter_action);
|
||||
check_held_reset(false, this->pgdown_action);
|
||||
check_held_reset(false, this->extra_enter_action);
|
||||
check_held_reset(false, this->extra_pgdown_action);
|
||||
check_held_reset(false, this->controller_button_action);
|
||||
check_held_reset(false, this->touch_action);
|
||||
void WindowScreen::reset_held_times(bool force) {
|
||||
if(force || (!this->shared_data->input_data.enable_mouse_input))
|
||||
check_held_reset(false, this->right_click_action);
|
||||
if(force || (!this->shared_data->input_data.enable_keyboard_input))
|
||||
check_held_reset(false, this->enter_action);
|
||||
if(force || (!this->shared_data->input_data.enable_keyboard_input))
|
||||
check_held_reset(false, this->pgdown_action);
|
||||
if(force || (!this->shared_data->input_data.enable_buttons_input))
|
||||
check_held_reset(false, this->extra_enter_action);
|
||||
if(force || (!this->shared_data->input_data.enable_buttons_input))
|
||||
check_held_reset(false, this->extra_pgdown_action);
|
||||
if(force || (!this->shared_data->input_data.enable_controller_input))
|
||||
check_held_reset(false, this->controller_button_action);
|
||||
if(force)
|
||||
check_held_reset(false, this->touch_action);
|
||||
}
|
||||
|
||||
void WindowScreen::poll_window(bool do_everything) {
|
||||
|
|
@ -2010,24 +2075,42 @@ void WindowScreen::poll_window(bool do_everything) {
|
|||
while(const std::optional event = this->m_win.pollEvent()) {
|
||||
if(event->is<sf::Event::Closed>())
|
||||
events_queue.emplace(EVENT_CLOSED);
|
||||
else if(const auto* keyPressed = event->getIf<sf::Event::KeyPressed>())
|
||||
events_queue.emplace(true, keyPressed->code);
|
||||
else if(const auto* keyReleased = event->getIf<sf::Event::KeyReleased>())
|
||||
events_queue.emplace(false, keyReleased->code);
|
||||
else if(const auto* textEntered = event->getIf<sf::Event::TextEntered>())
|
||||
events_queue.emplace(textEntered->unicode);
|
||||
else if(const auto* joystick_press = event->getIf<sf::Event::JoystickButtonPressed>())
|
||||
events_queue.emplace(true, joystick_press->joystickId, joystick_press->button);
|
||||
else if(const auto* joystick_release = event->getIf<sf::Event::JoystickButtonReleased>())
|
||||
events_queue.emplace(false, joystick_release->joystickId, joystick_release->button);
|
||||
else if(const auto* joystick_movement = event->getIf<sf::Event::JoystickMoved>())
|
||||
events_queue.emplace(joystick_movement->joystickId, joystick_movement->axis, joystick_movement->position);
|
||||
else if(const auto* mouse_pressed = event->getIf<sf::Event::MouseButtonPressed>())
|
||||
events_queue.emplace(true, mouse_pressed->button, mouse_pressed->position);
|
||||
else if(const auto* mouse_released = event->getIf<sf::Event::MouseButtonReleased>())
|
||||
events_queue.emplace(false, mouse_released->button, mouse_released->position);
|
||||
else if(const auto* mouse_movement = event->getIf<sf::Event::MouseMoved>())
|
||||
events_queue.emplace(mouse_movement->position);
|
||||
else if(const auto* keyPressed = event->getIf<sf::Event::KeyPressed>()) {
|
||||
if(this->shared_data->input_data.enable_keyboard_input)
|
||||
events_queue.emplace(true, keyPressed->code);
|
||||
}
|
||||
else if(const auto* keyReleased = event->getIf<sf::Event::KeyReleased>()) {
|
||||
if(this->shared_data->input_data.enable_keyboard_input)
|
||||
events_queue.emplace(false, keyReleased->code);
|
||||
}
|
||||
else if(const auto* textEntered = event->getIf<sf::Event::TextEntered>()) {
|
||||
if(this->shared_data->input_data.enable_keyboard_input)
|
||||
events_queue.emplace(textEntered->unicode);
|
||||
}
|
||||
else if(const auto* joystick_press = event->getIf<sf::Event::JoystickButtonPressed>()) {
|
||||
if(this->shared_data->input_data.enable_controller_input)
|
||||
events_queue.emplace(true, joystick_press->joystickId, joystick_press->button);
|
||||
}
|
||||
else if(const auto* joystick_release = event->getIf<sf::Event::JoystickButtonReleased>()) {
|
||||
if(this->shared_data->input_data.enable_controller_input)
|
||||
events_queue.emplace(false, joystick_release->joystickId, joystick_release->button);
|
||||
}
|
||||
else if(const auto* joystick_movement = event->getIf<sf::Event::JoystickMoved>()) {
|
||||
if(this->shared_data->input_data.enable_controller_input)
|
||||
events_queue.emplace(joystick_movement->joystickId, joystick_movement->axis, joystick_movement->position);
|
||||
}
|
||||
else if(const auto* mouse_pressed = event->getIf<sf::Event::MouseButtonPressed>()) {
|
||||
if(this->shared_data->input_data.enable_mouse_input)
|
||||
events_queue.emplace(true, mouse_pressed->button, mouse_pressed->position);
|
||||
}
|
||||
else if(const auto* mouse_released = event->getIf<sf::Event::MouseButtonReleased>()) {
|
||||
if(this->shared_data->input_data.enable_mouse_input)
|
||||
events_queue.emplace(false, mouse_released->button, mouse_released->position);
|
||||
}
|
||||
else if(const auto* mouse_movement = event->getIf<sf::Event::MouseMoved>()) {
|
||||
if(this->shared_data->input_data.enable_mouse_input)
|
||||
events_queue.emplace(mouse_movement->position);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this->m_win.hasFocus()) {
|
||||
|
|
@ -2058,9 +2141,11 @@ void WindowScreen::poll_window(bool do_everything) {
|
|||
}
|
||||
events_queue.emplace(true, sf::Mouse::Button::Left, touch_pos);
|
||||
}
|
||||
joystick_axis_poll(this->events_queue);
|
||||
if(this->shared_data->input_data.enable_controller_input)
|
||||
joystick_axis_poll(this->events_queue);
|
||||
}
|
||||
extra_buttons_poll(this->events_queue);
|
||||
if(this->shared_data->input_data.enable_buttons_input)
|
||||
extra_buttons_poll(this->events_queue);
|
||||
}
|
||||
else {
|
||||
this->reset_held_times();
|
||||
|
|
@ -2082,7 +2167,7 @@ void WindowScreen::prepare_menu_draws(int view_size_x, int view_size_y) {
|
|||
this->main_menu->prepare(this->loaded_info.menu_scaling_factor, view_size_x, view_size_y, this->capture_status->connected);
|
||||
break;
|
||||
case VIDEO_MENU_TYPE:
|
||||
this->video_menu->prepare(this->loaded_info.menu_scaling_factor, view_size_x, view_size_y, &this->loaded_info, this->display_data->fast_poll, this->m_stype);
|
||||
this->video_menu->prepare(this->loaded_info.menu_scaling_factor, view_size_x, view_size_y, &this->loaded_info, this->m_stype);
|
||||
break;
|
||||
case CROP_MENU_TYPE:
|
||||
this->crop_menu->prepare(this->loaded_info.menu_scaling_factor, view_size_x, view_size_y, *this->get_crop_index_ptr(&this->loaded_info));
|
||||
|
|
@ -2141,6 +2226,9 @@ void WindowScreen::prepare_menu_draws(int view_size_x, int view_size_y) {
|
|||
case VIDEO_EFFECTS_MENU_TYPE:
|
||||
this->video_effects_menu->prepare(this->loaded_info.menu_scaling_factor, view_size_x, view_size_y, &this->loaded_info);
|
||||
break;
|
||||
case INPUT_MENU_TYPE:
|
||||
this->input_menu->prepare(this->loaded_info.menu_scaling_factor, view_size_x, view_size_y, &this->shared_data->input_data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -2214,6 +2302,9 @@ void WindowScreen::execute_menu_draws() {
|
|||
case VIDEO_EFFECTS_MENU_TYPE:
|
||||
this->video_effects_menu->draw(this->loaded_info.menu_scaling_factor, this->m_win);
|
||||
break;
|
||||
case INPUT_MENU_TYPE:
|
||||
this->input_menu->draw(this->loaded_info.menu_scaling_factor, this->m_win);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,77 @@ static void SuccessConnectionOutTextGenerator(OutTextData &out_text_data, Captur
|
|||
}
|
||||
}
|
||||
|
||||
static bool load(const std::string path, const std::string name, ScreenInfo &top_info, ScreenInfo &bottom_info, ScreenInfo &joint_info, DisplayData &display_data, AudioData *audio_data, OutTextData &out_text_data, ExtraButtonShortcuts* extra_button_shortcuts, CaptureStatus* capture_status) {
|
||||
static bool load_shared(const std::string path, const std::string name, SharedData* shared_data, OutTextData &out_text_data, bool do_print) {
|
||||
std::ifstream file(path + name);
|
||||
std::string line;
|
||||
|
||||
if((!file) || (!file.is_open()) || (!file.good())) {
|
||||
if(do_print)
|
||||
UpdateOutText(out_text_data, "File " + path + name + " load failed.\nDefaults re-loaded.", "Load failed\nDefaults re-loaded", TEXT_KIND_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool result = true;
|
||||
|
||||
try {
|
||||
while(std::getline(file, line)) {
|
||||
std::istringstream kvp(line);
|
||||
std::string key;
|
||||
|
||||
if(std::getline(kvp, key, '=')) {
|
||||
std::string value;
|
||||
|
||||
if(std::getline(kvp, value)) {
|
||||
|
||||
if(key == "extra_button_enter_short") {
|
||||
shared_data->input_data.extra_button_shortcuts.enter_shortcut = get_window_command(static_cast<PossibleWindowCommands>(std::stoi(value)));
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "extra_button_page_up_short") {
|
||||
shared_data->input_data.extra_button_shortcuts.page_up_shortcut = get_window_command(static_cast<PossibleWindowCommands>(std::stoi(value)));
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "fast_poll") {
|
||||
shared_data->input_data.fast_poll = std::stoi(value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "enable_keyboard_input") {
|
||||
shared_data->input_data.enable_keyboard_input = std::stoi(value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "enable_controller_input") {
|
||||
shared_data->input_data.enable_controller_input = std::stoi(value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "enable_mouse_input") {
|
||||
shared_data->input_data.enable_mouse_input = std::stoi(value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "enable_buttons_input") {
|
||||
shared_data->input_data.enable_buttons_input = std::stoi(value);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(...) {
|
||||
if(do_print)
|
||||
UpdateOutText(out_text_data, "File " + path + name + " load failed.\nDefaults re-loaded.", "Load failed\nDefaults re-loaded", TEXT_KIND_ERROR);
|
||||
result = false;
|
||||
}
|
||||
|
||||
file.close();
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool load(const std::string path, const std::string name, ScreenInfo &top_info, ScreenInfo &bottom_info, ScreenInfo &joint_info, DisplayData &display_data, AudioData *audio_data, OutTextData &out_text_data, CaptureStatus* capture_status) {
|
||||
std::ifstream file(path + name);
|
||||
std::string line;
|
||||
|
||||
|
|
@ -90,26 +160,11 @@ static bool load(const std::string path, const std::string name, ScreenInfo &top
|
|||
continue;
|
||||
}
|
||||
|
||||
if(key == "fast_poll") {
|
||||
display_data.fast_poll = std::stoi(value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "last_connected_ds") {
|
||||
display_data.last_connected_ds = std::stoi(value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "extra_button_enter_short") {
|
||||
extra_button_shortcuts->enter_shortcut = get_window_command(static_cast<PossibleWindowCommands>(std::stoi(value)));
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "extra_button_page_up_short") {
|
||||
extra_button_shortcuts->page_up_shortcut = get_window_command(static_cast<PossibleWindowCommands>(std::stoi(value)));
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "is_screen_capture_type") {
|
||||
capture_status->capture_type = static_cast<CaptureScreensType>(std::stoi(value) % CaptureScreensType::CAPTURE_SCREENS_ENUM_END);
|
||||
continue;
|
||||
|
|
@ -135,7 +190,7 @@ static bool load(const std::string path, const std::string name, ScreenInfo &top
|
|||
return result;
|
||||
}
|
||||
|
||||
static void defaults_reload(FrontendData *frontend_data, AudioData* audio_data, ExtraButtonShortcuts* extra_button_shortcuts, CaptureStatus* capture_status) {
|
||||
static void defaults_reload(FrontendData *frontend_data, AudioData* audio_data, CaptureStatus* capture_status) {
|
||||
capture_status->enabled_3d = false;
|
||||
capture_status->capture_type = CAPTURE_SCREENS_BOTH;
|
||||
capture_status->capture_speed = CAPTURE_SPEEDS_FULL;
|
||||
|
|
@ -143,21 +198,20 @@ static void defaults_reload(FrontendData *frontend_data, AudioData* audio_data,
|
|||
reset_screen_info(frontend_data->bot_screen->m_info);
|
||||
reset_screen_info(frontend_data->joint_screen->m_info);
|
||||
audio_data->reset();
|
||||
extra_button_shortcuts->enter_shortcut = get_window_command(WINDOW_COMMAND_RATIO_CYCLE);
|
||||
extra_button_shortcuts->page_up_shortcut = get_window_command(WINDOW_COMMAND_CROP);
|
||||
reset_display_data(&frontend_data->display_data);
|
||||
if(frontend_data->display_data.mono_app_mode)
|
||||
frontend_data->joint_screen->m_info.is_fullscreen = true;
|
||||
frontend_data->reload = true;
|
||||
}
|
||||
|
||||
static void load_layout_file(int load_index, FrontendData *frontend_data, AudioData* audio_data, OutTextData &out_text_data, ExtraButtonShortcuts* extra_button_shortcuts, CaptureStatus* capture_status, bool skip_io, bool do_print, bool created_proper_folder) {
|
||||
static void load_layout_file(int load_index, FrontendData *frontend_data, AudioData* audio_data, OutTextData &out_text_data, CaptureStatus* capture_status, bool skip_io, bool do_print, bool created_proper_folder, bool is_first_load) {
|
||||
if(skip_io)
|
||||
return;
|
||||
|
||||
defaults_reload(frontend_data, audio_data, extra_button_shortcuts, capture_status);
|
||||
defaults_reload(frontend_data, audio_data, capture_status);
|
||||
|
||||
if(load_index == SIMPLE_RESET_DATA_INDEX) {
|
||||
reset_shared_data(&frontend_data->shared_data);
|
||||
UpdateOutText(out_text_data, "Reset detected. Defaults re-loaded", "Reset detected\nDefaults re-loaded", TEXT_KIND_WARNING);
|
||||
return;
|
||||
}
|
||||
|
|
@ -165,16 +219,45 @@ static void load_layout_file(int load_index, FrontendData *frontend_data, AudioD
|
|||
bool name_load_success = false;
|
||||
std::string layout_name = LayoutNameGenerator(load_index);
|
||||
std::string layout_path = LayoutPathGenerator(load_index, created_proper_folder);
|
||||
bool op_success = load(layout_path, layout_name, frontend_data->top_screen->m_info, frontend_data->bot_screen->m_info, frontend_data->joint_screen->m_info, frontend_data->display_data, audio_data, out_text_data, extra_button_shortcuts, capture_status);
|
||||
std::string shared_layout_path = LayoutPathGenerator(STARTUP_FILE_INDEX, created_proper_folder);
|
||||
std::string shared_layout_name = "shared.cfg";
|
||||
bool op_success = load(layout_path, layout_name, frontend_data->top_screen->m_info, frontend_data->bot_screen->m_info, frontend_data->joint_screen->m_info, frontend_data->display_data, audio_data, out_text_data, capture_status);
|
||||
if(do_print && op_success) {
|
||||
std::string load_name = load_layout_name(load_index, created_proper_folder, name_load_success);
|
||||
UpdateOutText(out_text_data, "Layout loaded from: " + layout_path + layout_name, "Layout " + load_name + " loaded", TEXT_KIND_SUCCESS);
|
||||
}
|
||||
else if(!op_success)
|
||||
defaults_reload(frontend_data, audio_data, extra_button_shortcuts, capture_status);
|
||||
defaults_reload(frontend_data, audio_data, capture_status);
|
||||
if(!is_first_load)
|
||||
return;
|
||||
bool shared_op_success = load_shared(shared_layout_path, shared_layout_name, &frontend_data->shared_data, out_text_data, op_success);
|
||||
if(!shared_op_success)
|
||||
reset_shared_data(&frontend_data->shared_data);
|
||||
if(!is_input_data_valid(&frontend_data->shared_data.input_data, are_extra_buttons_usable()))
|
||||
reset_input_data(&frontend_data->shared_data.input_data);
|
||||
}
|
||||
|
||||
static bool save(const std::string path, const std::string name, const std::string save_name, const ScreenInfo &top_info, const ScreenInfo &bottom_info, const ScreenInfo &joint_info, DisplayData &display_data, AudioData *audio_data, OutTextData &out_text_data, ExtraButtonShortcuts* extra_button_shortcuts, CaptureStatus* capture_status) {
|
||||
static bool save_shared(const std::string path, const std::string name, SharedData* shared_data, OutTextData &out_text_data, bool do_print) {
|
||||
std::ofstream file(path + name);
|
||||
if(!file.good()) {
|
||||
if(do_print)
|
||||
UpdateOutText(out_text_data, "File " + path + name + " save failed.", "Save failed", TEXT_KIND_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
file << "extra_button_enter_short=" << shared_data->input_data.extra_button_shortcuts.enter_shortcut->cmd << std::endl;
|
||||
file << "extra_button_page_up_short=" << shared_data->input_data.extra_button_shortcuts.page_up_shortcut->cmd << std::endl;
|
||||
file << "fast_poll=" << shared_data->input_data.fast_poll << std::endl;
|
||||
file << "enable_keyboard_input=" << shared_data->input_data.enable_keyboard_input << std::endl;
|
||||
file << "enable_controller_input=" << shared_data->input_data.enable_controller_input << std::endl;
|
||||
file << "enable_mouse_input=" << shared_data->input_data.enable_mouse_input << std::endl;
|
||||
file << "enable_buttons_input=" << shared_data->input_data.enable_buttons_input << std::endl;
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool save(const std::string path, const std::string name, const std::string save_name, const ScreenInfo &top_info, const ScreenInfo &bottom_info, const ScreenInfo &joint_info, DisplayData &display_data, AudioData *audio_data, OutTextData &out_text_data, CaptureStatus* capture_status) {
|
||||
std::ofstream file(path + name);
|
||||
if(!file.good()) {
|
||||
UpdateOutText(out_text_data, "File " + path + name + " save failed.", "Save failed", TEXT_KIND_ERROR);
|
||||
|
|
@ -187,10 +270,7 @@ static bool save(const std::string path, const std::string name, const std::stri
|
|||
file << save_screen_info("joint_", joint_info);
|
||||
file << save_screen_info("top_", top_info);
|
||||
file << "split=" << display_data.split << std::endl;
|
||||
file << "fast_poll=" << display_data.fast_poll << std::endl;
|
||||
file << "last_connected_ds=" << display_data.last_connected_ds << std::endl;
|
||||
file << "extra_button_enter_short=" << extra_button_shortcuts->enter_shortcut->cmd << std::endl;
|
||||
file << "extra_button_page_up_short=" << extra_button_shortcuts->page_up_shortcut->cmd << std::endl;
|
||||
file << "is_screen_capture_type=" << capture_status->capture_type << std::endl;
|
||||
file << "is_speed_capture=" << capture_status->capture_speed << std::endl;
|
||||
file << audio_data->save_audio_data();
|
||||
|
|
@ -199,7 +279,7 @@ static bool save(const std::string path, const std::string name, const std::stri
|
|||
return true;
|
||||
}
|
||||
|
||||
static void save_layout_file(int save_index, FrontendData *frontend_data, AudioData* audio_data, OutTextData &out_text_data, ExtraButtonShortcuts* extra_button_shortcuts, CaptureStatus* capture_status, bool skip_io, bool do_print, bool created_proper_folder) {
|
||||
static void save_layout_file(int save_index, FrontendData *frontend_data, AudioData* audio_data, OutTextData &out_text_data, CaptureStatus* capture_status, bool skip_io, bool do_print, bool created_proper_folder) {
|
||||
if(skip_io)
|
||||
return;
|
||||
|
||||
|
|
@ -210,10 +290,13 @@ static void save_layout_file(int save_index, FrontendData *frontend_data, AudioD
|
|||
std::string save_name = load_layout_name(save_index, created_proper_folder, name_load_success);
|
||||
std::string layout_name = LayoutNameGenerator(save_index);
|
||||
std::string layout_path = LayoutPathGenerator(save_index, created_proper_folder);
|
||||
bool op_success = save(layout_path, layout_name, save_name, frontend_data->top_screen->m_info, frontend_data->bot_screen->m_info, frontend_data->joint_screen->m_info, frontend_data->display_data, audio_data, out_text_data, extra_button_shortcuts, capture_status);
|
||||
std::string shared_layout_path = LayoutPathGenerator(STARTUP_FILE_INDEX, created_proper_folder);
|
||||
std::string shared_layout_name = "shared.cfg";
|
||||
bool op_success = save(layout_path, layout_name, save_name, frontend_data->top_screen->m_info, frontend_data->bot_screen->m_info, frontend_data->joint_screen->m_info, frontend_data->display_data, audio_data, out_text_data, capture_status);
|
||||
if(do_print && op_success) {
|
||||
UpdateOutText(out_text_data, "Layout saved to: " + layout_path + layout_name, "Layout " + save_name + " saved", TEXT_KIND_SUCCESS);
|
||||
}
|
||||
bool shared_op_success = save_shared(shared_layout_path, shared_layout_name, &frontend_data->shared_data, out_text_data, op_success);
|
||||
}
|
||||
|
||||
static void executeSoundRestart(Audio &audio, AudioData* audio_data, bool do_restart) {
|
||||
|
|
@ -317,19 +400,19 @@ static float get_time_multiplier(CaptureData* capture_data, bool should_ignore_d
|
|||
}
|
||||
}
|
||||
|
||||
static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data, bool mono_app, bool created_proper_folder) {
|
||||
static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data, bool mono_app, bool created_proper_folder, bool recovery_mode) {
|
||||
VideoOutputData *out_buf;
|
||||
double last_frame_time = 0.0;
|
||||
int num_elements_fps_array = 0;
|
||||
FrontendData frontend_data;
|
||||
ConsumerMutex draw_lock;
|
||||
reset_display_data(&frontend_data.display_data);
|
||||
reset_shared_data(&frontend_data.shared_data);
|
||||
frontend_data.display_data.mono_app_mode = mono_app;
|
||||
frontend_data.reload = true;
|
||||
bool skip_io = false;
|
||||
int num_allowed_blanks = MAX_ALLOWED_BLANKS;
|
||||
OutTextData out_text_data;
|
||||
ExtraButtonShortcuts extra_button_shortcuts;
|
||||
out_text_data.consumed = true;
|
||||
int ret_val = 0;
|
||||
int poll_timeout = 0;
|
||||
|
|
@ -339,14 +422,15 @@ static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data,
|
|||
memset(out_buf, 0, sizeof(VideoOutputData));
|
||||
|
||||
draw_lock.unlock();
|
||||
WindowScreen *top_screen = new WindowScreen(ScreenType::TOP, &capture_data->status, &frontend_data.display_data, audio_data, &extra_button_shortcuts, &draw_lock, created_proper_folder);
|
||||
WindowScreen *bot_screen = new WindowScreen(ScreenType::BOTTOM, &capture_data->status, &frontend_data.display_data, audio_data, &extra_button_shortcuts, &draw_lock, created_proper_folder);
|
||||
WindowScreen *joint_screen = new WindowScreen(ScreenType::JOINT, &capture_data->status, &frontend_data.display_data, audio_data, &extra_button_shortcuts, &draw_lock, created_proper_folder);
|
||||
WindowScreen *top_screen = new WindowScreen(ScreenType::TOP, &capture_data->status, &frontend_data.display_data, &frontend_data.shared_data, audio_data, &draw_lock, created_proper_folder);
|
||||
WindowScreen *bot_screen = new WindowScreen(ScreenType::BOTTOM, &capture_data->status, &frontend_data.display_data, &frontend_data.shared_data, audio_data, &draw_lock, created_proper_folder);
|
||||
WindowScreen *joint_screen = new WindowScreen(ScreenType::JOINT, &capture_data->status, &frontend_data.display_data, &frontend_data.shared_data, audio_data, &draw_lock, created_proper_folder);
|
||||
frontend_data.top_screen = top_screen;
|
||||
frontend_data.bot_screen = bot_screen;
|
||||
frontend_data.joint_screen = joint_screen;
|
||||
|
||||
load_layout_file(STARTUP_FILE_INDEX, &frontend_data, audio_data, out_text_data, &extra_button_shortcuts, &capture_data->status, skip_io, false, created_proper_folder);
|
||||
if(!recovery_mode)
|
||||
load_layout_file(STARTUP_FILE_INDEX, &frontend_data, audio_data, out_text_data, &capture_data->status, skip_io, false, created_proper_folder, true);
|
||||
// Due to the risk for seizures, at the start of the program, set BFI to false!
|
||||
top_screen->m_info.bfi = false;
|
||||
bot_screen->m_info.bfi = false;
|
||||
|
|
@ -373,7 +457,7 @@ static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data,
|
|||
poll_everything = false;
|
||||
poll_timeout--;
|
||||
}
|
||||
else if(frontend_data.display_data.fast_poll)
|
||||
else if(frontend_data.shared_data.input_data.fast_poll)
|
||||
poll_timeout = LOW_POLL_DIVISOR;
|
||||
VideoOutputData *chosen_buf = out_buf;
|
||||
bool blank_out = false;
|
||||
|
|
@ -426,12 +510,12 @@ static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data,
|
|||
chosen_buf = NULL;
|
||||
}
|
||||
|
||||
if(frontend_data.display_data.fast_poll)
|
||||
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);
|
||||
|
||||
if(!frontend_data.display_data.fast_poll)
|
||||
if(!frontend_data.shared_data.input_data.fast_poll)
|
||||
poll_all_windows(&frontend_data, poll_everything, polled);
|
||||
|
||||
int load_index = 0;
|
||||
|
|
@ -449,12 +533,12 @@ static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data,
|
|||
if((load_index = top_screen->load_data()) || (load_index = bot_screen->load_data()) || (load_index = joint_screen->load_data())) {
|
||||
// This value should only be loaded when starting the program...
|
||||
bool previous_last_connected_ds = frontend_data.display_data.last_connected_ds;
|
||||
load_layout_file(load_index, &frontend_data, audio_data, out_text_data, &extra_button_shortcuts, &capture_data->status, skip_io, true, created_proper_folder);
|
||||
load_layout_file(load_index, &frontend_data, audio_data, out_text_data, &capture_data->status, skip_io, true, created_proper_folder, false);
|
||||
frontend_data.display_data.last_connected_ds = previous_last_connected_ds;
|
||||
}
|
||||
|
||||
if((save_index = top_screen->save_data()) || (save_index = bot_screen->save_data()) || (save_index = joint_screen->save_data())) {
|
||||
save_layout_file(save_index, &frontend_data, audio_data, out_text_data, &extra_button_shortcuts, &capture_data->status, skip_io, true, created_proper_folder);
|
||||
save_layout_file(save_index, &frontend_data, audio_data, out_text_data, &capture_data->status, skip_io, true, created_proper_folder);
|
||||
top_screen->update_save_menu();
|
||||
bot_screen->update_save_menu();
|
||||
joint_screen->update_save_menu();
|
||||
|
|
@ -490,7 +574,7 @@ static int mainVideoOutputCall(AudioData* audio_data, CaptureData* capture_data,
|
|||
bot_screen->after_thread_join();
|
||||
joint_screen->after_thread_join();
|
||||
|
||||
save_layout_file(STARTUP_FILE_INDEX, &frontend_data, audio_data, out_text_data, &extra_button_shortcuts, &capture_data->status, skip_io, false, created_proper_folder);
|
||||
save_layout_file(STARTUP_FILE_INDEX, &frontend_data, audio_data, out_text_data, &capture_data->status, skip_io, false, created_proper_folder);
|
||||
|
||||
if(!out_text_data.consumed) {
|
||||
ConsoleOutText(out_text_data.full_text);
|
||||
|
|
@ -548,6 +632,7 @@ static bool parse_int_arg(int &index, int argc, char **argv, int &target, std::s
|
|||
int main(int argc, char **argv) {
|
||||
init_threads();
|
||||
bool mono_app = false;
|
||||
bool recovery_mode = false;
|
||||
int page_up_id = -1;
|
||||
int page_down_id = -1;
|
||||
int enter_id = -1;
|
||||
|
|
@ -557,6 +642,8 @@ int main(int argc, char **argv) {
|
|||
for (int i = 1; i < argc; i++) {
|
||||
if(parse_existence_arg(i, argv, mono_app, true, "--mono_app"))
|
||||
continue;
|
||||
if(parse_existence_arg(i, argv, recovery_mode, true, "--recovery_mode"))
|
||||
continue;
|
||||
#ifdef RASPI
|
||||
if(parse_int_arg(i, argc, argv, page_up_id, "--pi_select"))
|
||||
continue;
|
||||
|
|
@ -570,14 +657,15 @@ int main(int argc, char **argv) {
|
|||
continue;
|
||||
#endif
|
||||
std::cout << "Help:" << std::endl;
|
||||
std::cout << " --mono_app Enables special mode for when only this application" << std::endl;
|
||||
std::cout << " should run on the system. Disabled by default." << std::endl;
|
||||
std::cout << " --mono_app Enables special mode for when only this application" << std::endl;
|
||||
std::cout << " should run on the system. Disabled by default." << std::endl;
|
||||
std::cout << " --recovery_mode Resets to the defaults." << std::endl;
|
||||
#ifdef RASPI
|
||||
std::cout << " --pi_select ID Specifies ID for the select GPIO button." << std::endl;
|
||||
std::cout << " --pi_menu ID Specifies ID for the menu GPIO button." << std::endl;
|
||||
std::cout << " --pi_enter ID Specifies ID for the enter GPIO button." << std::endl;
|
||||
std::cout << " --pi_power ID Specifies ID for the poweroff GPIO button." << std::endl;
|
||||
std::cout << " --pi_pud_down Sets the pull-up GPIO mode to down. Default is up." << std::endl;
|
||||
std::cout << " --pi_select ID Specifies ID for the select GPIO button." << std::endl;
|
||||
std::cout << " --pi_menu ID Specifies ID for the menu GPIO button." << std::endl;
|
||||
std::cout << " --pi_enter ID Specifies ID for the enter GPIO button." << std::endl;
|
||||
std::cout << " --pi_power ID Specifies ID for the poweroff GPIO button." << std::endl;
|
||||
std::cout << " --pi_pud_down Sets the pull-up GPIO mode to down. Default is up." << std::endl;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -590,7 +678,7 @@ int main(int argc, char **argv) {
|
|||
std::thread capture_thread(captureCall, capture_data);
|
||||
std::thread audio_thread(soundCall, &audio_data, capture_data);
|
||||
|
||||
int ret_val = mainVideoOutputCall(&audio_data, capture_data, mono_app, created_proper_folder);
|
||||
int ret_val = mainVideoOutputCall(&audio_data, capture_data, mono_app, created_proper_folder, recovery_mode);
|
||||
audio_thread.join();
|
||||
capture_thread.join();
|
||||
delete capture_data;
|
||||
|
|
|
|||
|
|
@ -391,12 +391,25 @@ void insert_basic_pars(std::vector<const PARData*> &par_vector) {
|
|||
}
|
||||
}
|
||||
|
||||
void reset_display_data(DisplayData *display_data) {
|
||||
void reset_display_data(DisplayData* display_data) {
|
||||
display_data->split = false;
|
||||
display_data->fast_poll = false;
|
||||
display_data->last_connected_ds = false;
|
||||
}
|
||||
|
||||
void reset_input_data(InputData* input_data) {
|
||||
input_data->fast_poll = false;
|
||||
input_data->enable_controller_input = true;
|
||||
input_data->enable_keyboard_input = true;
|
||||
input_data->enable_mouse_input = true;
|
||||
input_data->enable_buttons_input = true;
|
||||
input_data->extra_button_shortcuts.enter_shortcut = get_window_command(WINDOW_COMMAND_RATIO_CYCLE);
|
||||
input_data->extra_button_shortcuts.page_up_shortcut = get_window_command(WINDOW_COMMAND_CROP);
|
||||
}
|
||||
|
||||
void reset_shared_data(SharedData* shared_data) {
|
||||
reset_input_data(&shared_data->input_data);
|
||||
}
|
||||
|
||||
void reset_fullscreen_info(ScreenInfo &info) {
|
||||
info.fullscreen_mode_width = 0;
|
||||
info.fullscreen_mode_height = 0;
|
||||
|
|
@ -841,6 +854,15 @@ void screen_display_thread(WindowScreen *screen) {
|
|||
screen->display_thread();
|
||||
}
|
||||
|
||||
bool is_input_data_valid(InputData* input_data, bool consider_buttons) {
|
||||
bool valid_input_mode_found = false;
|
||||
valid_input_mode_found = valid_input_mode_found || input_data->enable_controller_input;
|
||||
valid_input_mode_found = valid_input_mode_found || input_data->enable_keyboard_input;
|
||||
valid_input_mode_found = valid_input_mode_found || input_data->enable_mouse_input;
|
||||
valid_input_mode_found = valid_input_mode_found || (consider_buttons && input_data->enable_buttons_input);
|
||||
return valid_input_mode_found;
|
||||
}
|
||||
|
||||
std::string get_name_non_int_mode(NonIntegerScalingModes input) {
|
||||
std::string output = "";
|
||||
switch(input) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user