]> 4ch.mooo.com Git - 16.git/blob - src/lib/16_vrs.h
a0f306201855ef5b01109ffe5daeb2b150d2d291
[16.git] / src / lib / 16_vrs.h
1 #ifndef __16_VRS__
2 #define __16_VRS__
3
4 #include <stdint.h>
5 #include "hw/vga/vrl.h"
6 #include "hw/vga/vrs.h"
7
8 // Container for .vrs files loaded in memory with useful info
9 // Includes: 
10 // + size of the .vrs blob in memory
11 // + pointer to the blob/vrs header
12 // + id of the curent (shown) animation
13 // + id of the first sprite of the curret animation (supplementary)
14 // + id of the current (shown) sprite
15
16 struct vrs_container{
17         unsigned long size;
18         union{
19                 unsigned char *buffer;
20                 struct vrs_header *vrs_hdr;
21         };
22         uint16_t anchor_sprite_id;
23         uint16_t current_sprite_id; 
24 };
25
26 // Container for .vrl files loaded in memory with useful info
27 // Includes:
28 // + size of the .vrl blob in memory
29 // + pointer to the blob/vrl header
30 struct vrl_container{
31         unsigned long size;
32         union{
33                 unsigned char *buffer;
34                 struct vrl1_vgax_header *vrl_header;
35         };
36 };
37
38 // Read .vrs file into memory
39 // In:
40 // + char *filename - name of the file to load
41 // + struct vrs_container *vrs_cont - pointer to the vrs_container 
42 // to load the file into
43 // Out:
44 // + int - 0 on succes, 1 on failure
45 int read_vrs(char *filename, struct vrs_container *vrs_cont);
46
47 // Seek and return a specified .vrl blob from .vrs blob in memory
48 // In:
49 // + struct vrs_container *vrs_cont - pointer to the vrs_container 
50 // with a loaded .vrs file
51 // + uint16_t id - id of the vrl to retrive
52 // Out:
53 // struct vrl_container* - a pointer to a vrl_container with a pointer
54 // to the requested .vrl blob
55 struct vrl_container* get_vrl_by_id(struct vrs_container *vrs_cont, uint16_t id);
56
57 #endif