From 0a4cafcd57637b17c8efba9b607f81d5e4511584 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 27 Dec 2022 20:39:19 -0800 Subject: [PATCH] GB BIOS: Include timing in degenerate ArcTan2 cases (fixes #2763) --- CHANGES | 1 + src/gba/bios.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index 00e8d7587..06b1a5235 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ Emulation fixes: - GB Audio: Fix channel 3 volume being changed between samples (fixes mgba.io/i/1896) - GB Audio: Fix up boot sequence - GB Audio: Fix updating channels other than 2 when writing NR5x + - GB BIOS: Include timing in degenerate ArcTan2 cases (fixes mgba.io/i/2763) - GB Memory: Actually, HDMAs should start when LCD is off (fixes mgba.io/i/2662) - GB Serialize: Don't write BGP/OBP when loading SCGB state (fixes mgba.io/i/2694) - GB SIO: Further fix bidirectional transfer starting diff --git a/src/gba/bios.c b/src/gba/bios.c index d824830aa..1d0c0dd10 100644 --- a/src/gba/bios.c +++ b/src/gba/bios.c @@ -336,12 +336,14 @@ static int16_t _ArcTan(int32_t i, int32_t* r1, int32_t* r3, uint32_t* cycles) { static int16_t _ArcTan2(int32_t x, int32_t y, int32_t* r1, uint32_t* cycles) { if (!y) { + *cycles = 11; if (x >= 0) { return 0; } return 0x8000; } if (!x) { + *cycles = 11; if (y >= 0) { return 0x4000; }