mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 09:09:43 +00:00
Merge branch 'Get-Skyrimesm-Loading' into 'master'
Load esm files from vfs See merge request OpenMW/openmw!2756
This commit is contained in:
commit
ee41151520
4 changed files with 14 additions and 5 deletions
|
@ -42,6 +42,7 @@
|
|||
Bug #7122: Teleportation to underwater should cancel active water walking effect
|
||||
Bug #7163: Myar Aranath: Wheat breaks the GUI
|
||||
Bug #7172: Current music playlist continues playing indefinitely if next playlist is empty
|
||||
Bug #7243: Get Skyrim.esm loading
|
||||
Feature #5492: Let rain and snow collide with statics
|
||||
Feature #6447: Add LOD support to Object Paging
|
||||
Feature #6726: Lua API for creating new objects
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#include <components/esm4/reader.hpp>
|
||||
#include <components/files/conversion.hpp>
|
||||
#include <components/files/openfile.hpp>
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
|
@ -60,7 +63,8 @@ namespace MWWorld
|
|||
}
|
||||
case ESM::Format::Tes4:
|
||||
{
|
||||
ESM4::Reader readerESM4(std::move(stream), filepath);
|
||||
ESM4::Reader readerESM4(
|
||||
std::move(stream), filepath, MWBase::Environment::get().getResourceSystem()->getVFS());
|
||||
auto statelessEncoder = mEncoder->getStatelessEncoder();
|
||||
readerESM4.setEncoder(&statelessEncoder);
|
||||
mStore.loadESM4(readerESM4);
|
||||
|
|
|
@ -74,8 +74,9 @@ namespace ESM4
|
|||
subRecordHeader.dataSize = 0;
|
||||
}
|
||||
|
||||
Reader::Reader(Files::IStreamPtr&& esmStream, const std::filesystem::path& filename)
|
||||
: mEncoder(nullptr)
|
||||
Reader::Reader(Files::IStreamPtr&& esmStream, const std::filesystem::path& filename, VFS::Manager const* vfs)
|
||||
: mVFS(vfs)
|
||||
, mEncoder(nullptr)
|
||||
, mFileSize(0)
|
||||
, mStream(std::move(esmStream))
|
||||
{
|
||||
|
@ -224,7 +225,8 @@ namespace ESM4
|
|||
sp.type = stringType;
|
||||
|
||||
// TODO: possibly check if the resource exists?
|
||||
Files::IStreamPtr filestream = Files::openConstrainedFileStream(stringFile);
|
||||
Files::IStreamPtr filestream
|
||||
= mVFS ? mVFS->get(stringFile.string()) : Files::openConstrainedFileStream(stringFile);
|
||||
|
||||
filestream->seekg(0, std::ios::end);
|
||||
std::size_t fileSize = filestream->tellg();
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "loadtes4.hpp"
|
||||
|
||||
#include <components/files/istreamptr.hpp>
|
||||
#include <components/vfs/manager.hpp>
|
||||
|
||||
namespace ToUTF8
|
||||
{
|
||||
|
@ -83,6 +84,7 @@ namespace ESM4
|
|||
|
||||
class Reader
|
||||
{
|
||||
VFS::Manager const* mVFS;
|
||||
Header mHeader; // ESM4 header
|
||||
|
||||
ReaderContext mCtx;
|
||||
|
@ -138,7 +140,7 @@ namespace ESM4
|
|||
const ToUTF8::StatelessUtf8Encoder* encoder, bool hasNull = false);
|
||||
|
||||
public:
|
||||
Reader(Files::IStreamPtr&& esmStream, const std::filesystem::path& filename);
|
||||
Reader(Files::IStreamPtr&& esmStream, const std::filesystem::path& filename, VFS::Manager const* vfs = nullptr);
|
||||
~Reader();
|
||||
|
||||
void open(const std::filesystem::path& filename);
|
||||
|
|
Loading…
Reference in a new issue