From 7731f66e553a396f136953798751d5b6f84a9dd1 Mon Sep 17 00:00:00 2001 From: RSDuck Date: Tue, 1 Aug 2023 03:00:41 +0200 Subject: fix some UB --- src/DMA.cpp | 1 + src/NonStupidBitfield.h | 7 ++++--- src/frontend/qt_sdl/Config.cpp | 2 +- src/frontend/qt_sdl/ROMManager.cpp | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/DMA.cpp b/src/DMA.cpp index 6877914..d296511 100644 --- a/src/DMA.cpp +++ b/src/DMA.cpp @@ -79,6 +79,7 @@ void DMA::Reset() Stall = false; Running = false; + Executing = false; InProgress = false; MRAMBurstCount = 0; } diff --git a/src/NonStupidBitfield.h b/src/NonStupidBitfield.h index badefaf..a4fe7ec 100644 --- a/src/NonStupidBitfield.h +++ b/src/NonStupidBitfield.h @@ -144,10 +144,11 @@ struct NonStupidBitField { for (u32 i = 0; i < DataLength; i++) { - u32 idx = __builtin_ctzll(Data[i]); - if (Data[i] && idx + i * 64 < Size) + if (Data[i]) { - return {*this, i, idx, Data[i] & ~(1ULL << idx)}; + u32 idx = __builtin_ctzll(Data[i]); + if (idx + i * 64 < Size) + return {*this, i, idx, Data[i] & ~(1ULL << idx)}; } } return End(); diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp index afdaaee..b4d78f7 100644 --- a/src/frontend/qt_sdl/Config.cpp +++ b/src/frontend/qt_sdl/Config.cpp @@ -301,7 +301,7 @@ ConfigEntry ConfigFile[] = {"AudioInterp", 0, &AudioInterp, 0, false}, {"AudioBitDepth", 0, &AudioBitDepth, 0, false}, {"AudioVolume", 0, &AudioVolume, 256, true}, - {"DSiVolumeSync", 0, &DSiVolumeSync, 0, true}, + {"DSiVolumeSync", 1, &DSiVolumeSync, false, true}, {"MicInputType", 0, &MicInputType, 1, false}, {"MicDevice", 2, &MicDevice, (std::string)"", false}, {"MicWavPath", 2, &MicWavPath, (std::string)"", false}, diff --git a/src/frontend/qt_sdl/ROMManager.cpp b/src/frontend/qt_sdl/ROMManager.cpp index a3a911c..3b2b72b 100644 --- a/src/frontend/qt_sdl/ROMManager.cpp +++ b/src/frontend/qt_sdl/ROMManager.cpp @@ -451,6 +451,7 @@ void UnloadCheats() { delete CheatFile; CheatFile = nullptr; + AREngine::SetCodeFile(nullptr); } } -- cgit v1.2.3