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 bdac284 commit 15dd8a7
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 @@ -463,14 +463,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 @@ -484,6 +482,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 15dd8a7

Please sign in to comment.