Skip to content

Commit

Permalink
Merge pull request 86Box#4182 from Cacodemon345/chips_69000_black_cur…
Browse files Browse the repository at this point in the history
…sor_64x64_fix

C&T 69000: DPMS
  • Loading branch information
OBattler authored Feb 20, 2024
2 parents 3f65aed + 1b5d84f commit c902282
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/video/vid_chips_69000.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,12 @@ chips_69000_recalctimings(svga_t *svga)
svga->htotal -= 5;
}

if (((chips->ext_regs[0x61] & 0x8) && !(chips->ext_regs[0x61] & 0x4))
|| ((chips->ext_regs[0x61] & 0x2) && !(chips->ext_regs[0x61] & 0x1))) {
svga->dpms = 1;
} else
svga->dpms = 0;

if (chips->ext_regs[0x09] & 0x1) {
svga->vtotal -= 2;
svga->vtotal &= 0xFF;
Expand Down Expand Up @@ -1543,6 +1549,7 @@ chips_69000_write_ext_reg(chips_69000_t* chips, uint8_t val)
break;
case 0x61:
chips->ext_regs[chips->ext_index] = val & 0x7f;
svga_recalctimings(&chips->svga);
break;
case 0x62:
chips->ext_regs[chips->ext_index] = val & 0x9C;
Expand Down
13 changes: 11 additions & 2 deletions src/video/vid_svga.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,15 @@ svga_recalctimings(svga_t *svga)
/* Inform the user interface of any DPMS mode changes. */
if (svga->dpms) {
if (!svga->dpms_ui) {
/* Make sure to black out the entire screen to avoid lingering image. */
int y_add = enable_overscan ? svga->monitor->mon_overscan_y : 0;
int x_add = enable_overscan ? svga->monitor->mon_overscan_x : 0;
int y_start = enable_overscan ? 0 : (svga->monitor->mon_overscan_y >> 1);
int x_start = enable_overscan ? 0 : (svga->monitor->mon_overscan_x >> 1);
video_wait_for_buffer_monitor(svga->monitor_index);
memset(svga->monitor->target_buffer->dat, 0, svga->monitor->target_buffer->w * svga->monitor->target_buffer->h * 4);
video_blit_memtoscreen_monitor(x_start, y_start, svga->monitor->mon_xsize + x_add, svga->monitor->mon_ysize + y_add, svga->monitor_index);
video_wait_for_buffer_monitor(svga->monitor_index);
svga->dpms_ui = 1;
ui_sb_set_text_w(plat_get_string(IDS_2143));
}
Expand Down Expand Up @@ -1864,14 +1873,14 @@ svga_doblit(int wx, int wy, svga_t *svga)
p = &svga->monitor->target_buffer->line[i & 0x7ff][0];

for (j = 0; j < (svga->monitor->mon_xsize + x_add); j++)
p[j] = svga->overscan_color;
p[j] = svga->dpms ? 0 : svga->overscan_color;
}

for (i = 0; i < bottom; i++) {
p = &svga->monitor->target_buffer->line[(svga->monitor->mon_ysize + svga->y_add + i) & 0x7ff][0];

for (j = 0; j < (svga->monitor->mon_xsize + x_add); j++)
p[j] = svga->overscan_color;
p[j] = svga->dpms ? 0 : svga->overscan_color;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/video/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,9 @@ destroy_bitmap(bitmap_t *b)
bitmap_t *
create_bitmap(int x, int y)
{
bitmap_t *b = malloc(sizeof(bitmap_t) + (y * sizeof(uint32_t *)));
bitmap_t *b = calloc(sizeof(bitmap_t), (y * sizeof(uint32_t *)));

b->dat = malloc((size_t) x * y * 4);
b->dat = calloc((size_t) x * y, 4);
for (int c = 0; c < y; c++)
b->line[c] = &(b->dat[c * x]);
b->w = x;
Expand Down

0 comments on commit c902282

Please sign in to comment.