Skip to content

Commit

Permalink
Improve SMS border update detection (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonninnos authored Sep 15, 2024
1 parent daa8667 commit 1eb0431
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libretro/libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ static bool restart_eq = false;
static uint8_t temp[0x10000];
static int16 soundbuffer[3068];
static uint16_t bitmap_data_[720 * 576];
static uint8_t reg0_prev = 0;

static char g_rom_dir[256];
static char g_rom_name[256];
Expand Down Expand Up @@ -1308,7 +1309,6 @@ static bool update_viewport(void)

if ( (config.left_border != 0)
&& (reg[0] & 0x20)
&& (bitmap.viewport.x == 0)
&& ((system_hw == SYSTEM_MARKIII) || (system_hw & SYSTEM_SMS) || (system_hw == SYSTEM_PBC)))
{
bmdoffset = (16 + (config.ntsc ? 24 : 0));
Expand Down Expand Up @@ -3963,6 +3963,13 @@ void retro_run(void)

soundbuffer_size = audio_update(soundbuffer);

/* Force viewport update when SMS border changes after startup undetected */
if ( ((system_hw == SYSTEM_MARKIII) || (system_hw & SYSTEM_SMS) || (system_hw == SYSTEM_PBC))
&& reg[0] != reg0_prev)
bitmap.viewport.changed = 9;

reg0_prev = reg[0];

if (bitmap.viewport.changed & 9)
{
bool geometry_updated = update_viewport();
Expand Down

0 comments on commit 1eb0431

Please sign in to comment.