Wing Commander II
Reconstructed Win32 source (1996)
Toggle main menu visibility
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 */
10
short
ReadPacketSectionData
(
PacketSectionHandle
*handle,
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
}
ReadDataFileAtOffset
int ReadDataFileAtOffset(unsigned short fd, int offset, unsigned int length, void *data)
Definition
datafile.c:60
ReadPacketSectionData
short ReadPacketSectionData(PacketSectionHandle *handle, void *destination, unsigned int length)
Definition
resread.c:10
game.h
Shared Win32 declarations, types and library interfaces.
PacketSectionHandle
Definition
game_data.h:1172
PacketSectionHandle::dataOffset
unsigned int dataOffset
Definition
game_data.h:1177
PacketSectionHandle::file
short file
Definition
game_data.h:1173
PacketSectionHandle::dataSize
unsigned int dataSize
Definition
game_data.h:1179
PacketSectionHandle::position
unsigned int position
Definition
game_data.h:1178
src
resread.c
Generated by
1.18.0