1 #pragma once
2 
3 #include <stdint.h>
4 #include <stdbool.h>
5 
6 #define RGB32_R(x) (((x) >> 16) & 0xFF)
7 #define RGB32_G(x) (((x) >> 8) & 0xFF)
8 #define RGB32_B(x) ((x) & 0xFF)
9 #define RGB32(r, g, b) (((r) << 16) | ((g) << 8) | (b))
10 #define P6_TO_P8(x) (((x) << 2) + ((x) >> 4))
11 
12 #define PAL_TRANSPR 127
13 
14 // FT2 palette (exact order as real FT2)
15 enum
16 {
17 	PAL_BCKGRND = 0,
18 	PAL_PATTEXT = 1,
19 	PAL_BLCKMRK = 2,
20 	PAL_BLCKTXT = 3,
21 	PAL_DESKTOP = 4,
22 	PAL_FORGRND = 5,
23 	PAL_BUTTONS = 6,
24 	PAL_BTNTEXT = 7,
25 	PAL_DSKTOP2 = 8,
26 	PAL_DSKTOP1 = 9,
27 	PAL_BUTTON2 = 10,
28 	PAL_BUTTON1 = 11,
29 	PAL_MOUSEPT = 12,
30 
31 	// these are used for mouse XOR when hovering over the piano (?)
32 	PAL_PIANOXOR1 = 13,
33 	PAL_PIANOXOR2 = 14,
34 	PAL_PIANOXOR3 = 15,
35 
36 	// custom clone palettes
37 	PAL_LOOPPIN = 16,
38 	PAL_TEXTMRK = 17,
39 	PAL_BOXSLCT = 18,
40 
41 	// modifiable with setCustomPalColor()
42 	PAL_CUSTOM = 19,
43 
44 	PAL_NUM
45 };
46 
47 #ifdef _MSC_VER
48 #pragma pack(push)
49 #pragma pack(1)
50 #endif
51 typedef struct pal16_t
52 {
53 	uint8_t r, g, b;
54 }
55 #ifdef __GNUC__
56 __attribute__ ((packed))
57 #endif
58 pal16;
59 #ifdef _MSC_VER
60 #pragma pack(pop)
61 #endif
62 
63 void setCustomPalColor(uint32_t color);
64 
65 uint8_t palMax(int32_t c);
66 void setPal16(pal16 *p, bool redrawScreen);
67 
68 void sbPalRPos(uint32_t pos);
69 void sbPalGPos(uint32_t pos);
70 void sbPalBPos(uint32_t pos);
71 void sbPalContrastPos(uint32_t pos);
72 void configPalRDown(void);
73 void configPalRUp(void);
74 void configPalGDown(void);
75 void configPalGUp(void);
76 void configPalBDown(void);
77 void configPalBUp(void);
78 void configPalContDown(void);
79 void configPalContUp(void);
80 void showPaletteEditor(void);
81 
82 void rbConfigPalPatternText(void);
83 void rbConfigPalBlockMark(void);
84 void rbConfigPalTextOnBlock(void);
85 void rbConfigPalMouse(void);
86 void rbConfigPalDesktop(void);
87 void rbConfigPalButttons(void);
88 void rbConfigPalArctic(void);
89 void rbConfigPalLitheDark(void);
90 void rbConfigPalAuroraBorealis(void);
91 void rbConfigPalRose(void);
92 void rbConfigPalBlues(void);
93 void rbConfigPalDarkMode(void);
94 void rbConfigPalGold(void);
95 void rbConfigPalViolent(void);
96 void rbConfigPalHeavyMetal(void);
97 void rbConfigPalWhyColors(void);
98 void rbConfigPalJungle(void);
99 void rbConfigPalUserDefined(void);
100 
101 extern uint8_t cfg_ColorNum;
102