@@ -409,6 +409,7 @@ void gui_debug_window_huc6270_sprites(int vdc)
409409 GeargrafxCore* core = emu_get_core ();
410410 HuC6270* huc6270 = vdc == 1 ? core->GetHuC6270_1 () : core->GetHuC6270_2 ();
411411 u16 * sat = huc6270->GetSAT ();
412+ HuC6270::HuC6270_State* huc6270_state = huc6270->GetState ();
412413 GG_Runtime_Info runtime;
413414 emu_get_runtime (runtime);
414415 bool * show = ((vdc == 1 ) ? &config_debug.show_huc6270_1_sprites : &config_debug.show_huc6270_2_sprites );
@@ -496,13 +497,26 @@ void gui_debug_window_huc6270_sprites(int vdc)
496497 int palette = sprite_flags & 0x0F ;
497498 bool priority = (sprite_flags & 0x0080 ) != 0 ;
498499
499- float real_x = (float )(sprite_x - 32 );
500+ const float hds_scale = (runtime.screen_width == 512 ) ? 2 .0f : 8 .0f ;
501+ const int base_x_offset = (runtime.screen_width == 512 ) ? 64 : 32 ;
502+ int per_res_x_offset = 0 ;
503+ int hds = (int )((huc6270_state->R [HUC6270_REG_HSR] >> 8 ) & 0x7F );
504+ int base_hds = 4 ;
505+ int hds_delta = hds - base_hds;
506+ if (runtime.screen_width != 256 )
507+ {
508+ per_res_x_offset = (int )roundf (hds_delta * hds_scale);
509+ }
510+
511+ float real_x = (float )(sprite_x - base_x_offset + per_res_x_offset);
500512 float real_y = (float )(sprite_y - 64 );
513+ float width_f = (float )width;
514+ float height_f = (float )height;
501515
502516 float rectx_min = p_screen.x + (real_x * screen_scale);
503- float rectx_max = p_screen.x + ((real_x + width ) * screen_scale);
517+ float rectx_max = p_screen.x + ((real_x + width_f ) * screen_scale);
504518 float recty_min = p_screen.y + (real_y * screen_scale);
505- float recty_max = p_screen.y + ((real_y + height ) * screen_scale);
519+ float recty_max = p_screen.y + ((real_y + height_f ) * screen_scale);
506520
507521 rectx_min = fminf (fmaxf (rectx_min, p_screen.x ), p_screen.x + (runtime.screen_width * screen_scale));
508522 rectx_max = fminf (fmaxf (rectx_max, p_screen.x ), p_screen.x + (runtime.screen_width * screen_scale));
0 commit comments