mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 17:26:38 +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 <boost/filesystem.hpp> | ||||
| #include <OgreRoot.h> | ||||
| #include <OgreRenderWindow.h> | ||||
| 
 | ||||
|  | @ -339,8 +340,10 @@ std::string OMW::Engine::loadSettings (Settings::Manager & settings) | |||
| 
 | ||||
| void OMW::Engine::prepareEngine (Settings::Manager & settings) | ||||
| { | ||||
| 	boost::filesystem::path saves(mCfgMgr.getUserDataPath() / "saves"); | ||||
| 	 | ||||
|     mEnvironment.setStateManager ( | ||||
|         new MWState::StateManager (mCfgMgr.getUserDataPath() / "saves", mContentFiles.at (0))); | ||||
|         new MWState::StateManager (saves.make_preferred(), mContentFiles.at (0))); | ||||
| 
 | ||||
|     Nif::NIFFile::CacheLock cachelock; | ||||
| 
 | ||||
|  |  | |||
|  | @ -176,7 +176,7 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot | |||
|     else | ||||
|         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; | ||||
| 
 | ||||
|  |  | |||
|  | @ -80,8 +80,8 @@ namespace ESM | |||
|         rec.name = name; | ||||
|         rec.position = mStream->tellp(); | ||||
|         rec.size = 0; | ||||
|         writeT<int>(0); // Size goes here
 | ||||
|         writeT<int>(0); // Unused header?
 | ||||
|         writeT<uint32_t>(0); // Size goes here
 | ||||
|         writeT<uint32_t>(0); // Unused header?
 | ||||
|         writeT(flags); | ||||
|         mRecords.push_back(rec); | ||||
| 
 | ||||
|  | @ -105,7 +105,7 @@ namespace ESM | |||
|         rec.name = name; | ||||
|         rec.position = mStream->tellp(); | ||||
|         rec.size = 0; | ||||
|         writeT<int>(0); // Size goes here
 | ||||
|         writeT<uint32_t>(0); // Size goes here
 | ||||
|         mRecords.push_back(rec); | ||||
| 
 | ||||
|         assert(mRecords.back().size == 0); | ||||
|  | @ -120,7 +120,7 @@ namespace ESM | |||
|         mStream->seekp(rec.position); | ||||
| 
 | ||||
|         mCounting = false; | ||||
|         write (reinterpret_cast<const char*> (&rec.size), sizeof(int)); | ||||
|         write (reinterpret_cast<const char*> (&rec.size), sizeof(uint32_t)); | ||||
|         mCounting = true; | ||||
| 
 | ||||
|         mStream->seekp(0, std::ios::end); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue