#pragma once #include "StateManager.hpp" #include "appstates/BaseState.hpp" #include "appstates/TitleSelectCommon.hpp" #include "data/data.hpp" #include "ui/ui.hpp" #include class TitleOptionState final : public BaseState { public: /// @brief Constructs a new title option state. /// @param user Target user. /// @param titleInfo Target title. TitleOptionState(data::User *user, data::TitleInfo *titleInfo, TitleSelectCommon *titleSelect); /// @brief Required destructor. ~TitleOptionState() {}; /// @brief Returns a new TitleOptionState. See constructor. static inline std::shared_ptr create(data::User *user, data::TitleInfo *titleInfo, TitleSelectCommon *titleSelect) { return std::make_shared(user, titleInfo, titleSelect); } /// @brief Creates, pushes, and returns a new TitleOptionState static std::shared_ptr create_and_push(data::User *user, data::TitleInfo *titleInfo, TitleSelectCommon *titleSelect) { auto newState = TitleOptionState::create(user, titleInfo, titleSelect); StateManager::push_state(newState); return newState; } /// @brief Runs update routine. void update() override; /// @brief Handles hiding the panel. void sub_update() override; /// @brief Runs the render routine. void render() override; /// @brief This function allows tasks to signal to the spawning state to close itself on the next update() call. void close_on_update(); /// @brief Signals to the main thread that a view refresh is required on the next update() call. void refresh_required(); // clang-format off struct DataStruct { data::User *user{}; data::TitleInfo *titleInfo{}; TitleOptionState *spawningState{}; TitleSelectCommon *titleSelect{}; }; // clang-format on using TaskData = std::shared_ptr; private: /// @brief This is just in case the option should only apply to the current user. data::User *m_user{}; /// @brief This is the target title. data::TitleInfo *m_titleInfo{}; /// @brief Pointer to the title selection being used for updating. TitleSelectCommon *m_titleSelect{}; /// @brief The struct passed to functions. std::shared_ptr m_dataStruct{}; /// @brief This holds whether or not the state should deactivate itself on the next update loop. bool m_exitRequired{}; /// @brief This stores whether or a not a refresh is required on the next update(). bool m_refreshRequired{}; /// @brief Menu used and shared by all instances. static inline std::shared_ptr sm_titleOptionMenu{}; /// @brief This is shared by all instances of this class. static inline std::unique_ptr sm_slidePanel{}; /// @brief Initializes the static members all instances share. void initialize_static_members(); /// @brief Initializes the values of the struct passed to tasks. void initialize_data_struct(); /// @brief Creates and pushes the title information state. void create_push_info_state(); /// @brief Adds the currently highlighted title to the blacklist. void add_to_blacklist(); /// @brief Changes the current output directory for the title locally and remotely (if needed). void change_output_directory(); /// @brief Creates and pushes a new instance of file mode (once I get around to it.). void create_push_file_mode(); /// @brief Deletes all locally stored save backups for the current title. void delete_all_local_backups(); /// @brief Deletes all backups on the remote server. void delete_all_remote_backups(); /// @brief Resets the save data for the current title. Basically wipes it clean. void reset_save_data(); /// @brief Deletes the filesystem from the Switch. void delete_save_from_system(); /// @brief Extends the container to any size desired. void extend_save_container(); /// @brief Exports an SVI file for the current title. void export_svi_file(); /// @brief Performs some operations and marks the state for purging. void deactivate_state(); };