Repository navigation
Expand file tree
/
Copy pathmeta_api.cpp
More file actions
79 lines (69 loc) · 3.23 KB
/
Copy pathmeta_api.cpp
File metadata and controls
79 lines (69 loc) · 3.23 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
#include <precompiled.h>
meta_globals_t *gpMetaGlobals;
gamedll_funcs_t *gpGamedllFuncs;
mutil_funcs_t *gpMetaUtilFuncs;
enginefuncs_t *g_pengfuncsTable;
plugin_info_t Plugin_info =
{
META_INTERFACE_VERSION, // ifvers
"RefsAPI", // name
"1.0.10.2", // version
__DATE__, // date
"Refresh", // author
"https://github.com/jobmail/refsapi", // url
"REFSAPI", // logtag
PT_ANYTIME, // (when) loadable
PT_NEVER, // (when) unloadable
};
C_DLLEXPORT int Meta_Query(char *interfaceVersion, plugin_info_t **plinfo, mutil_funcs_t *pMetaUtilFuncs)
{
*plinfo = &Plugin_info;
gpMetaUtilFuncs = pMetaUtilFuncs;
return true;
}
META_FUNCTIONS gMetaFunctionTable =
{
NULL, // pfnGetEntityAPI HL SDK; called before game DLL
NULL, // pfnGetEntityAPI_Post META; called after game DLL
GetEntityAPI2, // pfnGetEntityAPI2 HL SDK2; called before game DLL
GetEntityAPI2_Post, // pfnGetEntityAPI2_Post META; called after game DLL
GetNewDLLFunctions, // pfnGetNewDLLFunctions HL SDK2; called before game DLL
GetNewDLLFunctions_Post, // pfnGetNewDLLFunctions_Post META; called after game DLL
GetEngineFunctions, // pfnGetEngineFunctions META; called before HL engine
GetEngineFunctions_Post, // pfnGetEngineFunctions_Post META; called after HL engine
};
C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs)
{
gpMetaGlobals = pMGlobals;
gpGamedllFuncs = pGamedllFuncs;
if (!OnMetaAttach())
return false;
DEBUG("*** Hello World! ***");
DEBUG("mysql_thread_safe = %d", mysql_thread_safe());
const char test_utf8[] = { '\xFF', '\xFF', '\xFF', 20, 0 };
#ifdef __SSE4_2__
DEBUG("Check is_valid_utf8(%s) = %d", "", g_SSE4_ENABLE ? is_valid_utf8_simd("") : is_valid_utf8(""));
DEBUG("Check is_valid_utf8(%s) = %d", "ʰᵒᵐᵉʳ", is_valid_utf8_simd("ʰᵒᵐᵉʳ"));
DEBUG("Check is_valid_utf8(%s) = %d", "test", g_SSE4_ENABLE ? is_valid_utf8_simd("test") : is_valid_utf8("test"));
DEBUG("Check is_valid_utf8(%s) = %d", "\xC3\x28", g_SSE4_ENABLE ? is_valid_utf8_simd("\xC3\x28") : is_valid_utf8("\xC3\x28"));
DEBUG("Check is_valid_utf8(%s) = %d", "\xED\xA0\x80", g_SSE4_ENABLE ? is_valid_utf8_simd("\xED\xA0\x80") : is_valid_utf8("\xED\xA0\x80"));
DEBUG("Check is_valid_utf8(%s) = %d\n", "\xFF\xFF\xFF\x20\x00", g_SSE4_ENABLE ? is_valid_utf8_simd("\xFF\xFF\xFF\x20\x00") : is_valid_utf8("\xFF\xFF\xFF\x20\x00"));
#else
DEBUG("Check is_valid_utf8(%s) = %d", "", is_valid_utf8(""));
DEBUG("Check is_valid_utf8(%s) = %d", "ʰᵒᵐᵉʳ", is_valid_utf8("ʰᵒᵐᵉʳ"));
DEBUG("Check is_valid_utf8(%s) = %d", "test", is_valid_utf8("test"));
DEBUG("Check is_valid_utf8(%s) = %d", "\xC3\x28", is_valid_utf8("\xC3\x28"));
DEBUG("Check is_valid_utf8(%s) = %d", "\xED\xA0\x80", is_valid_utf8("\xED\xA0\x80"));
DEBUG("Check is_valid_utf8(%s) = %d\n", "\xFF\xFF\xFF\x20\x00", is_valid_utf8("\xFF\xFF\xFF\x20\x00"));
#endif
cpu_test();
get_thread_info(true);
GET_HOOK_TABLES(PLID, &g_pengfuncsTable, nullptr, nullptr);
memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS));
return true;
}
C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
{
OnMetaDetach();
return true;
}