From 326e9d597052b2b69443b9ff6fa6ef17e6384119 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sat, 29 Jan 2022 16:26:28 -0800 Subject: [PATCH] GME: Fix music playback with no fade from crashing Only crashed with division by zero error on Intel, not on Apple Silicon. Funny that. Sending the fix upstream, too. Signed-off-by: Christopher Snowhill --- Frameworks/GME/gme/Music_Emu.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Frameworks/GME/gme/Music_Emu.cpp b/Frameworks/GME/gme/Music_Emu.cpp index f7e43dd65..2b0f35bec 100644 --- a/Frameworks/GME/gme/Music_Emu.cpp +++ b/Frameworks/GME/gme/Music_Emu.cpp @@ -311,6 +311,12 @@ static int int_log( blargg_long x, int step, int unit ) void Music_Emu::handle_fade( long out_count, sample_t* out ) { + if (!fade_step) + { + track_ended_ = emu_track_ended_ = true; + return; + } + for ( int i = 0; i < out_count; i += fade_block_size ) { int const shift = 14;