mirror of
https://github.com/ModOrganizer2/modorganizer-game_fallout76.git
synced 2026-07-27 14:08:28 -07:00
added savegame interface
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#include "fallout4savegame.h"
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
Fallout4SaveGame::Fallout4SaveGame(QString const &fileName) :
|
||||
GamebryoSaveGame(fileName)
|
||||
{
|
||||
FileWrapper file(this, "FO4_SAVEGAME");
|
||||
file.skip<unsigned long>(); // header size
|
||||
file.skip<unsigned long>(); // header version
|
||||
file.read(m_SaveNumber);
|
||||
|
||||
file.read(m_PCName);
|
||||
|
||||
unsigned long temp;
|
||||
file.read(temp);
|
||||
m_PCLevel = static_cast<unsigned short>(temp);
|
||||
file.read(m_PCLocation);
|
||||
|
||||
QString ignore;
|
||||
file.read(ignore); // playtime as ascii hh.mm.ss
|
||||
file.read(ignore); // race name (i.e. BretonRace)
|
||||
|
||||
file.skip<unsigned short>(); // Player gender (0 = male)
|
||||
file.skip<float>(2); // experience gathered, experience required
|
||||
|
||||
FILETIME ftime;
|
||||
file.read(ftime);
|
||||
//A file time is a 64-bit value that represents the number of 100-nanosecond
|
||||
//intervals that have elapsed since 12:00 A.M. January 1, 1601 Coordinated Universal Time (UTC).
|
||||
//So we need to convert that to something useful
|
||||
SYSTEMTIME ctime;
|
||||
::FileTimeToSystemTime(&ftime, &ctime);
|
||||
|
||||
setCreationTime(ctime);
|
||||
|
||||
file.readImage(384, true);
|
||||
|
||||
file.skip<unsigned char>(); // form version
|
||||
file.read(ignore); // game version
|
||||
file.skip<unsigned long>(); // plugin info size
|
||||
|
||||
file.readPlugins();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef FALLOUT4SAVEGAME_H
|
||||
#define FALLOUT4SAVEGAME_H
|
||||
|
||||
#include "gamebryosavegame.h"
|
||||
|
||||
class Fallout4SaveGame : public GamebryoSaveGame
|
||||
{
|
||||
public:
|
||||
Fallout4SaveGame(QString const &fileName);
|
||||
};
|
||||
|
||||
#endif // FALLOUT4SAVEGAME_H
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "fallout4savegameinfo.h"
|
||||
|
||||
#include "fallout4savegame.h"
|
||||
|
||||
const MOBase::ISaveGame *Fallout4SaveGameInfo::getSaveGameInfo(const QString &file) const
|
||||
{
|
||||
return new Fallout4SaveGame(file);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef SKYRIMSAVEGAMEINFO_H
|
||||
#define SKYRIMSAVEGAMEINFO_H
|
||||
|
||||
#include "savegameinfo.h"
|
||||
|
||||
class Fallout4SaveGameInfo : public SaveGameInfo
|
||||
{
|
||||
public:
|
||||
virtual MOBase::ISaveGame const *getSaveGameInfo(QString const &file) const override;
|
||||
};
|
||||
|
||||
#endif // SKYRIMSAVEGAMEINFO_H
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "fallout4dataarchives.h"
|
||||
#include "fallout4scriptextender.h"
|
||||
#include "fallout4savegameinfo.h"
|
||||
#include <scopeguard.h>
|
||||
#include <pluginsetting.h>
|
||||
#include "iplugingame.h"
|
||||
@@ -30,6 +31,7 @@ bool GameFallout4::init(IOrganizer *moInfo)
|
||||
m_ScriptExtender = std::shared_ptr<ScriptExtender>(new Fallout4ScriptExtender(this));
|
||||
m_DataArchives = std::shared_ptr<DataArchives>(new Fallout4DataArchives());
|
||||
m_LocalSavegames.reset(new GamebryoLocalSavegames(myGamesPath(), "Fallout4.ini"));
|
||||
m_SaveGameInfo = std::shared_ptr<SaveGameInfo>(new Fallout4SaveGameInfo());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user