gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-support/romusage/src/common.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 _COMMON_H
6 #define _COMMON_H
7
8 // #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
9
10 #define DEFAULT_STR_LEN 100
11
12 #define OPT_AREA_SORT_DEFAULT 0
13 #define OPT_AREA_SORT_SIZE_DESC 1
14 #define OPT_AREA_SORT_ADDR_ASC 2
15 #define OPT_AREA_SORT_HIDE 3
16
17 #define OPT_INPUT_SRC_NONE 0
18 #define OPT_INPUT_SRC_CDB 1
19 #define OPT_INPUT_SRC_NOI 2
20 #define OPT_INPUT_SRC_MAP 3
21 #define OPT_INPUT_SRC_IHX 4
22 #define OPT_INPUT_SRC_ROM 5
23
24 #define OPT_AREA_HIDE_SIZE_DEFAULT 0
25
26 #define OPT_PRINT_COLOR_OFF 0
27 #define OPT_PRINT_COLOR_WHOLE_ROW 1
28 #define OPT_PRINT_COLOR_WHOLE_ROW_DIMMED 2
29 #define OPT_PRINT_COLOR_ROW_ENDS 3
30 #define OPT_PRINT_COLOR_DEFAULT (OPT_PRINT_COLOR_WHOLE_ROW)
31
32
33 // Each flags should be a unique power of 2
34 #define OPT_MERGED_BANKS_NONE 0u
35 #define OPT_MERGED_BANKS_WRAM 1u
36 #define OPT_MERGED_BANKS_ROM 2u
37
38 #define OPT_PLAT_GAMEBOY 0u
39 #define OPT_PLAT_SMS_GG_GBDK 1u // GBDK specific layout for SMS/GG
40 #define OPT_PLAT_NES_GBDK_1 2u // GBDK specific layout for NES
41
42 #define BANKS_HIDE_SZ 30 // How many hide substrings to support
43 #define BANKS_HIDE_MAX (BANKS_HIDE_SZ - 1)
44
45 extern void options_reset_all(void);
46
47 extern bool banks_display_areas;
48 extern bool banks_display_headers;
49 extern bool banks_display_minigraph;
50 extern bool banks_display_largegraph;
51 extern bool option_compact_mode;
52 extern bool option_json_output;
53 extern bool option_summarized_mode;
54
55 extern unsigned int option_merged_banks;
56 extern unsigned int option_forced_display_max_bank_ROM;
57 extern unsigned int option_forced_display_max_bank_SRAM;
58
59 extern bool option_all_areas_exclusive;
60 extern bool option_quiet_mode;
61 extern bool option_suppress_duplicates;
62 extern bool option_error_on_warning;
63 extern unsigned int option_merged_banks;
64 // Use get_/set_() for these
65 // extern bool option_hide_banners;
66 // extern int option_input_source;
67 // extern int option_area_sort;
68 // extern int option_color_mode;
69 extern uint32_t option_area_hide_size;
70 extern bool exit_error;
71
72 extern int banks_hide_count;
73 extern char banks_hide_list[BANKS_HIDE_SZ][DEFAULT_STR_LEN];
74
75
76 void set_option_all_areas_exclusive(bool value);
77 void set_option_quiet_mode(bool value);
78 void set_option_suppress_duplicates(bool value);
79 void set_option_error_on_warning(bool value);
80 void set_option_hide_banners(bool value);
81 void set_option_input_source(int value);
82 void set_option_area_sort(int value);
83 void set_option_color_mode(int value);
84 void set_option_percentage_based_color(bool value);
85 void set_option_area_hide_size(uint32_t value);
86 void set_option_platform(unsigned int);
87 void set_option_display_asciistyle(bool value);
88 void set_option_show_compact(bool value);
89 void set_option_show_json(bool value);
90 void set_option_summarized(bool value);
91
92 bool set_option_displayed_bank_range(char * arg_str);
93
94 void set_option_merged_banks(unsigned int value);
95 bool set_option_banks_hide_add(char * str_bank_hide_substring);
96 bool set_option_binary_rom_empty_values(char * arg_str);
97
98 int get_option_input_source(void);
99 int get_option_area_sort(void);
100 int get_option_color_mode(void);
101 bool get_option_percentage_based_color(void);
102 bool get_option_hide_banners(void);
103 unsigned int get_option_platform(void);
104 bool get_option_display_asciistyle(void);
105 uint32_t get_option_area_hide_size(void);
106
107 uint32_t round_up_power_of_2(uint32_t val);
108
109 uint32_t min(uint32_t a, uint32_t b);
110 uint32_t max(uint32_t a, uint32_t b);
111
112 void set_option_is_web_mode(void);
113 bool get_option_is_web_mode(void);
114
115
116
117 #endif // _COMMON_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.