|
darope@0
|
1 |
// vi: set ts=4 sw=4 : |
|
darope@0
|
2 |
// vim: set tw=75 : |
|
darope@0
|
3 |
|
|
darope@0
|
4 |
// h_export.cpp - main exported DLL functionality |
|
darope@0
|
5 |
|
|
darope@0
|
6 |
// From SDK dlls/h_export.cpp: |
|
darope@0
|
7 |
|
|
darope@0
|
8 |
/*** |
|
darope@0
|
9 |
* |
|
darope@0
|
10 |
* Copyright (c) 1999, 2000 Valve LLC. All rights reserved. |
|
darope@0
|
11 |
* |
|
darope@0
|
12 |
* This product contains software technology licensed from Id |
|
darope@0
|
13 |
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. |
|
darope@0
|
14 |
* All Rights Reserved. |
|
darope@0
|
15 |
* |
|
darope@0
|
16 |
* Use, distribution, and modification of this source code and/or resulting |
|
darope@0
|
17 |
* object code is restricted to non-commercial enhancements to products from |
|
darope@0
|
18 |
* Valve LLC. All other use, distribution, or modification is prohibited |
|
darope@0
|
19 |
* without written permission from Valve LLC. |
|
darope@0
|
20 |
* |
|
darope@0
|
21 |
****/ |
|
darope@0
|
22 |
/* |
|
darope@0
|
23 |
|
|
darope@0
|
24 |
===== h_export.cpp ======================================================== |
|
darope@0
|
25 |
|
|
darope@0
|
26 |
Entity classes exported by Halflife. |
|
darope@0
|
27 |
|
|
darope@0
|
28 |
*/ |
|
darope@0
|
29 |
|
|
darope@0
|
30 |
#include <extdll.h> |
|
darope@0
|
31 |
|
|
darope@0
|
32 |
#include <h_export.h> |
|
darope@0
|
33 |
#include <meta_api.h> |
|
darope@0
|
34 |
|
|
darope@0
|
35 |
//! Holds engine functionality callbacks |
|
darope@0
|
36 |
enginefuncs_t g_engfuncs; |
|
darope@0
|
37 |
globalvars_t *gpGlobals; |
|
darope@0
|
38 |
|
|
darope@0
|
39 |
// Receive engine function table from engine. |
|
darope@0
|
40 |
// This appears to be the _first_ DLL routine called by the engine, so we |
|
darope@0
|
41 |
// do some setup operations here. |
|
darope@0
|
42 |
void WINAPI GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) |
|
darope@0
|
43 |
{ |
|
darope@0
|
44 |
memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); |
|
darope@0
|
45 |
gpGlobals = pGlobals; |
|
darope@0
|
46 |
// NOTE! Have to call logging function _after_ copying into g_engfuncs, so |
|
darope@0
|
47 |
// that g_engfuncs.pfnAlertMessage() can be resolved properly, heh. :) |
|
darope@0
|
48 |
UTIL_LogPrintf("[%s] dev: called: GiveFnptrsToDll\n", Plugin_info.logtag); |
|
darope@0
|
49 |
} |
|
ds@280
|
50 |
|
|
ds@280
|
51 |
// Avoid linking to libstdc++ |
|
ds@280
|
52 |
#if defined(linux) |
|
ds@280
|
53 |
extern "C" void __cxa_pure_virtual(void) |
|
ds@280
|
54 |
{ |
|
ds@280
|
55 |
} |
|
ds@280
|
56 |
|
|
ds@280
|
57 |
void *operator new(size_t size) |
|
ds@280
|
58 |
{ |
|
ds@280
|
59 |
return malloc(size); |
|
ds@280
|
60 |
} |
|
ds@280
|
61 |
|
|
ds@280
|
62 |
void *operator new[](size_t size) |
|
ds@280
|
63 |
{ |
|
ds@280
|
64 |
return malloc(size); |
|
ds@280
|
65 |
} |
|
ds@280
|
66 |
|
|
ds@280
|
67 |
void operator delete(void *ptr) |
|
ds@280
|
68 |
{ |
|
ds@280
|
69 |
free(ptr); |
|
ds@280
|
70 |
} |
|
ds@280
|
71 |
|
|
ds@280
|
72 |
void operator delete[](void * ptr) |
|
ds@280
|
73 |
{ |
|
ds@280
|
74 |
free(ptr); |
|
ds@280
|
75 |
} |
|
ds@280
|
76 |
#endif |