-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExplorerFile.h
71 lines (58 loc) · 1.76 KB
/
ExplorerFile.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
70
71
// ExplorerFile.h: interface for the CExplorerFile class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_EXPLORERFILE_H__EFA8EFCE_76FE_4767_95EB_D107D5FC14B4__INCLUDED_)
#define AFX_EXPLORERFILE_H__EFA8EFCE_76FE_4767_95EB_D107D5FC14B4__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CExplorerFile
{
public:
int GenerateTapfile(char ** _buff, bool headerless = false);
int GenerateBinfile(char ** _buff);
typedef enum
{
TAPFILE,
TAPFILE_HEADERLESS,
BINFILE
} TEXTRACTABLE_FORMATS;
typedef enum
{
PROGRAM = 0,
NUMBER_ARRAY = 1,
CHARACTER_ARRAY = 2,
CODE = 3
} TFILETYPE;
#pragma pack(push, 1)
typedef struct {
WORD blocksize;
BYTE flag;
} T_TAPFILE_BASE;
typedef struct {
T_TAPFILE_BASE base;
BYTE type;
char filename[10];
WORD filesize;
WORD param1;
WORD param2;
BYTE checksum;
} T_TAPFILE_HEADER;
#pragma pack(pop)
void AddData(char * _data, int _datasize);
CExplorerFile(std::string _filename, char * _data = NULL, int _size = 0, TFILETYPE _type = CODE, WORD _param1 = 0, WORD _param2 = 0);
virtual ~CExplorerFile();
void SetType(TFILETYPE _type) {m_type = _type;};
void SetParam1(TFILETYPE _p1) {m_param1 = _p1;};
void SetParam2(TFILETYPE _p2) {m_param2 = _p2;};
void SetFilename(std::string _fn) {m_strFilename = _fn;};
class EExplorerFile : public std::runtime_error {public: EExplorerFile(const std::string &what_arg) : std::runtime_error(what_arg) {};};
protected:
std::string m_strFilename;
std::vector<char> m_vData;
TFILETYPE m_type;
WORD m_param1;
WORD m_param2;
char * m_tapfile;
};
#endif // !defined(AFX_EXPLORERFILE_H__EFA8EFCE_76FE_4767_95EB_D107D5FC14B4__INCLUDED_)