diff --git a/source/lib/file/archive/archive_zip.cpp b/source/lib/file/archive/archive_zip.cpp index a6e011a51a..d68f4cc9bb 100644 --- a/source/lib/file/archive/archive_zip.cpp +++ b/source/lib/file/archive/archive_zip.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -336,7 +336,7 @@ public: return m_file->Pathname(); } - Status Load(const OsPath& /*name*/, const std::shared_ptr& buf, size_t size) const override + Status Load(const OsPath& /*name*/, const std::span buffer) const override { AdjustOffset(); @@ -354,7 +354,7 @@ public: } Stream stream(codec); - stream.SetOutputBuffer(buf.get(), size); + stream.SetOutputBuffer(buffer.data(), buffer.size()); io::Operation op(*m_file.get(), 0, m_csize, m_ofs); StreamFeeder streamFeeder(stream); RETURN_STATUS_IF_ERR(io::Run(op, io::Parameters(), streamFeeder)); diff --git a/source/lib/file/common/file_loader.h b/source/lib/file/common/file_loader.h index 54126a990a..57983769f0 100644 --- a/source/lib/file/common/file_loader.h +++ b/source/lib/file/common/file_loader.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -29,6 +29,7 @@ #include #include +#include struct IFileLoader { @@ -38,7 +39,7 @@ struct IFileLoader virtual wchar_t LocationCode() const = 0; virtual const OsPath& Path() const = 0; - virtual Status Load(const OsPath& name, const std::shared_ptr& buf, size_t size) const = 0; + virtual Status Load(const OsPath& name, const std::span buffer) const = 0; }; typedef std::shared_ptr PIFileLoader; diff --git a/source/lib/file/common/real_directory.cpp b/source/lib/file/common/real_directory.cpp index 82015b9f64..ecd362534f 100644 --- a/source/lib/file/common/real_directory.cpp +++ b/source/lib/file/common/real_directory.cpp @@ -48,9 +48,9 @@ RealDirectory::RealDirectory(const OsPath& path, size_t priority, size_t flags) } -/*virtual*/ Status RealDirectory::Load(const OsPath& name, const std::shared_ptr& buf, size_t size) const +/*virtual*/ Status RealDirectory::Load(const OsPath& name, const std::span buffer) const { - return io::Load(m_path / name, buf.get(), size); + return io::Load(m_path / name, buffer.data(), buffer.size()); } diff --git a/source/lib/file/common/real_directory.h b/source/lib/file/common/real_directory.h index 70cf69fb27..4be7b9b963 100644 --- a/source/lib/file/common/real_directory.h +++ b/source/lib/file/common/real_directory.h @@ -57,7 +57,7 @@ public: { return m_path; } - Status Load(const OsPath& name, const std::shared_ptr& buf, size_t size) const override; + Status Load(const OsPath& name, const std::span buffer) const override; Status Store(const OsPath& name, std::span fileContents); diff --git a/source/lib/file/vfs/tests/test_vfs_tree.h b/source/lib/file/vfs/tests/test_vfs_tree.h index 62a58b6a18..0a2c6cea13 100644 --- a/source/lib/file/vfs/tests/test_vfs_tree.h +++ b/source/lib/file/vfs/tests/test_vfs_tree.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -45,7 +45,7 @@ public: size_t Precedence() const override { return m_Precedence; } wchar_t LocationCode() const override { return L'\0'; } const OsPath& Path() const override { return m_Path; } - Status Load(const OsPath& /*name*/, const std::shared_ptr& /*buf*/, size_t /*size*/) const override + Status Load(const OsPath& /*name*/, const std::span) const override { return INFO::OK; } diff --git a/source/lib/file/vfs/vfs.cpp b/source/lib/file/vfs/vfs.cpp index 5ded64449c..23acd75f17 100644 --- a/source/lib/file/vfs/vfs.cpp +++ b/source/lib/file/vfs/vfs.cpp @@ -172,7 +172,7 @@ public: size = file->Size(); RETURN_STATUS_IF_ERR(AllocateAligned(fileContents, size, maxSectorSize)); - RETURN_STATUS_IF_ERR(file->Loader()->Load(file->Name(), fileContents, file->Size())); + RETURN_STATUS_IF_ERR(file->Loader()->Load(file->Name(), {fileContents.get(), file->Size()})); stats_io_user_request(size); m_trace->NotifyLoad(pathname, size); diff --git a/source/ps/SavedGame.cpp b/source/ps/SavedGame.cpp index 2beb46a742..ee8d3c6151 100644 --- a/source/ps/SavedGame.cpp +++ b/source/ps/SavedGame.cpp @@ -208,13 +208,13 @@ public: { std::string buffer; buffer.resize(fileInfo.Size()); - WARN_IF_ERR(archiveFile->Load("", DummySharedPtr((u8*)buffer.data()), buffer.size())); + WARN_IF_ERR(archiveFile->Load("", {reinterpret_cast(buffer.data()), buffer.size()})); Script::ParseJSON(Script::Request(m_ScriptInterface), buffer, &m_Metadata); } else if (pathname == L"simulation.dat" && m_SavedState) { m_SavedState->resize(fileInfo.Size()); - WARN_IF_ERR(archiveFile->Load("", DummySharedPtr((u8*)m_SavedState->data()), m_SavedState->size())); + WARN_IF_ERR(archiveFile->Load("", {reinterpret_cast(m_SavedState->data()), m_SavedState->size()})); } }