-
Notifications
You must be signed in to change notification settings - Fork 2
/
FA_def.h
159 lines (134 loc) · 4.37 KB
/
FA_def.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
#ifndef __FA_DEF__H__
#define __FA_DEF__H__
#include <stdint.h>
#include <windef.h>
#ifndef BYTE
#define BYTE unsigned char
#endif
#ifndef WORD
#define WORD uint16_t
#endif
/** MOD Type **/
#define FA_MOD_TYPE_CALL 0
#define FA_MOD_TYPE_JUMP 1
#define FA_MOD_TYPE_WRITE 2
#define FA_MOD_TYPE_NOP 3
#define FA_MOD_TYPE_BYTE 4
#define FA_MOD_TYPE_DETOUR 10
#define FA_ARRAYSIZE(T) (sizeof(T)/sizeof((T)[0]))
#define FA_VERSION "0.1alpha"
#define FA_MAXPATH 1024
#define FA_EXPORT __declspec(dllexport)
/** Call Convention */
#if defined(__GNUC__)
#define FA_FASTCALL __attribute__((fastcall))
#define FA_STDCALL __attribute__((stdcall))
#define FA_CDECL __attribute__((cdecl))
#define FA_THISCALL __attribute__((thiscall))
#define FA_INLINE inline
#elif defined(_MSC_VER)
#define FA_FASTCALL __fastcall
#define FA_STDCALL __stdcall
#define FA_CDECL __cdecl
#define FA_THISCALL __thiscall
#define FA_NAKED _declspec(naked)
#endif
/** FA SOD DEFINE **/
//基址
#define FA_ADDR_BASE 0x699538
//Mouse Manager
#define FA_ADDR_MOUSEMGR 0x6992B0
//Hero Levelup Exp After 12
#define FA_ADDR_HERO_LVUPEXP12 0x63AC20
#define FA_ADDR_SSKILL_NAME_BASE 0x67DCF0
#define FA_ADDR_SSKILL_LV_NAME_BASE 0x6A75D4
//GAMETYPE
#define FA_ADDR_GAMETYPE 0x698A40
#define FA_ADDR_GAMELEVEL 0x6834A4 //[0-4] 80~200%
#define FA_GAMETYPE_SINGLE 0
#define FA_GAMETYPE_HOTSEAT 3
//MessageBox
#define FA_MESSAGEBOX_YES 0x7805
#define FA_MESSAGEBOX_NO 0x7806
//Sec skills
#define FA_SSKILL_MYSTICISM_TABLE 0x63E9C8
#define FA_SSKILL_OFFENCE_TABLE 0x63E9F8
#define FA_SSKILL_ARMORER_TABLE 0x63EA08
#define FA_SSKILL_RESISTANCE_TABLE 0x63EA48
//DLG
#define FA_DLG_BUYBOAT_VTABLE 0x643918
#define FA_DLG_HEROINFO_VTABLE 0x63eAE8
#define FA_DLG_SYSOPTIONS_VTABLE 0x642478
//LOD 最大LOD数量
#define FA_MAX_LOD 8
//Artifact 最大宝物数量
#define H3_MAX_ARTIFACT 0x90
#define FA_MAX_ARTIFACT 255
//ComboArtifact 最大组合宝物数量
#define H3_MAX_COMBOARTIFACT 12
#define FA_MAX_COMBOARTIFACT 48
/** FA ASM FUNCTION **/
//Get Register Point
#if defined(__GNUC__)
#define FA_EAX(val) __asm__ __volatile__ ("movl %%eax, %0" : "=m"(val));
#define FA_EBX(val) __asm__ __volatile__ ("movl %%ebx, %0" : "=m"(val));
#define FA_ECX(val) __asm__ __volatile__ ("movl %%ecx, %0" : "=m"(val));
#define FA_EDX(val) __asm__ __volatile__ ("movl %%edx, %0" : "=m"(val));
#define FA_EBP(val) __asm__ __volatile__ ("movl %%ebp, %0" : "=m"(val));
#define FA_EDI(val) __asm__ __volatile__ ("movl %%edi, %0" : "=m"(val));
#define FA_ESI(val) __asm__ __volatile__ ("movl %%esi, %0" : "=m"(val));
#define FA_SET_EAX(val) __asm__ __volatile__ ("movl %0, %%eax" : "=m"(val));
#define FA_SET_EBX(val) __asm__ __volatile__ ("movl %0, %%ebx" : "=m"(val));
#define FA_SET_ECX(val) __asm__ __volatile__ ("movl %0, %%ecx" : "=m"(val));
#define FA_SET_ESI(val) __asm__ __volatile__ ("movl %0, %%esi" : "=m"(val));
//jmp use register ebx
#define FA_JMP_B(addr, esp) \
do{ \
DWORD __jmp_addr_ = addr; \
__asm __volatile__ ( \
"movl %0, %%ebx \n" \
: "=m"(__jmp_addr_) \
); \
__asm __volatile__ ( \
"leave \n" \
); \
__asm __volatile__ ( \
"add $"#esp", %esp \n" \
); \
__asm __volatile__ ( \
"jmp *%ebx \n" \
); \
}while(0)
//jmp use register edx(recomend)
#define FA_JMP_D(addr, esp) \
do{ \
DWORD __jmp_addr_ = addr; \
__asm __volatile__ ( \
"movl %0, %%edx \n" \
: "=m"(__jmp_addr_) \
); \
__asm __volatile__ ( \
"leave \n" \
); \
__asm __volatile__ ( \
"add $"#esp", %esp \n" \
); \
__asm __volatile__ ( \
"jmp *%edx \n" \
); \
}while(0)
#elif defined(_MSC_VER)
#define FA_EAX(val) __asm mov val, eax
#define FA_EBX(val) __asm mov val, ebx
#define FA_ECX(val) __asm mov val, ecx
#define FA_EDX(val) __asm mov val, edx
#define FA_ESI(val) __asm mov val, esi
#define FA_EDI(val) __asm mov val, edi
#define FA_EBP(val) __asm mov val, ebp
#define FA_SET_EAX(val) __asm mov eax, val
#endif
//Get Value From Point Macro not support string
#define FA_GET_PV(type, point) (*((type *)(point)))
//Save Value To Point Macro not support string
#define FA_SET_PV(type, point, val) (*((type *)(point)) = (type)val)
#endif