8 #include "rpage/aos/inc.prl" 17 extern struct DosLibrary *
DOSBase;
27 char tag[4], packer_tag[4];
28 UWORD unpacked_block_size, packed_block_size;
29 UBYTE *packed_block = NULL, *unpacked_block = NULL, *str_ptr;
32 printf(
"load_pak_locale_to_array(%s,%d);\n", filename, array_size);
34 if ((fileHandle = Open(filename, MODE_OLDFILE)))
36 Read(fileHandle, &tag, 4);
37 if (strncmp(tag,
"TXPK", 4) != 0)
39 printf(
"cannot found tag 'TXPK'!\n");
44 printf(
"found tag 'TXPK'!\n");
47 Read(fileHandle, &unpacked_block_size, 2);
48 unpacked_block = (
UBYTE *)calloc(unpacked_block_size,
sizeof(
UBYTE));
50 printf(
"unpacked_block_size = %d\n", unpacked_block_size);
53 Read(fileHandle, &packer_tag, 4);
56 Read(fileHandle, &tag, 4);
57 if (strncmp(tag,
"SIZE", 4) == 0)
60 Read(fileHandle, &packed_block_size, 2);
62 printf(
"packed_block_size = %d\n", packed_block_size);
64 packed_block = (
UBYTE *)calloc(packed_block_size,
sizeof(
UBYTE));
65 Read(fileHandle, packed_block, packed_block_size);
67 if (strncmp(packer_tag,
"MINZ", 4) == 0)
70 printf(
"Calling MINZ decoder!\n");
74 else if (strncmp(packer_tag,
"SHRK", 4) == 0)
77 printf(
"Calling SHRK decoder!\n");
79 ShrinklerDecompress(packed_block, unpacked_block, NULL, NULL);
81 else if (strncmp(packer_tag,
"NRV2", 4) == 0)
84 printf(
"Calling NRV2X decoder!\n");
86 nrv2s_unpack(packed_block, unpacked_block);
90 str_ptr = unpacked_block;
91 for(i = 0; i < array_size; i++)
94 str_len = (*str_ptr) << 8 | (*(str_ptr + 1));
96 printf(
"string len = 0x%X/%d, ", str_len, str_len);
99 text_array[i] = str_ptr;
102 printf(
"%s\n", text_array[i]);
108 if (packed_block != NULL)
118 printf(
", %s\n", tag);
124 return unpacked_block;
const char * err_no_size_found
UBYTE * load_pak_locale_to_array(char *text_array[], UWORD array_size, char *filename)
Compressed Text loading.
struct DosLibrary * DOSBase
size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags)