author | Medo <smaxein@googlemail.com> |
Sun, 03 Jun 2012 01:24:18 +0200 | |
changeset 7171 | 906e72caea7b |
parent 7162 | fe76d24a25d7 |
child 7173 | 7c2eb284f9f1 |
permissions | -rw-r--r-- |
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
1 |
#include "ipcconn.h" |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
2 |
#include "logging.h" |
7171 | 3 |
#include "socket.h" |
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
4 |
|
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
5 |
#include <string.h> |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
6 |
#include <stdbool.h> |
7171 | 7 |
#include <stdlib.h> |
8 |
#include <stdio.h> |
|
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
9 |
|
7171 | 10 |
typedef struct _flib_ipcconn { |
11 |
char playerName[256]; |
|
12 |
||
13 |
uint8_t readBuffer[256]; |
|
14 |
int readBufferSize; |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
15 |
|
7171 | 16 |
flib_acceptor acceptor; |
17 |
uint16_t port; |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
18 |
|
7171 | 19 |
flib_tcpsocket sock; |
20 |
flib_vector demoBuffer; |
|
21 |
} _flib_ipcconn; |
|
22 |
||
23 |
flib_ipcconn flib_ipcconn_create(bool recordDemo, const char *localPlayerName) { |
|
24 |
flib_ipcconn result = malloc(sizeof(_flib_ipcconn)); |
|
25 |
flib_acceptor acceptor = flib_acceptor_create(0); |
|
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
26 |
|
7171 | 27 |
if(!result || !acceptor) { |
28 |
free(result); |
|
29 |
flib_acceptor_close(&acceptor); |
|
30 |
return NULL; |
|
31 |
} |
|
32 |
||
33 |
result->acceptor = acceptor; |
|
34 |
result->sock = NULL; |
|
35 |
result->readBufferSize = 0; |
|
36 |
result->port = flib_acceptor_listenport(acceptor); |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
37 |
|
7171 | 38 |
if(localPlayerName) { |
39 |
strncpy(result->playerName, localPlayerName, 255); |
|
40 |
} else { |
|
41 |
strncpy(result->playerName, "Player", 255); |
|
42 |
} |
|
43 |
||
44 |
if(recordDemo) { |
|
45 |
result->demoBuffer = flib_vector_create(); |
|
46 |
} |
|
47 |
||
48 |
flib_log_i("Started listening for IPC connections on port %u", result->port); |
|
49 |
return result; |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
50 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
51 |
|
7171 | 52 |
uint16_t flib_ipcconn_port(flib_ipcconn ipc) { |
53 |
return ipc->port; |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
54 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
55 |
|
7171 | 56 |
void flib_ipcconn_destroy(flib_ipcconn *ipcptr) { |
57 |
if(!ipcptr || !*ipcptr) { |
|
58 |
return; |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
59 |
} |
7171 | 60 |
flib_ipcconn ipc = *ipcptr; |
61 |
flib_acceptor_close(&ipc->acceptor); |
|
62 |
flib_socket_close(&ipc->sock); |
|
63 |
flib_vector_destroy(&ipc->demoBuffer); |
|
64 |
free(ipc); |
|
65 |
*ipcptr = NULL; |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
66 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
67 |
|
7171 | 68 |
IpcConnState flib_ipcconn_state(flib_ipcconn ipc) { |
69 |
if(ipc && ipc->sock) { |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
70 |
return IPC_CONNECTED; |
7171 | 71 |
} else if(ipc && ipc->acceptor) { |
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
72 |
return IPC_LISTENING; |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
73 |
} else { |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
74 |
return IPC_NOT_CONNECTED; |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
75 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
76 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
77 |
|
7171 | 78 |
static void demo_record(flib_ipcconn ipc, const void *data, size_t len) { |
79 |
if(ipc->demoBuffer) { |
|
80 |
if(flib_vector_append(ipc->demoBuffer, data, len) < len) { |
|
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
81 |
// Out of memory, fail demo recording |
7171 | 82 |
flib_vector_destroy(&ipc->demoBuffer); |
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
83 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
84 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
85 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
86 |
|
7171 | 87 |
static void demo_record_from_engine(flib_ipcconn ipc, const uint8_t *message) { |
88 |
if(!ipc->demoBuffer || message[0]==0) { |
|
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
89 |
return; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
90 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
91 |
if(strchr("?CEiQqHb", message[1])) { |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
92 |
// Those message types are not recorded in a demo. |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
93 |
return; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
94 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
95 |
|
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
96 |
if(message[1] == 's') { |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
97 |
if(message[0] >= 3) { |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
98 |
// Chat messages get a special once-over to make them look as if they were received, not sent. |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
99 |
// Get the actual chat message as c string |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
100 |
char chatMsg[256]; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
101 |
memcpy(chatMsg, message+2, message[0]-3); |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
102 |
chatMsg[message[0]-3] = 0; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
103 |
|
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
104 |
char converted[257]; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
105 |
bool memessage = message[0] >= 7 && !memcmp(message+2, "/me ", 4); |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
106 |
const char *template = memessage ? "s\x02* %s %s " : "s\x01%s: %s "; |
7171 | 107 |
int size = snprintf(converted+1, 256, template, ipc->playerName, chatMsg); |
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
108 |
converted[0] = size>255 ? 255 : size; |
7171 | 109 |
demo_record(ipc, converted, converted[0]+1); |
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
110 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
111 |
} else { |
7171 | 112 |
demo_record(ipc, message, message[0]+1); |
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
113 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
114 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
115 |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
116 |
/** |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
117 |
* Receive a single message and copy it into the data buffer. |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
118 |
* Returns the length of the received message, -1 when nothing is received. |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
119 |
*/ |
7171 | 120 |
int flib_ipcconn_recv_message(flib_ipcconn ipc, void *data) { |
121 |
flib_ipcconn_tick(ipc); |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
122 |
|
7171 | 123 |
if(ipc->sock) { |
124 |
int size = flib_socket_nbrecv(ipc->sock, ipc->readBuffer+ipc->readBufferSize, sizeof(ipc->readBuffer)-ipc->readBufferSize); |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
125 |
if(size>=0) { |
7171 | 126 |
ipc->readBufferSize += size; |
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
127 |
} else { |
7171 | 128 |
flib_socket_close(&ipc->sock); |
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
129 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
130 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
131 |
|
7171 | 132 |
int msgsize = ipc->readBuffer[0]; |
133 |
if(ipc->readBufferSize > msgsize) { |
|
134 |
demo_record_from_engine(ipc, ipc->readBuffer); |
|
135 |
memcpy(data, ipc->readBuffer+1, msgsize); |
|
136 |
memmove(ipc->readBuffer, ipc->readBuffer+msgsize+1, ipc->readBufferSize-(msgsize+1)); |
|
137 |
ipc->readBufferSize -= (msgsize+1); |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
138 |
return msgsize; |
7171 | 139 |
} else if(!ipc->sock && ipc->readBufferSize>0) { |
140 |
flib_log_w("Last message from engine data stream is incomplete (received %u of %u bytes)", ipc->readBufferSize-1, msgsize); |
|
141 |
ipc->readBufferSize = 0; |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
142 |
return -1; |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
143 |
} else { |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
144 |
return -1; |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
145 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
146 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
147 |
|
7171 | 148 |
int flib_ipcconn_send_raw(flib_ipcconn ipc, void *data, size_t len) { |
149 |
flib_ipcconn_tick(ipc); |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
150 |
|
7171 | 151 |
if(!ipc->sock) { |
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
152 |
flib_log_w("flib_ipcconn_send_message: Not connected."); |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
153 |
return -1; |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
154 |
} |
7171 | 155 |
|
156 |
if(flib_socket_send(ipc->sock, data, len) == len) { |
|
157 |
demo_record(ipc, data, len); |
|
158 |
return 0; |
|
159 |
} else { |
|
160 |
flib_log_w("Failed or incomplete ICP write: engine connection lost."); |
|
161 |
flib_socket_close(&ipc->sock); |
|
162 |
return -1; |
|
163 |
} |
|
164 |
} |
|
165 |
||
166 |
int flib_ipcconn_send_message(flib_ipcconn ipc, void *data, size_t len) { |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
167 |
if(len>255) { |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
168 |
flib_log_e("Attempt to send too much data to the engine in a single message."); |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
169 |
return -1; |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
170 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
171 |
|
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
172 |
uint8_t sendbuf[256]; |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
173 |
sendbuf[0] = len; |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
174 |
memcpy(sendbuf+1, data, len); |
7171 | 175 |
|
176 |
return flib_ipcconn_send_raw(ipc, sendbuf, len+1); |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
177 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
178 |
|
7171 | 179 |
int flib_ipcconn_send_messagestr(flib_ipcconn ipc, char *data) { |
180 |
return flib_ipcconn_send_message(ipc, data, strlen(data)); |
|
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
181 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
182 |
|
7171 | 183 |
void flib_ipcconn_tick(flib_ipcconn ipc) { |
184 |
if(!ipc->sock && ipc->acceptor) { |
|
185 |
ipc->sock = flib_socket_accept(ipc->acceptor, true); |
|
186 |
if(ipc->sock) { |
|
187 |
flib_acceptor_close(&ipc->acceptor); |
|
7158
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
188 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
189 |
} |
a0573014ff4f
Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
190 |
} |
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
191 |
|
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
192 |
static void replace_gamemode(flib_buffer buf, char gamemode) { |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
193 |
size_t msgStart = 0; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
194 |
char *data = (char*)buf.data; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
195 |
while(msgStart+2 < buf.size) { |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
196 |
if(!memcmp(data+msgStart, "\x02T", 2)) { |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
197 |
data[msgStart+2] = gamemode; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
198 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
199 |
msgStart += (uint8_t)data[msgStart]+1; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
200 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
201 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
202 |
|
7171 | 203 |
flib_constbuffer flib_ipcconn_getdemo(flib_ipcconn ipc) { |
204 |
if(!ipc->demoBuffer) { |
|
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
205 |
flib_constbuffer result = {NULL, 0}; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
206 |
return result; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
207 |
} |
7171 | 208 |
replace_gamemode(flib_vector_as_buffer(ipc->demoBuffer), 'D'); |
209 |
return flib_vector_as_constbuffer(ipc->demoBuffer); |
|
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
210 |
} |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
211 |
|
7171 | 212 |
flib_constbuffer flib_ipcconn_getsave(flib_ipcconn ipc) { |
213 |
if(!ipc->demoBuffer) { |
|
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
214 |
flib_constbuffer result = {NULL, 0}; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
215 |
return result; |
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
216 |
} |
7171 | 217 |
replace_gamemode(flib_vector_as_buffer(ipc->demoBuffer), 'S'); |
218 |
return flib_vector_as_constbuffer(ipc->demoBuffer); |
|
7162
fe76d24a25d7
Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents:
7160
diff
changeset
|
219 |
} |