Debian Codegraph @

src/animlib.c

raw symbols SCIP
1 /*
2 * OpenTyrian: A modern cross-platform port of Tyrian
3 * Copyright (C) 2007-2009 The OpenTyrian Development Team
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 #include "animlib.h"cxx . . $ `<file>/src/animlib.h`/
20
21 #include "file.h"cxx . . $ `<file>/src/file.h`/
22 #include "keyboard.h"cxx . . $ `<file>/src/keyboard.h`/
23 #include "network.h"cxx . . $ `<file>/src/network.h`/
24 #include "nortsong.h"cxx . . $ `<file>/src/nortsong.h`/
25 #include "palette.h"cxx . . $ `<file>/src/palette.h`/
26 #include "sizebuf.h"cxx . . $ `<file>/src/sizebuf.h`/
27 #include "video.h"cxx . . $ `<file>/src/video.h`/
28
29 #include <assert.h>
30 #include <string.h>
31
32 /*** Structs ***/
33 /* The actual header has a lot of fields that are basically useless to us since
34 * we both set our own framerate and the format itself only allows for
35 * 320x200x8. Should a (nonexistent) ani be played that doesn't have the same
36 * assumed values we are going to use, TOO BAD. It'll just be treated as
37 * corrupt in playback.
38 */
39 #define PALETTE_OFFSETcxx . . $ `src/animlib.c:39:9`! 0x100 // 128 + sizeof(header)
40 #define PAGEHEADER_OFFSETcxx . . $ `src/animlib.c:40:9`! 0x500 // PALETTE_OFFSET + sizeof(palette)
41 #define ANIM_OFFSETcxx . . $ `src/animlib.c:41:9`! 0x0B00 // PAGEHEADER_OFFSET + sizeof(largepageheader) * 256
42 #define ANI_PAGE_SIZEcxx . . $ `src/animlib.c:42:9`! 0x10000 // 65536.
43
44 typedef struct anim_FileHeader_scxx . . $ anim_FileHeader_s#
45 {
46 Uint16cxx . . $ Uint16# nlpscxx . . $ anim_FileHeader_s#nlps.; /* Number of 'pages', max 256. */
47 Uint32cxx . . $ Uint32# nRecordscxx . . $ anim_FileHeader_s#nRecords.; /* Number of 'records', max 65535 */
48 } anim_FileHeader_tcxx . . $ anim_FileHeader_t#;
49
50 typedef struct anim_LargePageHeader_scxx . . $ anim_LargePageHeader_s#
51 {
52 Uint16cxx . . $ Uint16# baseRecordcxx . . $ anim_LargePageHeader_s#baseRecord.; /* The first record's number */
53 Uint16cxx . . $ Uint16# nRecordscxx . . $ anim_LargePageHeader_s#nRecords.; /* Number of records. Supposedly there are bit flags but I saw no such code */
54 Uint16cxx . . $ Uint16# nBytescxx . . $ anim_LargePageHeader_s#nBytes.; /* Number of bytes used, excluding headers */
55 } anim_LargePageHeader_tcxx . . $ anim_LargePageHeader_t#;
56
57 /*** Globals ***/
58 Uint8cxx . . $ Uint8# CurrentPageBuffercxx . . $ CurrentPageBuffer.[65536];
59 anim_LargePageHeader_tcxx . . $ anim_LargePageHeader_t# PageHeadercxx . . $ PageHeader.[256];
60 Uint16cxx . . $ Uint16# CurrentPageRecordSizescxx . . $ CurrentPageRecordSizes.[256];
61
62 anim_LargePageHeader_tcxx . . $ anim_LargePageHeader_t# CurrentPageHeadercxx . . $ CurrentPageHeader.;
63 anim_FileHeader_tcxx . . $ anim_FileHeader_t# FileHeadercxx . . $ FileHeader.;
64
65 unsigned int Curlpnumcxx . . $ Curlpnum.;
66
67 FILEcxx . . $ FILE# * InFilecxx . . $ InFile.;
68
69 /*** Function decs ***/
70 int JE_playRunSkipDumpcxx . . $ JE_playRunSkipDump(c271a33def0f2b11).(Uint8cxx . . $ Uint8# *, unsigned int);
71 void JE_closeAnimcxx . . $ JE_closeAnim(49f6e7a06ebc5aa8).(void);
72 int JE_loadAnimcxx . . $ JE_loadAnim(5c4306d8553b3696).(const char *);
73 int JE_renderFramecxx . . $ JE_renderFrame(4c679297bf94b9eb).(unsigned int);
74 int JE_findPagecxx . . $ JE_findPage(4c679297bf94b9eb). (unsigned int);
75 int JE_loadPagecxx . . $ JE_loadPage(4c679297bf94b9eb).(unsigned int);
76
77 /*** Implementation ***/
78
79 /* Loads the given page into memory.
80 *
81 * Returns 0 on success or nonzero on failure (bad data)
82 */
83 int JE_loadPagecxx . . $ JE_loadPage(4c679297bf94b9eb).(unsigned int pagenumber)
84 {
85 unsigned int i, pageSize;
86
87 if (Curlpnumcxx . . $ Curlpnum. == pagenumber)
88 return 0; /* Already loaded */
89 Curlpnumcxx . . $ Curlpnum. = pagenumber;
90
91 /* We need to seek to the page and load it into our buffer.
92 * Pages have a fixed size of 0x10000; any left over space is padded
93 * unless it's the end of the file.
94 *
95 * Pages repeat their headers for some reason. They then have two bytes of
96 * padding followed by a word for every record. THEN the data starts.
97 */
98 fseekcxx . . $ fseek(543fae30d249f6b1).(InFilecxx . . $ InFile., ANIM_OFFSETcxx . . $ `src/animlib.c:41:9`! + (pagenumber * ANI_PAGE_SIZEcxx . . $ `src/animlib.c:42:9`!), SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
99 fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&CurrentPageHeadercxx . . $ CurrentPageHeader..baseRecordcxx . . $ anim_LargePageHeader_s#baseRecord., 1, InFilecxx . . $ InFile.);
100 fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&CurrentPageHeadercxx . . $ CurrentPageHeader..nRecordscxx . . $ anim_LargePageHeader_s#nRecords., 1, InFilecxx . . $ InFile.);
101 fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&CurrentPageHeadercxx . . $ CurrentPageHeader..nBytescxx . . $ anim_LargePageHeader_s#nBytes., 1, InFilecxx . . $ InFile.);
102
103 fseekcxx . . $ fseek(543fae30d249f6b1).(InFilecxx . . $ InFile., 2, SEEK_CURcxx . . $ `<external>/232824719582829767/stdio.h:111:9`!);
104 fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(CurrentPageRecordSizescxx . . $ CurrentPageRecordSizes., CurrentPageHeadercxx . . $ CurrentPageHeader..nRecordscxx . . $ anim_LargePageHeader_s#nRecords., InFilecxx . . $ InFile.);
105
106 /* What remains is the 'compressed' data */
107 fread_diecxx . . $ fread_die(82d71c9ec5b61e0f).(CurrentPageBuffercxx . . $ CurrentPageBuffer., 1, CurrentPageHeadercxx . . $ CurrentPageHeader..nBytescxx . . $ anim_LargePageHeader_s#nBytes., InFilecxx . . $ InFile.);
108
109 /* Okay, we've succeeded in all our IO checks. Now, make sure the
110 * headers aren't lying or damaged or something.
111 */
112 pageSize = 0;
113 for (i = 0; i < CurrentPageHeadercxx . . $ CurrentPageHeader..nRecordscxx . . $ anim_LargePageHeader_s#nRecords.; i++)
114 pageSize += CurrentPageRecordSizescxx . . $ CurrentPageRecordSizes.[i];
115
116 if (pageSize != CurrentPageHeadercxx . . $ CurrentPageHeader..nBytescxx . . $ anim_LargePageHeader_s#nBytes.)
117 return -1;
118
119 /* So far, so good */
120 return 0;
121 }
122
123 int JE_findPagecxx . . $ JE_findPage(4c679297bf94b9eb).(unsigned int framenumber)
124 {
125 unsigned int i;
126
127 for (i = 0; i < FileHeadercxx . . $ FileHeader..nlpscxx . . $ anim_FileHeader_s#nlps.; i++)
128 {
129 if (PageHeadercxx . . $ PageHeader.[i].baseRecordcxx . . $ anim_LargePageHeader_s#baseRecord. <= framenumber &&
130 PageHeadercxx . . $ PageHeader.[i].baseRecordcxx . . $ anim_LargePageHeader_s#baseRecord. + PageHeadercxx . . $ PageHeader.[i].nRecordscxx . . $ anim_LargePageHeader_s#nRecords. > framenumber)
131 {
132 return i;
133 }
134 }
135
136 return -1; /* Did not find */
137 }
138
139 int JE_renderFramecxx . . $ JE_renderFrame(4c679297bf94b9eb).(unsigned int framenumber)
140 {
141 unsigned int i, offset, destframe;
142
143 destframe = framenumber - CurrentPageHeadercxx . . $ CurrentPageHeader..baseRecordcxx . . $ anim_LargePageHeader_s#baseRecord.;
144
145 offset = 0;
146 for (i = 0; i < destframe; i++)
147 offset += CurrentPageRecordSizescxx . . $ CurrentPageRecordSizes.[i];
148
149 return (JE_playRunSkipDumpcxx . . $ JE_playRunSkipDump(c271a33def0f2b11).(CurrentPageBuffercxx . . $ CurrentPageBuffer. + offset + 4, CurrentPageRecordSizescxx . . $ CurrentPageRecordSizes.[destframe] - 4));
150 }
151
152 void JE_playAnimcxx . . $ JE_playAnim(90f4975bd3552491).(const char *animfile, JE_bytecxx . . $ JE_byte# startingframe, JE_bytecxx . . $ JE_byte# speed)
153 {
154 unsigned int i;
155 int pageNum;
156
157 if (JE_loadAnimcxx . . $ JE_loadAnim(5c4306d8553b3696).(animfile) != 0)
158 return; /* Failed to open or process file */
159
160 /* Blank screen */
161 JE_clr256cxx . . $ JE_clr256(60a0b30a00b4fc6d).(VGAScreencxx . . $ VGAScreen.);
162 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
163
164 /* re FileHeader.nRecords-1: It's -1 in the pascal too.
165 * The final frame is a delta of the first, and we don't need that.
166 * We could also, if we ever ended up needing to loop anis, check
167 * the bools in the header to see if we should render the last
168 * frame. But that's never going to be necessary :)
169 */
170 for (i = startingframe; i < FileHeadercxx . . $ FileHeader..nRecordscxx . . $ anim_FileHeader_s#nRecords.-1; i++)
171 {
172 /* Handle boring crap */
173 setDelaycxx . . $ setDelay(d4f767463ce0a6b3).(speed);
174
175 /* Load required frame. The loading function is smart enough to not re-load an already loaded frame */
176 pageNum = JE_findPagecxx . . $ JE_findPage(4c679297bf94b9eb).(i);
177 if (pageNum == -1)
178 break;
179 if (JE_loadPagecxx . . $ JE_loadPage(4c679297bf94b9eb).(pageNum) != 0)
180 break;
181
182 /* render frame. */
183 if (JE_renderFramecxx . . $ JE_renderFrame(4c679297bf94b9eb).(i) != 0)
184 break;
185 JE_showVGAcxx . . $ JE_showVGA(49f6e7a06ebc5aa8).();
186
187 /* Return early if user presses a key */
188 service_SDL_eventscxx . . $ service_SDL_events(b45ddcbc8423892c).(truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!);
189 if (newkeycxx . . $ newkey.)
190 break;
191
192 /* Wait until we need the next frame */
193 NETWORK_KEEP_ALIVEcxx . . $ `src/network.h:88:9`!();
194 wait_delaycxx . . $ wait_delay(49f6e7a06ebc5aa8).();
195 }
196
197 JE_closeAnimcxx . . $ JE_closeAnim(49f6e7a06ebc5aa8).();
198 }
199
200 /* loadAnim opens the file and loads data from it into the header structs.
201 * It should take care to clean up after itself should an error occur.
202 */
203 int JE_loadAnimcxx . . $ JE_loadAnim(5c4306d8553b3696).(const char *filename)
204 {
205 unsigned int i;
206 long fileSize;
207 char temp[4];
208
209 Curlpnumcxx . . $ Curlpnum. = -1;
210 InFilecxx . . $ InFile. = dir_fopencxx . . $ dir_fopen(2493aa730c89ee72).(data_dircxx . . $ data_dir(33a1f659e94feb42).(), filename, "rb");
211 if (InFilecxx . . $ InFile. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
212 return -1;
213
214 fileSize = ftell_eofcxx . . $ ftell_eof(1dcafcd8ef4c6e6c).(InFilecxx . . $ InFile.);
215 if (fileSize < ANIM_OFFSETcxx . . $ `src/animlib.c:41:9`!)
216 {
217 /* We don't know the exact size our file should be yet,
218 * but we do know it should be way more than this */
219 fclosecxx . . $ fclose(89bc1efcdac0ca22).(InFilecxx . . $ InFile.);
220 return -1;
221 }
222
223 /* Read in the header. The header is 256 bytes long or so,
224 * but that includes a lot of padding as well as several
225 * vars we really don't care about. We shall check the ID and extract
226 * the handful of vars we care about. Every value in the header that
227 * is constant will be ignored.
228 */
229
230 fread_diecxx . . $ fread_die(82d71c9ec5b61e0f).(&temp, 1, 4, InFilecxx . . $ InFile.); /* The ID, should equal "LPF " */
231 fseekcxx . . $ fseek(543fae30d249f6b1).(InFilecxx . . $ InFile., 2, SEEK_CURcxx . . $ `<external>/232824719582829767/stdio.h:111:9`!); /* skip over this word */
232 fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&FileHeadercxx . . $ FileHeader..nlpscxx . . $ anim_FileHeader_s#nlps., 1, InFilecxx . . $ InFile.); /* Number of pages */
233 fread_u32_diecxx . . $ fread_u32_die(503b8e976a020473).(&FileHeadercxx . . $ FileHeader..nRecordscxx . . $ anim_FileHeader_s#nRecords., 1, InFilecxx . . $ InFile.); /* Number of records */
234
235 if (memcmpcxx . . $ memcmp(36f949851efa3055).(temp, "LPF ", 4) != 0 ||
236 FileHeadercxx . . $ FileHeader..nlpscxx . . $ anim_FileHeader_s#nlps. == 0 || FileHeadercxx . . $ FileHeader..nRecordscxx . . $ anim_FileHeader_s#nRecords. == 0 ||
237 FileHeadercxx . . $ FileHeader..nlpscxx . . $ anim_FileHeader_s#nlps. > 256 || FileHeadercxx . . $ FileHeader..nRecordscxx . . $ anim_FileHeader_s#nRecords. > 65535)
238 {
239 fclosecxx . . $ fclose(89bc1efcdac0ca22).(InFilecxx . . $ InFile.);
240 return -1;
241 }
242
243 /* Read in headers */
244 fseekcxx . . $ fseek(543fae30d249f6b1).(InFilecxx . . $ InFile., PAGEHEADER_OFFSETcxx . . $ `src/animlib.c:40:9`!, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
245 for (i = 0; i < FileHeadercxx . . $ FileHeader..nlpscxx . . $ anim_FileHeader_s#nlps.; i++)
246 {
247 fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&PageHeadercxx . . $ PageHeader.[i].baseRecordcxx . . $ anim_LargePageHeader_s#baseRecord., 1, InFilecxx . . $ InFile.);
248 fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&PageHeadercxx . . $ PageHeader.[i].nRecordscxx . . $ anim_LargePageHeader_s#nRecords., 1, InFilecxx . . $ InFile.);
249 fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&PageHeadercxx . . $ PageHeader.[i].nBytescxx . . $ anim_LargePageHeader_s#nBytes., 1, InFilecxx . . $ InFile.);
250 }
251
252 /* Now we have enough information to calculate the 'expected' file size.
253 * Our calculation SHOULD be equal to fileSize, but we won't begrudge
254 * padding */
255 if (fileSize < (FileHeadercxx . . $ FileHeader..nlpscxx . . $ anim_FileHeader_s#nlps.-1) * ANI_PAGE_SIZEcxx . . $ `src/animlib.c:42:9`! + ANIM_OFFSETcxx . . $ `src/animlib.c:41:9`!
256 + PageHeadercxx . . $ PageHeader.[FileHeadercxx . . $ FileHeader..nlpscxx . . $ anim_FileHeader_s#nlps.-1].nBytescxx . . $ anim_LargePageHeader_s#nBytes.
257 + PageHeadercxx . . $ PageHeader.[FileHeadercxx . . $ FileHeader..nlpscxx . . $ anim_FileHeader_s#nlps.-1].nRecordscxx . . $ anim_LargePageHeader_s#nRecords. * 2 + 8)
258 {
259 fclosecxx . . $ fclose(89bc1efcdac0ca22).(InFilecxx . . $ InFile.);
260 return -1;
261 }
262
263 /* Now read in the palette. */
264 fseekcxx . . $ fseek(543fae30d249f6b1).(InFilecxx . . $ InFile., PALETTE_OFFSETcxx . . $ `src/animlib.c:39:9`!, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
265 for (i = 0; i < 256; i++)
266 {
267 Uint8cxx . . $ Uint8# bgru[4];
268 fread_u8_diecxx . . $ fread_u8_die(77ebc59a7bf9f340).(bgru, 4, InFilecxx . . $ InFile.);
269 colorscxx . . $ colors.[i].bcxx . . $ SDL_Color#b. = bgru[0];
270 colorscxx . . $ colors.[i].gcxx . . $ SDL_Color#g. = bgru[1];
271 colorscxx . . $ colors.[i].rcxx . . $ SDL_Color#r. = bgru[2];
272 }
273 set_palettecxx . . $ set_palette(e7c4d2139a064c7f).(colorscxx . . $ colors., 0, 255);
274
275 /* Whew! That was hard. Let's go grab some beers! */
276 return 0;
277 }
278
279 void JE_closeAnimcxx . . $ JE_closeAnim(49f6e7a06ebc5aa8).(void)
280 {
281 fclosecxx . . $ fclose(89bc1efcdac0ca22).(InFilecxx . . $ InFile.);
282 }
283
284 /* RunSkipDump decompresses the video. There are three operations, run, skip,
285 * and dump. They can be used in either byte or word variations, making six
286 * possible actions, and there's a seventh 'stop' action, which looks
287 * like 0x80 0x00 0x00.
288 *
289 * Run is a memset.
290 * Dump is a memcpy.
291 * Skip leaves the old data intact and simply increments the pointers.
292 *
293 * returns 0 on success or 1 if decompressing failed. Failure to decompress
294 * indicates a broken or malicious file; playback should terminate.
295 */
296 int JE_playRunSkipDumpcxx . . $ JE_playRunSkipDump(c271a33def0f2b11).(Uint8cxx . . $ Uint8# *incomingBuffer, unsigned int IncomingBufferLength)
297 {
298 sizebuf_tcxx . . $ sizebuf_t# Buffer_IN, Buffer_OUT;
299 sizebuf_tcxx . . $ sizebuf_t# * pBuffer_IN = &Buffer_IN, * pBuffer_OUT = &Buffer_OUT;
300
301 #define ANI_SHORT_RLEcxx . . $ `src/animlib.c:301:10`! 0x00
302 #define ANI_SHORT_SKIPcxx . . $ `src/animlib.c:302:10`! 0x80
303 #define ANI_LONG_OPcxx . . $ `src/animlib.c:303:10`! 0x80
304 #define ANI_LONG_COPY_OR_RLEcxx . . $ `src/animlib.c:304:10`! 0x8000
305 #define ANI_LONG_RLEcxx . . $ `src/animlib.c:305:10`! 0x4000
306 #define ANI_STOPcxx . . $ `src/animlib.c:306:10`! 0x0000
307
308 SZ_Initcxx . . $ SZ_Init(548a69dbf7140519).(pBuffer_IN, incomingBuffer, IncomingBufferLength);
309 SZ_Initcxx . . $ SZ_Init(548a69dbf7140519).(pBuffer_OUT, VGAScreencxx . . $ VGAScreen.->pixelscxx . . $ SDL_Surface#pixels., VGAScreencxx . . $ VGAScreen.->hcxx . . $ SDL_Surface#h. * VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch.);
310
311 /* 320x200 is the only supported format.
312 * Assert is here as a hint should our screen size ever changes.
313 * As for how to decompress to the wrong screen size... */
314 assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(VGAScreen->h * VGAScreen->pitch == 320 * 200);
315
316 while (truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!)
317 {
318 /* Get one byte. This byte may have flags that tell us more */
319 unsigned int opcode = MSG_ReadBytecxx . . $ MSG_ReadByte(67ffb87ed4221dd).(pBuffer_IN);
320
321 /* Before we continue, check the error states/
322 * We should *probably* check these after every read and write, but
323 * I've rigged it so that the buffers will never go out of bounds.
324 * So we can afford to be lazy; if the buffer overflows below it will
325 * silently fail its writes and we'll catch the failure on our next
326 * run through the loop. A failure means we should be
327 * leaving ANYWAY. The contents of our buffers doesn't matter.
328 */
329 if (SZ_Errorcxx . . $ SZ_Error(afbd6f368aaad226).(pBuffer_IN) || SZ_Errorcxx . . $ SZ_Error(afbd6f368aaad226).(pBuffer_OUT))
330 return -1;
331
332 /* Divide into 'short' and 'long' */
333 if (opcode == ANI_LONG_OPcxx . . $ `src/animlib.c:303:10`!) /* long ops */
334 {
335 opcode = MSG_ReadWordcxx . . $ MSG_ReadWord(67ffb87ed4221dd).(pBuffer_IN);
336
337 if (opcode == ANI_STOPcxx . . $ `src/animlib.c:306:10`!) /* We are done decompressing. Leave */
338 {
339 break;
340 }
341 else if (!(opcode & ANI_LONG_COPY_OR_RLEcxx . . $ `src/animlib.c:304:10`!)) /* If it's not those two, it's a skip */
342 {
343 unsigned int count = opcode;
344 SZ_Seekcxx . . $ SZ_Seek(e703b2df531be2a0).(pBuffer_OUT, count, SEEK_CURcxx . . $ `<external>/232824719582829767/stdio.h:111:9`!);
345 }
346 else /* Now things get a bit more interesting... */
347 {
348 opcode &= ~ANI_LONG_COPY_OR_RLEcxx . . $ `src/animlib.c:304:10`!; /* Clear that flag */
349
350 if (opcode & ANI_LONG_RLEcxx . . $ `src/animlib.c:305:10`!) /* RLE */
351 {
352 unsigned int count = opcode & ~ANI_LONG_RLEcxx . . $ `src/animlib.c:305:10`!; /* Clear flag */
353
354 /* Extract another byte */
355 unsigned int value = MSG_ReadBytecxx . . $ MSG_ReadByte(67ffb87ed4221dd).(pBuffer_IN);
356
357 /* The actual run */
358 SZ_Memsetcxx . . $ SZ_Memset(8ebbc4f4e9fcf4ca).(pBuffer_OUT, value, count);
359 }
360 else
361 { /* Long copy */
362 unsigned int count = opcode;
363
364 /* Copy */
365 SZ_Memcpy2cxx . . $ SZ_Memcpy2(b3bf8a9a77d50383).(pBuffer_OUT, pBuffer_IN, count);
366 }
367 }
368 } /* End of long ops */
369 else /* short ops */
370 {
371 if (opcode & ANI_SHORT_SKIPcxx . . $ `src/animlib.c:302:10`!) /* Short skip, move pointer only */
372 {
373 unsigned int count = opcode & ~ANI_SHORT_SKIPcxx . . $ `src/animlib.c:302:10`!; /* clear flag to get count */
374 SZ_Seekcxx . . $ SZ_Seek(e703b2df531be2a0).(pBuffer_OUT, count, SEEK_CURcxx . . $ `<external>/232824719582829767/stdio.h:111:9`!);
375 }
376 else if (opcode == ANI_SHORT_RLEcxx . . $ `src/animlib.c:301:10`!) /* Short RLE, memset the destination */
377 {
378 /* Extract a few more bytes */
379 unsigned int count = MSG_ReadBytecxx . . $ MSG_ReadByte(67ffb87ed4221dd).(pBuffer_IN);
380 unsigned int value = MSG_ReadBytecxx . . $ MSG_ReadByte(67ffb87ed4221dd).(pBuffer_IN);
381
382 /* Run */
383 SZ_Memsetcxx . . $ SZ_Memset(8ebbc4f4e9fcf4ca).(pBuffer_OUT, value, count);
384 }
385 else /* Short copy, memcpy from src to dest. */
386 {
387 unsigned int count = opcode;
388
389 /* Dump */
390 SZ_Memcpy2cxx . . $ SZ_Memcpy2(b3bf8a9a77d50383).(pBuffer_OUT, pBuffer_IN, count);
391 }
392 } /* End of short ops */
393 }
394
395 /* And that's that */
396 return 0;
397 }