Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
pload.c
Go to the documentation of this file.
1/*
2 * Packet loader (Library\Source\Pload.c).
3 *
4 * Retail object 0x446580-0x44670F (link order; see docs/ORDER.md).
5 */
6#include "game.h"
7
8/* Function start: 0x446580 */
10{
11 context->textCursor = context->text;
12 *context->textCursor = 0;
13}
14
15/* Function start: 0x4465A0 */
16void *PacketLoad(const char *filename, short section,
17 void *destination, short flags,
18 void *decompressionWorkspace,
19 int registerHandle)
20{
21 unsigned char *data;
23
24 data = 0;
25 if (OpenPacketSection(filename, section, &handle) != 0) {
26 switch (handle.compression) {
27 case 1:
29 "[SYSTEM] : ERROR\n"
30 "Library\\Source\\Pload.c PacketLoad Compressed data in '%s'\n",
31 filename);
32 SystemDebugPrintf("[SYSTEM] : Exiting prematurely\n");
35 exit(0);
36 break;
37 default:
38 if (handle.dataSize == 0) {
39 data = 0;
41 break;
42 }
43 data = destination;
44 if (data == 0) {
46 handle.dataSize, (short)(flags | 0x40));
48 if (data == 0)
50 }
51 if (data != 0) {
52 if (registerHandle != 0 &&
53 IsPushedPacketHandle(data) == 0)
55 "qq PacketLoad with non-pushed dest");
57 &handle, data, handle.dataSize) == 0)
58 data = 0;
59 }
60 break;
61 }
62 CloseDataFileByHandle((unsigned short *)&handle);
63 }
64 return data;
65}
char PumpMessagesDuringWait(void)
Definition console.cpp:46
void * PacketLoad(const char *filename, short section, void *destination, short flags, void *decompressionWorkspace, int registerHandle)
Definition pload.c:16
int IsPushedPacketHandle(void *handle)
Definition memapi.c:53
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
void * AllocateTaggedMemory(unsigned int size, short flags)
Definition memapi.c:92
void ClearDebugPauseFlags(void)
Definition console.cpp:82
void ResetStringBuilder(TextContext *context)
Definition pload.c:9
void exit_squadron(const char *msg,...)
Definition message.c:44
void SystemDebugPrintf(const char *format,...)
Definition console.cpp:30
Shared Win32 declarations, types and library interfaces.
short g_nPacketError
Definition datafile.c:10
void * g_26_pLibraryCurrentLastPacketAllocation
Definition eventmgr.c:2504
unsigned int dataSize
Definition game_data.h:1179
char * text
Definition game.h:290
char * textCursor
Definition game.h:291