2020-02-28 07:00:09 +00:00
|
|
|
#pragma once
|
2020-12-19 06:33:05 +00:00
|
|
|
#include "common/bitfield.h"
|
2020-02-28 07:00:09 +00:00
|
|
|
#include "common/string.h"
|
2020-08-29 12:19:28 +00:00
|
|
|
#include "core/controller.h"
|
2020-02-28 07:00:12 +00:00
|
|
|
#include "core/host_interface.h"
|
2020-02-28 07:00:09 +00:00
|
|
|
#include <atomic>
|
|
|
|
#include <functional>
|
|
|
|
#include <map>
|
|
|
|
#include <memory>
|
|
|
|
#include <mutex>
|
2020-02-28 07:00:12 +00:00
|
|
|
#include <optional>
|
2020-02-28 07:00:09 +00:00
|
|
|
#include <string_view>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
2020-10-01 13:32:01 +00:00
|
|
|
class HostDisplayTexture;
|
|
|
|
|
2020-03-21 14:49:46 +00:00
|
|
|
class ControllerInterface;
|
|
|
|
|
2020-04-20 16:50:57 +00:00
|
|
|
namespace FrontendCommon {
|
|
|
|
class SaveStateSelectorUI;
|
2021-01-30 11:25:49 +00:00
|
|
|
|
|
|
|
enum class ControllerNavigationButton : u32
|
|
|
|
{
|
|
|
|
Activate, // A on XBox Controller, Cross on PS Controller
|
|
|
|
Cancel, // B on XBox Controller, Circle on PS Controller
|
|
|
|
LeftShoulder, // LB on XBox Controller, L1 on PS Controller
|
|
|
|
RightShoulder, // RB on XBox Controller, R1 on PS Controller
|
|
|
|
DPadLeft,
|
|
|
|
DPadRight,
|
|
|
|
DPadUp,
|
|
|
|
DPadDown,
|
|
|
|
Count
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace FrontendCommon
|
2020-04-20 16:50:57 +00:00
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
class CommonHostInterface : public HostInterface
|
|
|
|
{
|
|
|
|
public:
|
2020-03-21 14:49:46 +00:00
|
|
|
friend ControllerInterface;
|
|
|
|
|
2020-06-08 16:05:55 +00:00
|
|
|
enum : s32
|
|
|
|
{
|
|
|
|
PER_GAME_SAVE_STATE_SLOTS = 10,
|
|
|
|
GLOBAL_SAVE_STATE_SLOTS = 10
|
|
|
|
};
|
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
using HostKeyCode = s32;
|
2020-04-26 07:21:49 +00:00
|
|
|
using HostMouseButton = s32;
|
2020-02-28 07:00:09 +00:00
|
|
|
|
|
|
|
using InputButtonHandler = std::function<void(bool)>;
|
|
|
|
using InputAxisHandler = std::function<void(float)>;
|
2020-04-14 06:34:39 +00:00
|
|
|
using ControllerRumbleCallback = std::function<void(const float*, u32)>;
|
2020-02-28 07:00:09 +00:00
|
|
|
|
|
|
|
struct HotkeyInfo
|
|
|
|
{
|
|
|
|
String category;
|
|
|
|
String name;
|
|
|
|
String display_name;
|
|
|
|
InputButtonHandler handler;
|
|
|
|
};
|
|
|
|
|
|
|
|
using HotkeyInfoList = std::vector<HotkeyInfo>;
|
|
|
|
|
2021-01-30 05:45:52 +00:00
|
|
|
struct InputProfileEntry
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
std::string path;
|
|
|
|
};
|
|
|
|
using InputProfileList = std::vector<InputProfileEntry>;
|
|
|
|
|
2020-06-08 16:05:55 +00:00
|
|
|
struct SaveStateInfo
|
|
|
|
{
|
|
|
|
std::string path;
|
|
|
|
u64 timestamp;
|
|
|
|
s32 slot;
|
|
|
|
bool global;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ExtendedSaveStateInfo
|
|
|
|
{
|
|
|
|
std::string path;
|
2021-01-30 05:47:48 +00:00
|
|
|
std::string title;
|
|
|
|
std::string game_code;
|
|
|
|
std::string media_path;
|
2020-06-08 16:05:55 +00:00
|
|
|
u64 timestamp;
|
|
|
|
s32 slot;
|
|
|
|
bool global;
|
|
|
|
|
|
|
|
u32 screenshot_width;
|
|
|
|
u32 screenshot_height;
|
|
|
|
std::vector<u32> screenshot_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
using HostInterface::LoadState;
|
|
|
|
using HostInterface::SaveState;
|
|
|
|
|
2020-04-13 12:13:46 +00:00
|
|
|
/// Returns the name of the frontend.
|
|
|
|
virtual const char* GetFrontendName() const = 0;
|
|
|
|
|
2021-01-30 05:51:59 +00:00
|
|
|
/// Request the frontend to exit.
|
|
|
|
virtual void RequestExit() = 0;
|
|
|
|
|
2021-01-30 05:52:36 +00:00
|
|
|
/// Runs an event next frame as part of the event loop.
|
|
|
|
virtual void RunLater(std::function<void()> func) = 0;
|
|
|
|
|
|
|
|
/// Loads new settings and applies them.
|
|
|
|
virtual void ApplySettings(bool display_osd_messages) = 0;
|
|
|
|
|
2021-01-30 05:51:59 +00:00
|
|
|
virtual bool IsFullscreen() const;
|
|
|
|
virtual bool SetFullscreen(bool enabled);
|
|
|
|
|
2020-04-05 12:59:06 +00:00
|
|
|
virtual bool Initialize() override;
|
|
|
|
virtual void Shutdown() override;
|
2020-03-21 14:49:46 +00:00
|
|
|
|
2020-04-13 12:13:46 +00:00
|
|
|
virtual bool BootSystem(const SystemBootParameters& parameters) override;
|
|
|
|
virtual void PowerOffSystem() override;
|
2020-06-08 16:05:55 +00:00
|
|
|
virtual void DestroySystem() override;
|
|
|
|
|
|
|
|
/// Returns the game list.
|
2021-01-03 08:14:02 +00:00
|
|
|
ALWAYS_INLINE GameList* GetGameList() const { return m_game_list.get(); }
|
2020-04-13 12:13:46 +00:00
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
/// Returns a list of all available hotkeys.
|
2020-03-21 14:49:46 +00:00
|
|
|
ALWAYS_INLINE const HotkeyInfoList& GetHotkeyInfoList() const { return m_hotkeys; }
|
|
|
|
|
|
|
|
/// Access to current controller interface.
|
|
|
|
ALWAYS_INLINE ControllerInterface* GetControllerInterface() const { return m_controller_interface.get(); }
|
2020-02-28 07:00:09 +00:00
|
|
|
|
2020-04-13 12:13:46 +00:00
|
|
|
/// Returns true if running in batch mode, i.e. exit after emulation.
|
2020-12-19 06:33:05 +00:00
|
|
|
ALWAYS_INLINE bool InBatchMode() const { return m_command_line_flags.batch_mode; }
|
2020-04-13 12:13:46 +00:00
|
|
|
|
2021-01-30 11:37:49 +00:00
|
|
|
/// Returns true if the fullscreen UI is enabled.
|
|
|
|
ALWAYS_INLINE bool IsFullscreenUIEnabled() const { return m_fullscreen_ui_enabled; }
|
|
|
|
|
2020-04-13 12:13:46 +00:00
|
|
|
/// Parses command line parameters for all frontends.
|
|
|
|
bool ParseCommandLineParameters(int argc, char* argv[], std::unique_ptr<SystemBootParameters>* out_boot_params);
|
|
|
|
|
2021-01-30 05:45:52 +00:00
|
|
|
/// Returns a path where an input profile with the specified name would be saved.
|
|
|
|
std::string GetSavePathForInputProfile(const char* name) const;
|
|
|
|
|
|
|
|
/// Returns a list of all input profiles. first - name, second - path
|
|
|
|
InputProfileList GetInputProfileList() const;
|
|
|
|
|
|
|
|
/// Returns the path for an input profile.
|
|
|
|
std::string GetInputProfilePath(const char* name) const;
|
|
|
|
|
|
|
|
/// Applies the specified input profile.
|
|
|
|
void ApplyInputProfile(const char* profile_path, SettingsInterface& si);
|
|
|
|
|
|
|
|
/// Saves the current input configuration to the specified profile name.
|
|
|
|
bool SaveInputProfile(const char* profile_path, SettingsInterface& si);
|
|
|
|
|
2020-06-08 16:05:55 +00:00
|
|
|
/// Loads the current emulation state from file. Specifying a slot of -1 loads the "resume" game state.
|
|
|
|
bool LoadState(bool global, s32 slot);
|
|
|
|
|
|
|
|
/// Saves the current emulation state to a file. Specifying a slot of -1 saves the "resume" save state.
|
|
|
|
bool SaveState(bool global, s32 slot);
|
|
|
|
|
|
|
|
/// Loads the resume save state for the given game. Optionally boots the game anyway if loading fails.
|
|
|
|
bool ResumeSystemFromState(const char* filename, bool boot_on_failure);
|
|
|
|
|
|
|
|
/// Loads the most recent resume save state. This may be global or per-game.
|
|
|
|
bool ResumeSystemFromMostRecentState();
|
|
|
|
|
|
|
|
/// Saves the resume save state, call when shutting down. Not called automatically on DestroySystem() since that can
|
|
|
|
/// be called as a result of an error.
|
|
|
|
bool SaveResumeSaveState();
|
|
|
|
|
|
|
|
/// Returns a list of save states for the specified game code.
|
|
|
|
std::vector<SaveStateInfo> GetAvailableSaveStates(const char* game_code) const;
|
|
|
|
|
|
|
|
/// Returns save state info if present. If game_code is null or empty, assumes global state.
|
|
|
|
std::optional<SaveStateInfo> GetSaveStateInfo(const char* game_code, s32 slot);
|
|
|
|
|
|
|
|
/// Returns save state info if present. If game_code is null or empty, assumes global state.
|
|
|
|
std::optional<ExtendedSaveStateInfo> GetExtendedSaveStateInfo(const char* game_code, s32 slot);
|
|
|
|
|
|
|
|
/// Deletes save states for the specified game code. If resume is set, the resume state is deleted too.
|
|
|
|
void DeleteSaveStates(const char* game_code, bool resume);
|
|
|
|
|
|
|
|
/// Adds OSD messages, duration is in seconds.
|
|
|
|
void AddOSDMessage(std::string message, float duration = 2.0f) override;
|
2021-01-30 05:45:18 +00:00
|
|
|
bool EnumerateOSDMessages(std::function<bool(const std::string&, float)> callback);
|
2020-08-29 12:19:09 +00:00
|
|
|
void ClearOSDMessages();
|
2020-06-08 16:05:55 +00:00
|
|
|
|
|
|
|
/// Displays a loading screen with the logo, rendered with ImGui. Use when executing possibly-time-consuming tasks
|
|
|
|
/// such as compiling shaders when starting up.
|
|
|
|
void DisplayLoadingScreen(const char* message, int progress_min = -1, int progress_max = -1,
|
|
|
|
int progress_value = -1) override;
|
|
|
|
|
|
|
|
/// Retrieves information about specified game from game list.
|
|
|
|
void GetGameInfo(const char* path, CDImage* image, std::string* code, std::string* title) override;
|
|
|
|
|
|
|
|
/// Returns true if currently dumping audio.
|
|
|
|
bool IsDumpingAudio() const;
|
|
|
|
|
|
|
|
/// Starts dumping audio to a file. If no file name is provided, one will be generated automatically.
|
|
|
|
bool StartDumpingAudio(const char* filename = nullptr);
|
|
|
|
|
|
|
|
/// Stops dumping audio to file if it has been started.
|
|
|
|
void StopDumpingAudio();
|
|
|
|
|
|
|
|
/// Saves a screenshot to the specified file. IF no file name is provided, one will be generated automatically.
|
2020-11-26 12:51:13 +00:00
|
|
|
bool SaveScreenshot(const char* filename = nullptr, bool full_resolution = true, bool apply_aspect_ratio = true,
|
|
|
|
bool compress_on_thread = true);
|
2020-06-08 16:05:55 +00:00
|
|
|
|
2020-09-09 13:44:02 +00:00
|
|
|
/// Loads the cheat list from the specified file.
|
|
|
|
bool LoadCheatList(const char* filename);
|
|
|
|
|
|
|
|
/// Loads the cheat list for the current game title from the user directory.
|
|
|
|
bool LoadCheatListFromGameTitle();
|
|
|
|
|
2020-11-29 06:42:49 +00:00
|
|
|
/// Loads the cheat list for the current game code from the built-in code database.
|
|
|
|
bool LoadCheatListFromDatabase();
|
|
|
|
|
2020-10-19 15:14:49 +00:00
|
|
|
/// Saves the current cheat list to the game title's file.
|
|
|
|
bool SaveCheatList();
|
|
|
|
|
2020-09-09 13:44:02 +00:00
|
|
|
/// Saves the current cheat list to the specified file.
|
|
|
|
bool SaveCheatList(const char* filename);
|
|
|
|
|
|
|
|
/// Enables/disabled the specified cheat code.
|
|
|
|
void SetCheatCodeState(u32 index, bool enabled, bool save_to_file);
|
|
|
|
|
|
|
|
/// Immediately applies the specified cheat code.
|
|
|
|
void ApplyCheatCode(u32 index);
|
|
|
|
|
2020-09-13 12:31:31 +00:00
|
|
|
/// Temporarily toggles post-processing on/off.
|
|
|
|
void TogglePostProcessing();
|
|
|
|
|
2020-09-13 10:21:05 +00:00
|
|
|
/// Reloads post processing shaders with the current configuration.
|
|
|
|
void ReloadPostProcessingShaders();
|
|
|
|
|
2020-11-01 14:38:54 +00:00
|
|
|
/// Parses a fullscreen mode into its components (width * height @ refresh hz)
|
|
|
|
static bool ParseFullscreenMode(const std::string_view& mode, u32* width, u32* height, float* refresh_rate);
|
|
|
|
|
2021-01-12 16:36:11 +00:00
|
|
|
/// Returns true if fast forwarding or slow motion is currently active.
|
|
|
|
bool IsRunningAtNonStandardSpeed() const;
|
2020-11-03 11:21:11 +00:00
|
|
|
|
2020-11-18 13:14:25 +00:00
|
|
|
/// Requests the specified size for the render window. Not guaranteed to succeed (e.g. if in fullscreen).
|
|
|
|
virtual bool RequestRenderWindowSize(s32 new_window_width, s32 new_window_height);
|
|
|
|
|
|
|
|
/// Requests a resize to a multiple of the render window size.
|
|
|
|
bool RequestRenderWindowScale(float scale);
|
|
|
|
|
2020-12-29 06:29:14 +00:00
|
|
|
/// Returns a pointer to the top-level window, needed by some controller interfaces.
|
|
|
|
virtual void* GetTopLevelWindowHandle() const;
|
|
|
|
|
2020-11-27 07:57:20 +00:00
|
|
|
/// Opens a file in the DuckStation "package".
|
|
|
|
/// This is the APK for Android builds, or the program directory for standalone builds.
|
|
|
|
virtual std::unique_ptr<ByteStream> OpenPackageFile(const char* path, u32 flags) override;
|
|
|
|
|
2021-01-30 11:25:49 +00:00
|
|
|
/// Controller navigation, used by fullscreen mode. Returns true if the UI consumed the event, and it should not
|
|
|
|
/// execute the normal handler.
|
|
|
|
bool SetControllerNavigationButtonState(FrontendCommon::ControllerNavigationButton button, bool pressed);
|
|
|
|
|
2021-01-30 05:49:09 +00:00
|
|
|
/// Toggles fast forward state.
|
|
|
|
bool IsFastForwardEnabled() const { return m_fast_forward_enabled; }
|
|
|
|
void SetFastForwardEnabled(bool enabled);
|
|
|
|
|
|
|
|
/// Toggles turbo state.
|
|
|
|
bool IsTurboEnabled() const { return m_turbo_enabled; }
|
|
|
|
void SetTurboEnabled(bool enabled);
|
|
|
|
|
2021-01-31 14:50:47 +00:00
|
|
|
/// ImGui window drawing.
|
|
|
|
void DrawFPSWindow();
|
|
|
|
void DrawOSDMessages();
|
|
|
|
void DrawDebugWindows();
|
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
protected:
|
2020-06-08 16:05:55 +00:00
|
|
|
enum : u32
|
|
|
|
{
|
2020-07-16 17:27:12 +00:00
|
|
|
SETTINGS_VERSION = 3
|
2020-06-08 16:05:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct OSDMessage
|
|
|
|
{
|
|
|
|
std::string text;
|
|
|
|
Common::Timer time;
|
|
|
|
float duration;
|
|
|
|
};
|
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
CommonHostInterface();
|
|
|
|
~CommonHostInterface();
|
|
|
|
|
2021-01-13 08:54:37 +00:00
|
|
|
/// Registers frontend-specific hotkeys.
|
|
|
|
virtual void RegisterHotkeys();
|
|
|
|
|
2020-04-30 15:01:50 +00:00
|
|
|
/// Executes per-frame tasks such as controller polling.
|
|
|
|
virtual void PollAndUpdate();
|
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
virtual std::unique_ptr<AudioStream> CreateAudioStream(AudioBackend backend) override;
|
2020-12-08 14:48:00 +00:00
|
|
|
virtual s32 GetAudioOutputVolume() const override;
|
2020-08-22 06:44:06 +00:00
|
|
|
virtual void UpdateControllerInterface();
|
2020-02-28 07:00:09 +00:00
|
|
|
|
2020-03-12 03:53:58 +00:00
|
|
|
virtual void OnSystemCreated() override;
|
2021-01-31 07:28:30 +00:00
|
|
|
virtual void OnSystemPaused(bool paused) override;
|
2020-04-14 06:34:39 +00:00
|
|
|
virtual void OnSystemDestroyed() override;
|
2020-04-30 15:01:50 +00:00
|
|
|
virtual void OnRunningGameChanged() override;
|
2020-03-21 14:49:46 +00:00
|
|
|
virtual void OnControllerTypeChanged(u32 slot) override;
|
2020-02-28 07:00:09 +00:00
|
|
|
|
|
|
|
virtual std::optional<HostKeyCode> GetHostKeyCode(const std::string_view key_code) const;
|
|
|
|
|
2020-03-21 14:49:46 +00:00
|
|
|
virtual bool AddButtonToInputMap(const std::string& binding, const std::string_view& device,
|
|
|
|
const std::string_view& button, InputButtonHandler handler);
|
|
|
|
virtual bool AddAxisToInputMap(const std::string& binding, const std::string_view& device,
|
2020-08-29 12:19:28 +00:00
|
|
|
const std::string_view& axis, Controller::AxisType axis_type,
|
|
|
|
InputAxisHandler handler);
|
2020-04-14 06:34:39 +00:00
|
|
|
virtual bool AddRumbleToInputMap(const std::string& binding, u32 controller_index, u32 num_motors);
|
2020-03-21 14:49:46 +00:00
|
|
|
|
|
|
|
/// Reloads the input map from config. Callable from controller interface.
|
|
|
|
virtual void UpdateInputMap() = 0;
|
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
void RegisterHotkey(String category, String name, String display_name, InputButtonHandler handler);
|
|
|
|
bool HandleHostKeyEvent(HostKeyCode code, bool pressed);
|
2020-04-26 07:21:49 +00:00
|
|
|
bool HandleHostMouseEvent(HostMouseButton button, bool pressed);
|
2020-02-28 07:00:09 +00:00
|
|
|
void UpdateInputMap(SettingsInterface& si);
|
2020-08-23 09:38:37 +00:00
|
|
|
void ClearInputMap();
|
2020-02-28 07:00:09 +00:00
|
|
|
|
2020-04-14 06:34:39 +00:00
|
|
|
void AddControllerRumble(u32 controller_index, u32 num_motors, ControllerRumbleCallback callback);
|
|
|
|
void UpdateControllerRumble();
|
|
|
|
void StopControllerRumble();
|
|
|
|
|
2020-06-08 16:05:55 +00:00
|
|
|
/// Returns the path to a save state file. Specifying an index of -1 is the "resume" save state.
|
|
|
|
std::string GetGameSaveStateFileName(const char* game_code, s32 slot) const;
|
|
|
|
|
|
|
|
/// Returns the path to a save state file. Specifying an index of -1 is the "resume" save state.
|
|
|
|
std::string GetGlobalSaveStateFileName(s32 slot) const;
|
|
|
|
|
|
|
|
/// Sets the base path for the user directory. Can be overridden by platform/frontend/command line.
|
|
|
|
virtual void SetUserDirectory();
|
|
|
|
|
|
|
|
/// Updates logging settings.
|
|
|
|
virtual void UpdateLogSettings(LOGLEVEL level, const char* filter, bool log_to_console, bool log_to_debug,
|
|
|
|
bool log_to_window, bool log_to_file);
|
|
|
|
|
|
|
|
/// Returns the path of the settings file.
|
|
|
|
std::string GetSettingsFileName() const;
|
|
|
|
|
|
|
|
/// Returns the most recent resume save state.
|
|
|
|
std::string GetMostRecentResumeSaveStatePath() const;
|
|
|
|
|
2020-09-09 13:44:02 +00:00
|
|
|
/// Returns the path to the cheat file for the specified game title.
|
|
|
|
std::string GetCheatFileName() const;
|
|
|
|
|
2020-06-08 16:05:55 +00:00
|
|
|
/// Ensures the settings is valid and the correct version. If not, resets to defaults.
|
2020-10-09 08:26:21 +00:00
|
|
|
bool CheckSettings(SettingsInterface& si);
|
2020-06-08 16:05:55 +00:00
|
|
|
|
|
|
|
/// Restores all settings to defaults.
|
2020-07-09 03:29:58 +00:00
|
|
|
virtual void SetDefaultSettings(SettingsInterface& si) override;
|
2020-06-08 16:05:55 +00:00
|
|
|
|
|
|
|
/// Loads settings to m_settings and any frontend-specific parameters.
|
2020-10-11 02:14:29 +00:00
|
|
|
using HostInterface::LoadSettings;
|
2020-07-09 03:29:58 +00:00
|
|
|
virtual void LoadSettings(SettingsInterface& si) override;
|
2020-06-08 16:05:55 +00:00
|
|
|
|
|
|
|
/// Saves current settings variables to ini.
|
2020-07-09 03:29:58 +00:00
|
|
|
virtual void SaveSettings(SettingsInterface& si) override;
|
2020-06-08 16:05:55 +00:00
|
|
|
|
|
|
|
/// Checks for settings changes, std::move() the old settings away for comparing beforehand.
|
2020-07-09 03:29:58 +00:00
|
|
|
virtual void CheckForSettingsChanges(const Settings& old_settings) override;
|
2020-06-08 16:05:55 +00:00
|
|
|
|
|
|
|
/// Increases timer resolution when supported by the host OS.
|
|
|
|
void SetTimerResolutionIncreased(bool enabled);
|
|
|
|
|
|
|
|
void UpdateSpeedLimiterState();
|
|
|
|
|
|
|
|
void RecreateSystem() override;
|
|
|
|
|
2020-08-20 11:30:11 +00:00
|
|
|
void ApplyGameSettings(bool display_osd_messages);
|
|
|
|
|
2020-10-01 13:32:01 +00:00
|
|
|
bool CreateHostDisplayResources();
|
|
|
|
void ReleaseHostDisplayResources();
|
|
|
|
|
2020-06-08 16:05:55 +00:00
|
|
|
virtual void DrawImGuiWindows();
|
|
|
|
|
2020-07-07 15:57:34 +00:00
|
|
|
void DoFrameStep();
|
2020-12-06 13:32:32 +00:00
|
|
|
void DoToggleCheats();
|
2020-06-08 16:05:55 +00:00
|
|
|
|
2021-01-04 14:56:14 +00:00
|
|
|
std::string m_settings_filename;
|
|
|
|
|
2020-06-08 16:05:55 +00:00
|
|
|
std::unique_ptr<GameList> m_game_list;
|
|
|
|
|
2020-03-21 14:49:46 +00:00
|
|
|
std::unique_ptr<ControllerInterface> m_controller_interface;
|
|
|
|
|
2020-10-01 13:32:01 +00:00
|
|
|
std::unique_ptr<HostDisplayTexture> m_logo_texture;
|
|
|
|
|
2020-06-08 16:05:55 +00:00
|
|
|
std::deque<OSDMessage> m_osd_messages;
|
|
|
|
std::mutex m_osd_messages_lock;
|
|
|
|
|
2021-01-30 11:37:49 +00:00
|
|
|
bool m_fullscreen_ui_enabled = false;
|
2020-07-07 15:57:34 +00:00
|
|
|
bool m_frame_step_request = false;
|
2020-11-03 11:21:11 +00:00
|
|
|
bool m_fast_forward_enabled = false;
|
2021-01-10 15:57:10 +00:00
|
|
|
bool m_turbo_enabled = false;
|
2020-06-08 16:05:55 +00:00
|
|
|
bool m_timer_resolution_increased = false;
|
2021-01-12 16:36:11 +00:00
|
|
|
bool m_throttler_enabled = true;
|
2021-01-28 10:20:15 +00:00
|
|
|
bool m_display_all_frames = true;
|
2020-06-08 16:05:55 +00:00
|
|
|
|
2021-01-30 11:37:49 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
u8 bits;
|
|
|
|
|
|
|
|
// running in batch mode? i.e. exit after stopping emulation
|
|
|
|
BitField<u8, bool, 0, 1> batch_mode;
|
|
|
|
|
|
|
|
// disable controller interface (buggy devices with SDL)
|
|
|
|
BitField<u8, bool, 1, 1> disable_controller_interface;
|
2021-01-31 15:02:54 +00:00
|
|
|
|
|
|
|
// starting fullscreen (outside of boot options)
|
|
|
|
BitField<u8, bool, 2, 1> start_fullscreen;
|
2021-01-30 11:37:49 +00:00
|
|
|
} m_command_line_flags = {};
|
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
private:
|
2020-06-08 16:05:55 +00:00
|
|
|
void InitializeUserDirectory();
|
2020-02-28 07:00:09 +00:00
|
|
|
void RegisterGeneralHotkeys();
|
|
|
|
void RegisterGraphicsHotkeys();
|
|
|
|
void RegisterSaveStateHotkeys();
|
2020-05-09 14:54:23 +00:00
|
|
|
void RegisterAudioHotkeys();
|
2020-06-11 16:47:39 +00:00
|
|
|
void FindInputProfiles(const std::string& base_path, InputProfileList* out_list) const;
|
2020-02-28 07:00:09 +00:00
|
|
|
void UpdateControllerInputMap(SettingsInterface& si);
|
2020-10-04 08:20:18 +00:00
|
|
|
bool UpdateControllerInputMapFromGameSettings();
|
2020-02-28 07:00:09 +00:00
|
|
|
void UpdateHotkeyInputMap(SettingsInterface& si);
|
2020-04-14 15:44:04 +00:00
|
|
|
void ClearAllControllerBindings(SettingsInterface& si);
|
2020-02-28 07:00:09 +00:00
|
|
|
|
2020-04-30 15:01:53 +00:00
|
|
|
#ifdef WITH_DISCORD_PRESENCE
|
|
|
|
void SetDiscordPresenceEnabled(bool enabled);
|
|
|
|
void InitializeDiscordPresence();
|
|
|
|
void ShutdownDiscordPresence();
|
|
|
|
void UpdateDiscordPresence();
|
|
|
|
void PollDiscordPresence();
|
|
|
|
#endif
|
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
HotkeyInfoList m_hotkeys;
|
|
|
|
|
2020-04-20 16:50:57 +00:00
|
|
|
std::unique_ptr<FrontendCommon::SaveStateSelectorUI> m_save_state_selector_ui;
|
|
|
|
|
2020-02-28 07:00:09 +00:00
|
|
|
// input key maps
|
|
|
|
std::map<HostKeyCode, InputButtonHandler> m_keyboard_input_handlers;
|
2020-04-26 07:21:49 +00:00
|
|
|
std::map<HostMouseButton, InputButtonHandler> m_mouse_input_handlers;
|
2020-04-13 12:13:46 +00:00
|
|
|
|
2020-04-14 06:34:39 +00:00
|
|
|
// controller vibration motors/rumble
|
|
|
|
struct ControllerRumbleState
|
|
|
|
{
|
|
|
|
enum : u32
|
|
|
|
{
|
|
|
|
MAX_MOTORS = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
u32 controller_index;
|
|
|
|
u32 num_motors;
|
|
|
|
std::array<float, MAX_MOTORS> last_strength;
|
|
|
|
ControllerRumbleCallback update_callback;
|
2021-01-18 14:27:33 +00:00
|
|
|
u64 last_update_time;
|
2020-04-14 06:34:39 +00:00
|
|
|
};
|
|
|
|
std::vector<ControllerRumbleState> m_controller_vibration_motors;
|
|
|
|
|
2020-04-30 15:01:53 +00:00
|
|
|
#ifdef WITH_DISCORD_PRESENCE
|
|
|
|
// discord rich presence
|
|
|
|
bool m_discord_presence_enabled = false;
|
|
|
|
bool m_discord_presence_active = false;
|
|
|
|
#endif
|
2020-02-28 07:00:09 +00:00
|
|
|
};
|