1
+ // AMXWrapper for .NET Core
2
+ // Copyright 2015-2023 Tim Potze and ported to .NET Core by github.com/michael-fa
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+
16
+ using System ;
17
+ using System . Runtime . InteropServices ;
18
+ using System . Text ;
19
+
20
+ namespace AMXWrapperCore
21
+ {
22
+ internal static class AMXCall
23
+ {
24
+ private const string Library = "amx32.dll" ;
25
+
26
+
27
+ [ DllImport ( Library , EntryPoint = "amx_Flags" ) ]
28
+ public static extern int Flags ( ref AMXStruct amx , out UInt16 flags ) ;
29
+
30
+ //[DllImport(library, EntryPoint = "amx_Callback")]
31
+ //public static extern int Callback(ref AMXStruct amx, int index, IntPtr result, AMXArgumentList parms);
32
+
33
+ [ DllImport ( Library , EntryPoint = "amx_Init" ) ]
34
+ public static extern int Init ( ref AMXStruct amx , IntPtr program ) ;
35
+
36
+ [ DllImport ( Library , EntryPoint = "amx_Cleanup" ) ]
37
+ public static extern int Cleanup ( ref AMXStruct amx ) ;
38
+
39
+ [ DllImport ( Library , EntryPoint = "amx_Clone" ) ]
40
+ public static extern int Clone ( ref AMXStruct amxClone , AMXStruct amxSource , IntPtr data ) ;
41
+
42
+ [ DllImport ( Library , EntryPoint = "amx_MemInfo" ) ]
43
+ public static extern int MemoryInfo ( ref AMXStruct amx , out long codesize , out long datasize , out long stackheap ) ;
44
+
45
+ [ DllImport ( Library , EntryPoint = "amx_NameLength" ) ]
46
+ public static extern int NameLength ( ref AMXStruct amx , out int length ) ;
47
+
48
+ [ DllImport ( Library , EntryPoint = "amx_NumNatives" ) ]
49
+ public static extern int NumberOfNatives ( ref AMXStruct amx , out int number ) ;
50
+
51
+ [ DllImport ( Library , EntryPoint = "amx_GetNative" ) ]
52
+ public static extern int GetNative ( ref AMXStruct amx , int index , StringBuilder name ) ;
53
+
54
+ [ DllImport ( Library , EntryPoint = "amx_FindNative" ) ]
55
+ public static extern int FindNative ( ref AMXStruct amx , string name , out int index ) ;
56
+
57
+ [ DllImport ( Library , EntryPoint = "amx_NumPublics" ) ]
58
+ public static extern int NumberOfPublics ( ref AMXStruct amx , out int number ) ;
59
+
60
+ [ DllImport ( Library , EntryPoint = "amx_GetPublic" ) ]
61
+ public static extern int GetPublic ( ref AMXStruct amx , int index , StringBuilder name , out IntPtr address ) ;
62
+
63
+ [ DllImport ( Library , EntryPoint = "amx_FindPublic" ) ]
64
+ public static extern int FindPublic ( ref AMXStruct amx , string name , out int index ) ;
65
+
66
+ [ DllImport ( Library , EntryPoint = "amx_NumPubVars" ) ]
67
+ public static extern int NumberOfPublicVars ( ref AMXStruct amx , out int number ) ;
68
+
69
+ [ DllImport ( Library , EntryPoint = "amx_GetPubVar" ) ]
70
+ public static extern int GetPublicVar ( ref AMXStruct amx , int index , StringBuilder name , out IntPtr address ) ;
71
+
72
+ [ DllImport ( Library , EntryPoint = "amx_FindPubVar" ) ]
73
+ public static extern int FindPublicVar ( ref AMXStruct amx , string name , out IntPtr address ) ;
74
+
75
+ [ DllImport ( Library , EntryPoint = "amx_NumTags" ) ]
76
+ public static extern int NumberOfTags ( ref AMXStruct amx , out int number ) ;
77
+
78
+ [ DllImport ( Library , EntryPoint = "amx_GetTag" ) ]
79
+ public static extern int GetTag ( ref AMXStruct amx , int index , StringBuilder tagname , out Int32 tagID ) ;
80
+
81
+ [ DllImport ( Library , EntryPoint = "amx_FindTagId" ) ]
82
+ public static extern int FindTagId ( ref AMXStruct amx , Int32 tagID , StringBuilder tagname ) ;
83
+
84
+ //private static extern int amx_GetUserData(ref AMX amx, long tag, void **ptr);
85
+
86
+ //private static extern int amx_SetUserData(ref AMX amx, long tag, void *ptr);
87
+
88
+ [ DllImport ( Library , EntryPoint = "amx_Register" ) ]
89
+ public static extern int Register ( ref AMXStruct amx , [ MarshalAs ( UnmanagedType . LPArray ) ] AMXNativeInfo [ ] list ,
90
+ int count ) ;
91
+
92
+ [ DllImport ( Library , EntryPoint = "amx_Push" ) ]
93
+ public static extern int Push ( ref AMXStruct amx , Int32 value ) ;
94
+
95
+ [ DllImport ( Library , EntryPoint = "amx_PushAddress" ) ]
96
+ public static extern int PushAddress ( ref AMXStruct amx , IntPtr address ) ;
97
+
98
+ [ DllImport ( Library , EntryPoint = "amx_PushAddress" ) ]
99
+ public static extern int PushAddress ( ref AMXStruct amx , ref Cell cell ) ;
100
+
101
+ [ DllImport ( Library , EntryPoint = "amx_PushArray" ) ]
102
+ public static extern int PushArray ( ref AMXStruct amx , out CellPtr address , int [ ] array , int numcells ) ;
103
+
104
+ [ DllImport ( Library , EntryPoint = "amx_PushString" ) ]
105
+ public static extern int PushString ( ref AMXStruct amx , out IntPtr address , string str , int pack , int useWchar ) ;
106
+
107
+ [ DllImport ( Library , EntryPoint = "amx_Exec" ) ]
108
+ public static extern int Exec ( ref AMXStruct amx , out int retval , int index ) ;
109
+
110
+ //[DllImport(library, EntryPoint = "amx_SetCallback")]
111
+ //private static extern int AmxSetCallback(ref AMXStruct amx, AmxCallback callback);
112
+
113
+ //[DllImport(library, EntryPoint = "amx_SetDebugHook")]
114
+ //private static extern int AmxSetDebugHook(ref AMX amx,AmxDebug debug);
115
+
116
+ [ DllImport ( Library , EntryPoint = "amx_RaiseError" ) ]
117
+ public static extern int RaiseError ( ref AMXStruct amx , int error ) ;
118
+
119
+ [ DllImport ( Library , EntryPoint = "amx_Allot" ) ]
120
+ public static extern int Allot ( ref AMXStruct amx , int cells , out IntPtr address ) ;
121
+
122
+ [ DllImport ( Library , EntryPoint = "amx_Release" ) ]
123
+ public static extern int Release ( ref AMXStruct amx , IntPtr address ) ;
124
+
125
+ [ DllImport ( Library , EntryPoint = "amx_StrLen" ) ]
126
+ public static extern int StrLen ( IntPtr cstr , out int length ) ;
127
+
128
+ [ DllImport ( Library , EntryPoint = "amx_SetString" ) ]
129
+ public static extern int SetString ( IntPtr dest , string source , int pack , int useWchar , int size ) ;
130
+
131
+ [ DllImport ( Library , EntryPoint = "amx_GetString" ) ]
132
+ public static extern int GetString ( StringBuilder dest , IntPtr source , int useWchar , int size ) ;
133
+
134
+ //public static extern int amx_UTF8Get(const char *string, const char **endptr, cell *value)
135
+
136
+ //public static extern int amx_UTF8Put(char *string, char **endptr, int maxchars, cell value)
137
+
138
+ //public static extern int amx_UTF8Check(const char *string, int *length)
139
+
140
+ //public static extern int amx_UTF8Len(const cell *cstr, int *length)
141
+
142
+
143
+ [ DllImport ( Library , EntryPoint = "amx_ConsoleInit" ) ]
144
+ public static extern int ConsoleInit ( ref AMXStruct amx ) ;
145
+
146
+ [ DllImport ( Library , EntryPoint = "amx_ConsoleCleanup" ) ]
147
+ public static extern int ConsoleCleanup ( ref AMXStruct amx ) ;
148
+
149
+ [ DllImport ( Library , EntryPoint = "amx_CoreInit" ) ]
150
+ public static extern int CoreInit ( ref AMXStruct amx ) ;
151
+
152
+ [ DllImport ( Library , EntryPoint = "amx_CoreCleanup" ) ]
153
+ public static extern int CoreCleanup ( ref AMXStruct amx ) ;
154
+
155
+ [ DllImport ( Library , EntryPoint = "amx_DGramInit" ) ]
156
+ public static extern int DGramInit ( ref AMXStruct amx ) ;
157
+
158
+ [ DllImport ( Library , EntryPoint = "amx_DGramCleanup" ) ]
159
+ public static extern int DGramCleanup ( ref AMXStruct amx ) ;
160
+
161
+ [ DllImport ( Library , EntryPoint = "amx_StringInit" ) ]
162
+ public static extern int StringInit ( ref AMXStruct amx ) ;
163
+
164
+ [ DllImport ( Library , EntryPoint = "amx_StringCleanup" ) ]
165
+ public static extern int StringCleanup ( ref AMXStruct amx ) ;
166
+
167
+ [ DllImport ( Library , EntryPoint = "amx_TimeInit" ) ]
168
+ public static extern int TimeInit ( ref AMXStruct amx ) ;
169
+
170
+ [ DllImport ( Library , EntryPoint = "amx_TimeCleanup" ) ]
171
+ public static extern int TimeClean ( ref AMXStruct amx ) ;
172
+
173
+ [ DllImport ( Library , EntryPoint = "amx_FixedInit" ) ]
174
+ public static extern int FixedInit ( ref AMXStruct amx ) ;
175
+
176
+ [ DllImport ( Library , EntryPoint = "amx_FixedCleanup" ) ]
177
+ public static extern int FixedCleanup ( ref AMXStruct amx ) ;
178
+
179
+ [ DllImport ( Library , EntryPoint = "amx_FloatInit" ) ]
180
+ public static extern int FloatInit ( ref AMXStruct amx ) ;
181
+
182
+ [ DllImport ( Library , EntryPoint = "amx_FloatCleanup" ) ]
183
+ public static extern int FloatCleanup ( ref AMXStruct amx ) ;
184
+
185
+
186
+ }
187
+ }
0 commit comments