-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathKObject.cpp
More file actions
77 lines (64 loc) · 1.72 KB
/
KObject.cpp
File metadata and controls
77 lines (64 loc) · 1.72 KB
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 "KObject.h"
#include "File.h"
#include <cstdlib>
std::unordered_map<CKObject*, int> CKObject::refCounts;
std::unordered_map<CKObject*, int> CKObject::objIdMap;
std::set<std::pair<int, int>> CKUnknown::hits;
bool CKUnknown::isSubclassOfID(uint32_t fid)
{
return false;
}
int CKUnknown::getClassCategory()
{
return clCategory;
}
int CKUnknown::getClassID()
{
return clId;
}
const char * CKUnknown::getClassName()
{
return "?";
}
std::span<const int> CKUnknown::getClassHierarchy()
{
return std::span<const int>();
}
void CKUnknown::deserialize(KEnvironment* kenv, File * file, size_t length) {
this->mem.resize(length);
this->offset = (uint32_t)file->tell();
if (length > 0) {
file->read(this->mem.data(), this->mem.size());
}
}
void CKUnknown::serialize(KEnvironment* kenv, File * file) {
if (this->mem.size() > 0) {
file->write(this->mem.data(), this->mem.size());
}
}
void CKUnknown::deserializeLvlSpecific(KEnvironment * kenv, File * file, size_t length)
{
this->lsMem.resize(length);
this->lvlSpecificOffset = (uint32_t)file->tell();
if (length > 0) {
file->read(this->lsMem.data(), this->lsMem.size());
}
}
void CKUnknown::serializeLvlSpecific(KEnvironment * kenv, File * file)
{
if (this->lsMem.size() > 0) {
file->write(this->lsMem.data(), this->lsMem.size());
}
}
CKUnknown::CKUnknown(const CKUnknown& another) = default;
void CKObject::deserialize(KEnvironment * kenv, File * file, size_t length)
{
printf("Deserialization unimplemented, skipping\n");
file->seek(length, SEEK_CUR);
}
void CKObject::serialize(KEnvironment* kenv, File * file)
{
printf("Serialization unimplemented, writing random stuff\n");
const char *stuff = "Unimplemented, please fix this! ;)";
file->write(stuff, strlen(stuff));
}