Duckstation/src/core/host_interface.h

58 lines
1.4 KiB
C
Raw Normal View History

2019-09-12 14:18:13 +00:00
#pragma once
#include "types.h"
#include "settings.h"
2019-09-14 10:28:47 +00:00
#include <memory>
#include <optional>
#include <vector>
2019-09-12 14:18:13 +00:00
2019-10-10 16:20:21 +00:00
class AudioStream;
class HostDisplay;
2019-09-12 14:18:13 +00:00
2019-09-14 10:28:47 +00:00
class System;
2019-09-12 14:18:13 +00:00
class HostInterface
{
public:
2019-09-14 10:28:47 +00:00
HostInterface();
virtual ~HostInterface();
2019-11-07 15:07:39 +00:00
/// Access to host display.
ALWAYS_INLINE HostDisplay* GetDisplay() const { return m_display.get(); }
/// Access to host audio stream.
2019-10-10 16:20:21 +00:00
AudioStream* GetAudioStream() const { return m_audio_stream.get(); }
2019-11-07 15:07:39 +00:00
/// Returns a settings object which can be modified.
Settings& GetSettings() { return m_settings; }
bool CreateSystem();
bool BootSystem(const char* filename, const char* state_filename);
void DestroySystem();
2019-11-07 15:07:39 +00:00
virtual void ReportError(const char* message);
virtual void ReportMessage(const char* message);
2019-09-12 14:18:13 +00:00
// Adds OSD messages, duration is in seconds.
virtual void AddOSDMessage(const char* message, float duration = 2.0f) = 0;
2019-09-14 10:28:47 +00:00
/// Loads the BIOS image for the specified region.
virtual std::optional<std::vector<u8>> GetBIOSImage(ConsoleRegion region);
2019-09-14 10:28:47 +00:00
bool LoadState(const char* filename);
bool SaveState(const char* filename);
protected:
/// Connects controllers. TODO: Clean this up later...
virtual void ConnectControllers();
2019-11-07 15:07:39 +00:00
void UpdateAudioVisualSync();
std::unique_ptr<HostDisplay> m_display;
2019-10-10 16:20:21 +00:00
std::unique_ptr<AudioStream> m_audio_stream;
2019-09-14 10:28:47 +00:00
std::unique_ptr<System> m_system;
Settings m_settings;
2019-11-07 15:07:39 +00:00
bool m_paused = false;
bool m_speed_limiter_temp_disabled = false;
2019-09-12 14:18:13 +00:00
};