-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathADSFile.h
69 lines (53 loc) · 1.71 KB
/
ADSFile.h
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
#ifndef ADSFILE_H
#define ADSFILE_H
#include "CompressedBaseFile.h"
#include <map>
#include <tuple>
namespace SCRANTIC {
class ADSFile : public CompressedBaseFile
{
private:
void parseRawScript();
void findLabels();
void parseFile(v8 &data);
std::map<u16, std::string> mnemonics;
int getParamCount(u16 opcode);
u16 getOpcodeFromMnemonic(std::string &mnemonic);
void initMnemonics();
std::string getMnemoic(Command c);
protected:
u32 verSize;
std::string version;
u16 resScrTagSize;
u16 magic;
u32 resSize;
u16 resCount;
std::map<u16, std::string> resList;
v8 rawScript;
u32 tagSize;
u16 tagCount;
std::map<u16, std::multimap<std::pair<u16, u16>, size_t> > labels;
std::map<u16, std::vector<Command> > script;
std::map<u16, std::map<u16, std::vector<size_t>>> labelsAfter;
std::map<u16, std::map<u16, std::vector<size_t>>> labelsTogether;
#ifdef DUMP_ADS
friend class Robinson;
#endif
public:
std::map<u16, std::string> tagList;
ADSFile(const std::string &name, v8 &data);
explicit ADSFile(const std::string &filename);
std::string getResource(u16 num);
v8 repackIntoResource() override;
void saveFile(const std::string &path) override;
std::vector<Command> getBlockAfterMovie(u16 movie, u16 hash, u16 num = 0);
std::vector<Command> getBlockTogetherWithMovie(u16 movie, u16 hash, u16 num = 0);
std::vector<Command> getInitialBlock(u16 movie);
size_t getLabelCountAfter(u16 movie, u16 hash);
size_t getLabelCountTogether(u16 movie, u16 hash);
u16 getMovieNumberFromOrder(size_t pos);
size_t getMoviePosFromNumber(u16 number);
static u16 makeHash(u16 ttm, u16 scene);
};
}
#endif // ADSFILE_H