-
Notifications
You must be signed in to change notification settings - Fork 0
/
speedcode.sh
64 lines (52 loc) · 1.06 KB
/
speedcode.sh
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
#ifndef __SPDC_H
#define __SPDC_H
#define RTS 0x60
.STRUCT speedcodepart
{ speedcodepart .ADDR; unsigned char*
size .BYTE; unsigned char
repeatcount .WORD; unsigned int
callback .ADDR; void (*callback)(unsigned int parameters[])
parameters .ADDR; unsigned int*
};
#define REPEATS C(z, ZREPEAT_IDX) C(y, YREPEAT_IDX) C(x, XREPEAT_IDX)\
C(part, PARTREPEAT_IDX)
enum
{
#define C(x,y) y,
REPEATS
NUMOFLOOPS
#undef C
};
struct speedcode
{
union
{
struct
{
#define C(x,y) unsigned int x;
REPEATS
#undef C
}index;
unsigned int arr[NUMOFLOOPS];
}repeat;
struct speedcodepart *codedefines;
};
#define COUNTERS C(partrepeat, PARTREPEATCOUNT_IDX) C(z,ZCOUNT_IDX) C(y,YCOUNT_IDX)\
C(x,XCOUNT_IDX) C(part, PARTCOUNT_IDX)
enum
{
#define C(x,y) y,
COUNTERS
INVALIDCOUNTER
#undef C
};
union speedcodecountersU{
#define C(x,y) unsigned int x;
struct
{
COUNTERS
}counters;
unsigned int index[INVALIDCOUNTER];
#undef C
};
int __fastcall__ create_speedcode(struct speedcode* speedcodedef, void(*dest)(void));