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/hicolor/defines.h

      1 
      2 
      3 #ifndef __defines_h__
      4 #define __defines_h__
      5 
      6 #include <stdint.h>
      7 
      8 #include <common.h>
      9 
     10 // Originates on Windows format is BGRX24
     11 // TODO: is this right & ok for what code expects?
     12 typedef struct tagRGBQUAD {
     13   uint8_t rgbBlue;
     14   uint8_t rgbGreen;
     15   uint8_t rgbRed;
     16   uint8_t rgbReserved;
     17 } RGBQUAD;
     18 
     19 #define CGB_ATTR_TILES_BANK_0   0x00u
     20 #define CGB_ATTR_TILES_BANK_1   0x08u
     21 #define CGB_ATTR_TILES_BANK     0x08u
     22 #define CGB_ATTR_NO_FLIP        0x00u
     23 #define CGB_ATTR_VFLIP          0x40u
     24 #define CGB_ATTR_HFLIP          0x20u
     25 #define CGB_ATTR_PALETTES_ONLY     0x07u
     26 #define CGB_ATTR_WITHOUT_PALETTES  (~(CGB_ATTR_PALETTES_ONLY))
     27 
     28 #define CGB_TILES_START_BANK_0  0u
     29 #define CGB_TILES_START_BANK_1  256u
     30 
     31 #define RGB_SZ   3    // RGB888 size in bytes
     32 #define TILE_SZ  16u  // Tile size in bytes: (8 x 8) pixels x 2 Bits per pixel
     33 
     34 #define u8	uint8_t
     35 #define u16	uint16_t
     36 #define u32 uint32_t
     37 #define s8	int8_t
     38 #define s16 int16_t
     39 #define s32 int32_t
     40 
     41 enum conversion_types {
     42     CONV_TYPE_MED_CUT_NO_DITHER = 1,
     43     CONV_TYPE_MED_CUT_YES_DITHER = 2,
     44     CONV_TYPE_WU = 3,
     45 
     46     CONV_TYPE_MIN  = CONV_TYPE_MED_CUT_NO_DITHER,
     47     CONV_TYPE_MAX  = CONV_TYPE_WU
     48 };
     49 
     50 enum pattern_types {
     51     HICOLOR_PATTERN_ADAPTIVE_FAST = 0,
     52     HICOLOR_PATTERN_ADAPTIVE_MED  = 1,
     53     HICOLOR_PATTERN_ADAPTIVE_BEST = 2,
     54 
     55     HICOLOR_PATTERN_ADAPTIVE_COUNT = 3,
     56     HICOLOR_PATTERN_FIXED_COUNT    = 80,
     57     HICOLOR_PATTERN_MIN = 0,
     58     HICOLOR_PATTERN_MAX = (HICOLOR_PATTERN_FIXED_COUNT - 1),
     59 
     60     HICOLOR_PATTERN_OPT_MIN = 0,
     61     HICOLOR_PATTERN_OPT_MAX = ((HICOLOR_PATTERN_FIXED_COUNT + HICOLOR_PATTERN_ADAPTIVE_COUNT) - 1),
     62 
     63     HICOLOR_PATTERN_NOT_FOUND           = 998,
     64     HICOLOR_PATTERN_NOT_FOUND_HAS_CHARS = 999
     65 };
     66 
     67 #define CONV_SIDE_LEFT  0
     68 #define CONV_SIDE_RIGHT 1
     69 
     70 #define CONV_Y_SHIFT_UP_1    1
     71 #define CONV_Y_SHIFT_NO      0
     72 
     73 #define SM83_OPCODE_HALT        0x76u
     74 #define SM83_OPCODE_LD_HL_B     0x70u
     75 #define SM83_OPCODE_LD_HL_C     0x71u
     76 #define SM83_OPCODE_LD_HL_D     0x72u
     77 #define SM83_OPCODE_LD_HL_E     0x73u
     78 #define SM83_OPCODE_LD_HL_IMM8  0x36u
     79 #define SM83_OPCODE_RET         0xC9u
     80 
     81 #define PAL_REGION_HEIGHT_PX 2
     82 
     83 // #define BUF_WIDTH      160      // Originally 160
     84 // #define BUF_WIDTH_TILE_MAX      (BUF_WIDTH / TILE_WIDTH_PX)
     85 #define BUF_HEIGHT                  256      // Originally 144
     86 #define BUF_HEIGHT_IN_TILES         (BUF_HEIGHT / TILE_HEIGHT_PX)
     87 #define BUF_HEIGHT_IN_TILES_RNDUP   (BUF_HEIGHT_IN_TILES+1)        // Use larger size[side] for rounded up amount
     88 #define BUF_Y_REGION_COUNT_LR_RNDUP (((BUF_HEIGHT / PAL_REGION_HEIGHT_PX) + 1))
     89 
     90 #define VALIDATE_WIDTH  160 // (BUF_WIDTH)
     91 #define VALIDATE_HEIGHT (BUF_HEIGHT)
     92 
     93 #define BYTES_PER_COLOR 2
     94 #define COLORS_PER_PAL  4
     95 #define PALS_PER_SIDE  4
     96 
     97 
     98 #endif

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