--- /dev/null
+\e[0mSeg:0 Size:9973 Owner:0x0\r
+\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m0000\r
+\e[0m\e[0mSeg:27ba Size:36 Owner:0x0\r
+\e[41;31m+\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:27de Size:256 Owner:0x1984\r
+\e[44;34m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:28de Size:256 Owner:0x1776\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:29de Size:256 Owner:0x1778\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2ade Size:256 Owner:0x177a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2bde Size:256 Owner:0x177c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2cde Size:256 Owner:0x177e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2dde Size:256 Owner:0x1780\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2ede Size:256 Owner:0x1782\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2fde Size:256 Owner:0x1784\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:30de Size:256 Owner:0x1786\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:31de Size:256 Owner:0x1788\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:32de Size:256 Owner:0x178a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:33de Size:256 Owner:0x178c\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:34de Size:256 Owner:0x178e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:35de Size:256 Owner:0x1790\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:36de Size:256 Owner:0x1792\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:37de Size:256 Owner:0x1794\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:38de Size:256 Owner:0x1796\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:39de Size:256 Owner:0x1798\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3ade Size:256 Owner:0x179a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3bde Size:256 Owner:0x179c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3cde Size:256 Owner:0x179e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3dde Size:256 Owner:0x17a0\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3ede Size:256 Owner:0x17a2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3fde Size:256 Owner:0x17a4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:40de Size:256 Owner:0x17a6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:41de Size:256 Owner:0x17a8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:42de Size:256 Owner:0x17aa\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:43de Size:256 Owner:0x17ac\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:44de Size:256 Owner:0x17ae\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:45de Size:256 Owner:0x17b0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:46de Size:256 Owner:0x17b2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:47de Size:256 Owner:0x17b4\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:48de Size:256 Owner:0x17b6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:49de Size:256 Owner:0x17b8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4ade Size:256 Owner:0x17ba\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4bde Size:256 Owner:0x17bc\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4cde Size:256 Owner:0x17be\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4dde Size:256 Owner:0x17c0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4ede Size:256 Owner:0x17c2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4fde Size:256 Owner:0x17c4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:50de Size:256 Owner:0x17c6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:51de Size:256 Owner:0x17c8\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:52de Size:256 Owner:0x17ca\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:53de Size:256 Owner:0x17cc\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:54de Size:256 Owner:0x17ce\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:55de Size:256 Owner:0x17d0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:56de Size:256 Owner:0x17d2\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:57de Size:256 Owner:0x17d4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:58de Size:256 Owner:0x17d6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:59de Size:256 Owner:0x17d8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5ade Size:256 Owner:0x17da\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5bde Size:256 Owner:0x17dc\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5cde Size:256 Owner:0x17de\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5dde Size:256 Owner:0x17e0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5ede Size:256 Owner:0x17e2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5fde Size:256 Owner:0x17e4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:60de Size:256 Owner:0x17e6\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:61de Size:256 Owner:0x17e8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:62de Size:256 Owner:0x17ea\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:63de Size:256 Owner:0x17ec\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:64de Size:256 Owner:0x17ee\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:65de Size:256 Owner:0x17f0\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:66de Size:256 Owner:0x17f2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:67de Size:256 Owner:0x17f4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:68de Size:256 Owner:0x17f6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:69de Size:256 Owner:0x17f8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6ade Size:256 Owner:0x17fa\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6bde Size:256 Owner:0x17fc\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6cde Size:256 Owner:0x17fe\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6dde Size:256 Owner:0x1800\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6ede Size:256 Owner:0x1802\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6fde Size:256 Owner:0x1804\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:70de Size:256 Owner:0x1806\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:71de Size:256 Owner:0x1808\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:72de Size:256 Owner:0x180a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:73de Size:256 Owner:0x180c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:74de Size:256 Owner:0x180e\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:75de Size:256 Owner:0x1810\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:76de Size:256 Owner:0x1812\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:77de Size:256 Owner:0x1814\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:78de Size:256 Owner:0x1816\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:79de Size:256 Owner:0x1818\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7ade Size:256 Owner:0x181a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7bde Size:256 Owner:0x181c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7cde Size:256 Owner:0x181e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7dde Size:256 Owner:0x1820\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7ede Size:256 Owner:0x1822\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7fde Size:256 Owner:0x1824\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:80de Size:256 Owner:0x1826\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:81de Size:256 Owner:0x1828\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:82de Size:256 Owner:0x182a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:83de Size:256 Owner:0x182c\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:84de Size:256 Owner:0x182e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:85de Size:256 Owner:0x1830\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:86de Size:256 Owner:0x1832\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:87de Size:256 Owner:0x1834\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:88de Size:256 Owner:0x1836\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:89de Size:256 Owner:0x1838\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:8ade Size:256 Owner:0x183a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:8bde Size:256 Owner:0x183c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:8cde Size:401 Owner:0xef0c\r
+\e[44;34m++++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:b7de Size:18465 Owner:0x0\r
+\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m
\ No newline at end of file
--- /dev/null
+\r
+ == default ==\r
+\r
+ FREE block at 27dc0016 of size 68\r
+ USED block at 27dc005a of size 50\r
+ USED block at 27dc008c of size 50\r
+ USED block at 27dc00be of size 50\r
+ USED block at 27dc00f0 of size 50\r
+ USED block at 27dc0122 of size 50\r
+ USED block at 27dc0154 of size 50\r
+ USED block at 27dc0186 of size 50\r
+ USED block at 27dc01b8 of size 50\r
+ USED block at 27dc01ea of size 50\r
+ USED block at 27dc021c of size 50\r
+ USED block at 27dc024e of size 50\r
+ USED block at 27dc0280 of size 50\r
+ FREE block at 27dc02b2 of size 14\r
+ USED block at 27dc02c0 of size 20\r
+ USED block at 27dc02d4 of size 136\r
+ FREE block at 27dc035c of size 7328\r
+OK - end of heap\r
+\r
+ == near ==\r
+\r
+ USED block at 17dbefa6 of size 12\r
+ USED block at 17dbefb2 of size 330\r
+ USED block at 17dbf0fc of size 52\r
+ USED block at 17dbf130 of size 20\r
+ USED block at 17dbf144 of size 20\r
+ USED block at 17dbf158 of size 20\r
+ USED block at 17dbf16c of size 20\r
+ USED block at 17dbf180 of size 20\r
+ USED block at 17dbf194 of size 3688\r
+OK - end of heap\r
+\r
+ == far ==\r
+\r
+ USED block at 27dc0016 of size 68\r
+ USED block at 27dc005a of size 50\r
+ USED block at 27dc008c of size 50\r
+ USED block at 27dc00be of size 50\r
+ USED block at 27dc00f0 of size 50\r
+ USED block at 27dc0122 of size 50\r
+ USED block at 27dc0154 of size 50\r
+ USED block at 27dc0186 of size 50\r
+ USED block at 27dc01b8 of size 50\r
+ USED block at 27dc01ea of size 50\r
+ USED block at 27dc021c of size 50\r
+ USED block at 27dc024e of size 50\r
+ USED block at 27dc0280 of size 50\r
+ USED block at 27dc02b2 of size 14\r
+ USED block at 27dc02c0 of size 20\r
+ USED block at 27dc02d4 of size 136\r
+ USED block at 27dc035c of size 7328\r
+OK - end of heap\r
+\r
+Memory Type Total Used Free\r
+---------------- -------- -------- --------\r
+Default 8166 756 7410\r
+Near 4182 494 3688\r
+Far 8166 756 7410\r
+---------------- -------- -------- --------\r
+coreleft = 3686\r
+farcoreleft = 35502\r
+GetFreeSize = 31836\r
+GetNearFreeSize = 3688\r
+GetFarFreeSize = 31836\r
+memavl = 3686\r
+stackavail = 31557\r
*/\r
#include "src/lib/16_vrs.h"\r
\r
+void VRS_ReadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar){ VRS_OpenVRS(filename, enti, 1, gvar); }\r
+void VRS_LoadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar){ VRS_OpenVRS(filename, enti, 0, gvar); }\r
+void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar)\r
+{\r
+ //memptr big buffer;\r
+ static struct vrs_container vrs;\r
+ vrl1_vgax_offset_t **vrl_line_offsets;\r
+ uint16_t far *vrl_id_iter;\r
+ uint32_t far *vrl_headers_offsets;\r
+ struct vrl1_vgax_header far *curr_vrl;\r
+ uint32_t vrl_size;\r
+ int num_of_vrl,i;\r
+ int size=0;\r
+\r
+ switch(rlsw)\r
+ {\r
+ case 1:\r
+ CA_ReadFile(filename, &gvar->ca.spribuff, gvar);\r
+ break;\r
+ case 0:\r
+ CA_LoadFile(filename, &gvar->ca.spribuff, gvar);\r
+ break;\r
+ }\r
+\r
+ // Insert sanity cheks later\r
+ vrs.buffer = gvar->ca.spribuff;\r
+ vrs.data_size = size - sizeof(struct vrl1_vgax_header);\r
+ num_of_vrl = 0;\r
+ vrl_id_iter = (uint16_t far *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);\r
+ while(vrl_id_iter[num_of_vrl]){\r
+ num_of_vrl++;\r
+ }\r
+\r
+ // Allocate memory for vrl line offsets table\r
+ vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl);\r
+\r
+ vrl_headers_offsets = (uint32_t far *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);\r
+ // Calculate line offsets for each vrl\r
+ for(i = 0; i < num_of_vrl; i++){\r
+ curr_vrl = (struct vrl1_vgax_header far *)(vrs.buffer + vrl_headers_offsets[i]);\r
+\r
+ // Calc. vrl size as (next_offset - curr_offset)\r
+ if (i != num_of_vrl - 1){\r
+ vrl_size = vrl_headers_offsets[i+1] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);\r
+ }\r
+ // If it's the last vrl, size is (next_vrs_struct_offset - curr_offset)\r
+ else{\r
+ vrl_size = vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);\r
+ }\r
+ vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size);\r
+ }\r
+ vrs.vrl_line_offsets = vrl_line_offsets;\r
+\r
+ enti->spri->spritesheet = &vrs;\r
+ enti->spri->sprite_vrl_cont = malloc(sizeof(struct vrl_container));\r
+}\r
+\r
// Read .vrs file into far memory\r
int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container *vrs_cont){\r
int fd;\r