mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 22:05:38 +00:00
HostInterface: Add OpenPackageFile method
This commit is contained in:
parent
57c6e4d5e8
commit
5f69216f70
|
@ -133,6 +133,10 @@ public:
|
||||||
/// Returns true if any BIOS images are found in the configured BIOS directory.
|
/// Returns true if any BIOS images are found in the configured BIOS directory.
|
||||||
bool HasAnyBIOSImages();
|
bool HasAnyBIOSImages();
|
||||||
|
|
||||||
|
/// 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) = 0;
|
||||||
|
|
||||||
virtual void OnRunningGameChanged();
|
virtual void OnRunningGameChanged();
|
||||||
virtual void OnSystemPerformanceCountersUpdated();
|
virtual void OnSystemPerformanceCountersUpdated();
|
||||||
|
|
||||||
|
|
|
@ -864,6 +864,12 @@ std::string LibretroHostInterface::GetBIOSDirectory()
|
||||||
return system_directory;
|
return system_directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ByteStream> LibretroHostInterface::OpenPackageFile(const char* path, u32 flags)
|
||||||
|
{
|
||||||
|
Log_ErrorPrintf("Ignoring request for package file '%s'", path);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
void LibretroHostInterface::LoadSettings()
|
void LibretroHostInterface::LoadSettings()
|
||||||
{
|
{
|
||||||
LibretroSettingsInterface si;
|
LibretroSettingsInterface si;
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
std::string GetShaderCacheBasePath() const override;
|
std::string GetShaderCacheBasePath() const override;
|
||||||
std::string GetStringSettingValue(const char* section, const char* key, const char* default_value = "") override;
|
std::string GetStringSettingValue(const char* section, const char* key, const char* default_value = "") override;
|
||||||
std::string GetBIOSDirectory() override;
|
std::string GetBIOSDirectory() override;
|
||||||
|
std::unique_ptr<ByteStream> OpenPackageFile(const char* path, u32 flags) override;
|
||||||
|
|
||||||
bool UpdateSystemAVInfo(bool use_resolution_scale);
|
bool UpdateSystemAVInfo(bool use_resolution_scale);
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,7 @@ bool CommonHostInterface::Initialize()
|
||||||
|
|
||||||
m_game_list = std::make_unique<GameList>();
|
m_game_list = std::make_unique<GameList>();
|
||||||
m_game_list->SetCacheFilename(GetUserDirectoryRelativePath("cache/gamelist.cache"));
|
m_game_list->SetCacheFilename(GetUserDirectoryRelativePath("cache/gamelist.cache"));
|
||||||
m_game_list->SetDatabaseFilename(GetUserDirectoryRelativePath("cache/redump.dat"));
|
m_game_list->SetUserCompatibilityListFilename(GetProgramDirectoryRelativePath("compatibility.xml"));
|
||||||
m_game_list->SetCompatibilityFilename(GetProgramDirectoryRelativePath("database/compatibility.xml"));
|
|
||||||
m_game_list->SetGameSettingsFilename(GetProgramDirectoryRelativePath("database/gamesettings.ini"));
|
|
||||||
m_game_list->SetUserGameSettingsFilename(GetUserDirectoryRelativePath("gamesettings.ini"));
|
m_game_list->SetUserGameSettingsFilename(GetUserDirectoryRelativePath("gamesettings.ini"));
|
||||||
|
|
||||||
m_save_state_selector_ui = std::make_unique<FrontendCommon::SaveStateSelectorUI>(this);
|
m_save_state_selector_ui = std::make_unique<FrontendCommon::SaveStateSelectorUI>(this);
|
||||||
|
@ -2613,6 +2611,16 @@ bool CommonHostInterface::RequestRenderWindowScale(float scale)
|
||||||
return RequestRenderWindowSize(static_cast<s32>(requested_width), static_cast<s32>(requested_height));
|
return RequestRenderWindowSize(static_cast<s32>(requested_width), static_cast<s32>(requested_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ByteStream> CommonHostInterface::OpenPackageFile(const char* path, u32 flags)
|
||||||
|
{
|
||||||
|
const u32 allowed_flags = (BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_SEEKABLE | BYTESTREAM_OPEN_STREAMED);
|
||||||
|
const std::string full_path(
|
||||||
|
StringUtil::StdStringFromFormat("%s" FS_OSPATH_SEPARATOR_STR "%s", m_program_directory.c_str(), path));
|
||||||
|
const u32 real_flags = (flags & allowed_flags) | BYTESTREAM_OPEN_READ;
|
||||||
|
Log_DevPrintf("Requesting package file '%s'", path);
|
||||||
|
return FileSystem::OpenFile(full_path.c_str(), real_flags);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WITH_DISCORD_PRESENCE
|
#ifdef WITH_DISCORD_PRESENCE
|
||||||
|
|
||||||
void CommonHostInterface::SetDiscordPresenceEnabled(bool enabled)
|
void CommonHostInterface::SetDiscordPresenceEnabled(bool enabled)
|
||||||
|
|
|
@ -190,6 +190,10 @@ public:
|
||||||
/// Requests a resize to a multiple of the render window size.
|
/// Requests a resize to a multiple of the render window size.
|
||||||
bool RequestRenderWindowScale(float scale);
|
bool RequestRenderWindowScale(float scale);
|
||||||
|
|
||||||
|
/// 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;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum : u32
|
enum : u32
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue