22#ifndef MADS_CORE_PACK_H
23#define MADS_CORE_PACK_H
25#include "common/stream.h"
26#include "mads/core/general.h"
30#define PACK_ID_STRING "MADSPACK 2.0\032"
31#define PACK_ID_STRING_V1 "MADSPACK 1.0\032"
32#define PACK_ID_LENGTH 14
33#define PACK_ID_CHECK 12
37#define PACK_RAW_COPY 2
49#define PACK_IMPLODE_SIZE 35256
50#define PACK_EXPLODE_SIZE 12574
52#define PACK_PFABCOMP_SIZE 0x71be
53#define PACK_PFABEXP0_SIZE 0x382c
54#define PACK_PFABEXP1_SIZE 0x0820
55#define PACK_PFABEXP2_SIZE 0x0004
63#define PACK_RAW_COPY_SIZE 0x1000
65#define PACK_WINDOW_SIZE 4096
66#define PACK_MIN_WINDOW_SIZE 1024
68#define PACK_MAX_PACKET_SIZE 0xfc00
70#define PACK_MAX_LIST_LENGTH 16
73#define PACK_PRIORITY_SPRITE_SERIES 4
74#define PACK_PRIORITY_ANIMATIONS 5
76#define PACK_PRIORITY_FONTS 7
77#define PACK_PRIORITY_ROOM_DATA 8
78#define PACK_PRIORITY_ROOM_HOTSPOTS 9
79#define PACK_PRIORITY_INTERFACES 10
80#define PACK_PRIORITY_ROOM_ART 11
82#define PACK_OVERHEAD PackList::SIZE
91 static constexpr size_t SIZE = 1 + 1 + 4 + 4;
96#define PACK_HEADER (PACK_ID_LENGTH + 2)
99 char id_string[PACK_ID_LENGTH];
104 static constexpr size_t SIZE = PACK_HEADER + PackStrategy::SIZE * PACK_MAX_LIST_LENGTH;
110extern byte *pack_read_memory_ptr;
111extern byte *pack_write_memory_ptr;
116extern long pack_read_size;
117extern long pack_read_count;
118extern long pack_write_size;
119extern long pack_write_count;
122extern word(*pack_read_routine)(
char *buffer, word *size);
124extern word(*pack_write_routine)(
char *buffer, word *size);
126extern word pack_mode;
127extern byte *pack_buffer;
128extern word pack_buffer_size;
130extern int pack_default;
132extern byte pack_zip_enabled;
133extern byte pack_pfab_enabled;
134extern int pack_strategy;
140extern word (*pack_implode_routine)(
141 word (*read_buff)(
char *buffer, word *size),
142 word (*write_buff)(
char *buffer, word *size),
147extern word (*pack_explode_routine)(
148 word (*read_buff)(
char *buffer, word *size),
149 word (*write_buff)(
char *buffer, word *size),
152extern word (*pack_pFABcomp_routine)(
153 word (*read_buff)(
char *buffer, word *size),
154 word (*write_buff)(
char *buffer, word *size),
159extern word (*pack_pFABexp0_routine)(
160 word (*read_buff)(
char *buffer, word *size),
161 word (*write_buff)(
char *buffer, word *size),
164extern word (*pack_pFABexp1_routine)(
165 word (*read_buff)(
char *buffer, word *size),
169extern word (*pack_pFABexp2_routine)(
175extern byte *pack_special_buffer;
176extern void (*pack_special_function)();
179extern word pack_read_memory(
char *buffer, word *size);
180extern word pack_write_memory(
char *buffer, word *size);
181extern word pack_read_file(
char *buffer, word *size);
182extern word pack_write_file(
char *buffer, word *size);
194extern word pack_a_packet(
int packing_flag,
int explode_mode);
229extern long pack_data(
int packing_flag,
long size,
int source_type,
void *source,
230 int dest_type,
void *dest);
231extern void pack_set_special_buffer(
byte *buffer_address,
232 void (*(special_function))());
240extern int pack_check();
241extern void pack_enable_zip();
242extern void pack_enable_pfab();
243extern void pack_enable_pfab_explode();
244extern void pack_enable_zip_explode();
245extern long pack_rle(
byte *target,
byte *source, word source_size);