Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
pktsize.c
Go to the documentation of this file.
1/*
2 * Packet size.
3 *
4 * Retail object 0x453A70-0x453B2F (link order; see docs/ORDER.md).
5 */
6#include "game.h"
7
8/* Function start: 0x453A70 */
9unsigned int GetPacketSize(const char *filename, short section)
10{
12 unsigned int size;
13
14 size = (unsigned int)-1;
15 if (OpenPacketSection(filename, section, &handle) != 0) {
16 switch (handle.compression) {
17 case 1:
18 ReadPacketSectionData(&handle, &size, 4);
19 if (g_nPacketError != 0)
20 size = (unsigned int)-1;
21 break;
22 case 2:
23 size = handle.dataSize;
24 break;
25 default:
26 size = handle.dataSize;
27 break;
28 }
29 CloseDataFileByHandle((unsigned short *)&handle);
30 }
31 return size;
32}
short ReadPacketSectionData(PacketSectionHandle *handle, void *destination, unsigned int length)
Definition resread.c:10
short OpenPacketSection(const char *filename, short section, PacketSectionHandle *handle)
Definition packet.c:14
void CloseDataFileByHandle(unsigned short *handle)
Definition packet.c:72
unsigned int GetPacketSize(const char *filename, short section)
Definition pktsize.c:9
Shared Win32 declarations, types and library interfaces.
short g_nPacketError
Definition datafile.c:10
unsigned int dataSize
Definition game_data.h:1179