Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
FIX: ingame overlay was only display in FULL/Sharp with gnuboy
Browse files Browse the repository at this point in the history
FIX: text misalignment in option overlay creating a small border glitch
when going through options
Improve the contrast of sound and volume overlay bars
  • Loading branch information
Nibelheims committed Jul 15, 2023
1 parent 03c8328 commit 3698803
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
14 changes: 11 additions & 3 deletions Core/Src/porting/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,15 @@ static void draw_darken_rectangle(pixel_t *fb, uint16_t x1, uint16_t y1, uint16_
}
}

__attribute__((optimize("unroll-loops")))
static void draw_black_rectangle(pixel_t *fb, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2){
for(uint16_t i=y1; i < y2; i++){
for(uint16_t j=x1; j < x2; j++){
fb[j + GW_LCD_WIDTH * i] = 0;
}
}
}

__attribute__((optimize("unroll-loops")))
static void draw_darken_rounded_rectangle(pixel_t *fb, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2){
// *1 is inclusive, *2 is exclusive
Expand Down Expand Up @@ -656,7 +665,6 @@ static uint8_t box_height(uint8_t n) {
return ((INGAME_OVERLAY_BARS_IMG_Y - INGAME_OVERLAY_BOX_Y) / n) - INGAME_OVERLAY_BOX_GAP;
}

// FIXME
void common_ingame_overlay(void) {
rg_app_desc_t *app = odroid_system_get_app();
pixel_t *fb = lcd_get_active_buffer();
Expand Down Expand Up @@ -687,7 +695,7 @@ void common_ingame_overlay(void) {
INGAME_OVERLAY_BOX_X + INGAME_OVERLAY_BOX_W,
by + bh);
else
draw_darken_rectangle(fb,
draw_black_rectangle(fb,
INGAME_OVERLAY_BOX_X,
by,
INGAME_OVERLAY_BOX_X + INGAME_OVERLAY_BOX_W,
Expand Down Expand Up @@ -715,7 +723,7 @@ void common_ingame_overlay(void) {
INGAME_OVERLAY_BOX_X + INGAME_OVERLAY_BOX_W,
by + bh);
else
draw_darken_rectangle(fb,
draw_black_rectangle(fb,
INGAME_OVERLAY_BOX_X,
by,
INGAME_OVERLAY_BOX_X + INGAME_OVERLAY_BOX_W,
Expand Down
3 changes: 3 additions & 0 deletions Core/Src/porting/gb/main_gb.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ static inline void screen_blit_nn(int32_t dest_width, int32_t dest_height)
printf("Blit: %d us\n", (1000000 * PROFILING_DIFF(t_blit)) / t_blit_t0.SecondFraction);
#endif

common_ingame_overlay();
lcd_swap();
}

Expand Down Expand Up @@ -160,6 +161,7 @@ static void screen_blit_bilinear(int32_t dest_width)
printf("Blit: %d us\n", (1000000 * PROFILING_DIFF(t_blit)) / t_blit_t0.SecondFraction);
#endif

common_ingame_overlay();
lcd_swap();
}

Expand Down Expand Up @@ -304,6 +306,7 @@ static inline void screen_blit_jth(void) {
printf("Blit: %d us\n", (1000000 * PROFILING_DIFF(t_blit)) / t_blit_t0.SecondFraction);
#endif

common_ingame_overlay();
lcd_swap();
}

Expand Down
10 changes: 5 additions & 5 deletions Core/Src/porting/odroid_overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,9 @@ static bool filter_update_cb(odroid_dialog_choice_t *option, odroid_dialog_event
odroid_display_set_filter_mode(mode);
}

if (mode == ODROID_DISPLAY_FILTER_OFF) strcpy(option->value, "Off");
if (mode == ODROID_DISPLAY_FILTER_OFF) strcpy(option->value, "Off ");
if (mode == ODROID_DISPLAY_FILTER_SHARP) strcpy(option->value, "Sharp");
if (mode == ODROID_DISPLAY_FILTER_SOFT) strcpy(option->value, "Soft");
if (mode == ODROID_DISPLAY_FILTER_SOFT) strcpy(option->value, "Soft ");

return event == ODROID_DIALOG_ENTER;
}
Expand All @@ -505,9 +505,9 @@ static bool scaling_update_cb(odroid_dialog_choice_t *option, odroid_dialog_even
odroid_display_set_scaling_mode(mode);
}

if (mode == ODROID_DISPLAY_SCALING_OFF) strcpy(option->value, "Off");
if (mode == ODROID_DISPLAY_SCALING_FIT) strcpy(option->value, "Fit");
if (mode == ODROID_DISPLAY_SCALING_FULL) strcpy(option->value, "Full");
if (mode == ODROID_DISPLAY_SCALING_OFF) strcpy(option->value, "Off ");
if (mode == ODROID_DISPLAY_SCALING_FIT) strcpy(option->value, "Fit ");
if (mode == ODROID_DISPLAY_SCALING_FULL) strcpy(option->value, "Full ");
if (mode == ODROID_DISPLAY_SCALING_CUSTOM) strcpy(option->value, "Custom");

return event == ODROID_DIALOG_ENTER;
Expand Down

0 comments on commit 3698803

Please sign in to comment.