]> 4ch.mooo.com Git - 16.git/blob - src/lib/16_vrs.h
added files from branch wwww
[16.git] / src / lib / 16_vrs.h
1 /* Project 16 Source Code~
2  * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
3  *
4  * This file is part of Project 16.
5  *
6  * Project 16 is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Project 16 is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,
19  * Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  */
22 #ifndef __16_VRS__
23 #define __16_VRS__
24
25 #include "src/lib/modex16.h"
26 #include "src/lib/typdefst.h"
27 //#include <hw/cpu/cpu.h>
28 //#include <hw/dos/dos.h>
29 #include <hw/vga/vrl.h>
30 #include "src/lib/16_ca.h"
31
32 struct vrs_container{
33         // Size of a .vrs lob in memory
34         dword size;
35         union{
36                 byte huge *buffer;
37                 struct vrs_header huge *vrs_hdr;
38         };
39         // Array of corresponding vrl line offsets
40         vrl1_vgax_offset_t **vrl_line_offsets;
41 };
42
43 struct vrl_container{
44         // Size of a .vrl blob in memory
45         dword size;
46         union{
47                 byte huge *buffer;
48                 struct vrl1_vgax_header huge *vrl_header;
49         };
50         // Pointer to a corresponding vrl line offsets struct
51         vrl1_vgax_offset_t *line_offsets;
52 };
53
54 /* Read .vrs file into memory
55 * In:
56 * + char *filename - name of the file to load
57 * + struct vrs_container *vrs_cont - pointer to the vrs_container
58 * to load the file into
59 * Out:
60 * + int - 0 on succes, 1 on failure
61 */
62 int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container *vrs_cont);
63
64 /* Seek and return a specified .vrl blob from .vrs blob in memory
65 * In:
66 * + struct vrs_container *vrs_cont - pointer to the vrs_container
67 * with a loaded .vrs file
68 * + uint16_t id - id of the vrl to retrive
69 * Out:
70 * struct vrl_container* - a pointer to a vrl_container with a pointer
71 * to the requested .vrl blob
72 */
73 struct vrl_container * get_vrl_by_id(struct vrs_container *vrs_cont, uint16_t id);
74
75 #endif