Browse Source

use custom palettes to print scores

Thomas B 1 month ago
parent
commit
efed27d979
3 changed files with 9 additions and 7 deletions
  1. 2
    5
      src/gbprinter.c
  2. 6
    1
      src/gbprinter.h
  3. 1
    1
      src/main.c

+ 2
- 5
src/gbprinter.c View File

@@ -38,9 +38,6 @@ BANKREF(gbprinter)
38 38
 #define PRN_BUSY_TIMEOUT   (2 * 60) // 2s
39 39
 #define PRN_PRINT_TIMEOUT  (20 * 60) // 20s
40 40
 
41
-#define PRN_PALETTE_NORMAL 0b11100100u
42
-#define PRN_PALETTE_INV    0b00011011u
43
-
44 41
 #define PRN_NO_MARGINS     0x00
45 42
 #define PRN_FINAL_MARGIN   0x03
46 43
 
@@ -172,7 +169,7 @@ static void win_str_helper(const char *s, uint8_t y_pos) {
172 169
     win_str_center(line_buff, y_pos, 0);
173 170
 }
174 171
 
175
-enum PRN_STATUS gbprinter_screenshot(uint8_t win) BANKED {
172
+enum PRN_STATUS gbprinter_screenshot(uint8_t win, uint8_t palette) BANKED {
176 173
     static uint8_t tile_buff[2 * DEVICE_SCREEN_WIDTH * 16];
177 174
     static struct prn_config params;
178 175
     enum PRN_STATUS r = PRN_STATUS_OK;
@@ -222,7 +219,7 @@ enum PRN_STATUS gbprinter_screenshot(uint8_t win) BANKED {
222 219
 
223 220
     params.sheets = 1;
224 221
     params.margins = PRN_FINAL_MARGIN;
225
-    params.palette = PRN_PALETTE_NORMAL;
222
+    params.palette = palette;
226 223
     params.exposure = PRN_EXPO_DARK;
227 224
 
228 225
     printer_send_command(PRN_CMD_PRINT, (uint8_t *)&params, sizeof(struct prn_config));

+ 6
- 1
src/gbprinter.h View File

@@ -45,8 +45,13 @@ enum PRN_STATUS {
45 45
     PRN_STATUS_MASK_ANY    = 0x7FF,
46 46
 };
47 47
 
48
+#define PRN_PALETTE_NORMAL 0b11100100u
49
+#define PRN_PALETTE_INV    0b00011011u
50
+#define PRN_PALETTE_SC_W   0b00110100u
51
+#define PRN_PALETTE_SC_B   0b00011100u
52
+
48 53
 enum PRN_STATUS gbprinter_detect(void) BANKED;
49
-enum PRN_STATUS gbprinter_screenshot(uint8_t win) BANKED;
54
+enum PRN_STATUS gbprinter_screenshot(uint8_t win, uint8_t palette) BANKED;
50 55
 
51 56
 uint8_t gbprinter_error(enum PRN_STATUS status, char *buff);
52 57
 

+ 1
- 1
src/main.c View File

@@ -93,7 +93,7 @@ static void highscore(uint8_t is_black) NONBANKED {
93 93
             if (status == PRN_STATUS_OK) {
94 94
                 win_score_clear(is_black, 1);
95 95
                 list_scores(is_black);
96
-                status = gbprinter_screenshot(1);
96
+                status = gbprinter_screenshot(1, is_black ? PRN_PALETTE_SC_B : PRN_PALETTE_SC_W);
97 97
             }
98 98
 
99 99
             win_score_clear(2, 0);

Loading…
Cancel
Save