From 349e47f0b251b42c7a3d7e2d8072ce976a55b54c Mon Sep 17 00:00:00 2001 From: David Guillen Fandos Date: Tue, 23 Feb 2021 20:27:59 +0100 Subject: Small fixes to division by zero This causes crashes in PSP quite often in many games. Other CPUs might (depending on the processor state) silently return zero or some undefined value. The fix is borrowed from ReGBA's codebase --- gba_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gba_memory.c') diff --git a/gba_memory.c b/gba_memory.c index 2cb760a..7675bb0 100644 --- a/gba_memory.c +++ b/gba_memory.c @@ -199,7 +199,7 @@ static void sound_control_x(u32 value) #define sound_update_frequency_step(timer_number) \ timer[timer_number].frequency_step = \ - float_to_fp8_24(GBC_BASE_RATE / (timer_reload * sound_frequency)) \ + float_to_fp8_24((GBC_BASE_RATE / sound_frequency) / (timer_reload)) \ /* Main */ extern timer_type timer[4]; -- cgit v1.2.3