Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
resread.c
Go to the documentation of this file.
1/*
2 * Reads packet section data.
3 *
4 * Retail object 0x469BE0-0x469C7F (link order; see docs/ORDER.md).
5 */
6#include "game.h"
7#include <malloc.h>
8
9/* Function start: 0x469BE0 */
11 void *destination,
12 unsigned int length)
13{
14 int offset;
15 int end;
16
17 offset = (int)(handle->dataOffset + handle->position);
18 end = (int)(handle->dataOffset + handle->dataSize);
19 if (destination == 0)
20 return 0;
21 if (end < (int)(offset + length) || length == (unsigned int)-1)
22 length = (unsigned int)(end - offset);
23 if (ReadDataFileAtOffset((unsigned short)handle->file, offset,
24 length, destination) == 0)
25 return 0;
26 handle->position += length;
27 return 1;
28}
int ReadDataFileAtOffset(unsigned short fd, int offset, unsigned int length, void *data)
Definition datafile.c:60
short ReadPacketSectionData(PacketSectionHandle *handle, void *destination, unsigned int length)
Definition resread.c:10
Shared Win32 declarations, types and library interfaces.
unsigned int dataOffset
Definition game_data.h:1177
unsigned int dataSize
Definition game_data.h:1179
unsigned int position
Definition game_data.h:1178