1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#include "falloutnvsavegame.h"
#include "gamefalloutnv.h"
FalloutNVSaveGame::FalloutNVSaveGame(QString const& fileName, GameFalloutNV const* game)
: GamebryoSaveGame(fileName, game)
{
FileWrapper file(getFilepath(), "FO3SAVEGAME");
uint32_t width, height;
fetchInformationFields(file, width, height, m_SaveNumber, m_PCName, m_PCLevel,
m_PCLocation);
}
void FalloutNVSaveGame::fetchInformationFields(FileWrapper& file, uint32_t& width,
uint32_t& height,
uint32_t& saveNumber,
QString& playerName,
unsigned short& playerLevel,
QString& playerLocation) const
{
file.skip<uint32_t>(); // Save header size
file.skip<uint32_t>(); // File version?
file.skip<unsigned char>(); // Delimiter
// A huge wodge of text with no length but a delimiter. Given the null bytes
// in it I presume it's fixed length (64 bytes + delim) but I have no
// definite spec
for (unsigned char ignore = 0; ignore != 0x7c;) {
file.read(ignore); // unknown
}
file.setHasFieldMarkers(true);
file.setPluginString(GamebryoSaveGame::StringType::TYPE_BZSTRING);
file.read(width);
file.read(height);
file.read(saveNumber);
file.read(playerName);
QString whatthis;
file.read(whatthis);
long level;
file.read(level);
playerLevel = level;
file.read(playerLocation);
}
std::unique_ptr<GamebryoSaveGame::DataFields> FalloutNVSaveGame::fetchDataFields() const
{
FileWrapper file(getFilepath(), "FO3SAVEGAME");
std::unique_ptr<DataFields> fields = std::make_unique<DataFields>();
uint32_t width, height;
{
QString dummyName, dummyLocation;
unsigned short dummyLevel;
uint32_t dummySaveNumber;
fetchInformationFields(file, width, height, dummySaveNumber, dummyName, dummyLevel,
dummyLocation);
}
QString playtime;
file.read(playtime);
fields->Screenshot = file.readImage(width, height, 256);
file.skip<char>(5); // unknown (1 byte), plugin size (4 bytes)
file.setPluginString(GamebryoSaveGame::StringType::TYPE_BSTRING);
fields->Plugins = file.readPlugins();
return fields;
}
|