-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameShell.cpp
More file actions
139 lines (119 loc) · 3.45 KB
/
Copy pathGameShell.cpp
File metadata and controls
139 lines (119 loc) · 3.45 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
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
/* Copyright (c) 2026 SeriousAlexej.
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as published by
the Free Software Foundation
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
#include "GameShell.h"
#include <Engine/GameShell.h>
namespace
{
class GameGUIinterface
{
public:
GameGUIinterface()
: m_handle(NULL)
, mp_impl(NULL)
{
try {
#define GAMEDLL _fnmApplicationExe.FileDir()+"GameGUI"+_strModExt+".dll"
CTFileName fnmExpanded;
ExpandFilePath(EFP_READ, CTString(GAMEDLL), fnmExpanded);
m_handle = LoadLibraryA(fnmExpanded);
if (m_handle == NULL) {
ThrowF_t("%s", GetWindowsError(GetLastError()));
}
GameGUI_interface* (*GAMEGUI_Create)(void) = (GameGUI_interface* (*)(void))GetProcAddress(m_handle, "GAMEGUI_Create");
if (GAMEGUI_Create == NULL) {
ThrowF_t("%s", GetWindowsError(GetLastError()));
}
mp_impl = GAMEGUI_Create();
} catch (char* strError) {
FatalError("%s", strError);
}
}
~GameGUIinterface()
{
FreeLibrary(m_handle);
}
void Initialize(const CTFileName& gmsFile)
{
m_gmsFile = gmsFile;
mp_impl->Initialize(m_gmsFile);
}
public:
GameGUI_interface* mp_impl;
private:
HMODULE m_handle;
CTFileName m_gmsFile;
};
} // anonymous namespace
static GameGUI_interface_* sehGameGUI_interface_new()
{
GameGUI_interface_* res = NULL;
SECAPI_TRY
res = (GameGUI_interface_*)(new GameGUIinterface());
SECAPI_CATCH
return res;
}
GameGUI_interface_* GameGUI_interface_new()
{
GameGUI_interface_* res = NULL;
STREAM_TRY
res = sehGameGUI_interface_new();
STREAM_CATCH
return res;
}
static void sehGameGUI_interface_delete(GameGUI_interface_* p)
{
SECAPI_TRY
delete ((GameGUIinterface*)p);
SECAPI_CATCH
}
void GameGUI_interface_delete(GameGUI_interface_* p)
{
STREAM_TRY
sehGameGUI_interface_delete(p);
STREAM_CATCH
}
static void sehGameGUI_interface_Initialize(GameGUI_interface_* p, const CTFileName_* f)
{
SECAPI_TRY
((GameGUIinterface*)p)->Initialize(*((const CTFileName*)f));
SECAPI_CATCH
}
void GameGUI_interface_Initialize(GameGUI_interface_* p, const CTFileName_* f)
{
STREAM_TRY
sehGameGUI_interface_Initialize(p, f);
STREAM_CATCH
}
static void sehGameGUI_interface_End(GameGUI_interface_* p)
{
SECAPI_TRY
((GameGUIinterface*)p)->mp_impl->End();
SECAPI_CATCH
}
void GameGUI_interface_End(GameGUI_interface_* p)
{
STREAM_TRY
sehGameGUI_interface_End(p);
STREAM_CATCH
}
static void sehGameGUI_interface_QuickTest(GameGUI_interface_* p, const CTFileName_* fnMapName, CDrawPort_* pdp, CViewPort_* pvp)
{
SECAPI_TRY
((GameGUIinterface*)p)->mp_impl->QuickTest(*((const CTFileName*)fnMapName), (CDrawPort*)pdp, (CViewPort*)pvp);
SECAPI_CATCH
}
void GameGUI_interface_QuickTest(GameGUI_interface_* p, const CTFileName_* fnMapName, CDrawPort_* pdp, CViewPort_* pvp)
{
STREAM_TRY
sehGameGUI_interface_QuickTest(p, fnMapName, pdp, pvp);
STREAM_CATCH
}