Skip to content

Commit

Permalink
Move window internal counter
Browse files Browse the repository at this point in the history
  • Loading branch information
Baekalfen committed Jul 13, 2024
1 parent 529c719 commit ff168ef
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pyboy/core/lcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,12 @@ def scanline(self, lcd, y):
if lcd.disable_renderer:
return

# Weird behavior, where the window has it's own internal line counter. It's only incremented whenever the
# window is drawing something on the screen.
if lcd._LCDC.window_enable and wy <= y and wx < COLS:
self.ly_window += 1

x = 0
if not self.cgb:
if lcd._LCDC.window_enable and wy <= y and wx < COLS:
# Window has it's own internal line counter. It's only incremented whenever the window is drawing something on the screen.
self.ly_window += 1

# Before window
if wx > x:
x += self.scanline_background(y, x, bx, by, wx, lcd)
Expand All @@ -486,6 +484,9 @@ def scanline(self, lcd, y):
self.scanline_blank(y, x, COLS, lcd)
else:
if lcd._LCDC.window_enable and wy <= y and wx < COLS:
# Window has it's own internal line counter. It's only incremented whenever the window is drawing something on the screen.
self.ly_window += 1

# Before window
if wx > x:
x += self.scanline_background_cgb(y, x, bx, by, wx, lcd)
Expand Down

0 comments on commit ff168ef

Please sign in to comment.