fix some UB

This commit is contained in:
RSDuck 2023-08-01 03:00:41 +02:00
parent 3efbf1b813
commit 7731f66e55
4 changed files with 7 additions and 4 deletions

View File

@ -79,6 +79,7 @@ void DMA::Reset()
Stall = false;
Running = false;
Executing = false;
InProgress = false;
MRAMBurstCount = 0;
}

View File

@ -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();

View File

@ -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},

View File

@ -451,6 +451,7 @@ void UnloadCheats()
{
delete CheatFile;
CheatFile = nullptr;
AREngine::SetCodeFile(nullptr);
}
}