mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-25 15:15:40 +00:00
System: Make more functions static
This commit is contained in:
parent
e6a682f8d5
commit
70411783cd
|
@ -106,52 +106,6 @@ SystemBootParameters::SystemBootParameters(std::string filename_) : filename(std
|
||||||
SystemBootParameters::~SystemBootParameters() = default;
|
SystemBootParameters::~SystemBootParameters() = default;
|
||||||
|
|
||||||
namespace System {
|
namespace System {
|
||||||
static void CheckCacheLineSize();
|
|
||||||
|
|
||||||
static void LoadInputBindings(SettingsInterface& si, std::unique_lock<std::mutex>& lock);
|
|
||||||
|
|
||||||
static std::string GetExecutableNameForImage(IsoReader& iso, bool strip_subdirectories);
|
|
||||||
static bool ReadExecutableFromImage(IsoReader& iso, std::string* out_executable_name,
|
|
||||||
std::vector<u8>* out_executable_data);
|
|
||||||
static GameHash GetGameHashFromBuffer(std::string_view exe_name, std::span<const u8> exe_buffer,
|
|
||||||
const IsoReader::ISOPrimaryVolumeDescriptor& iso_pvd, u32 track_1_length);
|
|
||||||
|
|
||||||
static bool LoadBIOS(Error* error);
|
|
||||||
static void ResetBootMode();
|
|
||||||
static void InternalReset();
|
|
||||||
static void ClearRunningGame();
|
|
||||||
static void DestroySystem();
|
|
||||||
static std::string GetMediaPathFromSaveState(const char* path);
|
|
||||||
|
|
||||||
static bool CreateGPU(GPURenderer renderer, bool is_switching, Error* error);
|
|
||||||
static bool SaveUndoLoadState();
|
|
||||||
static void WarnAboutUnsafeSettings();
|
|
||||||
static void LogUnsafeSettingsToConsole(const SmallStringBase& messages);
|
|
||||||
|
|
||||||
/// Checks for settings changes, std::move() the old settings away for comparing beforehand.
|
|
||||||
static void CheckForSettingsChanges(const Settings& old_settings);
|
|
||||||
|
|
||||||
/// Throttles the system, i.e. sleeps until it's time to execute the next frame.
|
|
||||||
static void Throttle(Common::Timer::Value current_time);
|
|
||||||
static void UpdatePerformanceCounters();
|
|
||||||
static void AccumulatePreFrameSleepTime();
|
|
||||||
static void UpdatePreFrameSleepTime();
|
|
||||||
static void UpdateDisplayVSync();
|
|
||||||
|
|
||||||
static void SetRewinding(bool enabled);
|
|
||||||
static bool SaveRewindState();
|
|
||||||
static void DoRewind();
|
|
||||||
|
|
||||||
static void SaveRunaheadState();
|
|
||||||
static bool DoRunahead();
|
|
||||||
|
|
||||||
static bool Initialize(bool force_software_renderer, Error* error);
|
|
||||||
|
|
||||||
static bool UpdateGameSettingsLayer();
|
|
||||||
static void UpdateRunningGame(const std::string_view path, CDImage* image, bool booting);
|
|
||||||
static bool CheckForSBIFile(CDImage* image, Error* error);
|
|
||||||
static std::unique_ptr<MemoryCard> GetMemoryCardForSlot(u32 slot, MemoryCardType type);
|
|
||||||
|
|
||||||
/// Memory save states - only for internal use.
|
/// Memory save states - only for internal use.
|
||||||
namespace {
|
namespace {
|
||||||
struct SaveStateBuffer
|
struct SaveStateBuffer
|
||||||
|
@ -175,9 +129,61 @@ struct MemorySaveState
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
static void CheckCacheLineSize();
|
||||||
|
|
||||||
|
static void LoadInputBindings(SettingsInterface& si, std::unique_lock<std::mutex>& lock);
|
||||||
|
|
||||||
|
static std::string GetExecutableNameForImage(IsoReader& iso, bool strip_subdirectories);
|
||||||
|
static bool ReadExecutableFromImage(IsoReader& iso, std::string* out_executable_name,
|
||||||
|
std::vector<u8>* out_executable_data);
|
||||||
|
static GameHash GetGameHashFromBuffer(std::string_view exe_name, std::span<const u8> exe_buffer,
|
||||||
|
const IsoReader::ISOPrimaryVolumeDescriptor& iso_pvd, u32 track_1_length);
|
||||||
|
|
||||||
|
/// Checks for settings changes, std::move() the old settings away for comparing beforehand.
|
||||||
|
static void CheckForSettingsChanges(const Settings& old_settings);
|
||||||
|
static void WarnAboutUnsafeSettings();
|
||||||
|
static void LogUnsafeSettingsToConsole(const SmallStringBase& messages);
|
||||||
|
|
||||||
|
static bool Initialize(bool force_software_renderer, Error* error);
|
||||||
|
static bool LoadBIOS(Error* error);
|
||||||
|
static void ResetBootMode();
|
||||||
|
static void InternalReset();
|
||||||
|
static void ClearRunningGame();
|
||||||
|
static void DestroySystem();
|
||||||
|
|
||||||
|
static bool CreateGPU(GPURenderer renderer, bool is_switching, Error* error);
|
||||||
|
static bool RecreateGPU(GPURenderer renderer, bool force_recreate_device = false, bool update_display = true);
|
||||||
|
|
||||||
|
/// Updates the throttle period, call when target emulation speed changes.
|
||||||
|
static void UpdateThrottlePeriod();
|
||||||
|
static void ResetThrottler();
|
||||||
|
|
||||||
|
/// Throttles the system, i.e. sleeps until it's time to execute the next frame.
|
||||||
|
static void Throttle(Common::Timer::Value current_time);
|
||||||
|
static void UpdatePerformanceCounters();
|
||||||
|
static void AccumulatePreFrameSleepTime();
|
||||||
|
static void UpdatePreFrameSleepTime();
|
||||||
|
static void UpdateDisplayVSync();
|
||||||
|
static void ResetPerformanceCounters();
|
||||||
|
|
||||||
|
static bool UpdateGameSettingsLayer();
|
||||||
|
static void UpdateRunningGame(const std::string_view path, CDImage* image, bool booting);
|
||||||
|
static bool CheckForSBIFile(CDImage* image, Error* error);
|
||||||
|
|
||||||
|
static void UpdateControllers();
|
||||||
|
static void UpdateControllerSettings();
|
||||||
|
static void ResetControllers();
|
||||||
|
static void UpdatePerGameMemoryCards();
|
||||||
|
static std::unique_ptr<MemoryCard> GetMemoryCardForSlot(u32 slot, MemoryCardType type);
|
||||||
|
static void UpdateMultitaps();
|
||||||
|
|
||||||
/// Returns the maximum size of a save state, considering the current configuration.
|
/// Returns the maximum size of a save state, considering the current configuration.
|
||||||
static size_t GetMaxSaveStateSize();
|
static size_t GetMaxSaveStateSize();
|
||||||
|
|
||||||
|
static std::string GetMediaPathFromSaveState(const char* path);
|
||||||
|
static bool SaveUndoLoadState();
|
||||||
|
static void UpdateMemorySaveStateSettings();
|
||||||
|
static bool LoadRewindState(u32 skip_saves = 0, bool consume_state = true);
|
||||||
static bool SaveMemoryState(MemorySaveState* mss);
|
static bool SaveMemoryState(MemorySaveState* mss);
|
||||||
static bool LoadMemoryState(const MemorySaveState& mss);
|
static bool LoadMemoryState(const MemorySaveState& mss);
|
||||||
static bool LoadStateFromBuffer(const SaveStateBuffer& buffer, Error* error, bool update_display);
|
static bool LoadStateFromBuffer(const SaveStateBuffer& buffer, Error* error, bool update_display);
|
||||||
|
@ -192,6 +198,13 @@ static bool SaveStateBufferToFile(const SaveStateBuffer& buffer, std::FILE* fp,
|
||||||
static u32 CompressAndWriteStateData(std::FILE* fp, std::span<const u8> src, SaveStateCompression method, Error* error);
|
static u32 CompressAndWriteStateData(std::FILE* fp, std::span<const u8> src, SaveStateCompression method, Error* error);
|
||||||
static bool DoState(StateWrapper& sw, GPUTexture** host_texture, bool update_display, bool is_memory_state);
|
static bool DoState(StateWrapper& sw, GPUTexture** host_texture, bool update_display, bool is_memory_state);
|
||||||
|
|
||||||
|
static void SetRewinding(bool enabled);
|
||||||
|
static bool SaveRewindState();
|
||||||
|
static void DoRewind();
|
||||||
|
|
||||||
|
static void SaveRunaheadState();
|
||||||
|
static bool DoRunahead();
|
||||||
|
|
||||||
static void UpdateSessionTime(const std::string& prev_serial);
|
static void UpdateSessionTime(const std::string& prev_serial);
|
||||||
|
|
||||||
static void SetTimerResolutionIncreased(bool enabled);
|
static void SetTimerResolutionIncreased(bool enabled);
|
||||||
|
|
|
@ -210,7 +210,6 @@ u64 GetSessionPlayedTime();
|
||||||
|
|
||||||
const BIOS::ImageInfo* GetBIOSImageInfo();
|
const BIOS::ImageInfo* GetBIOSImageInfo();
|
||||||
|
|
||||||
// TODO: Move to PerformanceMetrics
|
|
||||||
static constexpr u32 NUM_FRAME_TIME_SAMPLES = 150;
|
static constexpr u32 NUM_FRAME_TIME_SAMPLES = 150;
|
||||||
using FrameTimeHistory = std::array<float, NUM_FRAME_TIME_SAMPLES>;
|
using FrameTimeHistory = std::array<float, NUM_FRAME_TIME_SAMPLES>;
|
||||||
|
|
||||||
|
@ -259,9 +258,6 @@ bool SaveResumeState(Error* error);
|
||||||
/// Runs the VM until the CPU execution is canceled.
|
/// Runs the VM until the CPU execution is canceled.
|
||||||
void Execute();
|
void Execute();
|
||||||
|
|
||||||
/// Recreates the GPU component, saving/loading the state so it is preserved. Call when the GPU renderer changes.
|
|
||||||
bool RecreateGPU(GPURenderer renderer, bool force_recreate_device = false, bool update_display = true);
|
|
||||||
|
|
||||||
void SingleStepCPU();
|
void SingleStepCPU();
|
||||||
|
|
||||||
/// Sets target emulation speed.
|
/// Sets target emulation speed.
|
||||||
|
@ -271,26 +267,15 @@ float GetAudioNominalRate();
|
||||||
/// Adjusts the throttle frequency, i.e. how many times we should sleep per second.
|
/// Adjusts the throttle frequency, i.e. how many times we should sleep per second.
|
||||||
void SetThrottleFrequency(float frequency);
|
void SetThrottleFrequency(float frequency);
|
||||||
|
|
||||||
/// Updates the throttle period, call when target emulation speed changes.
|
|
||||||
void UpdateThrottlePeriod();
|
|
||||||
void ResetThrottler();
|
|
||||||
void ResetPerformanceCounters();
|
|
||||||
|
|
||||||
// Access controllers for simulating input.
|
// Access controllers for simulating input.
|
||||||
Controller* GetController(u32 slot);
|
Controller* GetController(u32 slot);
|
||||||
void UpdateControllers();
|
|
||||||
void UpdateControllerSettings();
|
|
||||||
void ResetControllers();
|
|
||||||
void UpdateMemoryCardTypes();
|
void UpdateMemoryCardTypes();
|
||||||
void UpdatePerGameMemoryCards();
|
|
||||||
bool HasMemoryCard(u32 slot);
|
bool HasMemoryCard(u32 slot);
|
||||||
bool IsSavingMemoryCards();
|
bool IsSavingMemoryCards();
|
||||||
|
|
||||||
/// Swaps memory cards in slot 1/2.
|
/// Swaps memory cards in slot 1/2.
|
||||||
void SwapMemoryCards();
|
void SwapMemoryCards();
|
||||||
|
|
||||||
void UpdateMultitaps();
|
|
||||||
|
|
||||||
/// Dumps RAM to a file.
|
/// Dumps RAM to a file.
|
||||||
bool DumpRAM(const char* filename);
|
bool DumpRAM(const char* filename);
|
||||||
|
|
||||||
|
@ -461,8 +446,6 @@ void InvalidateDisplay();
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void CalculateRewindMemoryUsage(u32 num_saves, u32 resolution_scale, u64* ram_usage, u64* vram_usage);
|
void CalculateRewindMemoryUsage(u32 num_saves, u32 resolution_scale, u64* ram_usage, u64* vram_usage);
|
||||||
void ClearMemorySaveStates();
|
void ClearMemorySaveStates();
|
||||||
void UpdateMemorySaveStateSettings();
|
|
||||||
bool LoadRewindState(u32 skip_saves = 0, bool consume_state = true);
|
|
||||||
void SetRunaheadReplayFlag();
|
void SetRunaheadReplayFlag();
|
||||||
|
|
||||||
/// Shared socket multiplexer, used by PINE/GDB/etc.
|
/// Shared socket multiplexer, used by PINE/GDB/etc.
|
||||||
|
|
Loading…
Reference in a new issue