|
|
|
|
@ -106,6 +106,29 @@ SystemBootParameters::SystemBootParameters(std::string filename_) : filename(std
|
|
|
|
|
SystemBootParameters::~SystemBootParameters() = default;
|
|
|
|
|
|
|
|
|
|
namespace System {
|
|
|
|
|
/// Memory save states - only for internal use.
|
|
|
|
|
namespace {
|
|
|
|
|
struct SaveStateBuffer
|
|
|
|
|
{
|
|
|
|
|
std::string serial;
|
|
|
|
|
std::string title;
|
|
|
|
|
std::string media_path;
|
|
|
|
|
u32 media_subimage_index;
|
|
|
|
|
u32 version;
|
|
|
|
|
RGBA8Image screenshot;
|
|
|
|
|
DynamicHeapArray<u8> state_data;
|
|
|
|
|
size_t state_size;
|
|
|
|
|
};
|
|
|
|
|
struct MemorySaveState
|
|
|
|
|
{
|
|
|
|
|
std::unique_ptr<GPUTexture> vram_texture;
|
|
|
|
|
DynamicHeapArray<u8> state_data;
|
|
|
|
|
#ifdef PROFILE_MEMORY_SAVE_STATES
|
|
|
|
|
size_t state_size;
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
static void CheckCacheLineSize();
|
|
|
|
|
|
|
|
|
|
static void LoadInputBindings(SettingsInterface& si, std::unique_lock<std::mutex>& lock);
|
|
|
|
|
@ -116,20 +139,24 @@ static bool ReadExecutableFromImage(IsoReader& iso, std::string* out_executable_
|
|
|
|
|
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 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);
|
|
|
|
|
static bool RecreateGPU(GPURenderer renderer, bool force_recreate_device = false, bool update_display = true);
|
|
|
|
|
|
|
|
|
|
/// Checks for settings changes, std::move() the old settings away for comparing beforehand.
|
|
|
|
|
static void CheckForSettingsChanges(const Settings& old_settings);
|
|
|
|
|
/// 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);
|
|
|
|
|
@ -137,47 +164,26 @@ 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 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 std::unique_ptr<MemoryCard> GetMemoryCardForSlot(u32 slot, MemoryCardType type);
|
|
|
|
|
|
|
|
|
|
/// Memory save states - only for internal use.
|
|
|
|
|
namespace {
|
|
|
|
|
struct SaveStateBuffer
|
|
|
|
|
{
|
|
|
|
|
std::string serial;
|
|
|
|
|
std::string title;
|
|
|
|
|
std::string media_path;
|
|
|
|
|
u32 media_subimage_index;
|
|
|
|
|
u32 version;
|
|
|
|
|
RGBA8Image screenshot;
|
|
|
|
|
DynamicHeapArray<u8> state_data;
|
|
|
|
|
size_t state_size;
|
|
|
|
|
};
|
|
|
|
|
struct MemorySaveState
|
|
|
|
|
{
|
|
|
|
|
std::unique_ptr<GPUTexture> vram_texture;
|
|
|
|
|
DynamicHeapArray<u8> state_data;
|
|
|
|
|
#ifdef PROFILE_MEMORY_SAVE_STATES
|
|
|
|
|
size_t state_size;
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
} // namespace
|
|
|
|
|
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.
|
|
|
|
|
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 LoadMemoryState(const MemorySaveState& mss);
|
|
|
|
|
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 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 SetTimerResolutionIncreased(bool enabled);
|
|
|
|
|
|