From 15dd8a70844206a2fcdf4de9ce29c7f4b2aacdbc Mon Sep 17 00:00:00 2001 From: Mads Ynddal Date: Fri, 12 Jul 2024 17:25:41 -0700 Subject: [PATCH] Move window internal counter --- pyboy/core/lcd.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pyboy/core/lcd.py b/pyboy/core/lcd.py index 5c7fa9078..f3469a55c 100644 --- a/pyboy/core/lcd.py +++ b/pyboy/core/lcd.py @@ -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) @@ -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)