git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

gbdk-support/png2hicolorgb/src/options.c

      1 //
      2 // options.c
      3 //
      4 #include <stdio.h>
      5 #include <string.h>
      6 #include <stdint.h>
      7 #include <stdbool.h>
      8 
      9 #include <options.h>
     10 
     11  // Use sequential tile order number (0->255) for map index instead of VRAM tile index (128->255->0->127)
     12 bool opt_map_use_sequential_tile_index = true;
     13 bool opt_tile_dedupe                   = true;
     14 bool opt_c_file_output                 = false;
     15 bool opt_c_precompiled                 = false;
     16 int  opt_bank_num                      = BANK_NUM_UNSET;
     17 bool opt_pal_end_bit                   = false;
     18 bool opt_enable_pal_end_col            = false;
     19 uint16_t pal_end_color                 = 0x0000u; // Black in BGR555
     20 
     21 void opt_set_map_tile_order(bool newval) { opt_map_use_sequential_tile_index = newval; }
     22 bool opt_get_map_tile_order(void)        { return opt_map_use_sequential_tile_index; }
     23 
     24 void opt_set_tile_dedupe(bool newval) { opt_tile_dedupe = newval; }
     25 bool opt_get_tile_dedupe(void)        { return opt_tile_dedupe; }
     26 
     27 void opt_set_c_file_output(bool newval) { opt_c_file_output = newval; }
     28 bool opt_get_c_file_output(void)        { return opt_c_file_output; }
     29 
     30 void opt_set_bank_num(int newval) { opt_bank_num = newval; }
     31 int opt_get_bank_num(void)        { return opt_bank_num; }
     32 
     33 void opt_set_precompiled_palette(bool newval) { opt_c_precompiled = newval; }
     34 bool opt_get_precompiled_palette(void)        { return opt_c_precompiled; }
     35 
     36 void opt_set_pal_end_bit(bool newval) { opt_pal_end_bit = newval; }
     37 bool opt_get_pal_end_bit(void)        { return opt_pal_end_bit; }
     38 
     39 void opt_set_enable_pal_end_color(uint16_t end_color_bgr555) {
     40 
     41     opt_enable_pal_end_col = true;
     42     // Make sure unused high bit is not set for compat with pal_end_bit
     43     pal_end_color = (end_color_bgr555 & BGR555_MASK);
     44 }
     45 
     46 bool opt_get_enable_pal_end_color(void) {
     47 
     48     return opt_enable_pal_end_col;
     49 }
     50 
     51 void opt_load_pal_end_color(uint16_t * p_end_color, int * pal_end_color_count) {
     52 
     53     *p_end_color = pal_end_color;
     54 
     55     if (opt_enable_pal_end_col) {
     56         *pal_end_color_count = APPEND_END_COLOR_COUNT; // Add 8 Palettes x 4 Colors to palette data (2 bytes each)
     57     } else {
     58         *pal_end_color_count = 0; // Not enabled, so add zero bytes to pal size
     59     }
     60 }

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.