forked from leiizko/cod4x_lua_plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.h
More file actions
82 lines (66 loc) · 2.29 KB
/
main.h
File metadata and controls
82 lines (66 loc) · 2.29 KB
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
#ifndef MAIN_H
#define MAIN_H
#include "../pinc.h"
#include "inc/lua.h"
#include "inc/lualib.h"
#include "inc/lauxlib.h"
#include <stdlib.h>
#ifdef _WIN32
#include <memoryapi.h>
#else
#include <sys/mman.h>
#endif
#define ALIGNMENT 0x1000
#define MAX_FUNCTIONS 0x40
#define STUB_SIZE 0x20
#define PLUGIN_VERSION_MAJOR 0
#define PLUGIN_VERSION_MINOR 2
typedef unsigned int long DWORD;
static lua_State *LuaVM;
static char *AllocMem = NULL;
static int definedFunctions = 0;
void Global_LuaHandler( char *funcName );
void registerFunctionsToLua();
static int Lua_TraceBack( lua_State* L );
static int Plugin_Lua_pcall( lua_State* L, int nargs, int nret );
// Register functions
static int Lua_Cmd_AddCommand( lua_State *L );
static int Lua_ScrAddFunction( lua_State *L );
// Add functions
static int Lua_Scr_AddEntity( lua_State *L );
static int Lua_Scr_AddInt( lua_State *L );
static int Lua_Scr_AddFloat( lua_State *L );
static int Lua_Scr_AddBool( lua_State *L );
static int Lua_Scr_AddString( lua_State *L );
static int Lua_Scr_AddUndefined( lua_State *L );
static int Lua_Scr_AddVector( lua_State *L );
static int Lua_Scr_AddArray( lua_State *L );
static int Lua_Scr_MakeArray( lua_State *L );
static int Lua_Scr_AddArrayKeys( lua_State *L );
// Script threads
static int Lua_Scr_ExecEntThread( lua_State *L );
static int Lua_Scr_ExecThread( lua_State *L );
static int Lua_Scr_FreeThread( lua_State *L );
// Get functions
static int Lua_Scr_GetNumParam( lua_State *L );
static int Lua_Scr_GetInt( lua_State *L );
static int Lua_Scr_GetFloat( lua_State *L );
static int Lua_Scr_GetString( lua_State *L );
static int Lua_Scr_GetEntity( lua_State *L );
static int Lua_Scr_GetType( lua_State *L );
static int Lua_Scr_GetVector( lua_State *L );
static int Lua_Cmd_Argv( lua_State *L );
static int Lua_Cmd_Argc( lua_State *L );
// Utility
static int Lua_Printf( lua_State *L );
static int Lua_DPrintf( lua_State *L );
static int Lua_GetPluginVersion( lua_State *L );
static int Lua_GetMilliseconds( lua_State *L );
static int Lua_Scr_Error( lua_State *L );
static int Lua_Scr_ParamError( lua_State *L );
static int Lua_Scr_ObjectError( lua_State *L );
static int Lua_Error( lua_State *L );
void *aligned_malloc( int size, int ALIGN );
char *AllocStub( char *funcName );
DWORD SetCall(DWORD addr, void* destination);
#endif // MAIN_H