From 6ee86990792b2563e081bf08e24f5b3688373ac7 Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Sat, 11 Aug 2018 15:54:00 -0700 Subject: [PATCH] Rename color_mode_t values for clarity --- .../iosPrefControllerViewController.m | 6 ++--- .../Classes/OSX/EmulatorPrefsController.m | 12 +++++----- src/display.c | 24 +++++++++---------- src/display.h | 6 ++--- src/interface.c | 4 ++-- src/test/testcommon.c | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Apple2Mac/Apple2Mac/iosPrefControllerViewController.m b/Apple2Mac/Apple2Mac/iosPrefControllerViewController.m index 87829244..65a885a7 100644 --- a/Apple2Mac/Apple2Mac/iosPrefControllerViewController.m +++ b/Apple2Mac/Apple2Mac/iosPrefControllerViewController.m @@ -34,7 +34,7 @@ [defaults setDouble:CPU_SCALE_SLOWEST forKey:kApple2AltSpeed]; [defaults setBool:NO forKey:kApple2CPUSpeedIsMax]; [defaults setBool:NO forKey:kApple2AltSpeedIsMax]; - [defaults setInteger:COLOR_INTERP forKey:kApple2ColorConfig]; + [defaults setInteger:COLOR_MODE_INTERP forKey:kApple2ColorConfig]; // [defaults setInteger:JOY_KPAD forKey:kApple2JoystickConfig]; [defaults setBool:YES forKey:kApple2JoystickAutoRecenter]; [defaults removeObjectForKey:kApple2PrefStartupDiskA]; @@ -72,9 +72,9 @@ } NSInteger mode = [defaults integerForKey:kApple2ColorConfig]; - if (! ((mode >= COLOR_NONE) && (mode < NUM_COLOROPTS)) ) + if (! ((mode >= COLOR_MODE_BW) && (mode < NUM_COLOROPTS)) ) { - mode = COLOR_NONE; + mode = COLOR_MODE_BW; } //[self.videoModePicker d:mode]; //color_mode = (color_mode_t)mode; diff --git a/Apple2Mac/Classes/OSX/EmulatorPrefsController.m b/Apple2Mac/Classes/OSX/EmulatorPrefsController.m index e03cb13f..73e65783 100644 --- a/Apple2Mac/Classes/OSX/EmulatorPrefsController.m +++ b/Apple2Mac/Classes/OSX/EmulatorPrefsController.m @@ -68,7 +68,7 @@ [defaults setDouble:CPU_SCALE_SLOWEST forKey:kApple2AltSpeed]; [defaults setBool:NO forKey:kApple2CPUSpeedIsMax]; [defaults setBool:NO forKey:kApple2AltSpeedIsMax]; - [defaults setInteger:COLOR_INTERP forKey:kApple2ColorConfig]; + [defaults setInteger:COLOR_MODE_INTERP forKey:kApple2ColorConfig]; [defaults setInteger:JOY_KPAD forKey:kApple2JoystickConfig]; [defaults setBool:YES forKey:kApple2JoystickAutoRecenter]; [defaults removeObjectForKey:kApple2PrefStartupDiskA]; @@ -110,9 +110,9 @@ [self.soundCardChoice selectCellAtRow:1 column:0]; NSInteger mode = [defaults integerForKey:kApple2ColorConfig]; - if (! ((mode >= COLOR_NONE) && (mode < NUM_COLOROPTS)) ) + if (! ((mode >= COLOR_MODE_BW) && (mode < NUM_COLOROPTS)) ) { - mode = COLOR_NONE; + mode = COLOR_MODE_BW; } [self.colorChoice selectItemAtIndex:mode]; prefs_setLongValue(PREF_DOMAIN_VIDEO, PREF_COLOR_MODE, (color_mode_t)mode); @@ -166,7 +166,7 @@ [defaults setBool:([self.altMaxChoice state] == NSOnState) forKey:kApple2AltSpeedIsMax]; long lVal = 0; - color_mode_t mode = prefs_parseLongValue(PREF_DOMAIN_VIDEO, PREF_COLOR_MODE, &lVal, /*base:*/10) ? (color_mode_t)lVal : COLOR_INTERP; + color_mode_t mode = prefs_parseLongValue(PREF_DOMAIN_VIDEO, PREF_COLOR_MODE, &lVal, /*base:*/10) ? (color_mode_t)lVal : COLOR_MODE_INTERP; [defaults setInteger:mode forKey:kApple2ColorConfig]; [defaults setInteger:joy_mode forKey:kApple2JoystickConfig]; @@ -223,9 +223,9 @@ - (IBAction)colorChoiceChanged:(id)sender { NSInteger mode = [self.colorChoice indexOfSelectedItem]; - if (! ((mode >= COLOR_NONE) && (mode < NUM_COLOROPTS)) ) + if (! ((mode >= COLOR_MODE_BW) && (mode < NUM_COLOROPTS)) ) { - mode = COLOR_NONE; + mode = COLOR_MODE_BW; } prefs_setLongValue(PREF_DOMAIN_VIDEO, PREF_COLOR_MODE, mode); prefs_sync(PREF_DOMAIN_VIDEO); diff --git a/src/display.c b/src/display.c index 1fef3ae8..6d845cfd 100644 --- a/src/display.c +++ b/src/display.c @@ -27,7 +27,7 @@ static uint8_t video__wider_font[0x8000] = { 0 }; static uint8_t video__font[0x4000] = { 0 }; static uint8_t video__int_font[5][0x4000] = { { 0 } }; // interface font -static color_mode_t color_mode = COLOR_NONE; +static color_mode_t color_mode = COLOR_MODE_COLOR; // Precalculated framebuffer offsets given VM addr static unsigned int video__screen_addresses[8192] = { INT_MIN }; @@ -142,7 +142,7 @@ static void _initialize_hires_values(void) { } } - if (color_mode == COLOR_NONE) { + if (color_mode == COLOR_MODE_BW) { for (unsigned int value = 0x00; value <= 0xFF; value++) { for (unsigned int b = 0, e = value * 8; b < 7; b++, e++) { if (video__hires_even[e] != COLOR_BLACK) { @@ -153,7 +153,7 @@ static void _initialize_hires_values(void) { } } } - } else if (color_mode == COLOR_INTERP) { + } else if (color_mode == COLOR_MODE_INTERP) { for (unsigned int value = 0x00; value <= 0xFF; value++) { for (unsigned int b=1, e=value*8 + 1; b <= 5; b += 2, e += 2) { if (video__hires_even[e] == COLOR_BLACK) { @@ -427,13 +427,13 @@ static void _initialize_color() { } static void display_prefsChanged(const char *domain) { - long val = COLOR_INTERP; + long val = COLOR_MODE_INTERP; prefs_parseLongValue(domain, PREF_COLOR_MODE, &val, /*base:*/10); if (val < 0) { - val = COLOR_INTERP; + val = COLOR_MODE_INTERP; } if (val >= NUM_COLOROPTS) { - val = COLOR_INTERP; + val = COLOR_MODE_INTERP; } color_mode = (color_mode_t)val; display_reset(); @@ -644,7 +644,7 @@ static void _plot_lores40_scanline(scan_data_t *scandata) { uint8_t val = (b & lores_mask) << lores_shift; uint32_t val32; - if (color_mode == COLOR_NONE) { + if (color_mode == COLOR_MODE_BW) { uint8_t rot2 = ((col % 2) << 1); // 2 phases at double rotation val = (val << rot2) | ((val & 0xC0) >> rot2); val32 = ((val & 0x10) ? COLOR_LIGHT_WHITE : COLOR_BLACK) << 0; @@ -697,7 +697,7 @@ static void _plot_lores80_scanline(scan_data_t *scandata) { uint32_t val32_lo = 0x0; uint32_t val32_hi = 0x0; - if (color_mode == COLOR_NONE && val != 0x0) { + if (color_mode == COLOR_MODE_BW && val != 0x0) { val = (val >> 4) | val; { uint16_t val16 = val | (val << 8); @@ -729,7 +729,7 @@ static void _plot_lores80_scanline(scan_data_t *scandata) { uint32_t val32_lo = 0x0; uint32_t val32_hi = 0x0; - if (color_mode == COLOR_NONE && val != 0x0) { + if (color_mode == COLOR_MODE_BW && val != 0x0) { val = (val >> 4) | val; { uint16_t val16 = val | (val << 8); @@ -840,7 +840,7 @@ void display_plotMessage(uint8_t *fb, const interface_colorscheme_t cs, const ch static inline void __plot_hires80_pixels(uint8_t idx, uint8_t *fb_ptr) { uint8_t bCurr = idx; - if (color_mode == COLOR_NONE) { + if (color_mode == COLOR_MODE_BW) { uint32_t b32; b32 = (bCurr & 0x1) ? COLOR_LIGHT_WHITE : COLOR_BLACK; b32 |= ((bCurr & 0x2) ? COLOR_LIGHT_WHITE : COLOR_BLACK) << 8; @@ -1018,7 +1018,7 @@ static void _plot_hires40_scanline(scan_data_t *scandata) { *((uint16_t *)&color_buf[0]) = *((uint16_t *)(fb_ptr-3)); *((uint16_t *)&color_buf[DYNAMIC_SZ-2]) = *((uint16_t *)(fb_ptr+15)); - if (color_mode != COLOR_NONE) { + if (color_mode != COLOR_MODE_BW) { uint8_t *hires_altbase = NULL; if (is_even) { hires_altbase = (uint8_t *)&video__hires_odd[0]; @@ -1046,7 +1046,7 @@ static void _plot_hires40_scanline(scan_data_t *scandata) { } } - if (color_mode == COLOR_INTERP) { + if (color_mode == COLOR_MODE_BW) { uint8_t *interp_base = NULL; uint8_t *interp_altbase = NULL; if (is_even) { diff --git a/src/display.h b/src/display.h index e16bc345..dce5fb5d 100644 --- a/src/display.h +++ b/src/display.h @@ -60,9 +60,9 @@ extern A2Color_s colormap[]; * Color options */ typedef enum color_mode_t { - COLOR_NONE = 0, - COLOR, - COLOR_INTERP, + COLOR_MODE_BW = 0, + COLOR_MODE_COLOR, + COLOR_MODE_INTERP, NUM_COLOROPTS } color_mode_t; diff --git a/src/interface.c b/src/interface.c index 904d3b58..41f86fca 100644 --- a/src/interface.c +++ b/src/interface.c @@ -800,8 +800,8 @@ void c_interface_parameters() break; case OPT_COLOR: - sprintf(temp, "%s", (color_mode == COLOR) ? "Color " : - (color_mode == COLOR_INTERP) ? "Interpolated" : "Black/White "); + sprintf(temp, "%s", (color_mode == COLOR_MODE_COLOR) ? "Color " : + (color_mode == COLOR_MODE_INTERP) ? "Interpolated" : "Black/White "); break; case OPT_JOYSTICK: diff --git a/src/test/testcommon.c b/src/test/testcommon.c index 495ba187..bd2cac97 100644 --- a/src/test/testcommon.c +++ b/src/test/testcommon.c @@ -51,7 +51,7 @@ void test_common_init(void) { LEAK(envvar); prefs_load(); - prefs_setLongValue(PREF_DOMAIN_VIDEO, PREF_COLOR_MODE, COLOR); + prefs_setLongValue(PREF_DOMAIN_VIDEO, PREF_COLOR_MODE, COLOR_MODE_COLOR); prefs_setBoolValue(PREF_DOMAIN_KEYBOARD, PREF_KEYBOARD_CAPS, true); prefs_setFloatValue(PREF_DOMAIN_VM, PREF_CPU_SCALE, (CPU_SCALE_FASTEST * 100.)); prefs_setFloatValue(PREF_DOMAIN_VM, PREF_CPU_SCALE_ALT, (CPU_SCALE_FASTEST * 100.));