-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.h
166 lines (140 loc) · 3.37 KB
/
types.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/******************************************************************************
Project: MicroMacro
Author: SolarStrike Software
URL: www.solarstrike.net
License: Modified BSD (see license.txt)
******************************************************************************/
#ifndef TYPES_H
#define TYPES_H
#include <string>
#include <vector>
#include <queue>
#include "wininclude.h"
#include "mutex.h"
struct sqlite3;
namespace MicroMacro
{
enum Multivar_type{VT_NUMBER, VT_STRING, VT_NIL};
enum BatchJob_type{MEM_BYTE, MEM_UBYTE, MEM_SHORT, MEM_USHORT, MEM_INT, MEM_UINT,
MEM_INT64, MEM_UINT64, MEM_FLOAT, MEM_DOUBLE, MEM_STRING, MEM_SKIP};
typedef unsigned int ALuint;
class Event;
struct WindowInfo
{
std::string name;
std::string classname;
HWND hwnd;
};
/* Used in window.findList() */
struct EnumWindowListInfo
{
std::vector<WindowInfo> windows;
std::string name;
std::string classname;
};
/* Holds a handle to a process and any extra info about an open process */
struct ProcHandle
{
HANDLE handle;
bool is32bit;
};
/* Currently has no use */
/*
struct WindowDCPair
{
HWND hwnd;
HDC hdc;
};*/
/* Describes a memory read job (type and length) */
struct BatchJob
{
unsigned int count;
BatchJob_type type;
BatchJob &operator=(const BatchJob &);
};
/* Used to load and play sound */
struct AudioResource
{
ALuint buffer;
ALuint source;
};
/* Holds data read from a process */
struct MemoryChunk
{
size_t address;
size_t size;
char *data;
};
/* Holds SQLite3 database info */
struct SQLiteDb
{
sqlite3 *db;
bool opened;
};
struct SQLField
{
std::string name;
std::string value;
};
struct SQLResult
{
std::vector<SQLField> fields;
};
template <class T>
T getChunkVariable(MemoryChunk *pChunk, unsigned int offset, int &err)
{
err = 0;
if( (offset+sizeof(T)) > pChunk->size )
{
err = -1;
return (T)0;
}
return *(T*)(pChunk->data+offset);
}
std::string getChunkString(MemoryChunk *pChunk, size_t offset, size_t length, int &err);
struct Vector3d
{
double x; double y; double z;
Vector3d() : x(0), y(0), z(0) { };
Vector3d(double _x, double _y, double _z) : x(_x), y(_y), z(_z) { };
Vector3d &operator=(const Vector3d &);
Vector3d operator+(const Vector3d &);
Vector3d operator-(const Vector3d &);
Vector3d operator*(const Vector3d &);
Vector3d operator*(double);
Vector3d operator/(const Vector3d &);
Vector3d operator/(double);
Vector3d cross(const Vector3d &);
double dot(const Vector3d &);
Vector3d normal();
double magnitude();
};
struct Quaternion
{
double w, x, y, z;
Quaternion() : w(1), x(0), y(0), z(0) {};
Quaternion(double _w, double _x, double _y, double _z) : w(_w), x(_x), y(_y), z(_z) {};
Quaternion(Vector3d &);
Quaternion(Vector3d &, double);
Quaternion &operator=(const Quaternion &);
Quaternion operator*(double);
Vector3d operator*(const Vector3d &);
Quaternion operator*(const Quaternion &);
Quaternion conjugate();
Quaternion normal();
};
#ifdef NETWORKING_ENABLED
struct Socket
{
SOCKET socket;
HANDLE hThread;
int protocol;
bool connected;
bool open;
std::queue<Event> eventQueue;
std::queue<std::string> recvQueue;
Mutex mutex;
};
#endif
} // End of namespace MicroMacro
#endif