mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-09-07 08:05:16 -05:00
Implement proper frame delay and VRR for IS Nitro Emulator
This commit is contained in:
39
include/Menus/ISNitroMenu.hpp
Normal file
39
include/Menus/ISNitroMenu.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef __ISNMENU_HPP
|
||||
#define __ISNMENU_HPP
|
||||
|
||||
#include "OptionSelectionMenu.hpp"
|
||||
#include <chrono>
|
||||
|
||||
#include "TextRectangle.hpp"
|
||||
#include "sfml_gfx_structs.hpp"
|
||||
#include "display_structs.hpp"
|
||||
#include "capture_structs.hpp"
|
||||
|
||||
enum ISNitroMenuOutAction{
|
||||
ISN_MENU_NO_ACTION,
|
||||
ISN_MENU_BACK,
|
||||
ISN_MENU_DELAY,
|
||||
ISN_MENU_TYPE_DEC,
|
||||
ISN_MENU_TYPE_INC,
|
||||
};
|
||||
|
||||
class ISNitroMenu : public OptionSelectionMenu {
|
||||
public:
|
||||
ISNitroMenu(bool font_load_success, sf::Font &text_font);
|
||||
~ISNitroMenu();
|
||||
void prepare(float scaling_factor, int view_size_x, int view_size_y, CaptureStatus* capture_status);
|
||||
void insert_data();
|
||||
ISNitroMenuOutAction selected_index = ISNitroMenuOutAction::ISN_MENU_NO_ACTION;
|
||||
void reset_output_option();
|
||||
protected:
|
||||
bool is_option_selectable(int index, int action);
|
||||
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;
|
||||
};
|
||||
#endif
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "TextRectangle.hpp"
|
||||
#include "sfml_gfx_structs.hpp"
|
||||
#include "display_structs.hpp"
|
||||
#include "capture_structs.hpp"
|
||||
|
||||
enum MainMenuOutAction{
|
||||
MAIN_MENU_NO_ACTION,
|
||||
@@ -24,6 +25,7 @@ enum MainMenuOutAction{
|
||||
MAIN_MENU_EXTRA_SETTINGS,
|
||||
MAIN_MENU_SHUTDOWN,
|
||||
MAIN_MENU_SHORTCUT_SETTINGS,
|
||||
MAIN_MENU_ISN_SETTINGS,
|
||||
};
|
||||
|
||||
class MainMenu : public OptionSelectionMenu {
|
||||
@@ -31,7 +33,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);
|
||||
void insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_mode, bool enable_shortcuts, CaptureConnectionType cc_type, bool connected);
|
||||
MainMenuOutAction selected_index = MainMenuOutAction::MAIN_MENU_NO_ACTION;
|
||||
void reset_output_option();
|
||||
protected:
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define EXTRA_DATA_BUFFER_FTD3XX_SIZE (1 << 10)
|
||||
|
||||
enum CaptureConnectionType { CAPTURE_CONN_FTD3, CAPTURE_CONN_USB, CAPTURE_CONN_FTD2, CAPTURE_CONN_IS_NITRO };
|
||||
enum CaptureScreensType { CAPTURE_SCREENS_BOTH, CAPTURE_SCREENS_TOP, CAPTURE_SCREENS_BOTTOM, CAPTURE_SCREENS_ENUM_END };
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
@@ -125,18 +126,21 @@ struct CaptureStatus {
|
||||
CaptureDevice device;
|
||||
std::string error_text;
|
||||
bool new_error_text;
|
||||
bool enabled_3d = false;
|
||||
volatile int curr_in = 0;
|
||||
volatile int cooldown_curr_in = FIX_PARTIAL_FIRST_FRAME_NUM;
|
||||
volatile bool connected = false;
|
||||
volatile bool running = true;
|
||||
volatile bool close_success = true;
|
||||
volatile int curr_delay = 0;
|
||||
bool enabled_3d = false;
|
||||
CaptureScreensType capture_type;
|
||||
ConsumerMutex video_wait;
|
||||
ConsumerMutex audio_wait;
|
||||
};
|
||||
|
||||
struct CaptureData {
|
||||
void* handle;
|
||||
CaptureScreensType capture_type[NUM_CONCURRENT_DATA_BUFFERS];
|
||||
uint64_t read[NUM_CONCURRENT_DATA_BUFFERS];
|
||||
CaptureReceived capture_buf[NUM_CONCURRENT_DATA_BUFFERS];
|
||||
double time_in_buf[NUM_CONCURRENT_DATA_BUFFERS];
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
#include "capture_structs.hpp"
|
||||
#include "display_structs.hpp"
|
||||
|
||||
void convertVideoToOutput(CaptureReceived *p_in, VideoOutputData *p_out, CaptureData* capture_data);
|
||||
void convertAudioToOutput(CaptureReceived *p_in, sf::Int16 *p_out, uint64_t n_samples, const bool is_big_endian, CaptureData* capture_data);
|
||||
void convertVideoToOutput(int index, VideoOutputData *p_out, CaptureData* capture_data);
|
||||
void convertAudioToOutput(int index, sf::Int16 *p_out, uint64_t n_samples, const bool is_big_endian, CaptureData* capture_data);
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
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 };
|
||||
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 };
|
||||
|
||||
struct ScreenInfo {
|
||||
bool is_blurred;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "ShortcutMenu.hpp"
|
||||
#include "ActionSelectionMenu.hpp"
|
||||
#include "ScalingRatioMenu.hpp"
|
||||
#include "ISNitroMenu.hpp"
|
||||
#include "display_structs.hpp"
|
||||
#include "WindowCommands.hpp"
|
||||
|
||||
@@ -68,6 +69,7 @@ public:
|
||||
int check_connection_menu_result();
|
||||
void end_connection_menu();
|
||||
void update_ds_3ds_connection(bool changed_type);
|
||||
void update_capture_specific_settings();
|
||||
void update_save_menu();
|
||||
|
||||
void print_notification(std::string text, TextKind kind = TEXT_KIND_NORMAL);
|
||||
@@ -146,6 +148,7 @@ private:
|
||||
LicenseMenu *license_menu;
|
||||
ShortcutMenu *shortcut_menu;
|
||||
ActionSelectionMenu *action_selection_menu;
|
||||
ISNitroMenu *is_nitro_menu;
|
||||
ScalingRatioMenu *scaling_ratio_menu;
|
||||
std::vector<const CropData*> possible_crops;
|
||||
std::vector<const CropData*> possible_crops_ds;
|
||||
@@ -219,6 +222,7 @@ private:
|
||||
void fast_poll_change();
|
||||
void padding_change();
|
||||
void game_crop_enable_change();
|
||||
void is_nitro_capture_type_change(bool positive);
|
||||
void crop_value_change(int new_crop_value, bool do_print_notification = true, bool do_cycle = true);
|
||||
void par_value_change(int new_par_value, bool is_top);
|
||||
void offset_change(float &value, float change);
|
||||
@@ -273,7 +277,7 @@ private:
|
||||
void setWinSize(bool is_main_thread);
|
||||
bool can_setup_menu();
|
||||
void setup_no_menu();
|
||||
void setup_main_menu(bool reset_data = true);
|
||||
void setup_main_menu(bool reset_data = true, bool skip_setup_check = false);
|
||||
void setup_video_menu(bool reset_data = true);
|
||||
void setup_crop_menu(bool reset_data = true);
|
||||
void setup_par_menu(bool is_top, bool reset_data = true);
|
||||
@@ -290,6 +294,7 @@ private:
|
||||
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 setup_is_nitro_menu(bool reset_data = true);
|
||||
void update_connection();
|
||||
};
|
||||
|
||||
@@ -315,7 +320,8 @@ void get_par_size(int &width, int &height, float multiplier_factor, const PARDat
|
||||
float get_par_mult_factor(float width, float height, float max_width, float max_height, const PARData *correction_factor, bool is_rotated);
|
||||
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 update_connected_specific_settings(FrontendData* frontend_data, const CaptureDevice &cc_device);
|
||||
void screen_display_thread(WindowScreen *screen);
|
||||
std::string get_name_non_int_mode(NonIntegerScalingModes input);
|
||||
void default_sleep(int wanted_ms = -1);
|
||||
void default_sleep(float wanted_ms = -1);
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@ void list_devices_is_nitro(std::vector<CaptureDevice> &devices_list);
|
||||
bool is_nitro_connect_usb(bool print_failed, CaptureData* capture_data, CaptureDevice* device);
|
||||
void is_nitro_capture_main_loop(CaptureData* capture_data);
|
||||
void usb_is_nitro_capture_cleanup(CaptureData* capture_data);
|
||||
void usb_is_nitro_convertVideoToOutput(CaptureReceived *p_in, VideoOutputData *p_out, CaptureDevice* capture_device);
|
||||
void usb_is_nitro_convertVideoToOutput(CaptureReceived *p_in, VideoOutputData *p_out, CaptureScreensType capture_type);
|
||||
uint64_t usb_is_nitro_emulator_get_video_in_size(CaptureData* capture_data);
|
||||
void usb_is_nitro_init();
|
||||
void usb_is_nitro_close();
|
||||
|
||||
Reference in New Issue
Block a user