-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatch.h
69 lines (59 loc) · 1.99 KB
/
patch.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 PATCH_H_INCLUDED
#define PATCH_H_INCLUDED
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <windows.h>
#include "crc32.h"
#define INITT 1
#define CHECKK 2
#define APPLY 3
#define DONE 4
#define ERRORR 5
typedef struct {
unsigned long psize; // ðàçìåð ôàéëà ïîñëå ïðèìåíåíèÿ ïàò÷à
unsigned long osize; // ðàçìåð îðèãèíàëüíîãî ôàéëà
unsigned long crc32; // êîíòðîëüíàÿ ñóììà îðèãèíàëà
unsigned long packed; // åñëè óïàêîâàí, òî packed=ðàçìåð óïàêîâàííîãî ôàéëà, èíà÷å = 0
} FileInfo;
class PatchClass
{
private:
// PatchInfo *Pinfo; // çàãîëîâîê
char description[128]; // êðàòêîå îïèñàíèå ïàò÷à^M
unsigned long num; // êîëè÷åñòâî ôàéëîâ^M
unsigned char *mainbuf; // îñíîâíîé áóôåð
unsigned long offset; // ñìåùåíèå áóôåðà, íà âñÿêèé ñëó÷àé mainbuf íå òðîãàþ
unsigned long startoffset; // ñìåùåíèå íà÷àëà äàííûõ
unsigned char *srcbuf; // áóôåð
unsigned char *destbuf; // áóôåð
char regpath[128]; // ïóòü ê èãðå â ðååñòðå
char regkey[32]; // êëþ÷ â êîòîðîì õðàíèòñÿ ïóòü ê èãðå íà êîìïüþòåðå
char gamepath[256]; // ïóòü ê èãðå
char process; // òåêóùèé ïðîöåññ
int current; // òåêóùèé ôàéë
FileInfo FI; // òåêóùèé çàãîëîâîê
char currentpath[256]; // òåêóùèé ïóòü
bool nocrc; // îòêëþ÷èòü ïðîâåðêó CRC
bool patchanyway; // ñòàâèòü íå ñìîòðÿ íà íåñîîòâåòñòâèå ðàçìåðîâ
// HWND hwnd; // îêíî
void GetString(char *buf); // ñ÷èòûâàíèå ñòðîêè èç îñíîâíîãî áóôåðà, äëèíà ñòðîêè âìåñòå ñ çàâåðøàþùèì íîë¸ì - long
bool CheckNextCRC(); // ïðîâåðèèòü CRC ñëåäóþùåãî ôàéëà
bool PatchNext(); // ïàò÷èòü ñëåäóþùèé ôàéë
void abortProcess() { // ñáðîñ ïàðàìåòðîâ
process=0;
offset=startoffset;
current=0;
}
void createDiff(unsigned long size); // ïðèìåíèòü ïàò÷
public:
//PatchInfo *Pinfo;
PatchClass(unsigned char *buf);
bool getGamePath(char *buf);
char *getCurrentPath() { return currentpath; }
char *getTitle() { return description; }
char getProcess() { return process; }
bool check(char *path);
~PatchClass();
};
#endif // PATCH_H_INCLUDED