From 530debff00026e4cc84112a1e472f988cd18dd9a Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 20 May 2018 19:12:29 +0300 Subject: [PATCH] power_led_dim adjusts now brightness of dimmed state (1 to 100, 0 = off) --- cfgfile.cpp | 6 +++--- cia.cpp | 4 ++-- include/options.h | 2 +- od-win32/direct3d.cpp | 2 +- od-win32/direct3d11.cpp | 2 +- od-win32/win32gui.cpp | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cfgfile.cpp b/cfgfile.cpp index 5a7bfd81..85cc3dcc 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -2065,7 +2065,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) write_leds(f, _T("show_leds_enabled"), p->leds_on_screen_mask[0]); write_leds(f, _T("show_leds_enabled_rtg"), p->leds_on_screen_mask[1]); cfgfile_dwrite_bool(f, _T("show_refresh_indicator"), p->refresh_indicator); - cfgfile_dwrite_bool(f, _T("power_led_dim"), p->power_led_dim); + cfgfile_dwrite(f, _T("power_led_dim"), _T("%d"), p->power_led_dim); if (p->osd_pos.y || p->osd_pos.x) { cfgfile_dwrite (f, _T("osd_position"), _T("%.1f%s:%.1f%s"), @@ -3027,7 +3027,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_intval (option, value, _T("sound_stereo_mixing_delay"), &p->sound_mixed_stereo_delay, 1) || cfgfile_intval (option, value, _T("sampler_frequency"), &p->sampler_freq, 1) || cfgfile_intval (option, value, _T("sampler_buffer"), &p->sampler_buffer, 1) - || cfgfile_intval (option, value, _T("warp_limit"), &p->turbo_emulation_limit, 1) + || cfgfile_intval(option, value, _T("warp_limit"), &p->turbo_emulation_limit, 1) + || cfgfile_intval(option, value, _T("power_led_dim"), &p->power_led_dim, 1) || cfgfile_intval(option, value, _T("gfx_frame_slices"), &p->gfx_display_sections, 1) || cfgfile_intval(option, value, _T("gfx_framerate"), &p->gfx_framerate, 1) @@ -3111,7 +3112,6 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_yesno(option, value, _T("show_refresh_indicator"), &p->refresh_indicator) || cfgfile_yesno(option, value, _T("warp"), &p->turbo_emulation) || cfgfile_yesno(option, value, _T("headless"), &p->headless) - || cfgfile_yesno(option, value, _T("power_led_dim"), &p->power_led_dim) || cfgfile_yesno(option, value, _T("clipboard_sharing"), &p->clipboard_sharing) || cfgfile_yesno(option, value, _T("native_code"), &p->native_code) || cfgfile_yesno(option, value, _T("tablet_library"), &p->tablet_library) diff --git a/cia.cpp b/cia.cpp index 3adedb93..bf5db603 100644 --- a/cia.cpp +++ b/cia.cpp @@ -898,8 +898,8 @@ static void led_vsync (void) v = 255; if (v < 0) v = 0; - if (currprefs.power_led_dim && v < 96) - v = 96; + if (currprefs.power_led_dim && v < currprefs.power_led_dim) + v = currprefs.power_led_dim; if (v > 255) v = 255; gui_data.powerled_brightness = v; diff --git a/include/options.h b/include/options.h index 99718c2a..c4524bc9 100644 --- a/include/options.h +++ b/include/options.h @@ -556,7 +556,7 @@ struct uae_prefs { int collision_level; int leds_on_screen; int leds_on_screen_mask[2]; - bool power_led_dim; + int power_led_dim; struct wh osd_pos; int keyboard_leds[3]; bool keyboard_leds_in_use; diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 42539eda..fb83e451 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -1712,7 +1712,7 @@ static void narrowimg(struct uae_image *img, int *xop, int *yop, const TCHAR *na static uae_u8 dimming(uae_u8 v) { - return v / 2; + return v * currprefs.power_led_dim / 100; } static int createmask2texture (struct d3dstruct *d3d, const TCHAR *filename) diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index c45d7f3c..f7b4f918 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -2387,7 +2387,7 @@ static void narrowimg(struct uae_image *img, int *xop, int *yop, const TCHAR *na static uae_u8 dimming(uae_u8 v) { - return v / 2; + return v * currprefs.power_led_dim / 100; } static int createmask2texture(struct d3d11struct *d3d, const TCHAR *filename) diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 5547766d..4b5a2ff2 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -4410,7 +4410,7 @@ static const struct miscentry misclist[] = { { 0, 1, _T("Right Control = Right Windows key"), &workprefs.right_control_is_right_win_key }, { 0, 0, _T("Windows shutdown/logoff notification"), &workprefs.win32_shutdown_notification }, { 0, 1, _T("Warn when attempting to close window"), &workprefs.win32_warn_exit }, - { 0, 1, _T("Power led dims when audio filter is disabled"), &workprefs.power_led_dim }, + { 0, 1, _T("Power led dims when audio filter is disabled"), NULL, &workprefs.power_led_dim, 128, 0 }, { 0, NULL } }; -- 2.47.3