mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 12:45:45 -04:00
ByteStream: Move routines from FileSystem to ByteStream
This commit is contained in:
@ -483,7 +483,7 @@ bool CommonHostInterface::ParseCommandLineParameters(int argc, char* argv[],
|
||||
if (!state_filename.empty())
|
||||
{
|
||||
std::unique_ptr<ByteStream> state_stream =
|
||||
FileSystem::OpenFile(state_filename.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
ByteStream::OpenFile(state_filename.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
if (!state_stream)
|
||||
{
|
||||
Log_ErrorPrintf("Failed to open save state file '%s'", state_filename.c_str());
|
||||
@ -565,7 +565,7 @@ bool CommonHostInterface::CreateHostDisplayResources()
|
||||
std::unique_ptr<ByteStream> stream = OpenPackageFile("resources" FS_OSPATH_SEPARATOR_STR "roboto-regular.ttf",
|
||||
BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
std::vector<u8> font_data;
|
||||
if (!stream || (font_data = FileSystem::ReadBinaryStream(stream.get()), font_data.empty()))
|
||||
if (!stream || (font_data = ByteStream::ReadBinaryStream(stream.get()), font_data.empty()))
|
||||
{
|
||||
ReportError("Failed to load text font");
|
||||
m_display->DestroyImGuiContext();
|
||||
@ -580,7 +580,7 @@ bool CommonHostInterface::CreateHostDisplayResources()
|
||||
std::unique_ptr<ByteStream> stream = OpenPackageFile("resources" FS_OSPATH_SEPARATOR_STR "fa-solid-900.ttf",
|
||||
BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
std::vector<u8> font_data;
|
||||
if (!stream || (font_data = FileSystem::ReadBinaryStream(stream.get()), font_data.empty()))
|
||||
if (!stream || (font_data = ByteStream::ReadBinaryStream(stream.get()), font_data.empty()))
|
||||
{
|
||||
ReportError("Failed to load icon font");
|
||||
m_display->DestroyImGuiContext();
|
||||
@ -779,7 +779,7 @@ bool CommonHostInterface::SaveUndoLoadState()
|
||||
if (m_undo_load_state)
|
||||
m_undo_load_state.reset();
|
||||
|
||||
m_undo_load_state = ByteStream_CreateGrowableMemoryStream(nullptr, System::MAX_SAVE_STATE_SIZE);
|
||||
m_undo_load_state = ByteStream::CreateGrowableMemoryStream(nullptr, System::MAX_SAVE_STATE_SIZE);
|
||||
if (!System::SaveState(m_undo_load_state.get()))
|
||||
{
|
||||
AddOSDMessage(TranslateStdString("OSDMessage", "Failed to save undo load state."), 15.0f);
|
||||
@ -3183,7 +3183,7 @@ CommonHostInterface::GetExtendedSaveStateInfo(const char* game_code, s32 slot)
|
||||
return std::nullopt;
|
||||
|
||||
std::unique_ptr<ByteStream> stream =
|
||||
FileSystem::OpenFile(path.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_SEEKABLE);
|
||||
ByteStream::OpenFile(path.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_SEEKABLE);
|
||||
if (!stream)
|
||||
return std::nullopt;
|
||||
|
||||
@ -4249,7 +4249,7 @@ std::unique_ptr<ByteStream> CommonHostInterface::OpenPackageFile(const char* pat
|
||||
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);
|
||||
return ByteStream::OpenFile(full_path.c_str(), real_flags);
|
||||
}
|
||||
|
||||
bool CommonHostInterface::IsControllerNavigationActive() const
|
||||
|
@ -482,7 +482,7 @@ static std::unique_ptr<HostDisplayTexture> LoadTexture(const char* path, bool fr
|
||||
if (from_package)
|
||||
stream = g_host_interface->OpenPackageFile(path, BYTESTREAM_OPEN_READ);
|
||||
else
|
||||
stream = FileSystem::OpenFile(path, BYTESTREAM_OPEN_READ);
|
||||
stream = ByteStream::OpenFile(path, BYTESTREAM_OPEN_READ);
|
||||
if (!stream)
|
||||
{
|
||||
Log_ErrorPrintf("Failed to open texture resource '%s'", path);
|
||||
|
@ -31,7 +31,7 @@ bool GameDatabase::Load()
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string gamedb_data(FileSystem::ReadStreamToString(stream.get(), false));
|
||||
std::string gamedb_data(ByteStream::ReadStreamToString(stream.get(), false));
|
||||
if (gamedb_data.empty())
|
||||
{
|
||||
Log_ErrorPrintf("Failed to read game database");
|
||||
|
@ -249,7 +249,7 @@ void GameList::LoadCache()
|
||||
return;
|
||||
|
||||
std::unique_ptr<ByteStream> stream =
|
||||
FileSystem::OpenFile(m_cache_filename.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
ByteStream::OpenFile(m_cache_filename.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
if (!stream)
|
||||
return;
|
||||
|
||||
@ -373,7 +373,7 @@ bool GameList::OpenCacheForWriting()
|
||||
|
||||
Assert(!m_cache_write_stream);
|
||||
m_cache_write_stream =
|
||||
FileSystem::OpenFile(m_cache_filename.c_str(), BYTESTREAM_OPEN_CREATE | BYTESTREAM_OPEN_WRITE |
|
||||
ByteStream::OpenFile(m_cache_filename.c_str(), BYTESTREAM_OPEN_CREATE | BYTESTREAM_OPEN_WRITE |
|
||||
BYTESTREAM_OPEN_APPEND | BYTESTREAM_OPEN_STREAMED);
|
||||
if (!m_cache_write_stream || !m_cache_write_stream->SeekToEnd())
|
||||
{
|
||||
@ -793,7 +793,7 @@ void GameList::LoadCompatibilityList()
|
||||
g_host_interface->OpenPackageFile("database/compatibility.xml", BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
if (file)
|
||||
{
|
||||
LoadCompatibilityListFromXML(FileSystem::ReadStreamToString(file.get()));
|
||||
LoadCompatibilityListFromXML(ByteStream::ReadStreamToString(file.get()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -805,9 +805,9 @@ void GameList::LoadCompatibilityList()
|
||||
if (!m_user_compatibility_list_filename.empty() && FileSystem::FileExists(m_user_compatibility_list_filename.c_str()))
|
||||
{
|
||||
std::unique_ptr<ByteStream> file =
|
||||
FileSystem::OpenFile(m_user_compatibility_list_filename.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
ByteStream::OpenFile(m_user_compatibility_list_filename.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
if (file)
|
||||
LoadCompatibilityListFromXML(FileSystem::ReadStreamToString(file.get()));
|
||||
LoadCompatibilityListFromXML(ByteStream::ReadStreamToString(file.get()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1011,7 +1011,7 @@ void GameList::LoadGameSettings()
|
||||
g_host_interface->OpenPackageFile("database/gamesettings.ini", BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
if (file)
|
||||
{
|
||||
m_game_settings.Load(FileSystem::ReadStreamToString(file.get()));
|
||||
m_game_settings.Load(ByteStream::ReadStreamToString(file.get()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1023,9 +1023,9 @@ void GameList::LoadGameSettings()
|
||||
if (!m_user_game_settings_filename.empty() && FileSystem::FileExists(m_user_game_settings_filename.c_str()))
|
||||
{
|
||||
std::unique_ptr<ByteStream> file =
|
||||
FileSystem::OpenFile(m_user_game_settings_filename.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
ByteStream::OpenFile(m_user_game_settings_filename.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||
if (file)
|
||||
m_game_settings.Load(FileSystem::ReadStreamToString(file.get()));
|
||||
m_game_settings.Load(ByteStream::ReadStreamToString(file.get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user