notaz / pcsx_rearmed

ARM optimized PCSX fork
GNU General Public License v2.0
393 stars 210 forks source link

No visual change at directories/files selection when background is black #55

Closed isaauco closed 9 months ago

isaauco commented 9 years ago

I can not see the focus of the selected item at directory/file listings when background is black.

The focus (which consist in a pixel darkening) doesn't make any change in the background when this is black, as example as result of incorrect/missing background defined at skin or pressing ESC key while the game is at a black or partial black state.

I made a fix for this in the PCSX_REARMED code, at pcsx_rearmed/frontend/libpicofe/menu.c at function draw_dirlist:


        darken_ptr = (short *)g_menuscreen_ptr + g_menuscreen_w * max_cnt/2 * me_sfont_h;
        menu_darken_bg(darken_ptr, darken_ptr, g_menuscreen_w * me_sfont_h * 8 / 10, 0);
--      x = 5 + me_mfont_w + 1;
++      x = 5 + 2 * me_mfont_w + 1;
        if (start - 2 >= 0)
--              smalltext_out16(14, (start - 2) * me_sfont_h, curdir, 0xffff);
++              smalltext_out16(x, (start - 2) * me_sfont_h, curdir, 0xffff);
        for (i = 0; i < n; i++) {
                pos = start + i;
                if (pos < 0)  continue;
                if (pos >= max_cnt) break;
                if (namelist[i+1]->d_type == DT_DIR) {
                        smalltext_out16(x, pos * me_sfont_h, "/", 0xfff6);
--                      smalltext_out16(x + me_sfont_w, pos * me_sfont_h, namelist[i+1]->d_name, 0xfff6);
++                      if (i == sel)
++                          smalltext_out16(x + me_sfont_w, pos * me_sfont_h, namelist[i+1]->d_name, 0xff00);
++                      else
++                          smalltext_out16(x + me_sfont_w, pos * me_sfont_h, namelist[i+1]->d_name, 0xfff6);
                } else {
                        unsigned short color = fname2color(namelist[i+1]->d_name);
--                      smalltext_out16(x, pos * me_sfont_h, namelist[i+1]->d_name, color);
++                      if (i == sel)
++                          smalltext_out16(x, pos * me_sfont_h, namelist[i+1]->d_name, 0xff00);
++                      else
++                          smalltext_out16(x, pos * me_sfont_h, namelist[i+1]->d_name, color);
                }
        }

So, with this change not only the selected item (directory or file) darkens the background, also the selected item change its foreground color, and so, the selected item is clearly different even with a black or partial black background.

Maybe there is a better way to fix this issue but this is the first way I found after a fast reading of the pcsx_rearmed code.

notaz commented 9 months ago

The darkening was intended to make it easier to read the current selection in case the background was bright. ">" was to indicate the selection. Sorry for taking 8 years to respond, but I've decided to not to take this. It's a matter of preferences/taste.