summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-10-13 21:52:22 +0200
committerGitHub <noreply@github.com>2021-10-13 21:52:22 +0200
commit023eb0b7029eb3633ce9eeb039c11d835ea7fd74 (patch)
tree93aeabec56ac75e8d88baeb6f78e27840d09dead /Source/Core
parenta0a91ec4b86b16624b2da7000a0f54852cd33872 (diff)
parent78bfd25964206a1f0a34170fdd90ca1a8ce242db (diff)
Merge pull request #10085 from Pokechu22/C26495
Fix all uninitialized variable warnings (C26495)
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/AudioCommon/Mixer.h2
-rw-r--r--Source/Core/AudioCommon/OpenALStream.h8
-rw-r--r--Source/Core/Common/Config/ConfigInfo.h2
-rw-r--r--Source/Core/Common/FileUtil.h6
-rw-r--r--Source/Core/Common/FixedSizeQueue.h2
-rw-r--r--Source/Core/Common/IOFile.h13
-rw-r--r--Source/Core/Common/LinearDiskCache.h4
-rw-r--r--Source/Core/Common/Logging/ConsoleListener.h2
-rw-r--r--Source/Core/Common/SPSCQueue.h2
-rw-r--r--Source/Core/Core/ActionReplay.h6
-rw-r--r--Source/Core/Core/BootManager.cpp68
-rw-r--r--Source/Core/Core/CheatSearch.cpp70
-rw-r--r--Source/Core/Core/DSP/DSPCore.h4
-rw-r--r--Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp8
-rw-r--r--Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.h8
-rw-r--r--Source/Core/Core/Debugger/Debugger_SymbolMap.h2
-rw-r--r--Source/Core/Core/Debugger/Dump.cpp2
-rw-r--r--Source/Core/Core/Debugger/Dump.h4
-rw-r--r--Source/Core/Core/Debugger/RSO.h2
-rw-r--r--Source/Core/Core/FifoPlayer/FifoAnalyzer.h4
-rw-r--r--Source/Core/Core/FifoPlayer/FifoDataFile.cpp22
-rw-r--r--Source/Core/Core/FifoPlayer/FifoDataFile.h35
-rw-r--r--Source/Core/Core/HW/AddressSpace.cpp4
-rw-r--r--Source/Core/Core/HW/DSPHLE/UCodes/AX.h24
-rw-r--r--Source/Core/Core/HW/DSPHLE/UCodes/AXWii.h28
-rw-r--r--Source/Core/Core/HW/DVD/DVDThread.cpp20
-rw-r--r--Source/Core/Core/HW/EXI/EXI_Device.h2
-rw-r--r--Source/Core/Core/HW/EXI/EXI_DeviceEthernet.h4
-rw-r--r--Source/Core/Core/HW/GCMemcard/GCIFile.h2
-rw-r--r--Source/Core/Core/HW/GCMemcard/GCMemcard.h2
-rw-r--r--Source/Core/Core/HW/GCMemcard/GCMemcardBase.h2
-rw-r--r--Source/Core/Core/HW/GCMemcard/GCMemcardRaw.h3
-rw-r--r--Source/Core/Core/HW/SI/SI.cpp6
-rw-r--r--Source/Core/Core/HW/SI/SI_DeviceGBA.h2
-rw-r--r--Source/Core/Core/HW/WiiSaveStructs.h5
-rw-r--r--Source/Core/Core/HW/WiimoteCommon/DataReport.h2
-rw-r--r--Source/Core/Core/HW/WiimoteEmu/Camera.cpp2
-rw-r--r--Source/Core/Core/HW/WiimoteEmu/Camera.h4
-rw-r--r--Source/Core/Core/HW/WiimoteEmu/Dynamics.cpp4
-rw-r--r--Source/Core/Core/HW/WiimoteEmu/Dynamics.h15
-rw-r--r--Source/Core/Core/HW/WiimoteEmu/Extension/Drums.h6
-rw-r--r--Source/Core/Core/HW/WiimoteEmu/Speaker.h4
-rw-r--r--Source/Core/Core/HotkeyManager.h4
-rw-r--r--Source/Core/Core/IOS/DI/DI.h9
-rw-r--r--Source/Core/Core/IOS/ES/ES.h4
-rw-r--r--Source/Core/Core/IOS/IOSC.h4
-rw-r--r--Source/Core/Core/IOS/Network/NCD/WiiNetConfig.h2
-rw-r--r--Source/Core/Core/IOS/Network/SSL.h18
-rw-r--r--Source/Core/Core/IOS/Network/Socket.h8
-rw-r--r--Source/Core/Core/IOS/SDIO/SDIOSlot0.h2
-rw-r--r--Source/Core/Core/IOS/WFS/WFSI.h10
-rw-r--r--Source/Core/Core/IOS/WFS/WFSSRV.h6
-rw-r--r--Source/Core/Core/NetPlayClient.h8
-rw-r--r--Source/Core/Core/NetPlayProto.h166
-rw-r--r--Source/Core/Core/NetPlayServer.h28
-rw-r--r--Source/Core/Core/PowerPC/Jit64/Jit.h6
-rw-r--r--Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h6
-rw-r--r--Source/Core/Core/PowerPC/JitCommon/JitCache.h2
-rw-r--r--Source/Core/Core/PowerPC/MMU.cpp113
-rw-r--r--Source/Core/Core/PowerPC/MMU.h86
-rw-r--r--Source/Core/Core/PowerPC/PPCAnalyst.h53
-rw-r--r--Source/Core/Core/PowerPC/PPCCache.cpp4
-rw-r--r--Source/Core/Core/PowerPC/PPCCache.h16
-rw-r--r--Source/Core/Core/PowerPC/PowerPC.h32
-rw-r--r--Source/Core/Core/PowerPC/Profiler.h6
-rw-r--r--Source/Core/Core/State.cpp6
-rw-r--r--Source/Core/Core/SyncIdentifier.h10
-rw-r--r--Source/Core/DiscIO/CompressedBlob.cpp14
-rw-r--r--Source/Core/DiscIO/DirectoryBlob.h4
-rw-r--r--Source/Core/DiscIO/DiscScrubber.h2
-rw-r--r--Source/Core/DiscIO/LaggedFibonacciGenerator.h2
-rw-r--r--Source/Core/DiscIO/VolumeVerifier.h12
-rw-r--r--Source/Core/DiscIO/VolumeWii.h4
-rw-r--r--Source/Core/DiscIO/WIABlob.h19
-rw-r--r--Source/Core/DiscIO/WIACompression.h6
-rw-r--r--Source/Core/DiscIO/WiiEncryptionCache.h2
-rw-r--r--Source/Core/DolphinQt/Config/Graphics/PostProcessingConfigWindow.h2
-rw-r--r--Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp2
-rw-r--r--Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp6
-rw-r--r--Source/Core/DolphinQt/TAS/TASCheckBox.h6
-rw-r--r--Source/Core/InputCommon/ControlReference/ControlReference.cpp4
-rw-r--r--Source/Core/InputCommon/ControlReference/ControlReference.h5
-rw-r--r--Source/Core/InputCommon/ControlReference/ExpressionParser.h2
-rw-r--r--Source/Core/InputCommon/ControllerInterface/CoreDevice.h6
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp3
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h2
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h4
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp2
-rw-r--r--Source/Core/InputCommon/GCPadStatus.h20
-rw-r--r--Source/Core/UICommon/NetPlayIndex.h8
-rw-r--r--Source/Core/UpdaterCommon/UpdaterCommon.cpp6
-rw-r--r--Source/Core/VideoBackends/D3D/D3DPerfQuery.h2
-rw-r--r--Source/Core/VideoBackends/D3D12/D3D12BoundingBox.h2
-rw-r--r--Source/Core/VideoBackends/D3D12/DescriptorHeapManager.h2
-rw-r--r--Source/Core/VideoBackends/OGL/ProgramShaderCache.h2
-rw-r--r--Source/Core/VideoBackends/Software/SWVertexLoader.h2
-rw-r--r--Source/Core/VideoBackends/Software/SetupUnit.h8
-rw-r--r--Source/Core/VideoBackends/Software/Vec3.h2
-rw-r--r--Source/Core/VideoBackends/Vulkan/CommandBufferManager.h2
-rw-r--r--Source/Core/VideoBackends/Vulkan/VKSwapChain.h2
-rw-r--r--Source/Core/VideoCommon/CPMemory.h18
-rw-r--r--Source/Core/VideoCommon/CommandProcessor.h4
-rw-r--r--Source/Core/VideoCommon/FrameDump.h8
-rw-r--r--Source/Core/VideoCommon/GXPipelineTypes.h33
-rw-r--r--Source/Core/VideoCommon/HiresTextures.h4
-rw-r--r--Source/Core/VideoCommon/PostProcessing.h6
-rw-r--r--Source/Core/VideoCommon/ShaderCache.h2
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.h23
-rw-r--r--Source/Core/VideoCommon/VertexLoaderBase.h4
-rw-r--r--Source/Core/VideoCommon/VideoConfig.cpp23
-rw-r--r--Source/Core/VideoCommon/VideoConfig.h253
111 files changed, 785 insertions, 786 deletions
diff --git a/Source/Core/AudioCommon/Mixer.h b/Source/Core/AudioCommon/Mixer.h
index 2a1a62ba4f..b47f7b204c 100644
--- a/Source/Core/AudioCommon/Mixer.h
+++ b/Source/Core/AudioCommon/Mixer.h
@@ -99,7 +99,7 @@ private:
bool m_is_stretching = false;
AudioCommon::AudioStretcher m_stretcher;
AudioCommon::SurroundDecoder m_surround_decoder;
- std::array<short, MAX_SAMPLES * 2> m_scratch_buffer;
+ std::array<short, MAX_SAMPLES * 2> m_scratch_buffer{};
WaveFileWriter m_wave_writer_dtk;
WaveFileWriter m_wave_writer_dsp;
diff --git a/Source/Core/AudioCommon/OpenALStream.h b/Source/Core/AudioCommon/OpenALStream.h
index c252838568..812f0a9019 100644
--- a/Source/Core/AudioCommon/OpenALStream.h
+++ b/Source/Core/AudioCommon/OpenALStream.h
@@ -53,7 +53,7 @@ class OpenALStream final : public SoundStream
{
#ifdef _WIN32
public:
- OpenALStream() : m_source(0) {}
+ OpenALStream() = default;
~OpenALStream() override;
bool Init() override;
void SetVolume(int volume) override;
@@ -68,9 +68,9 @@ private:
Common::Flag m_run_thread;
std::vector<short> m_realtime_buffer;
- std::array<ALuint, OAL_BUFFERS> m_buffers;
- ALuint m_source;
- ALfloat m_volume;
+ std::array<ALuint, OAL_BUFFERS> m_buffers{};
+ ALuint m_source = 0;
+ ALfloat m_volume = 1;
#endif // _WIN32
};
diff --git a/Source/Core/Common/Config/ConfigInfo.h b/Source/Core/Common/Config/ConfigInfo.h
index 824947cfb6..e59239b881 100644
--- a/Source/Core/Common/Config/ConfigInfo.h
+++ b/Source/Core/Common/Config/ConfigInfo.h
@@ -23,7 +23,7 @@ using UnderlyingType = typename std::enable_if_t<std::is_enum<T>{}, std::underly
struct Location
{
- System system;
+ System system{};
std::string section;
std::string key;
diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h
index e2021bdab4..9c1116943c 100644
--- a/Source/Core/Common/FileUtil.h
+++ b/Source/Core/Common/FileUtil.h
@@ -85,11 +85,11 @@ enum
namespace File
{
-// FileSystem tree node/
+// FileSystem tree node
struct FSTEntry
{
- bool isDirectory;
- u64 size; // File length, or for directories, recursive count of children
+ bool isDirectory = false;
+ u64 size = 0; // File length, or for directories, recursive count of children
std::string physicalName; // Name on disk
std::string virtualName; // Name in FST names table
std::vector<FSTEntry> children;
diff --git a/Source/Core/Common/FixedSizeQueue.h b/Source/Core/Common/FixedSizeQueue.h
index a303cce4cd..dc58aab865 100644
--- a/Source/Core/Common/FixedSizeQueue.h
+++ b/Source/Core/Common/FixedSizeQueue.h
@@ -78,7 +78,7 @@ public:
bool empty() const noexcept { return size() == 0; }
private:
- std::array<T, N> storage;
+ std::array<T, N> storage{};
int head = 0;
int tail = 0;
// Sacrifice 4 bytes for a simpler implementation. may optimize away in the future.
diff --git a/Source/Core/Common/IOFile.h b/Source/Core/Common/IOFile.h
index 27285ce0df..873c4c2af5 100644
--- a/Source/Core/Common/IOFile.h
+++ b/Source/Core/Common/IOFile.h
@@ -3,6 +3,7 @@
#pragma once
+#include <array>
#include <cstddef>
#include <cstdio>
#include <string>
@@ -57,6 +58,18 @@ public:
return m_good;
}
+ template <typename T, std::size_t N>
+ bool ReadArray(std::array<T, N>* elements, size_t* num_read = nullptr)
+ {
+ return ReadArray(elements->data(), elements->size(), num_read);
+ }
+
+ template <typename T, std::size_t N>
+ bool WriteArray(const std::array<T, N>& elements)
+ {
+ return WriteArray(elements.data(), elements.size());
+ }
+
bool ReadBytes(void* data, size_t length)
{
return ReadArray(reinterpret_cast<char*>(data), length);
diff --git a/Source/Core/Common/LinearDiskCache.h b/Source/Core/Common/LinearDiskCache.h
index e6a1b29557..5f9f7589d4 100644
--- a/Source/Core/Common/LinearDiskCache.h
+++ b/Source/Core/Common/LinearDiskCache.h
@@ -153,7 +153,7 @@ private:
std::min(Common::scm_rev_git_str.size(), sizeof(ver)));
}
- u32 id;
+ u32 id = 0;
const u16 key_t_size = sizeof(K);
const u16 value_t_size = sizeof(V);
char ver[40] = {};
@@ -161,5 +161,5 @@ private:
} m_header;
File::IOFile m_file;
- u32 m_num_entries;
+ u32 m_num_entries = 0;
};
diff --git a/Source/Core/Common/Logging/ConsoleListener.h b/Source/Core/Common/Logging/ConsoleListener.h
index cd1984af6d..7310204377 100644
--- a/Source/Core/Common/Logging/ConsoleListener.h
+++ b/Source/Core/Common/Logging/ConsoleListener.h
@@ -14,5 +14,5 @@ public:
void Log(Common::Log::LOG_LEVELS level, const char* text) override;
private:
- bool m_use_color;
+ bool m_use_color = false;
};
diff --git a/Source/Core/Common/SPSCQueue.h b/Source/Core/Common/SPSCQueue.h
index 96f5b90eeb..27a0a8f282 100644
--- a/Source/Core/Common/SPSCQueue.h
+++ b/Source/Core/Common/SPSCQueue.h
@@ -98,7 +98,7 @@ private:
delete next_ptr;
}
- T current;
+ T current{};
std::atomic<ElementPtr*> next;
};
diff --git a/Source/Core/Core/ActionReplay.h b/Source/Core/Core/ActionReplay.h
index 96c4127d10..13b6294d30 100644
--- a/Source/Core/Core/ActionReplay.h
+++ b/Source/Core/Core/ActionReplay.h
@@ -16,10 +16,10 @@ namespace ActionReplay
{
struct AREntry
{
- AREntry() {}
+ AREntry() = default;
AREntry(u32 _addr, u32 _value) : cmd_addr(_addr), value(_value) {}
- u32 cmd_addr;
- u32 value;
+ u32 cmd_addr = 0;
+ u32 value = 0;
};
constexpr bool operator==(const AREntry& left, const AREntry& right)
{
diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp
index cac7f1574d..a9a0014155 100644
--- a/Source/Core/Core/BootManager.cpp
+++ b/Source/Core/Core/BootManager.cpp
@@ -64,44 +64,44 @@ public:
// These store if the relevant setting should be reset back later (true) or if it should be left
// alone on restore (false)
- bool bSetEmulationSpeed;
- bool bSetVolume;
- std::array<bool, MAX_BBMOTES> bSetWiimoteSource;
- std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads;
- std::array<bool, ExpansionInterface::MAX_EXI_CHANNELS> bSetEXIDevice;
+ bool bSetEmulationSpeed = false;
+ bool bSetVolume = false;
+ std::array<bool, MAX_BBMOTES> bSetWiimoteSource{};
+ std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads{};
+ std::array<bool, ExpansionInterface::MAX_EXI_CHANNELS> bSetEXIDevice{};
private:
- bool valid;
- bool bCPUThread;
- bool bJITFollowBranch;
- bool bSyncGPUOnSkipIdleHack;
- bool bFloatExceptions;
- bool bDivideByZeroExceptions;
- bool bFPRF;
- bool bAccurateNaNs;
- bool bMMU;
- bool bLowDCBZHack;
- bool bDisableICache;
- bool m_EnableJIT;
- bool bSyncGPU;
- int iSyncGpuMaxDistance;
- int iSyncGpuMinDistance;
- float fSyncGpuOverclock;
- bool bFastDiscSpeed;
- bool bDSPHLE;
- bool bHLE_BS2;
- int iSelectedLanguage;
- PowerPC::CPUCore cpu_core;
- int Volume;
- float m_EmulationSpeed;
- float m_OCFactor;
- bool m_OCEnable;
- bool m_bt_passthrough_enabled;
+ bool valid = false;
+ bool bCPUThread = false;
+ bool bJITFollowBranch = false;
+ bool bSyncGPUOnSkipIdleHack = false;
+ bool bFloatExceptions = false;
+ bool bDivideByZeroExceptions = false;
+ bool bFPRF = false;
+ bool bAccurateNaNs = false;
+ bool bMMU = false;
+ bool bLowDCBZHack = false;
+ bool bDisableICache = false;
+ bool m_EnableJIT = false;
+ bool bSyncGPU = false;
+ int iSyncGpuMaxDistance = 0;
+ int iSyncGpuMinDistance = 0;
+ float fSyncGpuOverclock = 0;
+ bool bFastDiscSpeed = false;
+ bool bDSPHLE = false;
+ bool bHLE_BS2 = false;
+ int iSelectedLanguage = 0;
+ PowerPC::CPUCore cpu_core = PowerPC::CPUCore::Interpreter;
+ int Volume = 0;
+ float m_EmulationSpeed = 0;
+ float m_OCFactor = 0;
+ bool m_OCEnable = false;
+ bool m_bt_passthrough_enabled = false;
std::string sBackend;
std::string m_strGPUDeterminismMode;
- std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource;
- std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads;
- std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice;
+ std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
+ std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads{};
+ std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice{};
};
void ConfigCache::SaveConfig(const SConfig& config)
diff --git a/Source/Core/Core/CheatSearch.cpp b/Source/Core/Core/CheatSearch.cpp
index 1b85cd9d14..9710f31624 100644
--- a/Source/Core/Core/CheatSearch.cpp
+++ b/Source/Core/Core/CheatSearch.cpp
@@ -101,87 +101,87 @@ std::vector<u8> Cheats::GetValueAsByteVector(const Cheats::SearchValue& value)
namespace
{
template <typename T>
-static PowerPC::TryReadResult<T>
+static std::optional<PowerPC::ReadResult<T>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space);
template <>
-PowerPC::TryReadResult<u8> TryReadValueFromEmulatedMemory(u32 addr,
- PowerPC::RequestedAddressSpace space)
+std::optional<PowerPC::ReadResult<u8>>
+TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadU8(addr, space);
}
template <>
-PowerPC::TryReadResult<u16> TryReadValueFromEmulatedMemory(u32 addr,
- PowerPC::RequestedAddressSpace space)
+std::optional<PowerPC::ReadResult<u16>>
+TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadU16(addr, space);
}
template <>
-PowerPC::TryReadResult<u32> TryReadValueFromEmulatedMemory(u32 addr,
- PowerPC::RequestedAddressSpace space)
+std::optional<PowerPC::ReadResult<u32>>
+TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadU32(addr, space);
}
template <>
-PowerPC::TryReadResult<u64> TryReadValueFromEmulatedMemory(u32 addr,
- PowerPC::RequestedAddressSpace space)
+std::optional<PowerPC::ReadResult<u64>>
+TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadU64(addr, space);
}
template <>
-PowerPC::TryReadResult<s8> TryReadValueFromEmulatedMemory(u32 addr,
- PowerPC::RequestedAddressSpace space)
+std::optional<PowerPC::ReadResult<s8>>
+TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
auto tmp = PowerPC::HostTryReadU8(addr, space);
if (!tmp)
- return PowerPC::TryReadResult<s8>();
- return PowerPC::TryReadResult<s8>(tmp.translated, Common::BitCast<s8>(tmp.value));
+ return std::nullopt;
+ return PowerPC::ReadResult<s8>(tmp->translated, Common::BitCast<s8>(tmp->value));
}
template <>
-PowerPC::TryReadResult<s16> TryReadValueFromEmulatedMemory(u32 addr,
- PowerPC::RequestedAddressSpace space)
+std::optional<PowerPC::ReadResult<s16>>
+TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
auto tmp = PowerPC::HostTryReadU16(addr, space);
if (!tmp)
- return PowerPC::TryReadResult<s16>();
- return PowerPC::TryReadResult<s16>(tmp.translated, Common::BitCast<s16>(tmp.value));
+ return std::nullopt;
+ return PowerPC::ReadResult<s16>(tmp->translated, Common::BitCast<s16>(tmp->value));
}
template <>
-PowerPC::TryReadResult<s32> TryReadValueFromEmulatedMemory(u32 addr,
- PowerPC::RequestedAddressSpace space)
+std::optional<PowerPC::ReadResult<s32>>
+TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
auto tmp = PowerPC::HostTryReadU32(addr, space);
if (!tmp)
- return PowerPC::TryReadResult<s32>();
- return PowerPC::TryReadResult<s32>(tmp.translated, Common::BitCast<s32>(tmp.value));
+ return std::nullopt;
+ return PowerPC::ReadResult<s32>(tmp->translated, Common::BitCast<s32>(tmp->value));
}
template <>
-PowerPC::TryReadResult<s64> TryReadValueFromEmulatedMemory(u32 addr,
- PowerPC::RequestedAddressSpace space)
+std::optional<PowerPC::ReadResult<s64>>
+TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
auto tmp = PowerPC::HostTryReadU64(addr, space);
if (!tmp)
- return PowerPC::TryReadResult<s64>();
- return PowerPC::TryReadResult<s64>(tmp.translated, Common::BitCast<s64>(tmp.value));
+ return std::nullopt;
+ return PowerPC::ReadResult<s64>(tmp->translated, Common::BitCast<s64>(tmp->value));
}
template <>
-PowerPC::TryReadResult<float> TryReadValueFromEmulatedMemory(u32 addr,
- PowerPC::RequestedAddressSpace space)
+std::optional<PowerPC::ReadResult<float>>
+TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadF32(addr, space);
}
template <>
-PowerPC::TryReadResult<double> TryReadValueFromEmulatedMemory(u32 addr,
- PowerPC::RequestedAddressSpace space)
+std::optional<PowerPC::ReadResult<double>>
+TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{
return PowerPC::HostTryReadF64(addr, space);
}
@@ -230,11 +230,11 @@ Cheats::NewSearch(const std::vector<Cheats::MemoryRange>& memory_ranges,
if (!current_value)
continue;
- if (validator(current_value.value))
+ if (validator(current_value->value))
{
auto& r = results.emplace_back();
- r.m_value = current_value.value;
- r.m_value_state = current_value.translated ?
+ r.m_value = current_value->value;
+ r.m_value_state = current_value->translated ?
Cheats::SearchResultValueState::ValueFromVirtualMemory :
Cheats::SearchResultValueState::ValueFromPhysicalMemory;
r.m_address = addr;
@@ -284,11 +284,11 @@ Cheats::NextSearch(const std::vector<Cheats::SearchResult<T>>& previous_results,
// if the previous state was invalid we always update the value to avoid getting stuck in an
// invalid state
if (!previous_result.IsValueValid() ||
- validator(current_value.value, previous_result.m_value))
+ validator(current_value->value, previous_result.m_value))
{
auto& r = results.emplace_back();
- r.m_value = current_value.value;
- r.m_value_state = current_value.translated ?
+ r.m_value = current_value->value;
+ r.m_value_state = current_value->translated ?
Cheats::SearchResultValueState::ValueFromVirtualMemory :
Cheats::SearchResultValueState::ValueFromPhysicalMemory;
r.m_address = addr;
diff --git a/Source/Core/Core/DSP/DSPCore.h b/Source/Core/Core/DSP/DSPCore.h
index 6455349a09..c61ac3940e 100644
--- a/Source/Core/Core/DSP/DSPCore.h
+++ b/Source/Core/Core/DSP/DSPCore.h
@@ -279,10 +279,10 @@ struct DSP_Regs
struct DSPInitOptions
{
// DSP IROM blob, which is where the DSP boots from. Embedded into the DSP.
- std::array<u16, DSP_IROM_SIZE> irom_contents;
+ std::array<u16, DSP_IROM_SIZE> irom_contents{};
// DSP DROM blob, which contains resampling coefficients.
- std::array<u16, DSP_COEF_SIZE> coef_contents;
+ std::array<u16, DSP_COEF_SIZE> coef_contents{};
// Core used to emulate the DSP.
// Default: JIT64.
diff --git a/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp b/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp
index 1d3b2768de..756529e89a 100644
--- a/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp
+++ b/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp
@@ -100,8 +100,7 @@ static Gen::OpArg GetRegisterPointer(size_t reg)
#define STATIC_REG_ACCS
//#undef STATIC_REG_ACCS
-DSPJitRegCache::DSPJitRegCache(DSPEmitter& emitter)
- : m_emitter(emitter), m_is_temporary(false), m_is_merged(false)
+DSPJitRegCache::DSPJitRegCache(DSPEmitter& emitter) : m_emitter(emitter), m_is_temporary(false)
{
for (X64CachedReg& xreg : m_xregs)
{
@@ -188,13 +187,10 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter& emitter)
m_regs[i + DSP_REG_AXL0].shift = 0;
m_regs[i + DSP_REG_AXH0].shift = 16;
}
-
- m_use_ctr = 0;
}
DSPJitRegCache::DSPJitRegCache(const DSPJitRegCache& cache)
- : m_regs(cache.m_regs), m_xregs(cache.m_xregs), m_emitter(cache.m_emitter),
- m_is_temporary(true), m_is_merged(false)
+ : m_regs(cache.m_regs), m_xregs(cache.m_xregs), m_emitter(cache.m_emitter), m_is_temporary(true)
{
}
diff --git a/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.h b/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.h
index 5a05415a38..24bc45b2e6 100644
--- a/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.h
+++ b/Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.h
@@ -170,14 +170,14 @@ private:
void MovToMemory(size_t reg);
void FlushMemBackedRegs();
- std::array<DynamicReg, 37> m_regs;
- std::array<X64CachedReg, 16> m_xregs;
+ std::array<DynamicReg, 37> m_regs{};
+ std::array<X64CachedReg, 16> m_xregs{};
DSPEmitter& m_emitter;
bool m_is_temporary;
- bool m_is_merged;
+ bool m_is_merged = false;
- int m_use_ctr;
+ int m_use_ctr = 0;
};
} // namespace DSP::JIT::x64
diff --git a/Source/Core/Core/Debugger/Debugger_SymbolMap.h b/Source/Core/Core/Debugger/Debugger_SymbolMap.h
index a8c3cd854d..38bac8f7fa 100644
--- a/Source/Core/Core/Debugger/Debugger_SymbolMap.h
+++ b/Source/Core/Core/Debugger/Debugger_SymbolMap.h
@@ -15,7 +15,7 @@ namespace Dolphin_Debugger
struct CallstackEntry
{
std::string Name;
- u32 vAddress;
+ u32 vAddress = 0;
};
bool GetCallstack(std::vector<CallstackEntry>& output);
diff --git a/Source/Core/Core/Debugger/Dump.cpp b/Source/Core/Core/Debugger/Dump.cpp
index 327056a85b..96d8f5b8cf 100644
--- a/Source/Core/Core/Debugger/Dump.cpp
+++ b/Source/Core/Core/Debugger/Dump.cpp
@@ -9,7 +9,7 @@
#include "Common/CommonTypes.h"
#include "Common/IOFile.h"
-CDump::CDump(const std::string& filename) : m_pData(nullptr)
+CDump::CDump(const std::string& filename)
{
File::IOFile pStream(filename, "rb");
if (pStream)
diff --git a/Source/Core/Core/Debugger/Dump.h b/Source/Core/Core/Debugger/Dump.h
index 647e3f5e5b..32a1795bb9 100644
--- a/Source/Core/Core/Debugger/Dump.h
+++ b/Source/Core/Core/Debugger/Dump.h
@@ -27,9 +27,9 @@ private:
STRUCTUR_SIZE = 0x2BC
};
- u8* m_pData;
+ u8* m_pData = nullptr;
- size_t m_size;
+ size_t m_size = 0;
u32 Read32(u32 _pos);
};
diff --git a/Source/Core/Core/Debugger/RSO.h b/Source/Core/Core/Debugger/RSO.h
index 67ab431533..dc5d61e8ab 100644
--- a/Source/Core/Core/Debugger/RSO.h
+++ b/Source/Core/Core/Debugger/RSO.h
@@ -131,7 +131,7 @@ public:
u32 GetImportsNameTable() const;
private:
- RSOHeader m_header;
+ RSOHeader m_header{};
std::string m_name;
u32 m_address = 0;
};
diff --git a/Source/Core/Core/FifoPlayer/FifoAnalyzer.h b/Source/Core/Core/FifoPlayer/FifoAnalyzer.h
index ff9f9460d7..4e167cbc9f 100644
--- a/Source/Core/Core/FifoPlayer/FifoAnalyzer.h
+++ b/Source/Core/Core/FifoPlayer/FifoAnalyzer.h
@@ -22,8 +22,8 @@ struct CPMemory
{
TVtxDesc vtxDesc;
std::array<VAT, CP_NUM_VAT_REG> vtxAttr;
- std::array<u32, CP_NUM_ARRAYS> arrayBases;
- std::array<u32, CP_NUM_ARRAYS> arrayStrides;
+ std::array<u32, CP_NUM_ARRAYS> arrayBases{};
+ std::array<u32, CP_NUM_ARRAYS> arrayStrides{};
};
void LoadCPReg(u32 subCmd, u32 value, CPMemory& cpMem);
diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp
index 76e151fcd3..16f4c2ba64 100644
--- a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp
+++ b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp
@@ -120,19 +120,19 @@ bool FifoDataFile::Save(const std::string& filename)
PadFile(m_Frames.size() * sizeof(FileFrameInfo), file);
u64 bpMemOffset = file.Tell();
- file.WriteArray(m_BPMem, BP_MEM_SIZE);
+ file.WriteArray(m_BPMem);
u64 cpMemOffset = file.Tell();
- file.WriteArray(m_CPMem, CP_MEM_SIZE);
+ file.WriteArray(m_CPMem);
u64 xfMemOffset = file.Tell();
- file.WriteArray(m_XFMem, XF_MEM_SIZE);
+ file.WriteArray(m_XFMem);
u64 xfRegsOffset = file.Tell();
- file.WriteArray(m_XFRegs, XF_REGS_SIZE);
+ file.WriteArray(m_XFRegs);
u64 texMemOffset = file.Tell();
- file.WriteArray(m_TexMem, TEX_MEM_SIZE);
+ file.WriteArray(m_TexMem);
// Write header
FileHeader header;
@@ -285,27 +285,27 @@ std::unique_ptr<FifoDataFile> FifoDataFile::Load(const std::string& filename, bo
u32 size = std::min<u32>(BP_MEM_SIZE, header.bpMemSize);
file.Seek(header.bpMemOffset, SEEK_SET);
- file.ReadArray(dataFile->m_BPMem, size);
+ file.ReadArray(&dataFile->m_BPMem);
size = std::min<u32>(CP_MEM_SIZE, header.cpMemSize);
file.Seek(header.cpMemOffset, SEEK_SET);
- file.ReadArray(dataFile->m_CPMem, size);
+ file.ReadArray(&dataFile->m_CPMem);
size = std::min<u32>(XF_MEM_SIZE, header.xfMemSize);
file.Seek(header.xfMemOffset, SEEK_SET);
- file.ReadArray(dataFile->m_XFMem, size);
+ file.ReadArray(&dataFile->m_XFMem);
size = std::min<u32>(XF_REGS_SIZE, header.xfRegsSize);
file.Seek(header.xfRegsOffset, SEEK_SET);
- file.ReadArray(dataFile->m_XFRegs, size);
+ file.ReadArray(&dataFile->m_XFRegs);
// Texture memory saving was added in version 4.
- std::memset(dataFile->m_TexMem, 0, TEX_MEM_SIZE);
+ dataFile->m_TexMem.fill(0);
if (dataFile->m_Version >= 4)
{
size = std::min<u32>(TEX_MEM_SIZE, header.texMemSize);
file.Seek(header.texMemOffset, SEEK_SET);
- file.ReadArray(dataFile->m_TexMem, size);
+ file.ReadArray(&dataFile->m_TexMem);
}
if (!file.IsGood())
diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.h b/Source/Core/Core/FifoPlayer/FifoDataFile.h
index 63c474bbc7..236f82e8b9 100644
--- a/Source/Core/Core/FifoPlayer/FifoDataFile.h
+++ b/Source/Core/Core/FifoPlayer/FifoDataFile.h
@@ -3,6 +3,7 @@
#pragma once
+#include <array>
#include <memory>
#include <string>
#include <vector>
@@ -25,18 +26,18 @@ struct MemoryUpdate
TMEM = 0x08,
};
- u32 fifoPosition;
- u32 address;
+ u32 fifoPosition = 0;
+ u32 address = 0;
std::vector<u8> data;
- Type type;
+ Type type{};
};
struct FifoFrameInfo
{
std::vector<u8> fifoData;
- u32 fifoStart;
- u32 fifoEnd;
+ u32 fifoStart = 0;
+ u32 fifoEnd = 0;
// Must be sorted by fifoPosition
std::vector<MemoryUpdate> memoryUpdates;
@@ -63,11 +64,11 @@ public:
bool HasBrokenEFBCopies() const;
bool ShouldGenerateFakeVIUpdates() const;
- u32* GetBPMem() { return m_BPMem; }
- u32* GetCPMem() { return m_CPMem; }
- u32* GetXFMem() { return m_XFMem; }
- u32* GetXFRegs() { return m_XFRegs; }
- u8* GetTexMem() { return m_TexMem; }
+ u32* GetBPMem() { return m_BPMem.data(); }
+ u32* GetCPMem() { return m_CPMem.data(); }
+ u32* GetXFMem() { return m_XFMem.data(); }
+ u32* GetXFRegs() { return m_XFRegs.data(); }
+ u8* GetTexMem() { return m_TexMem.data(); }
u32 GetRamSizeReal() { return m_ram_size_real; }
u32 GetExRamSizeReal() { return m_exram_size_real; }
@@ -93,13 +94,13 @@ private:
static void ReadMemoryUpdates(u64 fileOffset, u32 numUpdates,
std::vector<MemoryUpdate>& memUpdates, File::IOFile& file);
- u32 m_BPMem[BP_MEM_SIZE];
- u32 m_CPMem[CP_MEM_SIZE];
- u32 m_XFMem[XF_MEM_SIZE];
- u32 m_XFRegs[XF_REGS_SIZE];
- u8 m_TexMem[TEX_MEM_SIZE];
- u32 m_ram_size_real;
- u32 m_exram_size_real;
+ std::array<u32, BP_MEM_SIZE> m_BPMem{};
+ std::array<u32, CP_MEM_SIZE> m_CPMem{};
+ std::array<u32, XF_MEM_SIZE> m_XFMem{};
+ std::array<u32, XF_REGS_SIZE> m_XFRegs{};
+ std::array<u8, TEX_MEM_SIZE> m_TexMem{};
+ u32 m_ram_size_real = 0;
+ u32 m_exram_size_real = 0;
u32 m_Flags = 0;
u32 m_Version = 0;
diff --git a/Source/Core/Core/HW/AddressSpace.cpp b/Source/Core/Core/HW/AddressSpace.cpp
index 8bb2c4cee8..c140132efd 100644
--- a/Source/Core/Core/HW/AddressSpace.cpp
+++ b/Source/Core/Core/HW/AddressSpace.cpp
@@ -354,8 +354,8 @@ struct SmallBlockAccessors : Accessors
}
private:
- u8** alloc_base;
- u32 size;
+ u8** alloc_base = nullptr;
+ u32 size = 0;
};
struct NullAccessors : Accessors
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AX.h b/Source/Core/Core/HW/DSPHLE/UCodes/AX.h
index d0f73a6c2e..a9ddab8e08 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/AX.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/AX.h
@@ -82,24 +82,24 @@ protected:
};
// 32 * 5 because 32 samples per millisecond, for max 5 milliseconds.
- int m_samples_left[32 * 5];
- int m_samples_right[32 * 5];
- int m_samples_surround[32 * 5];
- int m_samples_auxA_left[32 * 5];
- int m_samples_auxA_right[32 * 5];
- int m_samples_auxA_surround[32 * 5];
- int m_samples_auxB_left[32 * 5];
- int m_samples_auxB_right[32 * 5];
- int m_samples_auxB_surround[32 * 5];
-
- u16 m_cmdlist[512];
+ int m_samples_left[32 * 5]{};
+ int m_samples_right[32 * 5]{};
+ int m_samples_surround[32 * 5]{};
+ int m_samples_auxA_left[32 * 5]{};
+ int m_samples_auxA_right[32 * 5]{};
+ int m_samples_auxA_surround[32 * 5]{};
+ int m_samples_auxB_left[32 * 5]{};
+ int m_samples_auxB_right[32 * 5]{};
+ int m_samples_auxB_surround[32 * 5]{};
+
+ u16 m_cmdlist[512]{};
u32 m_cmdlist_size = 0;
// Table of coefficients for polyphase sample rate conversion.
// The coefficients aren't always available (they are part of the DSP DROM)
// so we also need to know if they are valid or not.
std::optional<u32> m_coeffs_checksum = std::nullopt;
- std::array<s16, 0x800> m_coeffs;
+ std::array<s16, 0x800> m_coeffs{};
u16 m_compressor_pos = 0;
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.h b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.h
index 95e06034e5..7d1baf871d 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.h
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.h
@@ -21,27 +21,27 @@ public:
protected:
// Additional AUX buffers
- int m_samples_auxC_left[32 * 3];
- int m_samples_auxC_right[32 * 3];
- int m_samples_auxC_surround[32 * 3];
+ int m_samples_auxC_left[32 * 3]{};
+ int m_samples_auxC_right[32 * 3]{};
+ int m_samples_auxC_surround[32 * 3]{};
// Wiimote buffers
- int m_samples_wm0[6 * 3];
- int m_samples_aux0[6 * 3];
- int m_samples_wm1[6 * 3];
- int m_samples_aux1[6 * 3];
- int m_samples_wm2[6 * 3];
- int m_samples_aux2[6 * 3];
- int m_samples_wm3[6 * 3];
- int m_samples_aux3[6 * 3];
+ int m_samples_wm0[6 * 3]{};
+ int m_samples_aux0[6 * 3]{};
+ int m_samples_wm1[6 * 3]{};
+ int m_samples_aux1[6 * 3]{};
+ int m_samples_wm2[6 * 3]{};
+ int m_samples_aux2[6 * 3]{};
+ int m_samples_wm3[6 * 3]{};
+ int m_samples_aux3[6 * 3]{};
// Are we implementing an old version of AXWii which still has updates?
- bool m_old_axwii;
+ bool m_old_axwii = false;
// Last volume values for MAIN and AUX. Used to generate volume ramps to
// interpolate nicely between old and new volume values.
- u16 m_last_main_volume;
- u16 m_last_aux_volumes[3];
+ u16 m_last_main_volume = 0;
+ u16 m_last_aux_volumes[3]{};
// If needed, extract the updates related fields from a PB. We need to
// reinject them afterwards so that the correct PB typs is written to RAM.
diff --git a/Source/Core/Core/HW/DVD/DVDThread.cpp b/Source/Core/Core/HW/DVD/DVDThread.cpp
index 665557b45f..b06fcd19e2 100644
--- a/Source/Core/Core/HW/DVD/DVDThread.cpp
+++ b/Source/Core/Core/HW/DVD/DVDThread.cpp
@@ -37,26 +37,26 @@ namespace DVDThread
{
struct ReadRequest
{
- bool copy_to_ram;
- u32 output_address;
- u64 dvd_offset;
- u32 length;
- DiscIO::Partition partition;
+ bool copy_to_ram = false;
+ u32 output_address = 0;
+ u64 dvd_offset = 0;
+ u32 length = 0;
+ DiscIO::Partition partition{};
// This determines which code DVDInterface will run to reply
// to the emulated software. We can't use callbacks,
// because function pointers can't be stored in savestates.
- DVDInterface::ReplyType reply_type;
+ DVDInterface::ReplyType reply_type = DVDInterface::ReplyType::NoReply;
// IDs are used to uniquely identify a request. They must not be
// identical to IDs of any other requests that currently exist, but
// it's fine to re-use IDs of requests that have existed in the past.
- u64 id;
+ u64 id = 0;
// Only used for logging
- u64 time_started_ticks;
- u64 realtime_started_us;
- u64 realtime_done_us;
+ u64 time_started_ticks = 0;
+ u64 realtime_started_us = 0;
+ u64 realtime_done_us = 0;
};
using ReadResult = std::pair<ReadRequest, std::vector<u8>>;
diff --git a/Source/Core/Core/HW/EXI/EXI_Device.h b/Source/Core/Core/HW/EXI/EXI_Device.h
index c85bb06c1b..2f0d831af4 100644
--- a/Source/Core/Core/HW/EXI/EXI_Device.h
+++ b/Source/Core/Core/HW/EXI/EXI_Device.h
@@ -65,7 +65,7 @@ public:
// For savestates. storing it here seemed cleaner than requiring each implementation to report its
// type. I know this class is set up like an interface, but no code requires it to be strictly
// such.
- TEXIDevices m_device_type;
+ TEXIDevices m_device_type = TEXIDevices::EXIDEVICE_NONE;
private:
// Byte transfer function for this device
diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceEthernet.h b/Source/Core/Core/HW/EXI/EXI_DeviceEthernet.h
index f258a118f8..6d8be1f65b 100644
--- a/Source/Core/Core/HW/EXI/EXI_DeviceEthernet.h
+++ b/Source/Core/Core/HW/EXI/EXI_DeviceEthernet.h
@@ -404,8 +404,8 @@ private:
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
sf::UdpSocket m_sf_socket;
sf::IpAddress m_sf_recipient_ip;
- char m_in_frame[9004];
- char m_out_frame[9004];
+ char m_in_frame[9004]{};
+ char m_out_frame[9004]{};
std::thread m_read_thread;
Common::Flag m_read_enabled;
Common::Flag m_read_thread_shutdown;
diff --git a/Source/Core/Core/HW/GCMemcard/GCIFile.h b/Source/Core/Core/HW/GCMemcard/GCIFile.h
index d9e9326122..31d25c8c43 100644
--- a/Source/Core/Core/HW/GCMemcard/GCIFile.h
+++ b/Source/Core/Core/HW/GCMemcard/GCIFile.h
@@ -25,7 +25,7 @@ public:
DEntry m_gci_header;
std::vector<GCMBlock> m_save_data;
std::vector<u16> m_used_blocks;
- bool m_dirty;
+ bool m_dirty = false;
std::string m_filename;
};
} // namespace Memcard
diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcard.h b/Source/Core/Core/HW/GCMemcard/GCMemcard.h
index 1b965b28a3..6b82d162d2 100644
--- a/Source/Core/Core/HW/GCMemcard/GCMemcard.h
+++ b/Source/Core/Core/HW/GCMemcard/GCMemcard.h
@@ -82,7 +82,7 @@ private:
struct GCMemcardAnimationFrameRGBA8
{
std::vector<u32> image_data;
- u8 delay;
+ u8 delay = 0;
};
// size of a single memory card block in bytes
diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardBase.h b/Source/Core/Core/HW/GCMemcard/GCMemcardBase.h
index b7924801e4..6990148587 100644
--- a/Source/Core/Core/HW/GCMemcard/GCMemcardBase.h
+++ b/Source/Core/Core/HW/GCMemcard/GCMemcardBase.h
@@ -23,10 +23,8 @@ public:
virtual void ClearAll() = 0;
virtual void DoState(PointerWrap& p) = 0;
u32 GetCardId() const { return m_nintendo_card_id; }
- bool IsAddressInBounds(u32 address) const { return address <= (m_memory_card_size - 1); }
protected:
int m_card_index;
u16 m_nintendo_card_id;
- u32 m_memory_card_size;
};
diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.h b/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.h
index fc8049c873..a8624b64eb 100644
--- a/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.h
+++ b/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.h
@@ -31,6 +31,8 @@ public:
void DoState(PointerWrap& p) override;
private:
+ bool IsAddressInBounds(u32 address) const { return address <= (m_memory_card_size - 1); }
+
std::string m_filename;
std::unique_ptr<u8[]> m_memcard_data;
std::unique_ptr<u8[]> m_flush_buffer;
@@ -38,4 +40,5 @@ private:
std::mutex m_flush_mutex;
Common::Event m_flush_trigger;
Common::Flag m_dirty;
+ u32 m_memory_card_size;
};
diff --git a/Source/Core/Core/HW/SI/SI.cpp b/Source/Core/Core/HW/SI/SI.cpp
index 051081fdd0..c55ce4e932 100644
--- a/Source/Core/Core/HW/SI/SI.cpp
+++ b/Source/Core/Core/HW/SI/SI.cpp
@@ -96,9 +96,9 @@ union USIChannelIn_Lo
// SI Channel
struct SSIChannel
{
- USIChannelOut out;
- USIChannelIn_Hi in_hi;
- USIChannelIn_Lo in_lo;
+ USIChannelOut out{};
+ USIChannelIn_Hi in_hi{};
+ USIChannelIn_Lo in_lo{};
std::unique_ptr<ISIDevice> device;
bool has_recent_device_change = false;
diff --git a/Source/Core/Core/HW/SI/SI_DeviceGBA.h b/Source/Core/Core/HW/SI/SI_DeviceGBA.h
index 663c4c9b1f..0827fa2665 100644
--- a/Source/Core/Core/HW/SI/SI_DeviceGBA.h
+++ b/Source/Core/Core/HW/SI/SI_DeviceGBA.h
@@ -60,7 +60,7 @@ private:
GBASockServer m_sock_server;
NextAction m_next_action = NextAction::SendCommand;
- EBufferCommands m_last_cmd;
+ EBufferCommands m_last_cmd = EBufferCommands::CMD_STATUS;
u64 m_timestamp_sent = 0;
};
} // namespace SerialInterface
diff --git a/Source/Core/Core/HW/WiiSaveStructs.h b/Source/Core/Core/HW/WiiSaveStructs.h
index d5935fade7..e95ce0b6fa 100644
--- a/Source/Core/Core/HW/WiiSaveStructs.h
+++ b/Source/Core/Core/HW/WiiSaveStructs.h
@@ -91,8 +91,9 @@ public:
File = 1,
Directory = 2,
};
- u8 mode, attributes;
- Type type;
+ u8 mode = 0;
+ u8 attributes = 0;
+ Type type{};
/// File name relative to the title data directory.
std::string path;
// Only valid for regular (i.e. non-directory) files.
diff --git a/Source/Core/Core/HW/WiimoteCommon/DataReport.h b/Source/Core/Core/HW/WiimoteCommon/DataReport.h
index cdf53d9619..8297424e6a 100644
--- a/Source/Core/Core/HW/WiimoteCommon/DataReport.h
+++ b/Source/Core/Core/HW/WiimoteCommon/DataReport.h
@@ -49,7 +49,7 @@ public:
virtual u32 GetDataSize() const = 0;
- u8* data_ptr;
+ u8* data_ptr = nullptr;
};
std::unique_ptr<DataReportManipulator> MakeDataReportManipulator(InputReportID rpt_id,
diff --git a/Source/Core/Core/HW/WiimoteEmu/Camera.cpp b/Source/Core/Core/HW/WiimoteEmu/Camera.cpp
index bc87b66ff6..f2a9885fc7 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Camera.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Camera.cpp
@@ -94,7 +94,7 @@ void CameraLogic::Update(const Common::Matrix44& transform, Common::Vec2 field_o
struct CameraPoint
{
IRBasic::IRObject position;
- u8 size;
+ u8 size = 0;
};
std::array<CameraPoint, leds.size()> camera_points;
diff --git a/Source/Core/Core/HW/WiimoteEmu/Camera.h b/Source/Core/Core/HW/WiimoteEmu/Camera.h
index fa76c8ee71..5c2a186ced 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Camera.h
+++ b/Source/Core/Core/HW/WiimoteEmu/Camera.h
@@ -155,10 +155,10 @@ private:
int BusRead(u8 slave_addr, u8 addr, int count, u8* data_out) override;
int BusWrite(u8 slave_addr, u8 addr, int count, const u8* data_in) override;
- Register m_reg_data;
+ Register m_reg_data{};
// When disabled the camera does not respond on the bus.
// Change is triggered by wiimote report 0x13.
- bool m_is_enabled;
+ bool m_is_enabled = false;
};
} // namespace WiimoteEmu
diff --git a/Source/Core/Core/HW/WiimoteEmu/Dynamics.cpp b/Source/Core/Core/HW/WiimoteEmu/Dynamics.cpp
index 9c09d1cf0d..f4c31ec7a8 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Dynamics.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Dynamics.cpp
@@ -79,10 +79,6 @@ Common::Quaternion ComplementaryFilter(const Common::Quaternion& gyroscope,
}
}
-IMUCursorState::IMUCursorState() : rotation{Common::Quaternion::Identity()}
-{
-}
-
void EmulateShake(PositionalState* state, ControllerEmu::Shake* const shake_group,
float time_elapsed)
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/Dynamics.h b/Source/Core/Core/HW/WiimoteEmu/Dynamics.h
index 7a82c319b2..2933fbb7c3 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Dynamics.h
+++ b/Source/Core/Core/HW/WiimoteEmu/Dynamics.h
@@ -23,27 +23,25 @@ using MathUtil::GRAVITY_ACCELERATION;
struct PositionalState
{
// meters
- Common::Vec3 position;
+ Common::Vec3 position{};
// meters/second
- Common::Vec3 velocity;
+ Common::Vec3 velocity{};
// meters/second^2
- Common::Vec3 acceleration;
+ Common::Vec3 acceleration{};
};
struct RotationalState
{
// radians
- Common::Vec3 angle;
+ Common::Vec3 angle{};
// radians/second
- Common::Vec3 angular_velocity;
+ Common::Vec3 angular_velocity{};
};
struct IMUCursorState
{
- IMUCursorState();
-
// Rotation of world around device.
- Common::Quaternion rotation;
+ Common::Quaternion rotation = Common::Quaternion::Identity();
float recentered_pitch = {};
};
@@ -51,6 +49,7 @@ struct IMUCursorState
// Contains both positional and rotational state.
struct MotionState : PositionalState, RotationalState
{
+ MotionState() = default;
};
// Note that 'gyroscope' is rotation of world around device.
diff --git a/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.h b/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.h
index f35e67dc7f..a74013bf32 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.h
+++ b/Source/Core/Core/HW/WiimoteEmu/Extension/Drums.h
@@ -112,10 +112,10 @@ private:
ControllerEmu::SettingValue<double> m_hit_strength_setting;
// Holds previous user input state to watch for "new" hits.
- u8 m_prev_pad_input;
+ u8 m_prev_pad_input = 0;
// Holds new drum pad hits that still need velocity data to be sent.
- u8 m_new_pad_hits;
+ u8 m_new_pad_hits = 0;
// Holds how many more frames to send each drum-pad bit.
- std::array<u8, 6> m_pad_remaining_frames;
+ std::array<u8, 6> m_pad_remaining_frames{};
};
} // namespace WiimoteEmu
diff --git a/Source/Core/Core/HW/WiimoteEmu/Speaker.h b/Source/Core/Core/HW/WiimoteEmu/Speaker.h
index 09f98d69a0..d2004df459 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Speaker.h
+++ b/Source/Core/Core/HW/WiimoteEmu/Speaker.h
@@ -64,11 +64,11 @@ private:
int BusRead(u8 slave_addr, u8 addr, int count, u8* data_out) override;
int BusWrite(u8 slave_addr, u8 addr, int count, const u8* data_in) override;
- Register reg_data;
+ Register reg_data{};
// TODO: What actions reset this state?
// Is this actually in the register somewhere?
- ADPCMState adpcm_state;
+ ADPCMState adpcm_state{};
ControllerEmu::SettingValue<double> m_speaker_pan_setting;
};
diff --git a/Source/Core/Core/HotkeyManager.h b/Source/Core/Core/HotkeyManager.h
index 8f1f37dd10..b214c95a66 100644
--- a/Source/Core/Core/HotkeyManager.h
+++ b/Source/Core/Core/HotkeyManager.h
@@ -232,8 +232,8 @@ public:
void LoadDefaults(const ControllerInterface& ciface) override;
private:
- std::array<ControllerEmu::Buttons*, NUM_HOTKEY_GROUPS> m_keys;
- std::array<ControllerEmu::ControlGroup*, NUM_HOTKEY_GROUPS> m_hotkey_groups;
+ std::array<ControllerEmu::Buttons*, NUM_HOTKEY_GROUPS> m_keys{};
+ std::array<ControllerEmu::ControlGroup*, NUM_HOTKEY_GROUPS> m_hotkey_groups{};
};
namespace HotkeyManagerEmu
diff --git a/Source/Core/Core/IOS/DI/DI.h b/Source/Core/Core/IOS/DI/DI.h
index 76e36214eb..43645be356 100644
--- a/Source/Core/Core/IOS/DI/DI.h
+++ b/Source/Core/Core/IOS/DI/DI.h
@@ -110,12 +110,9 @@ private:
struct ExecutingCommandInfo
{
ExecutingCommandInfo() {}
- ExecutingCommandInfo(u32 request_address)
- : m_request_address(request_address), m_copy_diimmbuf(false)
- {
- }
- u32 m_request_address;
- bool m_copy_diimmbuf;
+ ExecutingCommandInfo(u32 request_address) : m_request_address(request_address) {}
+ u32 m_request_address = 0;
+ bool m_copy_diimmbuf = false;
};
friend class ::CBoot;
diff --git a/Source/Core/Core/IOS/ES/ES.h b/Source/Core/Core/IOS/ES/ES.h
index 75ceac887d..2b7e79559f 100644
--- a/Source/Core/Core/IOS/ES/ES.h
+++ b/Source/Core/Core/IOS/ES/ES.h
@@ -377,9 +377,9 @@ private:
struct OpenedContent
{
bool m_opened = false;
- u64 m_fd;
+ u64 m_fd = 0;
u64 m_title_id = 0;
- ES::Content m_content;
+ ES::Content m_content{};
u32 m_uid = 0;
};
diff --git a/Source/Core/Core/IOS/IOSC.h b/Source/Core/Core/IOS/IOSC.h
index 54b01dfb4e..eca55a752d 100644
--- a/Source/Core/Core/IOS/IOSC.h
+++ b/Source/Core/Core/IOS/IOSC.h
@@ -237,8 +237,8 @@ private:
void DoState(PointerWrap& p);
bool in_use = false;
- ObjectType type;
- ObjectSubType subtype;
+ ObjectType type{};
+ ObjectSubType subtype{};
std::vector<u8> data;
u32 misc_data = 0;
u32 owner_mask = 0;
diff --git a/Source/Core/Core/IOS/Network/NCD/WiiNetConfig.h b/Source/Core/Core/IOS/Network/NCD/WiiNetConfig.h
index 98f0048bd9..6299b0bff0 100644
--- a/Source/Core/Core/IOS/Network/NCD/WiiNetConfig.h
+++ b/Source/Core/Core/IOS/Network/NCD/WiiNetConfig.h
@@ -137,7 +137,7 @@ private:
};
#pragma pack(pop)
- ConfigData m_data;
+ ConfigData m_data{};
};
} // namespace Net
} // namespace IOS::HLE
diff --git a/Source/Core/Core/IOS/Network/SSL.h b/Source/Core/Core/IOS/Network/SSL.h
index eee750ed8f..98cb2adf3b 100644
--- a/Source/Core/Core/IOS/Network/SSL.h
+++ b/Source/Core/Core/IOS/Network/SSL.h
@@ -65,18 +65,18 @@ enum SSL_IOCTL
struct WII_SSL
{
- mbedtls_ssl_context ctx;
- mbedtls_ssl_config config;
- mbedtls_ssl_session session;
- mbedtls_entropy_context entropy;
- mbedtls_ctr_drbg_context ctr_drbg;
- mbedtls_x509_crt cacert;
- mbedtls_x509_crt clicert;
- mbedtls_pk_context pk;
+ mbedtls_ssl_context ctx{};
+ mbedtls_ssl_config config{};
+ mbedtls_ssl_session session{};
+ mbedtls_entropy_context entropy{};
+ mbedtls_ctr_drbg_context ctr_drbg{};
+ mbedtls_x509_crt cacert{};
+ mbedtls_x509_crt clicert{};
+ mbedtls_pk_context pk{};
int sockfd = -1;
int hostfd = -1;
std::string hostname;
- bool active;
+ bool active = false;
};
class NetSSLDevice : public Device
diff --git a/Source/Core/Core/IOS/Network/Socket.h b/Source/Core/Core/IOS/Network/Socket.h
index f84c84652c..f9555da9e7 100644
--- a/Source/Core/Core/IOS/Network/Socket.h
+++ b/Source/Core/Core/IOS/Network/Socket.h
@@ -233,10 +233,10 @@ public:
struct PollCommand
{
- u32 request_addr;
- u32 buffer_out;
+ u32 request_addr = 0;
+ u32 buffer_out = 0;
std::vector<pollfd_t> wii_fds;
- s64 timeout;
+ s64 timeout = 0;
};
static s32 GetNetErrorCode(s32 ret, std::string_view caller, bool is_rw);
@@ -292,7 +292,7 @@ private:
void UpdatePollCommands();
std::unordered_map<s32, WiiSocket> WiiSockets;
- s32 errno_last;
+ s32 errno_last = 0;
std::vector<PollCommand> pending_polls;
std::chrono::time_point<std::chrono::high_resolution_clock> last_time =
std::chrono::high_resolution_clock::now();
diff --git a/Source/Core/Core/IOS/SDIO/SDIOSlot0.h b/Source/Core/Core/IOS/SDIO/SDIOSlot0.h
index 97f6835961..efa6595c78 100644
--- a/Source/Core/Core/IOS/SDIO/SDIOSlot0.h
+++ b/Source/Core/Core/IOS/SDIO/SDIOSlot0.h
@@ -159,7 +159,7 @@ private:
u32 m_block_length = 0;
u32 m_bus_width = 0;
- std::array<u32, 0x200 / sizeof(u32)> m_registers;
+ std::array<u32, 0x200 / sizeof(u32)> m_registers{};
File::IOFile m_card;
};
diff --git a/Source/Core/Core/IOS/WFS/WFSI.h b/Source/Core/Core/IOS/WFS/WFSI.h
index 6a0a065c3b..c83709d386 100644
--- a/Source/Core/Core/IOS/WFS/WFSI.h
+++ b/Source/Core/Core/IOS/WFS/WFSI.h
@@ -50,20 +50,20 @@ private:
std::string m_device_name;
- mbedtls_aes_context m_aes_ctx;
+ mbedtls_aes_context m_aes_ctx{};
u8 m_aes_key[0x10] = {};
u8 m_aes_iv[0x10] = {};
ES::TMDReader m_tmd;
std::string m_base_extract_path;
- u64 m_current_title_id;
+ u64 m_current_title_id = 0;
std::string m_current_title_id_str;
- u16 m_current_group_id;
+ u16 m_current_group_id = 0;
std::string m_current_group_id_str;
- u64 m_import_title_id;
+ u64 m_import_title_id = 0;
std::string m_import_title_id_str;
- u16 m_import_group_id;
+ u16 m_import_group_id = 0;
std::string m_import_group_id_str;
// Set on IMPORT_TITLE_INIT when the next profile application should not delete
diff --git a/Source/Core/Core/IOS/WFS/WFSSRV.h b/Source/Core/Core/IOS/WFS/WFSSRV.h
index 5c78fa1c3f..cfc6dcc2df 100644
--- a/Source/Core/Core/IOS/WFS/WFSSRV.h
+++ b/Source/Core/Core/IOS/WFS/WFSSRV.h
@@ -84,10 +84,10 @@ private:
struct FileDescriptor
{
- bool in_use;
+ bool in_use = false;
std::string path;
- int mode;
- size_t position;
+ int mode = 0;
+ size_t position = 0;
File::IOFile file;
bool Open();
diff --git a/Source/Core/Core/NetPlayClient.h b/Source/Core/Core/NetPlayClient.h
index 3257ac17cd..3c02cad266 100644
--- a/Source/Core/Core/NetPlayClient.h
+++ b/Source/Core/Core/NetPlayClient.h
@@ -82,11 +82,11 @@ public:
class Player
{
public:
- PlayerId pid;
+ PlayerId pid{};
std::string name;
std::string revision;
- u32 ping;
- SyncIdentifierComparison game_status;
+ u32 ping = 0;
+ SyncIdentifierComparison game_status = SyncIdentifierComparison::Unknown;
bool IsHost() const { return pid == 1; }
};
@@ -153,7 +153,7 @@ protected:
struct AsyncQueueEntry
{
sf::Packet packet;
- u8 channel_id;
+ u8 channel_id = 0;
};
void ClearBuffers();
diff --git a/Source/Core/Core/NetPlayProto.h b/Source/Core/Core/NetPlayProto.h
index 537b820701..87af1fe26c 100644
--- a/Source/Core/Core/NetPlayProto.h
+++ b/Source/Core/Core/NetPlayProto.h
@@ -28,84 +28,84 @@ namespace NetPlay
{
struct NetSettings
{
- bool m_CPUthread;
- PowerPC::CPUCore m_CPUcore;
- bool m_EnableCheats;
- int m_SelectedLanguage;
- bool m_OverrideRegionSettings;
- bool m_DSPHLE;
- bool m_DSPEnableJIT;
- bool m_WriteToMemcard;
- bool m_RAMOverrideEnable;
- u32 m_Mem1Size;
- u32 m_Mem2Size;
- DiscIO::Region m_FallbackRegion;
- bool m_AllowSDWrites;
- bool m_CopyWiiSave;
- bool m_OCEnable;
- float m_OCFactor;
- std::array<ExpansionInterface::TEXIDevices, 3> m_EXIDevice;
-
- std::array<u32, Config::SYSCONF_SETTINGS.size()> m_SYSCONFSettings;
-
- bool m_EFBAccessEnable;
- bool m_BBoxEnable;
- bool m_ForceProgressive;
- bool m_EFBToTextureEnable;
- bool m_XFBToTextureEnable;
- bool m_DisableCopyToVRAM;
- bool m_ImmediateXFBEnable;
- bool m_EFBEmulateFormatChanges;
- int m_SafeTextureCacheColorSamples;
- bool m_PerfQueriesEnable;
- bool m_FloatExceptions;
- bool m_DivideByZeroExceptions;
- bool m_FPRF;
- bool m_AccurateNaNs;
- bool m_DisableICache;
- bool m_SyncOnSkipIdle;
- bool m_SyncGPU;
- int m_SyncGpuMaxDistance;
- int m_SyncGpuMinDistance;
- float m_SyncGpuOverclock;
- bool m_JITFollowBranch;
- bool m_FastDiscSpeed;
- bool m_MMU;
- bool m_Fastmem;
- bool m_SkipIPL;
- bool m_LoadIPLDump;
- bool m_VertexRounding;
- int m_InternalResolution;
- bool m_EFBScaledCopy;
- bool m_FastDepthCalc;
- bool m_EnablePixelLighting;
- bool m_WidescreenHack;
- bool m_ForceFiltering;
- int m_MaxAnisotropy;
- bool m_ForceTrueColor;
- bool m_DisableCopyFilter;
- bool m_DisableFog;
- bool m_ArbitraryMipmapDetection;
- float m_ArbitraryMipmapDetectionThreshold;
- bool m_EnableGPUTextureDecoding;
- bool m_DeferEFBCopies;
- int m_EFBAccessTileSize;
- bool m_EFBAccessDeferInvalidation;
-
- bool m_StrictSettingsSync;
- bool m_SyncSaveData;
- bool m_SyncCodes;
+ bool m_CPUthread = false;
+ PowerPC::CPUCore m_CPUcore{};
+ bool m_EnableCheats = false;
+ int m_SelectedLanguage = 0;
+ bool m_OverrideRegionSettings = false;
+ bool m_DSPHLE = false;
+ bool m_DSPEnableJIT = false;
+ bool m_WriteToMemcard = false;
+ bool m_RAMOverrideEnable = false;
+ u32 m_Mem1Size = 0;
+ u32 m_Mem2Size = 0;
+ DiscIO::Region m_FallbackRegion{};
+ bool m_AllowSDWrites = false;
+ bool m_CopyWiiSave = false;
+ bool m_OCEnable = false;
+ float m_OCFactor = 0;
+ std::array<ExpansionInterface::TEXIDevices, 3> m_EXIDevice{};
+
+ std::array<u32, Config::SYSCONF_SETTINGS.size()> m_SYSCONFSettings{};
+
+ bool m_EFBAccessEnable = false;
+ bool m_BBoxEnable = false;
+ bool m_ForceProgressive = false;
+ bool m_EFBToTextureEnable = false;
+ bool m_XFBToTextureEnable = false;
+ bool m_DisableCopyToVRAM = false;
+ bool m_ImmediateXFBEnable = false;
+ bool m_EFBEmulateFormatChanges = false;
+ int m_SafeTextureCacheColorSamples = 0;
+ bool m_PerfQueriesEnable = false;
+ bool m_FloatExceptions = false;
+ bool m_DivideByZeroExceptions = false;
+ bool m_FPRF = false;
+ bool m_AccurateNaNs = false;
+ bool m_DisableICache = false;
+ bool m_SyncOnSkipIdle = false;
+ bool m_SyncGPU = false;
+ int m_SyncGpuMaxDistance = 0;
+ int m_SyncGpuMinDistance = 0;
+ float m_SyncGpuOverclock = 0;
+ bool m_JITFollowBranch = false;
+ bool m_FastDiscSpeed = false;
+ bool m_MMU = false;
+ bool m_Fastmem = false;
+ bool m_SkipIPL = false;
+ bool m_LoadIPLDump = false;
+ bool m_VertexRounding = false;
+ int m_InternalResolution = 0;
+ bool m_EFBScaledCopy = false;
+ bool m_FastDepthCalc = false;
+ bool m_EnablePixelLighting = false;
+ bool m_WidescreenHack = false;
+ bool m_ForceFiltering = false;
+ int m_MaxAnisotropy = 0;
+ bool m_ForceTrueColor = false;
+ bool m_DisableCopyFilter = false;
+ bool m_DisableFog = false;
+ bool m_ArbitraryMipmapDetection = false;
+ float m_ArbitraryMipmapDetectionThreshold = 0;
+ bool m_EnableGPUTextureDecoding = false;
+ bool m_DeferEFBCopies = false;
+ int m_EFBAccessTileSize = 0;
+ bool m_EFBAccessDeferInvalidation = false;
+
+ bool m_StrictSettingsSync = false;
+ bool m_SyncSaveData = false;
+ bool m_SyncCodes = false;
std::string m_SaveDataRegion;
- bool m_SyncAllWiiSaves;
- std::array<int, 4> m_WiimoteExtension;
- bool m_GolfMode;
- bool m_UseFMA;
- bool m_HideRemoteGBAs;
+ bool m_SyncAllWiiSaves = false;
+ std::array<int, 4> m_WiimoteExtension{};
+ bool m_GolfMode = false;
+ bool m_UseFMA = false;
+ bool m_HideRemoteGBAs = false;
// These aren't sent over the network directly
- bool m_IsHosting;
- bool m_HostInputAuthority;
- std::array<std::string, 4> m_GBARomPaths;
+ bool m_IsHosting = false;
+ bool m_HostInputAuthority = false;
+ std::array<std::string, 4> m_GBARomPaths{};
};
struct NetTraversalConfig
@@ -226,7 +226,7 @@ enum : u8
struct WiimoteInput
{
- u8 report_id;
+ u8 report_id = 0;
std::vector<u8> data;
};
using PlayerId = u8;
@@ -235,19 +235,19 @@ using PadIndex = s8;
using PadMappingArray = std::array<PlayerId, 4>;
struct GBAConfig
{
- bool enabled;
- bool has_rom;
+ bool enabled = false;
+ bool has_rom = false;
std::string title;
- std::array<u8, 20> hash;
+ std::array<u8, 20> hash{};
};
using GBAConfigArray = std::array<GBAConfig, 4>;
struct PadDetails
{
- std::string player_name;
- bool is_local;
- int local_pad;
- bool hide_gba;
+ std::string player_name{};
+ bool is_local = false;
+ int local_pad = 0;
+ bool hide_gba = false;
};
std::string GetPlayerMappingString(PlayerId pid, const PadMappingArray& pad_map,
diff --git a/Source/Core/Core/NetPlayServer.h b/Source/Core/Core/NetPlayServer.h
index 76c1d7ae94..67de180204 100644
--- a/Source/Core/Core/NetPlayServer.h
+++ b/Source/Core/Core/NetPlayServer.h
@@ -80,16 +80,16 @@ private:
class Client
{
public:
- PlayerId pid;
+ PlayerId pid{};
std::string name;
std::string revision;
- SyncIdentifierComparison game_status;
- bool has_ipl_dump;
- bool has_hardware_fma;
+ SyncIdentifierComparison game_status = SyncIdentifierComparison::Unknown;
+ bool has_ipl_dump = false;
+ bool has_hardware_fma = false;
- ENetPeer* socket;
- u32 ping;
- u32 current_game;
+ ENetPeer* socket = nullptr;
+ u32 ping = 0;
+ u32 current_game = 0;
Common::QoSSession qos_session;
@@ -106,16 +106,16 @@ private:
struct AsyncQueueEntry
{
sf::Packet packet;
- PlayerId target_pid;
- TargetMode target_mode;
- u8 channel_id;
+ PlayerId target_pid{};
+ TargetMode target_mode{};
+ u8 channel_id = 0;
};
struct ChunkedDataQueueEntry
{
sf::Packet packet;
- PlayerId target_pid;
- TargetMode target_mode;
+ PlayerId target_pid{};
+ TargetMode target_mode{};
std::string title;
};
@@ -171,7 +171,7 @@ private:
std::map<PlayerId, Client> m_players;
std::unordered_map<u32, std::vector<std::pair<PlayerId, u64>>> m_timebase_by_frame;
- bool m_desync_detected;
+ bool m_desync_detected = false;
struct
{
@@ -191,7 +191,7 @@ private:
Common::Event m_chunked_data_event;
Common::Event m_chunked_data_complete_event;
std::thread m_chunked_data_thread;
- u32 m_next_chunked_data_id;
+ u32 m_next_chunked_data_id = 0;
std::unordered_map<u32, unsigned int> m_chunked_data_complete_count;
bool m_abort_chunked_data = false;
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.h b/Source/Core/Core/PowerPC/Jit64/Jit.h
index 70c53bd784..2e5b4949db 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit.h
+++ b/Source/Core/Core/PowerPC/Jit64/Jit.h
@@ -266,9 +266,9 @@ private:
Jit64AsmRoutineManager asm_routines{*this};
- bool m_enable_blr_optimization;
- bool m_cleanup_after_stackfault;
- u8* m_stack;
+ bool m_enable_blr_optimization = false;
+ bool m_cleanup_after_stackfault = false;
+ u8* m_stack = nullptr;
HyoutaUtilities::RangeSizeSet<u8*> m_free_ranges_near;
HyoutaUtilities::RangeSizeSet<u8*> m_free_ranges_far;
diff --git a/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h b/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h
index 330ba7f4ae..1340633578 100644
--- a/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h
+++ b/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h
@@ -134,9 +134,9 @@ protected:
FarCodeCache m_far_code;
// Backed up when we switch to far code.
- u8* m_near_code;
- u8* m_near_code_end;
- bool m_near_code_write_failed;
+ u8* m_near_code = nullptr;
+ u8* m_near_code_end = nullptr;
+ bool m_near_code_write_failed = false;
std::unordered_map<u8*, TrampolineInfo> m_back_patch_info;
std::unordered_map<u8*, u8*> m_exception_handler_at_loc;
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.h b/Source/Core/Core/PowerPC/JitCommon/JitCache.h
index c9e3f02d91..f2c0719109 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitCache.h
+++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.h
@@ -205,5 +205,5 @@ private:
// This array is indexed with the masked PC and likely holds the correct block id.
// This is used as a fast cache of block_map used in the assembly dispatcher.
- std::array<JitBlock*, FAST_BLOCK_MAP_ELEMENTS> fast_block_map; // start_addr & mask -> number
+ std::array<JitBlock*, FAST_BLOCK_MAP_ELEMENTS> fast_block_map{}; // start_addr & mask -> number
};
diff --git a/Source/Core/Core/PowerPC/MMU.cpp b/Source/Core/Core/PowerPC/MMU.cpp
index a567c60047..6f1ef604f9 100644
--- a/Source/Core/Core/PowerPC/MMU.cpp
+++ b/Source/Core/Core/PowerPC/MMU.cpp
@@ -3,7 +3,6 @@
#include "Core/PowerPC/MMU.h"
-#include <cassert>
#include <cstddef>
#include <cstring>
#include <string>
@@ -469,34 +468,35 @@ u32 HostRead_Instruction(const u32 address)
return ReadFromHardware<XCheckTLBFlag::OpcodeNoException, u32>(address);
}
-TryReadResult<u32> HostTryReadInstruction(const u32 address, RequestedAddressSpace space)
+std::optional<ReadResult<u32>> HostTryReadInstruction(const u32 address,
+ RequestedAddressSpace space)
{
if (!HostIsInstructionRAMAddress(address, space))
- return TryReadResult<u32>();
+ return std::nullopt;
switch (space)
{
case RequestedAddressSpace::Effective:
{
const u32 value = ReadFromHardware<XCheckTLBFlag::OpcodeNoException, u32>(address);
- return TryReadResult<u32>(!!MSR.DR, value);
+ return ReadResult<u32>(!!MSR.DR, value);
}
case RequestedAddressSpace::Physical:
{
const u32 value = ReadFromHardware<XCheckTLBFlag::OpcodeNoException, u32, true>(address);
- return TryReadResult<u32>(false, value);
+ return ReadResult<u32>(false, value);
}
case RequestedAddressSpace::Virtual:
{
if (!MSR.DR)
- return TryReadResult<u32>();
+ return std::nullopt;
const u32 value = ReadFromHardware<XCheckTLBFlag::OpcodeNoException, u32>(address);
- return TryReadResult<u32>(true, value);
+ return ReadResult<u32>(true, value);
}
}
- assert(0);
- return TryReadResult<u32>();
+ ASSERT(0);
+ return std::nullopt;
}
static void Memcheck(u32 address, u64 var, bool write, size_t size)
@@ -575,70 +575,70 @@ float Read_F32(const u32 address)
}
template <typename T>
-static TryReadResult<T> HostTryReadUX(const u32 address, RequestedAddressSpace space)
+static std::optional<ReadResult<T>> HostTryReadUX(const u32 address, RequestedAddressSpace space)
{
if (!HostIsRAMAddress(address, space))
- return TryReadResult<T>();
+ return std::nullopt;
switch (space)
{
case RequestedAddressSpace::Effective:
{
T value = ReadFromHardware<XCheckTLBFlag::NoException, T>(address);
- return TryReadResult<T>(!!MSR.DR, std::move(value));
+ return ReadResult<T>(!!MSR.DR, std::move(value));
}
case RequestedAddressSpace::Physical:
{
T value = ReadFromHardware<XCheckTLBFlag::NoException, T, true>(address);
- return TryReadResult<T>(false, std::move(value));
+ return ReadResult<T>(false, std::move(value));
}
case RequestedAddressSpace::Virtual:
{
if (!MSR.DR)
- return TryReadResult<T>();
+ return std::nullopt;
T value = ReadFromHardware<XCheckTLBFlag::NoException, T>(address);
- return TryReadResult<T>(true, std::move(value));
+ return ReadResult<T>(true, std::move(value));
}
}
- assert(0);
- return TryReadResult<T>();
+ ASSERT(0);
+ return std::nullopt;
}
-TryReadResult<u8> HostTryReadU8(u32 address, RequestedAddressSpace space)
+std::optional<ReadResult<u8>> HostTryReadU8(u32 address, RequestedAddressSpace space)
{
return HostTryReadUX<u8>(address, space);
}
-TryReadResult<u16> HostTryReadU16(u32 address, RequestedAddressSpace space)
+std::optional<ReadResult<u16>> HostTryReadU16(u32 address, RequestedAddressSpace space)
{
return HostTryReadUX<u16>(address, space);
}
-TryReadResult<u32> HostTryReadU32(u32 address, RequestedAddressSpace space)
+std::optional<ReadResult<u32>> HostTryReadU32(u32 address, RequestedAddressSpace space)
{
return HostTryReadUX<u32>(address, space);
}
-TryReadResult<u64> HostTryReadU64(u32 address, RequestedAddressSpace space)
+std::optional<ReadResult<u64>> HostTryReadU64(u32 address, RequestedAddressSpace space)
{
return HostTryReadUX<u64>(address, space);
}
-TryReadResult<float> HostTryReadF32(u32 address, RequestedAddressSpace space)
+std::optional<ReadResult<float>> HostTryReadF32(u32 address, RequestedAddressSpace space)
{
const auto result = HostTryReadUX<u32>(address, space);
if (!result)
- return TryReadResult<float>();
- return TryReadResult<float>(result.translated, Common::BitCast<float>(result.value));
+ return std::nullopt;
+ return ReadResult<float>(result->translated, Common::BitCast<float>(result->value));
}
-TryReadResult<double> HostTryReadF64(u32 address, RequestedAddressSpace space)
+std::optional<ReadResult<double>> HostTryReadF64(u32 address, RequestedAddressSpace space)
{
const auto result = HostTryReadUX<u64>(address, space);
if (!result)
- return TryReadResult<double>();
- return TryReadResult<double>(result.translated, Common::BitCast<double>(result.value));
+ return std::nullopt;
+ return ReadResult<double>(result->translated, Common::BitCast<double>(result->value));
}
u32 Read_U8_ZX(const u32 address)
@@ -764,62 +764,68 @@ void HostWrite_F64(const double var, const u32 address)
HostWrite_U64(integral, address);
}
-static TryWriteResult HostTryWriteUX(const u32 var, const u32 address, const u32 size,
- RequestedAddressSpace space)
+static std::optional<WriteResult> HostTryWriteUX(const u32 var, const u32 address, const u32 size,
+ RequestedAddressSpace space)
{
if (!HostIsRAMAddress(address, space))
- return TryWriteResult();
+ return std::nullopt;
switch (space)
{
case RequestedAddressSpace::Effective:
WriteToHardware<XCheckTLBFlag::NoException>(address, var, size);
- return TryWriteResult(!!MSR.DR);
+ return WriteResult(!!MSR.DR);
case RequestedAddressSpace::Physical:
WriteToHardware<XCheckTLBFlag::NoException, true>(address, var, size);
- return TryWriteResult(false);
+ return WriteResult(false);
case RequestedAddressSpace::Virtual:
if (!MSR.DR)
- return TryWriteResult();
+ return std::nullopt;
WriteToHardware<XCheckTLBFlag::NoException>(address, var, size);
- return TryWriteResult(true);
+ return WriteResult(true);
}
- assert(0);
- return TryWriteResult();
+ ASSERT(0);
+ return std::nullopt;
}
-TryWriteResult HostTryWriteU8(const u32 var, const u32 address, RequestedAddressSpace space)
+std::optional<WriteResult> HostTryWriteU8(const u32 var, const u32 address,
+ RequestedAddressSpace space)
{
return HostTryWriteUX(var, address, 1, space);
}
-TryWriteResult HostTryWriteU16(const u32 var, const u32 address, RequestedAddressSpace space)
+std::optional<WriteResult> HostTryWriteU16(const u32 var, const u32 address,
+ RequestedAddressSpace space)
{
return HostTryWriteUX(var, address, 2, space);
}
-TryWriteResult HostTryWriteU32(const u32 var, const u32 address, RequestedAddressSpace space)
+std::optional<WriteResult> HostTryWriteU32(const u32 var, const u32 address,
+ RequestedAddressSpace space)
{
return HostTryWriteUX(var, address, 4, space);
}
-TryWriteResult HostTryWriteU64(const u64 var, const u32 address, RequestedAddressSpace space)
+std::optional<WriteResult> HostTryWriteU64(const u64 var, const u32 address,
+ RequestedAddressSpace space)
{
- const TryWriteResult result = HostTryWriteUX(static_cast<u32>(var >> 32), address, 4, space);
+ const auto result = HostTryWriteUX(static_cast<u32>(var >> 32), address, 4, space);
if (!result)
return result;
return HostTryWriteUX(static_cast<u32>(var), address + 4, 4, space);
}
-TryWriteResult HostTryWriteF32(const float var, const u32 address, RequestedAddressSpace space)
+std::optional<WriteResult> HostTryWriteF32(const float var, const u32 address,
+ RequestedAddressSpace space)
{
const u32 integral = Common::BitCast<u32>(var);
return HostTryWriteU32(integral, address, space);
}
-TryWriteResult HostTryWriteF64(const double var, const u32 address, RequestedAddressSpace space)
+std::optional<WriteResult> HostTryWriteF64(const double var, const u32 address,
+ RequestedAddressSpace space)
{
const u64 integral = Common::BitCast<u64>(var);
return HostTryWriteU64(integral, address, space);
@@ -841,25 +847,26 @@ std::string HostGetString(u32 address, size_t size)
return s;
}
-TryReadResult<std::string> HostTryReadString(u32 address, size_t size, RequestedAddressSpace space)
+std::optional<ReadResult<std::string>> HostTryReadString(u32 address, size_t size,
+ RequestedAddressSpace space)
{
auto c = HostTryReadU8(address, space);
if (!c)
- return TryReadResult<std::string>();
- if (c.value == 0)
- return TryReadResult<std::string>(c.translated, "");
+ return std::nullopt;
+ if (c->value == 0)
+ return ReadResult<std::string>(c->translated, "");
std::string s;
- s += static_cast<char>(c.value);
+ s += static_cast<char>(c->value);
while (size == 0 || s.length() < size)
{
++address;
const auto res = HostTryReadU8(address, space);
- if (!res || res.value == 0)
+ if (!res || res->value == 0)
break;
- s += static_cast<char>(res.value);
+ s += static_cast<char>(res->value);
}
- return TryReadResult<std::string>(c.translated, std::move(s));
+ return ReadResult<std::string>(c->translated, std::move(s));
}
bool IsOptimizableRAMAddress(const u32 address)
@@ -925,7 +932,7 @@ bool HostIsRAMAddress(u32 address, RequestedAddressSpace space)
return IsRAMAddress<XCheckTLBFlag::NoException>(address, true);
}
- assert(0);
+ ASSERT(0);
return false;
}
@@ -947,7 +954,7 @@ bool HostIsInstructionRAMAddress(u32 address, RequestedAddressSpace space)
return IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(address, true);
}
- assert(0);
+ ASSERT(0);
return false;
}
diff --git a/Source/Core/Core/PowerPC/MMU.h b/Source/Core/Core/PowerPC/MMU.h
index 47786078cb..afe36a9875 100644
--- a/Source/Core/Core/PowerPC/MMU.h
+++ b/Source/Core/Core/PowerPC/MMU.h
@@ -37,11 +37,8 @@ u32 HostRead_Instruction(u32 address);
std::string HostGetString(u32 address, size_t size = 0);
template <typename T>
-struct TryReadResult
+struct ReadResult
{
- // whether the read succeeded; if false, the other fields should not be touched
- bool success;
-
// whether the address had to be translated (given address was treated as virtual) or not (given
// address was treated as physical)
bool translated;
@@ -49,37 +46,31 @@ struct TryReadResult
// the actual value that was read
T value;
- TryReadResult() : success(false) {}
- TryReadResult(bool translated_, T&& value_)
- : success(true), translated(translated_), value(std::move(value_))
- {
- }
- TryReadResult(bool translated_, const T& value_)
- : success(true), translated(translated_), value(value_)
+ ReadResult(bool translated_, T&& value_) : translated(translated_), value(std::forward<T>(value_))
{
}
- explicit operator bool() const { return success; }
+ ReadResult(bool translated_, const T& value_) : translated(translated_), value(value_) {}
};
// Try to read a value from emulated memory at the given address in the given memory space.
-// If the read succeeds, the returned TryReadResult contains the read value and information on
-// whether the given address had to be translated or not. Unlike the HostRead functions, this does
-// not raise a user-visible alert on failure.
-TryReadResult<u8> HostTryReadU8(u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryReadResult<u16> HostTryReadU16(u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryReadResult<u32> HostTryReadU32(u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryReadResult<u64> HostTryReadU64(u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryReadResult<float> HostTryReadF32(u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryReadResult<double>
+// If the read succeeds, the returned value will be present and the ReadResult contains the read
+// value and information on whether the given address had to be translated or not. Unlike the
+// HostRead functions, this does not raise a user-visible alert on failure.
+std::optional<ReadResult<u8>>
+HostTryReadU8(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<ReadResult<u16>>
+HostTryReadU16(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<ReadResult<u32>>
+HostTryReadU32(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<ReadResult<u64>>
+HostTryReadU64(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<ReadResult<float>>
+HostTryReadF32(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<ReadResult<double>>
HostTryReadF64(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryReadResult<u32>
+std::optional<ReadResult<u32>>
HostTryReadInstruction(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryReadResult<std::string>
+std::optional<ReadResult<std::string>>
HostTryReadString(u32 address, size_t size = 0,
RequestedAddressSpace space = RequestedAddressSpace::Effective);
@@ -93,36 +84,37 @@ void HostWrite_U64(u64 var, u32 address);
void HostWrite_F32(float var, u32 address);
void HostWrite_F64(double var, u32 address);
-struct TryWriteResult
+struct WriteResult
{
- // whether the write succeeded; if false, the other fields should not be touched
- bool success;
-
// whether the address had to be translated (given address was treated as virtual) or not (given
// address was treated as physical)
bool translated;
- TryWriteResult() : success(false) {}
- TryWriteResult(bool translated_) : success(true), translated(translated_) {}
- explicit operator bool() const { return success; }
+ explicit WriteResult(bool translated_) : translated(translated_) {}
};
// Try to a write a value to memory at the given address in the given memory space.
// If the write succeeds, the returned TryWriteResult contains information on whether the given
// address had to be translated or not. Unlike the HostWrite functions, this does not raise a
// user-visible alert on failure.
-TryWriteResult HostTryWriteU8(u32 var, const u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryWriteResult HostTryWriteU16(u32 var, const u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryWriteResult HostTryWriteU32(u32 var, const u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryWriteResult HostTryWriteU64(u64 var, const u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryWriteResult HostTryWriteF32(float var, const u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
-TryWriteResult HostTryWriteF64(double var, const u32 address,
- RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<WriteResult>
+HostTryWriteU8(u32 var, const u32 address,
+ RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<WriteResult>
+HostTryWriteU16(u32 var, const u32 address,
+ RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<WriteResult>
+HostTryWriteU32(u32 var, const u32 address,
+ RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<WriteResult>
+HostTryWriteU64(u64 var, const u32 address,
+ RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<WriteResult>
+HostTryWriteF32(float var, const u32 address,
+ RequestedAddressSpace space = RequestedAddressSpace::Effective);
+std::optional<WriteResult>
+HostTryWriteF64(double var, const u32 address,
+ RequestedAddressSpace space = RequestedAddressSpace::Effective);
// Returns whether a read or write to the given address will resolve to a RAM access in the given
// address space.
diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.h b/Source/Core/Core/PowerPC/PPCAnalyst.h
index 223f07bb7b..4dfd043f41 100644
--- a/Source/Core/Core/PowerPC/PPCAnalyst.h
+++ b/Source/Core/Core/PowerPC/PPCAnalyst.h
@@ -24,29 +24,29 @@ namespace PPCAnalyst
struct CodeOp // 16B
{
UGeckoInstruction inst;
- GekkoOPInfo* opinfo;
- u32 address;
- u32 branchTo; // if UINT32_MAX, not a branch
+ GekkoOPInfo* opinfo = nullptr;
+ u32 address = 0;
+ u32 branchTo = 0; // if UINT32_MAX, not a branch
BitSet32 regsOut;
BitSet32 regsIn;
BitSet32 fregsIn;
- s8 fregOut;
- bool isBranchTarget;
- bool branchUsesCtr;
- bool branchIsIdleLoop;
- bool wantsCR0;
- bool wantsCR1;
- bool wantsFPRF;
- bool wantsCA;
- bool wantsCAInFlags;
- bool outputCR0;
- bool outputCR1;
- bool outputFPRF;
- bool outputCA;
- bool canEndBlock;
- bool canCauseException;
- bool skipLRStack;
- bool skip; // followed BL-s for example
+ s8 fregOut = 0;
+ bool isBranchTarget = false;
+ bool branchUsesCtr = false;
+ bool branchIsIdleLoop = false;
+ bool wantsCR0 = false;
+ bool wantsCR1 = false;
+ bool wantsFPRF = false;
+ bool wantsCA = false;
+ bool wantsCAInFlags = false;
+ bool outputCR0 = false;
+ bool outputCR1 = false;
+ bool outputFPRF = false;
+ bool outputCA = false;
+ bool canEndBlock = false;
+ bool canCauseException = false;
+ bool skipLRStack = false;
+ bool skip = false; // followed BL-s for example
// which registers are still needed after this instruction in this block
BitSet32 fprInUse;
BitSet32 gprInUse;
@@ -138,23 +138,24 @@ using CodeBuffer = std::vector<CodeOp>;
struct CodeBlock
{
// Beginning PPC address.
- u32 m_address;
+ u32 m_address = 0;
// Number of instructions
// Gives us the size of the block.
- u32 m_num_instructions;
+ u32 m_num_instructions = 0;
// Some basic statistics about the block.
- BlockStats* m_stats;
+ BlockStats* m_stats = nullptr;
// Register statistics about the block.
- BlockRegStats *m_gpa, *m_fpa;
+ BlockRegStats* m_gpa = nullptr;
+ BlockRegStats* m_fpa = nullptr;
// Are we a broken block?
- bool m_broken;
+ bool m_broken = false;
// Did we have a memory_exception?
- bool m_memory_exception;
+ bool m_memory_exception = false;
// Which GQRs this block uses, if any.
BitSet8 m_gqr_used;
diff --git a/Source/Core/Core/PowerPC/PPCCache.cpp b/Source/Core/Core/PowerPC/PPCCache.cpp
index 2e0ccd7159..181764dc3b 100644
--- a/Source/Core/Core/PowerPC/PPCCache.cpp
+++ b/Source/Core/Core/PowerPC/PPCCache.cpp
@@ -87,10 +87,6 @@ constexpr std::array<u32, 128> s_way_from_plru = [] {
}();
} // Anonymous namespace
-InstructionCache::InstructionCache()
-{
-}
-
void InstructionCache::Reset()
{
valid.fill(0);
diff --git a/Source/Core/Core/PowerPC/PPCCache.h b/Source/Core/Core/PowerPC/PPCCache.h
index 1bb0f8877e..fdc23ba546 100644
--- a/Source/Core/Core/PowerPC/PPCCache.h
+++ b/Source/Core/Core/PowerPC/PPCCache.h
@@ -21,16 +21,16 @@ constexpr u32 ICACHE_VMEM_BIT = 0x20000000;
struct InstructionCache
{
- std::array<std::array<std::array<u32, ICACHE_BLOCK_SIZE>, ICACHE_WAYS>, ICACHE_SETS> data;
- std::array<std::array<u32, ICACHE_WAYS>, ICACHE_SETS> tags;
- std::array<u32, ICACHE_SETS> plru;
- std::array<u32, ICACHE_SETS> valid;
+ std::array<std::array<std::array<u32, ICACHE_BLOCK_SIZE>, ICACHE_WAYS>, ICACHE_SETS> data{};
+ std::array<std::array<u32, ICACHE_WAYS>, ICACHE_SETS> tags{};
+ std::array<u32, ICACHE_SETS> plru{};
+ std::array<u32, ICACHE_SETS> valid{};
- std::array<u8, 1 << 20> lookup_table;
- std::array<u8, 1 << 21> lookup_table_ex;
- std::array<u8, 1 << 20> lookup_table_vmem;
+ std::array<u8, 1 << 20> lookup_table{};
+ std::array<u8, 1 << 21> lookup_table_ex{};
+ std::array<u8, 1 << 20> lookup_table_vmem{};
- InstructionCache();
+ InstructionCache() = default;
u32 ReadInstruction(u32 addr);
void Invalidate(u32 addr);
void Init();
diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h
index 33566908b9..ea05fdcd01 100644
--- a/Source/Core/Core/PowerPC/PowerPC.h
+++ b/Source/Core/Core/PowerPC/PowerPC.h
@@ -113,14 +113,14 @@ static_assert(std::is_standard_layout<PairedSingle>(), "PairedSingle must be sta
// Unfortunately not all of those fit in 520 bytes, but we can fit most of ps and all of the rest.
struct PowerPCState
{
- u32 pc; // program counter
- u32 npc;
+ u32 pc = 0; // program counter
+ u32 npc = 0;
// gather pipe pointer for JIT access
- u8* gather_pipe_ptr;
- u8* gather_pipe_base_ptr;
+ u8* gather_pipe_ptr = nullptr;
+ u8* gather_pipe_base_ptr = nullptr;
- u32 gpr[32]; // General purpose registers. r1 = stack pointer.
+ u32 gpr[32]{}; // General purpose registers. r1 = stack pointer.
#ifndef _M_X86_64
// The paired singles are strange : PS0 is stored in the full 64 bits of each FPR
@@ -129,25 +129,25 @@ struct PowerPCState
alignas(16) PairedSingle ps[32];
#endif
- ConditionRegister cr;
+ ConditionRegister cr{};
UReg_MSR msr; // machine state register
UReg_FPSCR fpscr; // floating point flags/status bits
// Exception management.
- u32 Exceptions;
+ u32 Exceptions = 0;
// Downcount for determining when we need to do timing
// This isn't quite the right location for it, but it is here to accelerate the ARM JIT
// This variable should be inside of the CoreTiming namespace if we wanted to be correct.
- int downcount;
+ int downcount = 0;
// XER, reformatted into byte fields for easier access.
- u8 xer_ca;
- u8 xer_so_ov; // format: (SO << 1) | OV
+ u8 xer_ca = 0;
+ u8 xer_so_ov = 0; // format: (SO << 1) | OV
// The Broadway CPU implements bits 16-23 of the XER register... even though it doesn't support
// lscbx
- u16 xer_stringctrl;
+ u16 xer_stringctrl = 0;
#if _M_X86_64
// This member exists only for the purpose of an assertion that its offset <= 0x100.
@@ -156,19 +156,19 @@ struct PowerPCState
alignas(16) PairedSingle ps[32];
#endif
- u32 sr[16]; // Segment registers.
+ u32 sr[16]{}; // Segment registers.
// special purpose registers - controls quantizers, DMA, and lots of other misc extensions.
// also for power management, but we don't care about that.
- u32 spr[1024];
+ u32 spr[1024]{};
// Storage for the stack pointer of the BLR optimization.
- u8* stored_stack_pointer;
+ u8* stored_stack_pointer = nullptr;
std::array<std::array<TLBEntry, TLB_SIZE / TLB_WAYS>, NUM_TLBS> tlb;
- u32 pagetable_base;
- u32 pagetable_hashmask;
+ u32 pagetable_base = 0;
+ u32 pagetable_hashmask = 0;
InstructionCache iCache;
diff --git a/Source/Core/Core/PowerPC/Profiler.h b/Source/Core/Core/PowerPC/Profiler.h
index c7853c1534..3c4b3eb33b 100644
--- a/Source/Core/Core/PowerPC/Profiler.h
+++ b/Source/Core/Core/PowerPC/Profiler.h
@@ -28,9 +28,9 @@ struct BlockStat
struct ProfileStats
{
std::vector<BlockStat> block_stats;
- u64 cost_sum;
- u64 timecost_sum;
- u64 countsPerSec;
+ u64 cost_sum = 0;
+ u64 timecost_sum = 0;
+ u64 countsPerSec = 0;
};
} // namespace Profiler
diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp
index 729a60b993..86877ecb50 100644
--- a/Source/Core/Core/State.cpp
+++ b/Source/Core/Core/State.cpp
@@ -298,10 +298,10 @@ static std::map<double, int> GetSavedStates()
struct CompressAndDumpState_args
{
- std::vector<u8>* buffer_vector;
- std::mutex* buffer_mutex;
+ std::vector<u8>* buffer_vector = nullptr;
+ std::mutex* buffer_mutex = nullptr;
std::string filename;
- bool wait;
+ bool wait = false;
};
static void CompressAndDumpState(CompressAndDumpState_args save_args)
diff --git a/Source/Core/Core/SyncIdentifier.h b/Source/Core/Core/SyncIdentifier.h
index 9be190943c..7175f073c4 100644
--- a/Source/Core/Core/SyncIdentifier.h
+++ b/Source/Core/Core/SyncIdentifier.h
@@ -13,18 +13,18 @@ namespace NetPlay
{
struct SyncIdentifier
{
- u64 dol_elf_size;
+ u64 dol_elf_size = 0;
std::string game_id;
- u16 revision;
- u8 disc_number;
- bool is_datel;
+ u16 revision = 0;
+ u8 disc_number = 0;
+ bool is_datel = false;
// This hash is intended to be (but is not guaranteed to be):
// 1. Identical for discs with no differences that affect netplay/TAS sync
// 2. Different for discs with differences that affect netplay/TAS sync
// 3. Much faster than hashing the entire disc
// The way the hash is calculated may change with updates to Dolphin.
- std::array<u8, 20> sync_hash;
+ std::array<u8, 20> sync_hash{};
bool operator==(const SyncIdentifier& s) const
{
diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp
index c39dbc64bf..70d123ccf3 100644
--- a/Source/Core/DiscIO/CompressedBlob.cpp
+++ b/Source/Core/DiscIO/CompressedBlob.cpp
@@ -173,17 +173,17 @@ struct CompressThreadState
struct CompressParameters
{
- std::vector<u8> data;
- u32 block_number;
- u64 inpos;
+ std::vector<u8> data{};
+ u32 block_number = 0;
+ u64 inpos = 0;
};
struct OutputParameters
{
- std::vector<u8> data;
- u32 block_number;
- bool compressed;
- u64 inpos;
+ std::vector<u8> data{};
+ u32 block_number = 0;
+ bool compressed = false;
+ u64 inpos = 0;
};
static ConversionResultCode SetUpCompressThreadState(CompressThreadState* state)
diff --git a/Source/Core/DiscIO/DirectoryBlob.h b/Source/Core/DiscIO/DirectoryBlob.h
index 1ec5372fa4..e4eb1b3cd3 100644
--- a/Source/Core/DiscIO/DirectoryBlob.h
+++ b/Source/Core/DiscIO/DirectoryBlob.h
@@ -132,14 +132,14 @@ private:
std::vector<u8> m_apploader;
std::vector<u8> m_fst_data;
- std::array<u8, VolumeWii::AES_KEY_SIZE> m_key;
+ std::array<u8, VolumeWii::AES_KEY_SIZE> m_key{};
std::string m_root_directory;
bool m_is_wii = false;
// GameCube has no shift, Wii has 2 bit shift
u32 m_address_shift = 0;
- u64 m_data_size;
+ u64 m_data_size = 0;
};
class DirectoryBlobReader : public BlobReader
diff --git a/Source/Core/DiscIO/DiscScrubber.h b/Source/Core/DiscIO/DiscScrubber.h
index 35135bea61..72d50bf402 100644
--- a/Source/Core/DiscIO/DiscScrubber.h
+++ b/Source/Core/DiscIO/DiscScrubber.h
@@ -46,7 +46,7 @@ private:
bool ParsePartitionData(const Partition& partition);
void ParseFileSystemData(u64 partition_data_offset, const FileInfo& directory);
- const Volume* m_disc;
+ const Volume* m_disc = nullptr;
std::vector<u8> m_free_table;
u64 m_file_size = 0;
diff --git a/Source/Core/DiscIO/LaggedFibonacciGenerator.h b/Source/Core/DiscIO/LaggedFibonacciGenerator.h
index d4b3a51cc4..2eace618aa 100644
--- a/Source/Core/DiscIO/LaggedFibonacciGenerator.h
+++ b/Source/Core/DiscIO/LaggedFibonacciGenerator.h
@@ -43,7 +43,7 @@ private:
static constexpr size_t LFG_K = 521;
static constexpr size_t LFG_J = 32;
- std::array<u32, LFG_K> m_buffer;
+ std::array<u32, LFG_K> m_buffer{};
size_t m_position_bytes = 0;
};
diff --git a/Source/Core/DiscIO/VolumeVerifier.h b/Source/Core/DiscIO/VolumeVerifier.h
index a6fea8f76b..6e573880ac 100644
--- a/Source/Core/DiscIO/VolumeVerifier.h
+++ b/Source/Core/DiscIO/VolumeVerifier.h
@@ -78,7 +78,7 @@ private:
struct PotentialMatch
{
- u64 size;
+ u64 size = 0;
Hashes<std::vector<u8>> hashes;
};
@@ -87,9 +87,9 @@ private:
std::vector<PotentialMatch> ScanDatfile(const std::vector<u8>& data, const std::string& system);
std::string m_game_id;
- u16 m_revision;
- u8 m_disc_number;
- u64 m_size;
+ u16 m_revision = 0;
+ u8 m_disc_number = 0;
+ u64 m_size = 0;
std::future<std::vector<PotentialMatch>> m_future;
Result m_result;
@@ -173,8 +173,8 @@ private:
Hashes<bool> m_hashes_to_calculate{};
bool m_calculating_any_hash = false;
unsigned long m_crc32_context = 0;
- mbedtls_md5_context m_md5_context;
- mbedtls_sha1_context m_sha1_context;
+ mbedtls_md5_context m_md5_context{};
+ mbedtls_sha1_context m_sha1_context{};
u64 m_excess_bytes = 0;
std::vector<u8> m_data;
diff --git a/Source/Core/DiscIO/VolumeWii.h b/Source/Core/DiscIO/VolumeWii.h
index 1e89e63e92..f2dea1b016 100644
--- a/Source/Core/DiscIO/VolumeWii.h
+++ b/Source/Core/DiscIO/VolumeWii.h
@@ -122,7 +122,7 @@ private:
Common::Lazy<std::vector<u8>> h3_table;
Common::Lazy<std::unique_ptr<FileSystem>> file_system;
Common::Lazy<u64> data_offset;
- u32 type;
+ u32 type = 0;
};
std::unique_ptr<BlobReader> m_reader;
@@ -131,7 +131,7 @@ private:
bool m_encrypted;
mutable u64 m_last_decrypted_block;
- mutable u8 m_last_decrypted_block_data[BLOCK_DATA_SIZE];
+ mutable u8 m_last_decrypted_block_data[BLOCK_DATA_SIZE]{};
};
} // namespace DiscIO
diff --git a/Source/Core/DiscIO/WIABlob.h b/Source/Core/DiscIO/WIABlob.h
index 88db70a210..d13476762b 100644
--- a/Source/Core/DiscIO/WIABlob.h
+++ b/Source/Core/DiscIO/WIABlob.h
@@ -168,7 +168,10 @@ private:
bool is_partition;
u8 partition_data_index;
- DataEntry(size_t index_) : index(static_cast<u32>(index_)), is_partition(false) {}
+ DataEntry(size_t index_)
+ : index(static_cast<u32>(index_)), is_partition(false), partition_data_index(0)
+ {
+ }
DataEntry(size_t index_, size_t partition_data_index_)
: index(static_cast<u32>(index_)), is_partition(true),
partition_data_index(static_cast<u8>(partition_data_index_))
@@ -281,11 +284,11 @@ private:
struct CompressParameters
{
- std::vector<u8> data;
- const DataEntry* data_entry;
- u64 data_offset;
- u64 bytes_read;
- size_t group_index;
+ std::vector<u8> data{};
+ const DataEntry* data_entry = nullptr;
+ u64 data_offset = 0;
+ u64 bytes_read = 0;
+ size_t group_index = 0;
};
struct WIAOutputParametersEntry
@@ -312,8 +315,8 @@ private:
struct OutputParameters
{
std::vector<OutputParametersEntry> entries;
- u64 bytes_read;
- size_t group_index;
+ u64 bytes_read = 0;
+ size_t group_index = 0;
};
static bool PadTo4(File::IOFile* file, u64* bytes_written);
diff --git a/Source/Core/DiscIO/WIACompression.h b/Source/Core/DiscIO/WIACompression.h
index df5e9dacba..fdabedbed0 100644
--- a/Source/Core/DiscIO/WIACompression.h
+++ b/Source/Core/DiscIO/WIACompression.h
@@ -141,7 +141,7 @@ private:
u32 m_rvz_packed_size;
u32 m_size = 0;
- bool m_junk;
+ bool m_junk = false;
LaggedFibonacciGenerator m_lfg;
};
@@ -178,7 +178,7 @@ public:
private:
std::vector<u8> m_buffer;
- size_t m_bytes_written;
+ size_t m_bytes_written = 0;
mbedtls_sha1_context m_sha1_context;
};
@@ -244,7 +244,7 @@ private:
void ExpandBuffer(size_t bytes_to_add);
ZSTD_CStream* m_stream;
- ZSTD_outBuffer m_out_buffer;
+ ZSTD_outBuffer m_out_buffer{};
std::vector<u8> m_buffer;
};
diff --git a/Source/Core/DiscIO/WiiEncryptionCache.h b/Source/Core/DiscIO/WiiEncryptionCache.h
index 629daff2bb..3516d3b538 100644
--- a/Source/Core/DiscIO/WiiEncryptionCache.h
+++ b/Source/Core/DiscIO/WiiEncryptionCache.h
@@ -50,7 +50,7 @@ public:
private:
BlobReader* m_blob;
std::unique_ptr<std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>> m_cache;
- u64 m_cached_offset;
+ u64 m_cached_offset = 0;
};
} // namespace DiscIO
diff --git a/Source/Core/DolphinQt/Config/Graphics/PostProcessingConfigWindow.h b/Source/Core/DolphinQt/Config/Graphics/PostProcessingConfigWindow.h
index 0117c05b8b..4b37380c34 100644
--- a/Source/Core/DolphinQt/Config/Graphics/PostProcessingConfigWindow.h
+++ b/Source/Core/DolphinQt/Config/Graphics/PostProcessingConfigWindow.h
@@ -52,7 +52,7 @@ private:
u32 AddInteger(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row);
u32 AddFloat(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row);
- QCheckBox* m_checkbox;
+ QCheckBox* m_checkbox = nullptr;
std::vector<QSlider*> m_sliders;
std::vector<QLineEdit*> m_value_boxes;
diff --git a/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp b/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp
index 659b6a889f..6e178a2ed8 100644
--- a/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp
+++ b/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp
@@ -207,7 +207,7 @@ public:
private:
std::function<ControlState()> m_state_evaluator;
- bool m_should_paint_state_indicator;
+ bool m_should_paint_state_indicator = false;
};
IOWindow::IOWindow(MappingWidget* parent, ControllerEmu::EmulatedController* controller,
diff --git a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
index 0b571e9502..a2b113f881 100644
--- a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
+++ b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp
@@ -35,10 +35,10 @@
struct CodeViewBranch
{
- u32 src_addr;
- u32 dst_addr;
+ u32 src_addr = 0;
+ u32 dst_addr = 0;
u32 indentation = 0;
- bool is_link;
+ bool is_link = false;
};
constexpr u32 WIDTH_PER_BRANCH_ARROW = 16;
diff --git a/Source/Core/DolphinQt/TAS/TASCheckBox.h b/Source/Core/DolphinQt/TAS/TASCheckBox.h
index 04d3b3001c..afec671194 100644
--- a/Source/Core/DolphinQt/TAS/TASCheckBox.h
+++ b/Source/Core/DolphinQt/TAS/TASCheckBox.h
@@ -21,7 +21,7 @@ protected:
private:
const TASInputWindow* m_parent;
- int m_frame_turbo_started;
- int m_turbo_press_frames;
- int m_turbo_total_frames;
+ int m_frame_turbo_started = 0;
+ int m_turbo_press_frames = 0;
+ int m_turbo_total_frames = 0;
};
diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.cpp b/Source/Core/InputCommon/ControlReference/ControlReference.cpp
index 4bdfbddfef..795204cc05 100644
--- a/Source/Core/InputCommon/ControlReference/ControlReference.cpp
+++ b/Source/Core/InputCommon/ControlReference/ControlReference.cpp
@@ -58,9 +58,7 @@ std::optional<std::string> ControlReference::SetExpression(std::string expr)
return parse_result.description;
}
-ControlReference::ControlReference() : range(1), m_parsed_expression(nullptr)
-{
-}
+ControlReference::ControlReference() = default;
ControlReference::~ControlReference() = default;
diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.h b/Source/Core/InputCommon/ControlReference/ControlReference.h
index da6e10a5c2..f12e354bb3 100644
--- a/Source/Core/InputCommon/ControlReference/ControlReference.h
+++ b/Source/Core/InputCommon/ControlReference/ControlReference.h
@@ -41,13 +41,14 @@ public:
// Returns a human-readable error description when the given expression is invalid.
std::optional<std::string> SetExpression(std::string expr);
- ControlState range;
+ ControlState range = 1;
protected:
ControlReference();
std::string m_expression;
std::unique_ptr<ciface::ExpressionParser::Expression> m_parsed_expression;
- ciface::ExpressionParser::ParseStatus m_parse_status;
+ ciface::ExpressionParser::ParseStatus m_parse_status =
+ ciface::ExpressionParser::ParseStatus::EmptyExpression;
};
template <>
diff --git a/Source/Core/InputCommon/ControlReference/ExpressionParser.h b/Source/Core/InputCommon/ControlReference/ExpressionParser.h
index 16554738eb..405445b8a0 100644
--- a/Source/Core/InputCommon/ControlReference/ExpressionParser.h
+++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.h
@@ -181,7 +181,7 @@ public:
static ParseResult MakeSuccessfulResult(std::unique_ptr<Expression>&& expr);
static ParseResult MakeErrorResult(Token token, std::string description);
- ParseStatus status;
+ ParseStatus status = ParseStatus::EmptyExpression;
std::unique_ptr<Expression> expr;
// Used for parse errors:
diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h
index def895afa1..2840f43463 100644
--- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h
+++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h
@@ -174,7 +174,7 @@ protected:
void AddCombinedInput(std::string name, const std::pair<std::string, std::string>& inputs);
private:
- int m_id;
+ int m_id = 0;
std::vector<Input*> m_inputs;
std::vector<Output*> m_outputs;
};
@@ -216,10 +216,10 @@ public:
struct InputDetection
{
std::shared_ptr<Device> device;
- Device::Input* input;
+ Device::Input* input = nullptr;
Clock::time_point press_time;
std::optional<Clock::time_point> release_time;
- ControlState smoothness;
+ ControlState smoothness = 0;
};
Device::Input* FindInput(std::string_view name, const Device* def_dev) const;
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
index 5a6c6c221e..e7a8bea6fe 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
@@ -177,9 +177,6 @@ Joystick::Joystick(const LPDIRECTINPUTDEVICE8 device) : m_device(device)
InitForceFeedback(m_device, num_ff_axes);
}
- // Zero inputs:
- m_state_in = {};
-
// Set hats to center:
// "The center position is normally reported as -1" -MSDN
std::fill(std::begin(m_state_in.rgdwPOV), std::end(m_state_in.rgdwPOV), -1);
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h
index be04becf41..a142aeba00 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h
@@ -70,7 +70,7 @@ public:
private:
const LPDIRECTINPUTDEVICE8 m_device;
- DIJOYSTATE m_state_in;
+ DIJOYSTATE m_state_in{};
bool m_buffered;
};
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h
index d174f4a28e..eba4c8ab93 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h
@@ -22,10 +22,10 @@ class KeyboardMouse : public Core::Device
private:
struct State
{
- BYTE keyboard[256];
+ BYTE keyboard[256]{};
// Old smoothed relative mouse movement.
- DIMOUSESTATE2 mouse;
+ DIMOUSESTATE2 mouse{};
// Normalized mouse cursor position.
Common::TVec2<ControlState> cursor;
diff --git a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
index b63a8582ae..7342ef4d47 100644
--- a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
@@ -191,7 +191,7 @@ struct Server
std::string m_description;
std::string m_address;
u16 m_port;
- std::array<Proto::MessageType::PortInfo, Proto::PORT_COUNT> m_port_info;
+ std::array<Proto::MessageType::PortInfo, Proto::PORT_COUNT> m_port_info{};
sf::UdpSocket m_socket;
SteadyClock::time_point m_disconnect_time = SteadyClock::now();
};
diff --git a/Source/Core/InputCommon/GCPadStatus.h b/Source/Core/InputCommon/GCPadStatus.h
index 62cd071f26..74849e5594 100644
--- a/Source/Core/InputCommon/GCPadStatus.h
+++ b/Source/Core/InputCommon/GCPadStatus.h
@@ -30,16 +30,16 @@ enum PadButton
struct GCPadStatus
{
- u16 button; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
- u8 stickX; // 0 <= stickX <= 255
- u8 stickY; // 0 <= stickY <= 255
- u8 substickX; // 0 <= substickX <= 255
- u8 substickY; // 0 <= substickY <= 255
- u8 triggerLeft; // 0 <= triggerLeft <= 255
- u8 triggerRight; // 0 <= triggerRight <= 255
- u8 analogA; // 0 <= analogA <= 255
- u8 analogB; // 0 <= analogB <= 255
- bool isConnected{true};
+ u16 button = 0; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
+ u8 stickX = 0; // 0 <= stickX <= 255
+ u8 stickY = 0; // 0 <= stickY <= 255
+ u8 substickX = 0; // 0 <= substickX <= 255
+ u8 substickY = 0; // 0 <= substickY <= 255
+ u8 triggerLeft = 0; // 0 <= triggerLeft <= 255
+ u8 triggerRight = 0; // 0 <= triggerRight <= 255
+ u8 analogA = 0; // 0 <= analogA <= 255
+ u8 analogB = 0; // 0 <= analogB <= 255
+ bool isConnected = true;
static const u8 MAIN_STICK_CENTER_X = 0x80;
static const u8 MAIN_STICK_CENTER_Y = 0x80;
diff --git a/Source/Core/UICommon/NetPlayIndex.h b/Source/Core/UICommon/NetPlayIndex.h
index 18bfa5c8e6..13fb674a66 100644
--- a/Source/Core/UICommon/NetPlayIndex.h
+++ b/Source/Core/UICommon/NetPlayIndex.h
@@ -23,11 +23,11 @@ struct NetPlaySession
std::string game_id;
std::string version;
- int player_count;
- int port;
+ int player_count = 0;
+ int port = 0;
- bool has_password;
- bool in_game;
+ bool has_password = false;
+ bool in_game = false;
bool EncryptID(std::string_view password);
std::optional<std::string> DecryptID(std::string_view password) const;
diff --git a/Source/Core/UpdaterCommon/UpdaterCommon.cpp b/Source/Core/UpdaterCommon/UpdaterCommon.cpp
index 74665bf4c1..f3c18c2609 100644
--- a/Source/Core/UpdaterCommon/UpdaterCommon.cpp
+++ b/Source/Core/UpdaterCommon/UpdaterCommon.cpp
@@ -49,7 +49,7 @@ struct TodoList
struct DownloadOp
{
Manifest::Filename filename;
- Manifest::Hash hash;
+ Manifest::Hash hash{};
};
std::vector<DownloadOp> to_download;
@@ -57,14 +57,14 @@ struct TodoList
{
Manifest::Filename filename;
std::optional<Manifest::Hash> old_hash;
- Manifest::Hash new_hash;
+ Manifest::Hash new_hash{};
};
std::vector<UpdateOp> to_update;
struct DeleteOp
{
Manifest::Filename filename;
- Manifest::Hash old_hash;
+ Manifest::Hash old_hash{};
};
std::vector<DeleteOp> to_delete;
diff --git a/Source/Core/VideoBackends/D3D/D3DPerfQuery.h b/Source/Core/VideoBackends/D3D/D3DPerfQuery.h
index a21c6a358b..fc1848f29a 100644
--- a/Source/Core/VideoBackends/D3D/D3DPerfQuery.h
+++ b/Source/Core/VideoBackends/D3D/D3DPerfQuery.h
@@ -26,7 +26,7 @@ private:
struct ActiveQuery
{
ComPtr<ID3D11Query> query;
- PerfQueryGroup query_type;
+ PerfQueryGroup query_type{};
};
void WeakFlush();
diff --git a/Source/Core/VideoBackends/D3D12/D3D12BoundingBox.h b/Source/Core/VideoBackends/D3D12/D3D12BoundingBox.h
index 03aa892b39..d2d95c5c83 100644
--- a/Source/Core/VideoBackends/D3D12/D3D12BoundingBox.h
+++ b/Source/Core/VideoBackends/D3D12/D3D12BoundingBox.h
@@ -34,7 +34,7 @@ private:
ComPtr<ID3D12Resource> m_gpu_buffer;
ComPtr<ID3D12Resource> m_readback_buffer;
StreamBuffer m_upload_buffer;
- DescriptorHandle m_gpu_descriptor;
+ DescriptorHandle m_gpu_descriptor{};
};
} // namespace DX12
diff --git a/Source/Core/VideoBackends/D3D12/DescriptorHeapManager.h b/Source/Core/VideoBackends/D3D12/DescriptorHeapManager.h
index 6ab9a7f939..ce4d23b533 100644
--- a/Source/Core/VideoBackends/D3D12/DescriptorHeapManager.h
+++ b/Source/Core/VideoBackends/D3D12/DescriptorHeapManager.h
@@ -66,7 +66,7 @@ private:
u32 m_descriptor_increment_size = 0;
u32 m_current_offset = 0;
- D3D12_CPU_DESCRIPTOR_HANDLE m_heap_base_cpu;
+ D3D12_CPU_DESCRIPTOR_HANDLE m_heap_base_cpu{};
std::unordered_map<SamplerState::StorageType, D3D12_CPU_DESCRIPTOR_HANDLE> m_sampler_map;
};
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h
index eb1f6d21d2..9e198987b8 100644
--- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h
+++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h
@@ -59,7 +59,7 @@ struct PipelineProgramKeyHash
struct PipelineProgram
{
- PipelineProgramKey key;
+ PipelineProgramKey key{};
SHADER shader;
std::atomic_size_t reference_count{1};
bool binary_retrieved = false;
diff --git a/Source/Core/VideoBackends/Software/SWVertexLoader.h b/Source/Core/VideoBackends/Software/SWVertexLoader.h
index 5df794c822..4bc9f67ca8 100644
--- a/Source/Core/VideoBackends/Software/SWVertexLoader.h
+++ b/Source/Core/VideoBackends/Software/SWVertexLoader.h
@@ -25,6 +25,6 @@ protected:
void SetFormat(u8 attributeIndex, u8 primitiveType);
void ParseVertex(const PortableVertexDeclaration& vdec, int index);
- InputVertexData m_vertex;
+ InputVertexData m_vertex{};
SetupUnit m_setup_unit;
};
diff --git a/Source/Core/VideoBackends/Software/SetupUnit.h b/Source/Core/VideoBackends/Software/SetupUnit.h
index 3bab4257e6..a9f9584e07 100644
--- a/Source/Core/VideoBackends/Software/SetupUnit.h
+++ b/Source/Core/VideoBackends/Software/SetupUnit.h
@@ -8,12 +8,12 @@
class SetupUnit
{
- u8 m_PrimType;
- int m_VertexCounter;
+ u8 m_PrimType = 0;
+ int m_VertexCounter = 0;
OutputVertexData m_Vertices[3];
- OutputVertexData* m_VertPointer[3];
- OutputVertexData* m_VertWritePointer;
+ OutputVertexData* m_VertPointer[3]{};
+ OutputVertexData* m_VertWritePointer{};
void SetupQuad();
void SetupTriangle();
diff --git a/Source/Core/VideoBackends/Software/Vec3.h b/Source/Core/VideoBackends/Software/Vec3.h
index 7392ccdaa8..a7efd9c400 100644
--- a/Source/Core/VideoBackends/Software/Vec3.h
+++ b/Source/Core/VideoBackends/Software/Vec3.h
@@ -11,7 +11,7 @@ class Vec3
public:
float x, y, z;
- Vec3() {}
+ Vec3() = default;
explicit Vec3(float f) { x = y = z = f; }
explicit Vec3(const float* f)
{
diff --git a/Source/Core/VideoBackends/Vulkan/CommandBufferManager.h b/Source/Core/VideoBackends/Vulkan/CommandBufferManager.h
index 2f5477f5d0..632e43534a 100644
--- a/Source/Core/VideoBackends/Vulkan/CommandBufferManager.h
+++ b/Source/Core/VideoBackends/Vulkan/CommandBufferManager.h
@@ -120,7 +120,7 @@ private:
u64 m_completed_fence_counter = 0;
std::array<FrameResources, NUM_COMMAND_BUFFERS> m_frame_resources;
- u32 m_current_frame;
+ u32 m_current_frame = 0;
// Threaded command buffer execution
// Semaphore determines when a command buffer can be queued
diff --git a/Source/Core/VideoBackends/Vulkan/VKSwapChain.h b/Source/Core/VideoBackends/Vulkan/VKSwapChain.h
index 52d3bc81bb..0077a93ec1 100644
--- a/Source/Core/VideoBackends/Vulkan/VKSwapChain.h
+++ b/Source/Core/VideoBackends/Vulkan/VKSwapChain.h
@@ -86,7 +86,7 @@ private:
struct SwapChainImage
{
- VkImage image;
+ VkImage image{};
std::unique_ptr<VKTexture> texture;
std::unique_ptr<VKFramebuffer> framebuffer;
};
diff --git a/Source/Core/VideoCommon/CPMemory.h b/Source/Core/VideoCommon/CPMemory.h
index 038e6787ea..81d0316cec 100644
--- a/Source/Core/VideoCommon/CPMemory.h
+++ b/Source/Core/VideoCommon/CPMemory.h
@@ -607,19 +607,19 @@ class VertexLoaderBase;
// STATE_TO_SAVE
struct CPState final
{
- u32 array_bases[CP_NUM_ARRAYS];
- u32 array_strides[CP_NUM_ARRAYS];
- TMatrixIndexA matrix_index_a;
- TMatrixIndexB matrix_index_b;
+ u32 array_bases[CP_NUM_ARRAYS]{};
+ u32 array_strides[CP_NUM_ARRAYS]{};
+ TMatrixIndexA matrix_index_a{};
+ TMatrixIndexB matrix_index_b{};
TVtxDesc vtx_desc;
// Most games only use the first VtxAttr and simply reconfigure it all the time as needed.
- VAT vtx_attr[CP_NUM_VAT_REG];
+ VAT vtx_attr[CP_NUM_VAT_REG]{};
// Attributes that actually belong to VertexLoaderManager:
- BitSet32 attr_dirty;
- bool bases_dirty;
- VertexLoaderBase* vertex_loaders[CP_NUM_VAT_REG];
- int last_id;
+ BitSet32 attr_dirty{};
+ bool bases_dirty = false;
+ VertexLoaderBase* vertex_loaders[CP_NUM_VAT_REG]{};
+ int last_id = 0;
};
class PointerWrap;
diff --git a/Source/Core/VideoCommon/CommandProcessor.h b/Source/Core/VideoCommon/CommandProcessor.h
index e73fecfe41..66ef981cac 100644
--- a/Source/Core/VideoCommon/CommandProcessor.h
+++ b/Source/Core/VideoCommon/CommandProcessor.h
@@ -20,8 +20,8 @@ struct SCPFifoStruct
// fifo registers
std::atomic<u32> CPBase;
std::atomic<u32> CPEnd;
- u32 CPHiWatermark;
- u32 CPLoWatermark;
+ u32 CPHiWatermark = 0;
+ u32 CPLoWatermark = 0;
std::atomic<u32> CPReadWriteDistance;
std::atomic<u32> CPWritePointer;
std::atomic<u32> CPReadPointer;
diff --git a/Source/Core/VideoCommon/FrameDump.h b/Source/Core/VideoCommon/FrameDump.h
index 6024d9ec8e..23e3bead20 100644
--- a/Source/Core/VideoCommon/FrameDump.h
+++ b/Source/Core/VideoCommon/FrameDump.h
@@ -30,10 +30,10 @@ public:
struct FrameData
{
- const u8* data;
- int width;
- int height;
- int stride;
+ const u8* data = nullptr;
+ int width = 0;
+ int height = 0;
+ int stride = 0;
FrameState state;
};
diff --git a/Source/Core/VideoCommon/GXPipelineTypes.h b/Source/Core/VideoCommon/GXPipelineTypes.h
index 38193405c5..231bddefc1 100644
--- a/Source/Core/VideoCommon/GXPipelineTypes.h
+++ b/Source/Core/VideoCommon/GXPipelineTypes.h
@@ -35,10 +35,19 @@ struct GXPipelineUid
// and this map lookup can happen every draw call. However, as using memcmp() will also compare
// any padding bytes, we have to ensure these are zeroed out.
GXPipelineUid() { std::memset(static_cast<void*>(this), 0, sizeof(*this)); }
+#ifdef _MSC_VER
+#pragma warning(push)
+// Disable warning for uninitialized member variables, as MSVC doesn't recognise that memcpy
+// performs this initialization.
+#pragma warning(disable : 26495)
+#endif
GXPipelineUid(const GXPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
}
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
GXPipelineUid& operator=(const GXPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
@@ -65,10 +74,18 @@ struct GXUberPipelineUid
BlendingState blending_state;
GXUberPipelineUid() { std::memset(static_cast<void*>(this), 0, sizeof(*this)); }
+#ifdef _MSC_VER
+#pragma warning(push)
+// Disable warning for uninitialized member variables
+#pragma warning(disable : 26495)
+#endif
GXUberPipelineUid(const GXUberPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
}
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
GXUberPipelineUid& operator=(const GXUberPipelineUid& rhs)
{
std::memcpy(static_cast<void*>(this), &rhs, sizeof(*this));
@@ -90,23 +107,23 @@ struct GXUberPipelineUid
#pragma pack(push, 1)
struct SerializedGXPipelineUid
{
- PortableVertexDeclaration vertex_decl;
+ PortableVertexDeclaration vertex_decl{};
VertexShaderUid vs_uid;
GeometryShaderUid gs_uid;
PixelShaderUid ps_uid;
- u32 rasterization_state_bits;
- u32 depth_state_bits;
- u32 blending_state_bits;
+ u32 rasterization_state_bits = 0;
+ u32 depth_state_bits = 0;
+ u32 blending_state_bits = 0;
};
struct SerializedGXUberPipelineUid
{
- PortableVertexDeclaration vertex_decl;
+ PortableVertexDeclaration vertex_decl{};
UberShader::VertexShaderUid vs_uid;
GeometryShaderUid gs_uid;
UberShader::PixelShaderUid ps_uid;
- u32 rasterization_state_bits;
- u32 depth_state_bits;
- u32 blending_state_bits;
+ u32 rasterization_state_bits = 0;
+ u32 depth_state_bits = 0;
+ u32 blending_state_bits = 0;
};
#pragma pack(pop)
diff --git a/Source/Core/VideoCommon/HiresTextures.h b/Source/Core/VideoCommon/HiresTextures.h
index 64e20746f2..78e40460db 100644
--- a/Source/Core/VideoCommon/HiresTextures.h
+++ b/Source/Core/VideoCommon/HiresTextures.h
@@ -54,6 +54,6 @@ private:
static bool LoadTexture(Level& level, const std::vector<u8>& buffer);
static void Prefetch();
- HiresTexture() {}
- bool m_has_arbitrary_mipmaps;
+ HiresTexture() = default;
+ bool m_has_arbitrary_mipmaps = false;
};
diff --git a/Source/Core/VideoCommon/PostProcessing.h b/Source/Core/VideoCommon/PostProcessing.h
index 55f92c5914..aafee8f1f6 100644
--- a/Source/Core/VideoCommon/PostProcessing.h
+++ b/Source/Core/VideoCommon/PostProcessing.h
@@ -31,7 +31,7 @@ public:
OPTION_INTEGER,
};
- bool m_bool_value;
+ bool m_bool_value = false;
std::vector<float> m_float_values;
std::vector<s32> m_integer_values;
@@ -45,12 +45,12 @@ public:
std::vector<float> m_float_step_values;
std::vector<s32> m_integer_step_values;
- OptionType m_type;
+ OptionType m_type = OptionType::OPTION_BOOL;
std::string m_gui_name;
std::string m_option_name;
std::string m_dependent_option;
- bool m_dirty;
+ bool m_dirty = false;
};
using ConfigMap = std::map<std::string, ConfigurationOption>;
diff --git a/Source/Core/VideoCommon/ShaderCache.h b/Source/Core/VideoCommon/ShaderCache.h
index b083927de4..c1b8f55b55 100644
--- a/Source/Core/VideoCommon/ShaderCache.h
+++ b/Source/Core/VideoCommon/ShaderCache.h
@@ -211,7 +211,7 @@ private:
struct Shader
{
std::unique_ptr<AbstractShader> shader;
- bool pending;
+ bool pending = false;
};
std::map<Uid, Shader> shader_map;
LinearDiskCache<Uid, u8> disk_cache;
diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h
index 12db848aa3..3fa9b85aa0 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.h
+++ b/Source/Core/VideoCommon/TextureCacheBase.h
@@ -90,14 +90,14 @@ public:
// common members
std::unique_ptr<AbstractTexture> texture;
std::unique_ptr<AbstractFramebuffer> framebuffer;
- u32 addr;
- u32 size_in_bytes;
- u64 base_hash;
- u64 hash; // for paletted textures, hash = base_hash ^ palette_hash
+ u32 addr = 0;
+ u32 size_in_bytes = 0;
+ u64 base_hash = 0;
+ u64 hash = 0; // for paletted textures, hash = base_hash ^ palette_hash
TextureAndTLUTFormat format;
- u32 memory_stride;
- bool is_efb_copy;
- bool is_custom_tex;
+ u32 memory_stride = 0;
+ bool is_efb_copy = false;
+ bool is_custom_tex = false;
bool may_have_overlapping_textures = true;
bool tmem_only = false; // indicates that this texture only exists in the tmem cache
bool has_arbitrary_mips = false; // indicates that the mips in this texture are arbitrary
@@ -105,13 +105,14 @@ public:
bool should_force_safe_hashing = false; // for XFB
bool is_xfb_copy = false;
bool is_xfb_container = false;
- u64 id;
+ u64 id = 0;
bool reference_changed = false; // used by xfb to determine when a reference xfb changed
- unsigned int native_width,
- native_height; // Texture dimensions from the GameCube's point of view
- unsigned int native_levels;
+ // Texture dimensions from the GameCube's point of view
+ u32 native_width = 0;
+ u32 native_height = 0;
+ u32 native_levels = 0;
// used to delete textures which haven't been used for TEXTURE_KILL_THRESHOLD frames
int frameCount = FRAMECOUNT_INVALID;
diff --git a/Source/Core/VideoCommon/VertexLoaderBase.h b/Source/Core/VideoCommon/VertexLoaderBase.h
index 77e3d85aa7..26ec5c6026 100644
--- a/Source/Core/VideoCommon/VertexLoaderBase.h
+++ b/Source/Core/VideoCommon/VertexLoaderBase.h
@@ -16,8 +16,8 @@ class DataReader;
class VertexLoaderUID
{
- std::array<u32, 5> vid;
- size_t hash;
+ std::array<u32, 5> vid{};
+ size_t hash = 0;
public:
VertexLoaderUID() {}
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp
index 70ad7096e9..255e1722b9 100644
--- a/Source/Core/VideoCommon/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/VideoConfig.cpp
@@ -33,29 +33,6 @@ void UpdateActiveConfig()
g_ActiveConfig.bVSyncActive = IsVSyncActive(g_ActiveConfig.bVSync);
}
-VideoConfig::VideoConfig()
-{
- // Needed for the first frame, I think
- fAspectRatioHackW = 1;
- fAspectRatioHackH = 1;
-
- // disable all features by default
- backend_info.api_type = APIType::Nothing;
- backend_info.MaxTextureSize = 16384;
- backend_info.bSupportsExclusiveFullscreen = false;
- backend_info.bSupportsMultithreading = false;
- backend_info.bSupportsST3CTextures = false;
- backend_info.bSupportsBPTCTextures = false;
-
- bEnableValidationLayer = false;
-
-#if defined(ANDROID)
- bBackendMultithreading = false;
-#else
- bBackendMultithreading = true;
-#endif
-}
-
void VideoConfig::Refresh()
{
if (!s_has_registered_callback)
diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h
index cb5e03be2b..495eef6c28 100644
--- a/Source/Core/VideoCommon/VideoConfig.h
+++ b/Source/Core/VideoCommon/VideoConfig.h
@@ -13,8 +13,7 @@
#include <vector>
#include "Common/CommonTypes.h"
-
-enum class APIType;
+#include "VideoCommon/VideoCommon.h"
// Log in two categories, and save three other options in the same byte
#define CONF_LOG 1
@@ -53,135 +52,140 @@ enum class ShaderCompilationMode : int
// NEVER inherit from this class.
struct VideoConfig final
{
- VideoConfig();
+ VideoConfig() = default;
void Refresh();
void VerifyValidity();
// General
- bool bVSync;
- bool bVSyncActive;
- bool bWidescreenHack;
- AspectMode aspect_mode;
- AspectMode suggested_aspect_mode;
- bool bCrop; // Aspect ratio controls.
- bool bShaderCache;
+ bool bVSync = false;
+ bool bVSyncActive = false;
+ bool bWidescreenHack = false;
+ AspectMode aspect_mode{};
+ AspectMode suggested_aspect_mode{};
+ bool bCrop = false; // Aspect ratio controls.
+ bool bShaderCache = false;
// Enhancements
- u32 iMultisamples;
- bool bSSAA;
- int iEFBScale;
- bool bForceFiltering;
- int iMaxAnisotropy;
+ u32 iMultisamples = 0;
+ bool bSSAA = false;
+ int iEFBScale = 0;
+ bool bForceFiltering = false;
+ int iMaxAnisotropy = 0;
std::string sPostProcessingShader;
- bool bForceTrueColor;
- bool bDisableCopyFilter;
- bool bArbitraryMipmapDetection;
- float fArbitraryMipmapDetectionThreshold;
+ bool bForceTrueColor = false;
+ bool bDisableCopyFilter = false;
+ bool bArbitraryMipmapDetection = false;
+ float fArbitraryMipmapDetectionThreshold = 0;
// Information
- bool bShowFPS;
- bool bShowNetPlayPing;
- bool bShowNetPlayMessages;
- bool bOverlayStats;
- bool bOverlayProjStats;
- bool bTexFmtOverlayEnable;
- bool bTexFmtOverlayCenter;
- bool bLogRenderTimeToFile;
+ bool bShowFPS = false;
+ bool bShowNetPlayPing = false;
+ bool bShowNetPlayMessages = false;
+ bool bOverlayStats = false;
+ bool bOverlayProjStats = false;
+ bool bTexFmtOverlayEnable = false;
+ bool bTexFmtOverlayCenter = false;
+ bool bLogRenderTimeToFile = false;
// Render
- bool bWireFrame;
- bool bDisableFog;
+ bool bWireFrame = false;
+ bool bDisableFog = false;
// Utility
- bool bDumpTextures;
- bool bDumpMipmapTextures;
- bool bDumpBaseTextures;
- bool bHiresTextures;
- bool bCacheHiresTextures;
- bool bDumpEFBTarget;
- bool bDumpXFBTarget;
- bool bDumpFramesAsImages;
- bool bUseFFV1;
+ bool bDumpTextures = false;
+ bool bDumpMipmapTextures = false;
+ bool bDumpBaseTextures = false;
+ bool bHiresTextures = false;
+ bool bCacheHiresTextures = false;
+ bool bDumpEFBTarget = false;
+ bool bDumpXFBTarget = false;
+ bool bDumpFramesAsImages = false;
+ bool bUseFFV1 = false;
std::string sDumpCodec;
std::string sDumpEncoder;
std::string sDumpFormat;
std::string sDumpPath;
- bool bInternalResolutionFrameDumps;
- bool bBorderlessFullscreen;
- bool bEnableGPUTextureDecoding;
- int iBitrateKbps;
+ bool bInternalResolutionFrameDumps = false;
+ bool bBorderlessFullscreen = false;
+ bool bEnableGPUTextureDecoding = false;
+ int iBitrateKbps = 0;
// Hacks
- bool bEFBAccessEnable;
- bool bEFBAccessDeferInvalidation;
- bool bPerfQueriesEnable;
- bool bBBoxEnable;
- bool bForceProgressive;
-
- bool bEFBEmulateFormatChanges;
- bool bSkipEFBCopyToRam;
- bool bSkipXFBCopyToRam;
- bool bDisableCopyToVRAM;
- bool bDeferEFBCopies;
- bool bImmediateXFB;
- bool bSkipPresentingDuplicateXFBs;
- bool bCopyEFBScaled;
- int iSafeTextureCache_ColorSamples;
- float fAspectRatioHackW, fAspectRatioHackH;
- bool bEnablePixelLighting;
- bool bFastDepthCalc;
- bool bVertexRounding;
- int iEFBAccessTileSize;
- int iLog; // CONF_ bits
- int iSaveTargetId; // TODO: Should be dropped
- u32 iMissingColorValue;
+ bool bEFBAccessEnable = false;
+ bool bEFBAccessDeferInvalidation = false;
+ bool bPerfQueriesEnable = false;
+ bool bBBoxEnable = false;
+ bool bForceProgressive = false;
+
+ bool bEFBEmulateFormatChanges = false;
+ bool bSkipEFBCopyToRam = false;
+ bool bSkipXFBCopyToRam = false;
+ bool bDisableCopyToVRAM = false;
+ bool bDeferEFBCopies = false;
+ bool bImmediateXFB = false;
+ bool bSkipPresentingDuplicateXFBs = false;
+ bool bCopyEFBScaled = false;
+ int iSafeTextureCache_ColorSamples = 0;
+ float fAspectRatioHackW = 1; // Initial value needed for the first frame
+ float fAspectRatioHackH = 1;
+ bool bEnablePixelLighting = false;
+ bool bFastDepthCalc = false;
+ bool bVertexRounding = false;
+ int iEFBAccessTileSize = 0;
+ int iLog = 0; // CONF_ bits
+ int iSaveTargetId = 0; // TODO: Should be dropped
+ u32 iMissingColorValue = 0;
// Stereoscopy
- StereoMode stereo_mode;
- int iStereoDepth;
- int iStereoConvergence;
- int iStereoConvergencePercentage;
- bool bStereoSwapEyes;
- bool bStereoEFBMonoDepth;
- int iStereoDepthPercentage;
+ StereoMode stereo_mode{};
+ int iStereoDepth = 0;
+ int iStereoConvergence = 0;
+ int iStereoConvergencePercentage = 0;
+ bool bStereoSwapEyes = false;
+ bool bStereoEFBMonoDepth = false;
+ int iStereoDepthPercentage = 0;
// D3D only config, mostly to be merged into the above
- int iAdapter;
+ int iAdapter = 0;
// VideoSW Debugging
- int drawStart;
- int drawEnd;
- bool bZComploc;
- bool bZFreeze;
- bool bDumpObjects;
- bool bDumpTevStages;
- bool bDumpTevTextureFetches;
+ int drawStart = 0;
+ int drawEnd = 0;
+ bool bZComploc = false;
+ bool bZFreeze = false;
+ bool bDumpObjects = false;
+ bool bDumpTevStages = false;
+ bool bDumpTevTextureFetches = false;
// Enable API validation layers, currently only supported with Vulkan.
- bool bEnableValidationLayer;
+ bool bEnableValidationLayer = false;
// Multithreaded submission, currently only supported with Vulkan.
- bool bBackendMultithreading;
+#if defined(ANDROID)
+ bool bBackendMultithreading = false;
+#else
+ bool bBackendMultithreading = true;
+#endif
// Early command buffer execution interval in number of draws.
// Currently only supported with Vulkan.
- int iCommandBufferExecuteInterval;
+ int iCommandBufferExecuteInterval = 0;
// Shader compilation settings.
- bool bWaitForShadersBeforeStarting;
- ShaderCompilationMode iShaderCompilationMode;
+ bool bWaitForShadersBeforeStarting = false;
+ ShaderCompilationMode iShaderCompilationMode{};
// Number of shader compiler threads.
// 0 disables background compilation.
// -1 uses an automatic number based on the CPU threads.
- int iShaderCompilerThreads;
- int iShaderPrecompilerThreads;
+ int iShaderCompilerThreads = 0;
+ int iShaderPrecompilerThreads = 0;
// Static config per API
// TODO: Move this out of VideoConfig
struct
{
- APIType api_type;
+ APIType api_type = APIType::Nothing;
std::vector<std::string> Adapters; // for D3D
std::vector<u32> AAModes;
@@ -189,42 +193,43 @@ struct VideoConfig final
// TODO: merge AdapterName and Adapters array
std::string AdapterName; // for OpenGL
- u32 MaxTextureSize;
- bool bUsesLowerLeftOrigin;
-
- bool bSupportsExclusiveFullscreen;
- bool bSupportsDualSourceBlend;
- bool bSupportsPrimitiveRestart;
- bool bSupportsOversizedViewports;
- bool bSupportsGeometryShaders;
- bool bSupportsComputeShaders;
- bool bSupports3DVision;
- bool bSupportsEarlyZ; // needed by PixelShaderGen, so must stay in VideoCommon
- bool bSupportsBindingLayout; // Needed by ShaderGen, so must stay in VideoCommon
- bool bSupportsBBox;
- bool bSupportsGSInstancing; // Needed by GeometryShaderGen, so must stay in VideoCommon
- bool bSupportsPostProcessing;
- bool bSupportsPaletteConversion;
- bool bSupportsClipControl; // Needed by VertexShaderGen, so must stay in VideoCommon
- bool bSupportsSSAA;
- bool bSupportsFragmentStoresAndAtomics; // a.k.a. OpenGL SSBOs a.k.a. Direct3D UAVs
- bool bSupportsDepthClamp; // Needed by VertexShaderGen, so must stay in VideoCommon
- bool bSupportsReversedDepthRange;
- bool bSupportsLogicOp;
- bool bSupportsMultithreading;
- bool bSupportsGPUTextureDecoding;
- bool bSupportsST3CTextures;
- bool bSupportsCopyToVram;
- bool bSupportsBitfield; // Needed by UberShaders, so must stay in VideoCommon
- bool bSupportsDynamicSamplerIndexing; // Needed by UberShaders, so must stay in VideoCommon
- bool bSupportsBPTCTextures;
- bool bSupportsFramebufferFetch; // Used as an alternative to dual-source blend on GLES
- bool bSupportsBackgroundCompiling;
- bool bSupportsLargePoints;
- bool bSupportsPartialDepthCopies;
- bool bSupportsDepthReadback;
- bool bSupportsShaderBinaries;
- bool bSupportsPipelineCacheData;
+ u32 MaxTextureSize = 16384;
+ bool bUsesLowerLeftOrigin = false;
+
+ bool bSupportsExclusiveFullscreen = false;
+ bool bSupportsDualSourceBlend = false;
+ bool bSupportsPrimitiveRestart = false;
+ bool bSupportsOversizedViewports = false;
+ bool bSupportsGeometryShaders = false;
+ bool bSupportsComputeShaders = false;
+ bool bSupports3DVision = false;
+ bool bSupportsEarlyZ = false; // needed by PixelShaderGen, so must stay in VideoCommon
+ bool bSupportsBindingLayout = false; // Needed by ShaderGen, so must stay in VideoCommon
+ bool bSupportsBBox = false;
+ bool bSupportsGSInstancing = false; // Needed by GeometryShaderGen, so must stay in VideoCommon
+ bool bSupportsPostProcessing = false;
+ bool bSupportsPaletteConversion = false;
+ bool bSupportsClipControl = false; // Needed by VertexShaderGen, so must stay in VideoCommon
+ bool bSupportsSSAA = false;
+ bool bSupportsFragmentStoresAndAtomics = false; // a.k.a. OpenGL SSBOs a.k.a. Direct3D UAVs
+ bool bSupportsDepthClamp = false; // Needed by VertexShaderGen, so must stay in VideoCommon
+ bool bSupportsReversedDepthRange = false;
+ bool bSupportsLogicOp = false;
+ bool bSupportsMultithreading = false;
+ bool bSupportsGPUTextureDecoding = false;
+ bool bSupportsST3CTextures = false;
+ bool bSupportsCopyToVram = false;
+ bool bSupportsBitfield = false; // Needed by UberShaders, so must stay in VideoCommon
+ // Needed by UberShaders, so must stay in VideoCommon
+ bool bSupportsDynamicSamplerIndexing = false;
+ bool bSupportsBPTCTextures = false;
+ bool bSupportsFramebufferFetch = false; // Used as an alternative to dual-source blend on GLES
+ bool bSupportsBackgroundCompiling = false;
+ bool bSupportsLargePoints = false;
+ bool bSupportsPartialDepthCopies = false;
+ bool bSupportsDepthReadback = false;
+ bool bSupportsShaderBinaries = false;
+ bool bSupportsPipelineCacheData = false;
} backend_info;
// Utility