mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-29 08:15:35 +00:00
Fix Windows save & load.
This commit is contained in:
parent
c3f350e3fb
commit
c241405d91
3 changed files with 9 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
#include <OgreRoot.h>
|
#include <OgreRoot.h>
|
||||||
#include <OgreRenderWindow.h>
|
#include <OgreRenderWindow.h>
|
||||||
|
|
||||||
|
@ -339,8 +340,10 @@ std::string OMW::Engine::loadSettings (Settings::Manager & settings)
|
||||||
|
|
||||||
void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
{
|
{
|
||||||
|
boost::filesystem::path saves(mCfgMgr.getUserDataPath() / "saves");
|
||||||
|
|
||||||
mEnvironment.setStateManager (
|
mEnvironment.setStateManager (
|
||||||
new MWState::StateManager (mCfgMgr.getUserDataPath() / "saves", mContentFiles.at (0)));
|
new MWState::StateManager (saves.make_preferred(), mContentFiles.at (0)));
|
||||||
|
|
||||||
Nif::NIFFile::CacheLock cachelock;
|
Nif::NIFFile::CacheLock cachelock;
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
||||||
else
|
else
|
||||||
slot = mCharacterManager.getCurrentCharacter()->updateSlot (slot, profile);
|
slot = mCharacterManager.getCurrentCharacter()->updateSlot (slot, profile);
|
||||||
|
|
||||||
std::ofstream stream (slot->mPath.string().c_str());
|
std::ofstream stream (slot->mPath.string().c_str(), std::ios::binary);
|
||||||
|
|
||||||
ESM::ESMWriter writer;
|
ESM::ESMWriter writer;
|
||||||
|
|
||||||
|
|
|
@ -80,8 +80,8 @@ namespace ESM
|
||||||
rec.name = name;
|
rec.name = name;
|
||||||
rec.position = mStream->tellp();
|
rec.position = mStream->tellp();
|
||||||
rec.size = 0;
|
rec.size = 0;
|
||||||
writeT<int>(0); // Size goes here
|
writeT<uint32_t>(0); // Size goes here
|
||||||
writeT<int>(0); // Unused header?
|
writeT<uint32_t>(0); // Unused header?
|
||||||
writeT(flags);
|
writeT(flags);
|
||||||
mRecords.push_back(rec);
|
mRecords.push_back(rec);
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ namespace ESM
|
||||||
rec.name = name;
|
rec.name = name;
|
||||||
rec.position = mStream->tellp();
|
rec.position = mStream->tellp();
|
||||||
rec.size = 0;
|
rec.size = 0;
|
||||||
writeT<int>(0); // Size goes here
|
writeT<uint32_t>(0); // Size goes here
|
||||||
mRecords.push_back(rec);
|
mRecords.push_back(rec);
|
||||||
|
|
||||||
assert(mRecords.back().size == 0);
|
assert(mRecords.back().size == 0);
|
||||||
|
@ -120,7 +120,7 @@ namespace ESM
|
||||||
mStream->seekp(rec.position);
|
mStream->seekp(rec.position);
|
||||||
|
|
||||||
mCounting = false;
|
mCounting = false;
|
||||||
write (reinterpret_cast<const char*> (&rec.size), sizeof(int));
|
write (reinterpret_cast<const char*> (&rec.size), sizeof(uint32_t));
|
||||||
mCounting = true;
|
mCounting = true;
|
||||||
|
|
||||||
mStream->seekp(0, std::ios::end);
|
mStream->seekp(0, std::ios::end);
|
||||||
|
|
Loading…
Reference in a new issue