mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-09-07 08:05:16 -05:00
Implement non-integer scaling modes
This commit is contained in:
41
include/Menus/ScalingRatioMenu.hpp
Executable file
41
include/Menus/ScalingRatioMenu.hpp
Executable file
@@ -0,0 +1,41 @@
|
||||
#ifndef __SCALINGRATIOMENU_HPP
|
||||
#define __SCALINGRATIOMENU_HPP
|
||||
|
||||
#include "OptionSelectionMenu.hpp"
|
||||
#include <chrono>
|
||||
|
||||
#include "TextRectangle.hpp"
|
||||
#include "sfml_gfx_structs.hpp"
|
||||
#include "display_structs.hpp"
|
||||
|
||||
enum ScalingRatioMenuOutAction{
|
||||
SCALING_RATIO_MENU_NO_ACTION,
|
||||
SCALING_RATIO_MENU_BACK,
|
||||
SCALING_RATIO_MENU_FULLSCREEN_SCALING_TOP,
|
||||
SCALING_RATIO_MENU_FULLSCREEN_SCALING_BOTTOM,
|
||||
SCALING_RATIO_MENU_NON_INT_SCALING_TOP,
|
||||
SCALING_RATIO_MENU_NON_INT_SCALING_BOTTOM,
|
||||
SCALING_RATIO_MENU_ALGO_INC,
|
||||
SCALING_RATIO_MENU_ALGO_DEC,
|
||||
};
|
||||
|
||||
class ScalingRatioMenu : public OptionSelectionMenu {
|
||||
public:
|
||||
ScalingRatioMenu(bool font_load_success, sf::Font &text_font);
|
||||
~ScalingRatioMenu();
|
||||
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info);
|
||||
void insert_data();
|
||||
ScalingRatioMenuOutAction selected_index = ScalingRatioMenuOutAction::SCALING_RATIO_MENU_NO_ACTION;
|
||||
void reset_output_option();
|
||||
protected:
|
||||
bool is_option_inc_dec(int index);
|
||||
void set_output_option(int index, int action);
|
||||
int get_num_options();
|
||||
std::string get_string_option(int index, int action);
|
||||
void class_setup();
|
||||
private:
|
||||
int *options_indexes;
|
||||
int num_enabled_options;
|
||||
std::string setTextOptionDualPercentage(int index, float value_1, float value_2);
|
||||
};
|
||||
#endif
|
||||
@@ -26,8 +26,6 @@ enum VideoMenuOutAction{
|
||||
VIDEO_MENU_OFFSET_SETTINGS,
|
||||
VIDEO_MENU_WINDOW_SCALING_DEC,
|
||||
VIDEO_MENU_WINDOW_SCALING_INC,
|
||||
VIDEO_MENU_FULLSCREEN_SCALING_TOP,
|
||||
VIDEO_MENU_FULLSCREEN_SCALING_BOTTOM,
|
||||
VIDEO_MENU_BFI_SETTINGS,
|
||||
VIDEO_MENU_MENU_SCALING_DEC,
|
||||
VIDEO_MENU_MENU_SCALING_INC,
|
||||
@@ -38,13 +36,15 @@ enum VideoMenuOutAction{
|
||||
VIDEO_MENU_BOTTOM_ROTATION_DEC,
|
||||
VIDEO_MENU_BOTTOM_ROTATION_INC,
|
||||
VIDEO_MENU_FAST_POLL,
|
||||
VIDEO_MENU_NON_INT_SCALING,
|
||||
VIDEO_MENU_SCALING_RATIO_SETTINGS,
|
||||
};
|
||||
|
||||
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);
|
||||
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info, bool fast_poll, ScreenType screen_type);
|
||||
void insert_data(ScreenType s_type, bool is_fullscreen);
|
||||
VideoMenuOutAction selected_index = VideoMenuOutAction::VIDEO_MENU_NO_ACTION;
|
||||
void reset_output_option();
|
||||
@@ -57,6 +57,5 @@ protected:
|
||||
private:
|
||||
int *options_indexes;
|
||||
int num_enabled_options;
|
||||
std::string setTextOptionDualPercentage(int index, int value_1, int value_2);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
enum ScreenType { TOP, BOTTOM, JOINT };
|
||||
enum BottomRelativePosition { UNDER_TOP, LEFT_TOP, ABOVE_TOP, RIGHT_TOP, BOT_REL_POS_END };
|
||||
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 };
|
||||
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 };
|
||||
|
||||
struct ScreenInfo {
|
||||
bool is_blurred;
|
||||
@@ -22,6 +23,7 @@ struct ScreenInfo {
|
||||
bool v_sync_enabled;
|
||||
bool async;
|
||||
int top_scaling, bot_scaling;
|
||||
float non_integer_top_scaling, non_integer_bot_scaling;
|
||||
bool bfi;
|
||||
int bfi_divider;
|
||||
int bfi_amount;
|
||||
@@ -32,6 +34,9 @@ struct ScreenInfo {
|
||||
int fullscreen_mode_width;
|
||||
int fullscreen_mode_height;
|
||||
int fullscreen_mode_bpp;
|
||||
NonIntegerScalingModes non_integer_mode;
|
||||
bool use_non_integer_scaling_top;
|
||||
bool use_non_integer_scaling_bottom;
|
||||
};
|
||||
|
||||
struct DisplayData {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "LicenseMenu.hpp"
|
||||
#include "ShortcutMenu.hpp"
|
||||
#include "ActionSelectionMenu.hpp"
|
||||
#include "ScalingRatioMenu.hpp"
|
||||
#include "display_structs.hpp"
|
||||
#include "WindowCommands.hpp"
|
||||
|
||||
@@ -88,6 +89,8 @@ private:
|
||||
struct ResizingScreenData {
|
||||
sf::Vector2f size;
|
||||
int *scaling;
|
||||
float* non_int_scaling;
|
||||
bool use_non_int_scaling;
|
||||
int rotation;
|
||||
const PARData *par;
|
||||
};
|
||||
@@ -142,6 +145,7 @@ private:
|
||||
LicenseMenu *license_menu;
|
||||
ShortcutMenu *shortcut_menu;
|
||||
ActionSelectionMenu *action_selection_menu;
|
||||
ScalingRatioMenu *scaling_ratio_menu;
|
||||
std::vector<const CropData*> possible_crops;
|
||||
std::vector<const CropData*> possible_crops_ds;
|
||||
std::vector<const CropData*> possible_crops_with_games;
|
||||
@@ -221,6 +225,8 @@ private:
|
||||
void ratio_change(bool top_priority, bool cycle = false);
|
||||
void bfi_change();
|
||||
void bottom_pos_change(int new_bottom_pos);
|
||||
void non_int_scaling_change(bool target_top);
|
||||
void non_int_mode_change(bool positive);
|
||||
bool query_reset_request();
|
||||
void reset_held_times();
|
||||
void poll_window(bool do_everything);
|
||||
@@ -236,8 +242,15 @@ private:
|
||||
void display_data_to_window(bool actually_draw, bool is_debug = false);
|
||||
void window_render_call();
|
||||
void set_position_screens(sf::Vector2f &curr_top_screen_size, sf::Vector2f &curr_bot_screen_size, int offset_x, int offset_y, int max_x, int max_y, bool do_work = true);
|
||||
int prepare_screen_ratio(sf::Vector2f &screen_size, int own_rotation, int width_limit, int height_limit, int other_rotation, const PARData *own_par);
|
||||
float get_max_float_screen_multiplier(ResizingScreenData *own_screen, int width_limit, int height_limit, int other_rotation);
|
||||
int prepare_screen_ratio(ResizingScreenData *own_screen, int width_limit, int height_limit, int other_rotation);
|
||||
bool can_non_integerly_scale();
|
||||
void calc_scaling_resize_screens(ResizingScreenData *own_screen, ResizingScreenData* other_screen, bool increase, bool mantain, bool set_to_zero, bool cycle);
|
||||
void rescale_nonint_subscreen(ResizingScreenData *main_screen_resize_data, ResizingScreenData *sub_screen_resize_data);
|
||||
void direct_scale_nonint_screen(ResizingScreenData *main_screen_resize_data, int sub_min_width, int sub_min_height, int sub_screen_rotation);
|
||||
void non_int_scale_screens_with_main(ResizingScreenData *main_screen_resize_data, ResizingScreenData *sub_screen_resize_data, int sub_min_width, int sub_height_min);
|
||||
void non_int_scale_screens_both(ResizingScreenData *main_screen_resize_data, ResizingScreenData *sub_screen_resize_data, int free_width, int free_height, float multiplier_main, int main_min_width, int main_height_min, int sub_min_width, int sub_height_min);
|
||||
void non_integer_scale_screens(ResizingScreenData *top_screen_resize_data, ResizingScreenData *bot_screen_resize_data);
|
||||
void prepare_size_ratios(bool top_increase, bool bot_increase, bool cycle = false);
|
||||
int get_fullscreen_offset_x(int top_width, int top_height, int bot_width, int bot_height);
|
||||
int get_fullscreen_offset_y(int top_width, int top_height, int bot_width, int bot_height);
|
||||
@@ -271,6 +284,7 @@ private:
|
||||
void setup_status_menu(bool reset_data = true);
|
||||
void setup_licenses_menu(bool reset_data = true);
|
||||
void setup_relative_pos_menu(bool reset_data = true);
|
||||
void setup_scaling_ratio_menu(bool reset_data = true);
|
||||
void update_connection();
|
||||
};
|
||||
|
||||
@@ -293,8 +307,10 @@ void reset_screen_info(ScreenInfo &info);
|
||||
bool load_screen_info(std::string key, std::string value, std::string base, ScreenInfo &info);
|
||||
std::string save_screen_info(std::string base, const ScreenInfo &info);
|
||||
void get_par_size(int &width, int &height, float multiplier_factor, const PARData *correction_factor);
|
||||
float get_par_mult_factor(float width, float height, float max_width, float max_height, const PARData *correction_factor, bool is_rotated);
|
||||
void default_sleep(int wanted_ms = -1);
|
||||
void update_output(FrontendData* frontend_data, double frame_time = 0.0, VideoOutputData *out_buf = NULL);
|
||||
void update_connected_3ds_ds(FrontendData* frontend_data, const CaptureDevice &old_cc_device, const CaptureDevice &new_cc_device);
|
||||
void screen_display_thread(WindowScreen *screen);
|
||||
std::string get_name_non_int_mode(NonIntegerScalingModes input);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user