gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-support/bankpack/obj_data.h
1 // This is free and unencumbered software released into the public domain.
2 // For more information, please refer to <https://unlicense.org>
3 // bbbbbr 2020
4
5 #ifndef _AREAS_H
6 #define _AREAS_H
7
8 #include "list.h"
9
10 #define OBJ_NAME_MAX_STR_LEN 255
11 #define AREA_LINE_RECORDS 2 // Bank number, Size
12 #define SYMBOL_LINE_RECORDS 2 // Name, DefVal
13 #define SYMBOL_REWRITE_RECORDS 2 // Name, DefVal
14
15 #define BANK_TYPE_UNSET 0
16 #define BANK_TYPE_CODE 1 // Default type is CODE
17 #define BANK_TYPE_LIT_EXCLUSIVE 2
18
19
20 typedef struct bank_item {
21 uint32_t size;
22 uint32_t free;
23 uint32_t reserved;
24 uint32_t type;
25 uint16_t item_count;
26 } bank_item;
27
28
29 typedef struct area_item {
30 uint32_t file_id;
31 char name[OBJ_NAME_MAX_STR_LEN];
32 uint32_t size; // uint32_t to avoid mingw sscanf() buffer overflow
33 uint32_t bank_num_in; // uint32_t to avoid mingw sscanf() buffer overflow
34 uint32_t bank_num_out; // uint32_t to avoid mingw sscanf() buffer overflow
35 uint32_t type;
36 } area_item;
37
38 typedef struct symbol_item {
39 uint32_t file_id;
40 char name[OBJ_NAME_MAX_STR_LEN];
41 bool is_banked_def;
42 uint32_t bank_num_in; // uint32_t to avoid mingw sscanf() buffer overflow
43 bool found_matching_symbol;
44 } symbol_item;
45
46 typedef struct symbol_match_item {
47 char name[OBJ_NAME_MAX_STR_LEN];
48 } symbol_match_item;
49
50
51 void obj_data_init(void);
52 void obj_data_cleanup(void);
53
54 int areas_add(char * area_str, uint32_t file_id);
55 int symbols_add(char * area_str, uint32_t file_id, unsigned int obj_file_format);
56 void symbol_match_add(char *);
57
58 void obj_data_process(list_type *);
59
60 bool area_modify_and_write_to_file(char * strline_in, FILE * out_file, uint16_t bank_num);
61 bool symbol_modify_and_write_to_file(char * strline_in, FILE * out_file, uint16_t bank_num, uint32_t file_id, unsigned int obj_file_format);
62
63 void banks_show(void);
64
65
66 #endif // _AREAS_H
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.