Merge pull request #10085 from Pokechu22/C26495

Fix all uninitialized variable warnings (C26495)
This commit is contained in:
Léo Lam 2021-10-13 21:52:22 +02:00 committed by GitHub
commit 023eb0b702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
114 changed files with 783 additions and 784 deletions

View File

@ -99,7 +99,7 @@ private:
bool m_is_stretching = false; bool m_is_stretching = false;
AudioCommon::AudioStretcher m_stretcher; AudioCommon::AudioStretcher m_stretcher;
AudioCommon::SurroundDecoder m_surround_decoder; 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_dtk;
WaveFileWriter m_wave_writer_dsp; WaveFileWriter m_wave_writer_dsp;

View File

@ -53,7 +53,7 @@ class OpenALStream final : public SoundStream
{ {
#ifdef _WIN32 #ifdef _WIN32
public: public:
OpenALStream() : m_source(0) {} OpenALStream() = default;
~OpenALStream() override; ~OpenALStream() override;
bool Init() override; bool Init() override;
void SetVolume(int volume) override; void SetVolume(int volume) override;
@ -68,9 +68,9 @@ private:
Common::Flag m_run_thread; Common::Flag m_run_thread;
std::vector<short> m_realtime_buffer; std::vector<short> m_realtime_buffer;
std::array<ALuint, OAL_BUFFERS> m_buffers; std::array<ALuint, OAL_BUFFERS> m_buffers{};
ALuint m_source; ALuint m_source = 0;
ALfloat m_volume; ALfloat m_volume = 1;
#endif // _WIN32 #endif // _WIN32
}; };

View File

@ -23,7 +23,7 @@ using UnderlyingType = typename std::enable_if_t<std::is_enum<T>{}, std::underly
struct Location struct Location
{ {
System system; System system{};
std::string section; std::string section;
std::string key; std::string key;

View File

@ -85,11 +85,11 @@ enum
namespace File namespace File
{ {
// FileSystem tree node/ // FileSystem tree node
struct FSTEntry struct FSTEntry
{ {
bool isDirectory; bool isDirectory = false;
u64 size; // File length, or for directories, recursive count of children u64 size = 0; // File length, or for directories, recursive count of children
std::string physicalName; // Name on disk std::string physicalName; // Name on disk
std::string virtualName; // Name in FST names table std::string virtualName; // Name in FST names table
std::vector<FSTEntry> children; std::vector<FSTEntry> children;

View File

@ -78,7 +78,7 @@ public:
bool empty() const noexcept { return size() == 0; } bool empty() const noexcept { return size() == 0; }
private: private:
std::array<T, N> storage; std::array<T, N> storage{};
int head = 0; int head = 0;
int tail = 0; int tail = 0;
// Sacrifice 4 bytes for a simpler implementation. may optimize away in the future. // Sacrifice 4 bytes for a simpler implementation. may optimize away in the future.

View File

@ -3,6 +3,7 @@
#pragma once #pragma once
#include <array>
#include <cstddef> #include <cstddef>
#include <cstdio> #include <cstdio>
#include <string> #include <string>
@ -57,6 +58,18 @@ public:
return m_good; 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) bool ReadBytes(void* data, size_t length)
{ {
return ReadArray(reinterpret_cast<char*>(data), length); return ReadArray(reinterpret_cast<char*>(data), length);

View File

@ -153,7 +153,7 @@ private:
std::min(Common::scm_rev_git_str.size(), sizeof(ver))); std::min(Common::scm_rev_git_str.size(), sizeof(ver)));
} }
u32 id; u32 id = 0;
const u16 key_t_size = sizeof(K); const u16 key_t_size = sizeof(K);
const u16 value_t_size = sizeof(V); const u16 value_t_size = sizeof(V);
char ver[40] = {}; char ver[40] = {};
@ -161,5 +161,5 @@ private:
} m_header; } m_header;
File::IOFile m_file; File::IOFile m_file;
u32 m_num_entries; u32 m_num_entries = 0;
}; };

View File

@ -14,5 +14,5 @@ public:
void Log(Common::Log::LOG_LEVELS level, const char* text) override; void Log(Common::Log::LOG_LEVELS level, const char* text) override;
private: private:
bool m_use_color; bool m_use_color = false;
}; };

View File

@ -98,7 +98,7 @@ private:
delete next_ptr; delete next_ptr;
} }
T current; T current{};
std::atomic<ElementPtr*> next; std::atomic<ElementPtr*> next;
}; };

View File

@ -16,10 +16,10 @@ namespace ActionReplay
{ {
struct AREntry struct AREntry
{ {
AREntry() {} AREntry() = default;
AREntry(u32 _addr, u32 _value) : cmd_addr(_addr), value(_value) {} AREntry(u32 _addr, u32 _value) : cmd_addr(_addr), value(_value) {}
u32 cmd_addr; u32 cmd_addr = 0;
u32 value; u32 value = 0;
}; };
constexpr bool operator==(const AREntry& left, const AREntry& right) constexpr bool operator==(const AREntry& left, const AREntry& right)
{ {

View File

@ -64,44 +64,44 @@ public:
// These store if the relevant setting should be reset back later (true) or if it should be left // These store if the relevant setting should be reset back later (true) or if it should be left
// alone on restore (false) // alone on restore (false)
bool bSetEmulationSpeed; bool bSetEmulationSpeed = false;
bool bSetVolume; bool bSetVolume = false;
std::array<bool, MAX_BBMOTES> bSetWiimoteSource; std::array<bool, MAX_BBMOTES> bSetWiimoteSource{};
std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads; std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads{};
std::array<bool, ExpansionInterface::MAX_EXI_CHANNELS> bSetEXIDevice; std::array<bool, ExpansionInterface::MAX_EXI_CHANNELS> bSetEXIDevice{};
private: private:
bool valid; bool valid = false;
bool bCPUThread; bool bCPUThread = false;
bool bJITFollowBranch; bool bJITFollowBranch = false;
bool bSyncGPUOnSkipIdleHack; bool bSyncGPUOnSkipIdleHack = false;
bool bFloatExceptions; bool bFloatExceptions = false;
bool bDivideByZeroExceptions; bool bDivideByZeroExceptions = false;
bool bFPRF; bool bFPRF = false;
bool bAccurateNaNs; bool bAccurateNaNs = false;
bool bMMU; bool bMMU = false;
bool bLowDCBZHack; bool bLowDCBZHack = false;
bool bDisableICache; bool bDisableICache = false;
bool m_EnableJIT; bool m_EnableJIT = false;
bool bSyncGPU; bool bSyncGPU = false;
int iSyncGpuMaxDistance; int iSyncGpuMaxDistance = 0;
int iSyncGpuMinDistance; int iSyncGpuMinDistance = 0;
float fSyncGpuOverclock; float fSyncGpuOverclock = 0;
bool bFastDiscSpeed; bool bFastDiscSpeed = false;
bool bDSPHLE; bool bDSPHLE = false;
bool bHLE_BS2; bool bHLE_BS2 = false;
int iSelectedLanguage; int iSelectedLanguage = 0;
PowerPC::CPUCore cpu_core; PowerPC::CPUCore cpu_core = PowerPC::CPUCore::Interpreter;
int Volume; int Volume = 0;
float m_EmulationSpeed; float m_EmulationSpeed = 0;
float m_OCFactor; float m_OCFactor = 0;
bool m_OCEnable; bool m_OCEnable = false;
bool m_bt_passthrough_enabled; bool m_bt_passthrough_enabled = false;
std::string sBackend; std::string sBackend;
std::string m_strGPUDeterminismMode; std::string m_strGPUDeterminismMode;
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource; std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads; std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads{};
std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice; std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice{};
}; };
void ConfigCache::SaveConfig(const SConfig& config) void ConfigCache::SaveConfig(const SConfig& config)

View File

@ -101,87 +101,87 @@ std::vector<u8> Cheats::GetValueAsByteVector(const Cheats::SearchValue& value)
namespace namespace
{ {
template <typename T> template <typename T>
static PowerPC::TryReadResult<T> static std::optional<PowerPC::ReadResult<T>>
TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space); TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space);
template <> template <>
PowerPC::TryReadResult<u8> TryReadValueFromEmulatedMemory(u32 addr, std::optional<PowerPC::ReadResult<u8>>
PowerPC::RequestedAddressSpace space) TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{ {
return PowerPC::HostTryReadU8(addr, space); return PowerPC::HostTryReadU8(addr, space);
} }
template <> template <>
PowerPC::TryReadResult<u16> TryReadValueFromEmulatedMemory(u32 addr, std::optional<PowerPC::ReadResult<u16>>
PowerPC::RequestedAddressSpace space) TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{ {
return PowerPC::HostTryReadU16(addr, space); return PowerPC::HostTryReadU16(addr, space);
} }
template <> template <>
PowerPC::TryReadResult<u32> TryReadValueFromEmulatedMemory(u32 addr, std::optional<PowerPC::ReadResult<u32>>
PowerPC::RequestedAddressSpace space) TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{ {
return PowerPC::HostTryReadU32(addr, space); return PowerPC::HostTryReadU32(addr, space);
} }
template <> template <>
PowerPC::TryReadResult<u64> TryReadValueFromEmulatedMemory(u32 addr, std::optional<PowerPC::ReadResult<u64>>
PowerPC::RequestedAddressSpace space) TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{ {
return PowerPC::HostTryReadU64(addr, space); return PowerPC::HostTryReadU64(addr, space);
} }
template <> template <>
PowerPC::TryReadResult<s8> TryReadValueFromEmulatedMemory(u32 addr, std::optional<PowerPC::ReadResult<s8>>
PowerPC::RequestedAddressSpace space) TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{ {
auto tmp = PowerPC::HostTryReadU8(addr, space); auto tmp = PowerPC::HostTryReadU8(addr, space);
if (!tmp) if (!tmp)
return PowerPC::TryReadResult<s8>(); return std::nullopt;
return PowerPC::TryReadResult<s8>(tmp.translated, Common::BitCast<s8>(tmp.value)); return PowerPC::ReadResult<s8>(tmp->translated, Common::BitCast<s8>(tmp->value));
} }
template <> template <>
PowerPC::TryReadResult<s16> TryReadValueFromEmulatedMemory(u32 addr, std::optional<PowerPC::ReadResult<s16>>
PowerPC::RequestedAddressSpace space) TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{ {
auto tmp = PowerPC::HostTryReadU16(addr, space); auto tmp = PowerPC::HostTryReadU16(addr, space);
if (!tmp) if (!tmp)
return PowerPC::TryReadResult<s16>(); return std::nullopt;
return PowerPC::TryReadResult<s16>(tmp.translated, Common::BitCast<s16>(tmp.value)); return PowerPC::ReadResult<s16>(tmp->translated, Common::BitCast<s16>(tmp->value));
} }
template <> template <>
PowerPC::TryReadResult<s32> TryReadValueFromEmulatedMemory(u32 addr, std::optional<PowerPC::ReadResult<s32>>
PowerPC::RequestedAddressSpace space) TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{ {
auto tmp = PowerPC::HostTryReadU32(addr, space); auto tmp = PowerPC::HostTryReadU32(addr, space);
if (!tmp) if (!tmp)
return PowerPC::TryReadResult<s32>(); return std::nullopt;
return PowerPC::TryReadResult<s32>(tmp.translated, Common::BitCast<s32>(tmp.value)); return PowerPC::ReadResult<s32>(tmp->translated, Common::BitCast<s32>(tmp->value));
} }
template <> template <>
PowerPC::TryReadResult<s64> TryReadValueFromEmulatedMemory(u32 addr, std::optional<PowerPC::ReadResult<s64>>
PowerPC::RequestedAddressSpace space) TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{ {
auto tmp = PowerPC::HostTryReadU64(addr, space); auto tmp = PowerPC::HostTryReadU64(addr, space);
if (!tmp) if (!tmp)
return PowerPC::TryReadResult<s64>(); return std::nullopt;
return PowerPC::TryReadResult<s64>(tmp.translated, Common::BitCast<s64>(tmp.value)); return PowerPC::ReadResult<s64>(tmp->translated, Common::BitCast<s64>(tmp->value));
} }
template <> template <>
PowerPC::TryReadResult<float> TryReadValueFromEmulatedMemory(u32 addr, std::optional<PowerPC::ReadResult<float>>
PowerPC::RequestedAddressSpace space) TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{ {
return PowerPC::HostTryReadF32(addr, space); return PowerPC::HostTryReadF32(addr, space);
} }
template <> template <>
PowerPC::TryReadResult<double> TryReadValueFromEmulatedMemory(u32 addr, std::optional<PowerPC::ReadResult<double>>
PowerPC::RequestedAddressSpace space) TryReadValueFromEmulatedMemory(u32 addr, PowerPC::RequestedAddressSpace space)
{ {
return PowerPC::HostTryReadF64(addr, space); return PowerPC::HostTryReadF64(addr, space);
} }
@ -230,11 +230,11 @@ Cheats::NewSearch(const std::vector<Cheats::MemoryRange>& memory_ranges,
if (!current_value) if (!current_value)
continue; continue;
if (validator(current_value.value)) if (validator(current_value->value))
{ {
auto& r = results.emplace_back(); auto& r = results.emplace_back();
r.m_value = current_value.value; r.m_value = current_value->value;
r.m_value_state = current_value.translated ? r.m_value_state = current_value->translated ?
Cheats::SearchResultValueState::ValueFromVirtualMemory : Cheats::SearchResultValueState::ValueFromVirtualMemory :
Cheats::SearchResultValueState::ValueFromPhysicalMemory; Cheats::SearchResultValueState::ValueFromPhysicalMemory;
r.m_address = addr; 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 // if the previous state was invalid we always update the value to avoid getting stuck in an
// invalid state // invalid state
if (!previous_result.IsValueValid() || 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(); auto& r = results.emplace_back();
r.m_value = current_value.value; r.m_value = current_value->value;
r.m_value_state = current_value.translated ? r.m_value_state = current_value->translated ?
Cheats::SearchResultValueState::ValueFromVirtualMemory : Cheats::SearchResultValueState::ValueFromVirtualMemory :
Cheats::SearchResultValueState::ValueFromPhysicalMemory; Cheats::SearchResultValueState::ValueFromPhysicalMemory;
r.m_address = addr; r.m_address = addr;

View File

@ -279,10 +279,10 @@ struct DSP_Regs
struct DSPInitOptions struct DSPInitOptions
{ {
// DSP IROM blob, which is where the DSP boots from. Embedded into the DSP. // 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. // 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. // Core used to emulate the DSP.
// Default: JIT64. // Default: JIT64.

View File

@ -100,8 +100,7 @@ static Gen::OpArg GetRegisterPointer(size_t reg)
#define STATIC_REG_ACCS #define STATIC_REG_ACCS
//#undef STATIC_REG_ACCS //#undef STATIC_REG_ACCS
DSPJitRegCache::DSPJitRegCache(DSPEmitter& emitter) DSPJitRegCache::DSPJitRegCache(DSPEmitter& emitter) : m_emitter(emitter), m_is_temporary(false)
: m_emitter(emitter), m_is_temporary(false), m_is_merged(false)
{ {
for (X64CachedReg& xreg : m_xregs) 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_AXL0].shift = 0;
m_regs[i + DSP_REG_AXH0].shift = 16; m_regs[i + DSP_REG_AXH0].shift = 16;
} }
m_use_ctr = 0;
} }
DSPJitRegCache::DSPJitRegCache(const DSPJitRegCache& cache) DSPJitRegCache::DSPJitRegCache(const DSPJitRegCache& cache)
: m_regs(cache.m_regs), m_xregs(cache.m_xregs), m_emitter(cache.m_emitter), : m_regs(cache.m_regs), m_xregs(cache.m_xregs), m_emitter(cache.m_emitter), m_is_temporary(true)
m_is_temporary(true), m_is_merged(false)
{ {
} }

View File

@ -170,14 +170,14 @@ private:
void MovToMemory(size_t reg); void MovToMemory(size_t reg);
void FlushMemBackedRegs(); void FlushMemBackedRegs();
std::array<DynamicReg, 37> m_regs; std::array<DynamicReg, 37> m_regs{};
std::array<X64CachedReg, 16> m_xregs; std::array<X64CachedReg, 16> m_xregs{};
DSPEmitter& m_emitter; DSPEmitter& m_emitter;
bool m_is_temporary; 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 } // namespace DSP::JIT::x64

View File

@ -15,7 +15,7 @@ namespace Dolphin_Debugger
struct CallstackEntry struct CallstackEntry
{ {
std::string Name; std::string Name;
u32 vAddress; u32 vAddress = 0;
}; };
bool GetCallstack(std::vector<CallstackEntry>& output); bool GetCallstack(std::vector<CallstackEntry>& output);

View File

@ -9,7 +9,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/IOFile.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"); File::IOFile pStream(filename, "rb");
if (pStream) if (pStream)

View File

@ -27,9 +27,9 @@ private:
STRUCTUR_SIZE = 0x2BC STRUCTUR_SIZE = 0x2BC
}; };
u8* m_pData; u8* m_pData = nullptr;
size_t m_size; size_t m_size = 0;
u32 Read32(u32 _pos); u32 Read32(u32 _pos);
}; };

View File

@ -131,7 +131,7 @@ public:
u32 GetImportsNameTable() const; u32 GetImportsNameTable() const;
private: private:
RSOHeader m_header; RSOHeader m_header{};
std::string m_name; std::string m_name;
u32 m_address = 0; u32 m_address = 0;
}; };

View File

@ -22,8 +22,8 @@ struct CPMemory
{ {
TVtxDesc vtxDesc; TVtxDesc vtxDesc;
std::array<VAT, CP_NUM_VAT_REG> vtxAttr; std::array<VAT, CP_NUM_VAT_REG> vtxAttr;
std::array<u32, CP_NUM_ARRAYS> arrayBases; std::array<u32, CP_NUM_ARRAYS> arrayBases{};
std::array<u32, CP_NUM_ARRAYS> arrayStrides; std::array<u32, CP_NUM_ARRAYS> arrayStrides{};
}; };
void LoadCPReg(u32 subCmd, u32 value, CPMemory& cpMem); void LoadCPReg(u32 subCmd, u32 value, CPMemory& cpMem);

View File

@ -120,19 +120,19 @@ bool FifoDataFile::Save(const std::string& filename)
PadFile(m_Frames.size() * sizeof(FileFrameInfo), file); PadFile(m_Frames.size() * sizeof(FileFrameInfo), file);
u64 bpMemOffset = file.Tell(); u64 bpMemOffset = file.Tell();
file.WriteArray(m_BPMem, BP_MEM_SIZE); file.WriteArray(m_BPMem);
u64 cpMemOffset = file.Tell(); u64 cpMemOffset = file.Tell();
file.WriteArray(m_CPMem, CP_MEM_SIZE); file.WriteArray(m_CPMem);
u64 xfMemOffset = file.Tell(); u64 xfMemOffset = file.Tell();
file.WriteArray(m_XFMem, XF_MEM_SIZE); file.WriteArray(m_XFMem);
u64 xfRegsOffset = file.Tell(); u64 xfRegsOffset = file.Tell();
file.WriteArray(m_XFRegs, XF_REGS_SIZE); file.WriteArray(m_XFRegs);
u64 texMemOffset = file.Tell(); u64 texMemOffset = file.Tell();
file.WriteArray(m_TexMem, TEX_MEM_SIZE); file.WriteArray(m_TexMem);
// Write header // Write header
FileHeader 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); u32 size = std::min<u32>(BP_MEM_SIZE, header.bpMemSize);
file.Seek(header.bpMemOffset, SEEK_SET); 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); size = std::min<u32>(CP_MEM_SIZE, header.cpMemSize);
file.Seek(header.cpMemOffset, SEEK_SET); 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); size = std::min<u32>(XF_MEM_SIZE, header.xfMemSize);
file.Seek(header.xfMemOffset, SEEK_SET); 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); size = std::min<u32>(XF_REGS_SIZE, header.xfRegsSize);
file.Seek(header.xfRegsOffset, SEEK_SET); 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. // 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) if (dataFile->m_Version >= 4)
{ {
size = std::min<u32>(TEX_MEM_SIZE, header.texMemSize); size = std::min<u32>(TEX_MEM_SIZE, header.texMemSize);
file.Seek(header.texMemOffset, SEEK_SET); file.Seek(header.texMemOffset, SEEK_SET);
file.ReadArray(dataFile->m_TexMem, size); file.ReadArray(&dataFile->m_TexMem);
} }
if (!file.IsGood()) if (!file.IsGood())

View File

@ -3,6 +3,7 @@
#pragma once #pragma once
#include <array>
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
@ -25,18 +26,18 @@ struct MemoryUpdate
TMEM = 0x08, TMEM = 0x08,
}; };
u32 fifoPosition; u32 fifoPosition = 0;
u32 address; u32 address = 0;
std::vector<u8> data; std::vector<u8> data;
Type type; Type type{};
}; };
struct FifoFrameInfo struct FifoFrameInfo
{ {
std::vector<u8> fifoData; std::vector<u8> fifoData;
u32 fifoStart; u32 fifoStart = 0;
u32 fifoEnd; u32 fifoEnd = 0;
// Must be sorted by fifoPosition // Must be sorted by fifoPosition
std::vector<MemoryUpdate> memoryUpdates; std::vector<MemoryUpdate> memoryUpdates;
@ -63,11 +64,11 @@ public:
bool HasBrokenEFBCopies() const; bool HasBrokenEFBCopies() const;
bool ShouldGenerateFakeVIUpdates() const; bool ShouldGenerateFakeVIUpdates() const;
u32* GetBPMem() { return m_BPMem; } u32* GetBPMem() { return m_BPMem.data(); }
u32* GetCPMem() { return m_CPMem; } u32* GetCPMem() { return m_CPMem.data(); }
u32* GetXFMem() { return m_XFMem; } u32* GetXFMem() { return m_XFMem.data(); }
u32* GetXFRegs() { return m_XFRegs; } u32* GetXFRegs() { return m_XFRegs.data(); }
u8* GetTexMem() { return m_TexMem; } u8* GetTexMem() { return m_TexMem.data(); }
u32 GetRamSizeReal() { return m_ram_size_real; } u32 GetRamSizeReal() { return m_ram_size_real; }
u32 GetExRamSizeReal() { return m_exram_size_real; } u32 GetExRamSizeReal() { return m_exram_size_real; }
@ -93,13 +94,13 @@ private:
static void ReadMemoryUpdates(u64 fileOffset, u32 numUpdates, static void ReadMemoryUpdates(u64 fileOffset, u32 numUpdates,
std::vector<MemoryUpdate>& memUpdates, File::IOFile& file); std::vector<MemoryUpdate>& memUpdates, File::IOFile& file);
u32 m_BPMem[BP_MEM_SIZE]; std::array<u32, BP_MEM_SIZE> m_BPMem{};
u32 m_CPMem[CP_MEM_SIZE]; std::array<u32, CP_MEM_SIZE> m_CPMem{};
u32 m_XFMem[XF_MEM_SIZE]; std::array<u32, XF_MEM_SIZE> m_XFMem{};
u32 m_XFRegs[XF_REGS_SIZE]; std::array<u32, XF_REGS_SIZE> m_XFRegs{};
u8 m_TexMem[TEX_MEM_SIZE]; std::array<u8, TEX_MEM_SIZE> m_TexMem{};
u32 m_ram_size_real; u32 m_ram_size_real = 0;
u32 m_exram_size_real; u32 m_exram_size_real = 0;
u32 m_Flags = 0; u32 m_Flags = 0;
u32 m_Version = 0; u32 m_Version = 0;

View File

@ -354,8 +354,8 @@ struct SmallBlockAccessors : Accessors
} }
private: private:
u8** alloc_base; u8** alloc_base = nullptr;
u32 size; u32 size = 0;
}; };
struct NullAccessors : Accessors struct NullAccessors : Accessors

View File

@ -82,24 +82,24 @@ protected:
}; };
// 32 * 5 because 32 samples per millisecond, for max 5 milliseconds. // 32 * 5 because 32 samples per millisecond, for max 5 milliseconds.
int m_samples_left[32 * 5]; int m_samples_left[32 * 5]{};
int m_samples_right[32 * 5]; int m_samples_right[32 * 5]{};
int m_samples_surround[32 * 5]; int m_samples_surround[32 * 5]{};
int m_samples_auxA_left[32 * 5]; int m_samples_auxA_left[32 * 5]{};
int m_samples_auxA_right[32 * 5]; int m_samples_auxA_right[32 * 5]{};
int m_samples_auxA_surround[32 * 5]; int m_samples_auxA_surround[32 * 5]{};
int m_samples_auxB_left[32 * 5]; int m_samples_auxB_left[32 * 5]{};
int m_samples_auxB_right[32 * 5]; int m_samples_auxB_right[32 * 5]{};
int m_samples_auxB_surround[32 * 5]; int m_samples_auxB_surround[32 * 5]{};
u16 m_cmdlist[512]; u16 m_cmdlist[512]{};
u32 m_cmdlist_size = 0; u32 m_cmdlist_size = 0;
// Table of coefficients for polyphase sample rate conversion. // Table of coefficients for polyphase sample rate conversion.
// The coefficients aren't always available (they are part of the DSP DROM) // 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. // so we also need to know if they are valid or not.
std::optional<u32> m_coeffs_checksum = std::nullopt; 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; u16 m_compressor_pos = 0;

View File

@ -21,27 +21,27 @@ public:
protected: protected:
// Additional AUX buffers // Additional AUX buffers
int m_samples_auxC_left[32 * 3]; int m_samples_auxC_left[32 * 3]{};
int m_samples_auxC_right[32 * 3]; int m_samples_auxC_right[32 * 3]{};
int m_samples_auxC_surround[32 * 3]; int m_samples_auxC_surround[32 * 3]{};
// Wiimote buffers // Wiimote buffers
int m_samples_wm0[6 * 3]; int m_samples_wm0[6 * 3]{};
int m_samples_aux0[6 * 3]; int m_samples_aux0[6 * 3]{};
int m_samples_wm1[6 * 3]; int m_samples_wm1[6 * 3]{};
int m_samples_aux1[6 * 3]; int m_samples_aux1[6 * 3]{};
int m_samples_wm2[6 * 3]; int m_samples_wm2[6 * 3]{};
int m_samples_aux2[6 * 3]; int m_samples_aux2[6 * 3]{};
int m_samples_wm3[6 * 3]; int m_samples_wm3[6 * 3]{};
int m_samples_aux3[6 * 3]; int m_samples_aux3[6 * 3]{};
// Are we implementing an old version of AXWii which still has updates? // 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 // Last volume values for MAIN and AUX. Used to generate volume ramps to
// interpolate nicely between old and new volume values. // interpolate nicely between old and new volume values.
u16 m_last_main_volume; u16 m_last_main_volume = 0;
u16 m_last_aux_volumes[3]; u16 m_last_aux_volumes[3]{};
// If needed, extract the updates related fields from a PB. We need to // 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. // reinject them afterwards so that the correct PB typs is written to RAM.

View File

@ -37,26 +37,26 @@ namespace DVDThread
{ {
struct ReadRequest struct ReadRequest
{ {
bool copy_to_ram; bool copy_to_ram = false;
u32 output_address; u32 output_address = 0;
u64 dvd_offset; u64 dvd_offset = 0;
u32 length; u32 length = 0;
DiscIO::Partition partition; DiscIO::Partition partition{};
// This determines which code DVDInterface will run to reply // This determines which code DVDInterface will run to reply
// to the emulated software. We can't use callbacks, // to the emulated software. We can't use callbacks,
// because function pointers can't be stored in savestates. // 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 // IDs are used to uniquely identify a request. They must not be
// identical to IDs of any other requests that currently exist, but // 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. // it's fine to re-use IDs of requests that have existed in the past.
u64 id; u64 id = 0;
// Only used for logging // Only used for logging
u64 time_started_ticks; u64 time_started_ticks = 0;
u64 realtime_started_us; u64 realtime_started_us = 0;
u64 realtime_done_us; u64 realtime_done_us = 0;
}; };
using ReadResult = std::pair<ReadRequest, std::vector<u8>>; using ReadResult = std::pair<ReadRequest, std::vector<u8>>;

View File

@ -65,7 +65,7 @@ public:
// For savestates. storing it here seemed cleaner than requiring each implementation to report its // 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 // type. I know this class is set up like an interface, but no code requires it to be strictly
// such. // such.
TEXIDevices m_device_type; TEXIDevices m_device_type = TEXIDevices::EXIDEVICE_NONE;
private: private:
// Byte transfer function for this device // Byte transfer function for this device

View File

@ -404,8 +404,8 @@ private:
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
sf::UdpSocket m_sf_socket; sf::UdpSocket m_sf_socket;
sf::IpAddress m_sf_recipient_ip; sf::IpAddress m_sf_recipient_ip;
char m_in_frame[9004]; char m_in_frame[9004]{};
char m_out_frame[9004]; char m_out_frame[9004]{};
std::thread m_read_thread; std::thread m_read_thread;
Common::Flag m_read_enabled; Common::Flag m_read_enabled;
Common::Flag m_read_thread_shutdown; Common::Flag m_read_thread_shutdown;

View File

@ -25,7 +25,7 @@ public:
DEntry m_gci_header; DEntry m_gci_header;
std::vector<GCMBlock> m_save_data; std::vector<GCMBlock> m_save_data;
std::vector<u16> m_used_blocks; std::vector<u16> m_used_blocks;
bool m_dirty; bool m_dirty = false;
std::string m_filename; std::string m_filename;
}; };
} // namespace Memcard } // namespace Memcard

View File

@ -82,7 +82,7 @@ private:
struct GCMemcardAnimationFrameRGBA8 struct GCMemcardAnimationFrameRGBA8
{ {
std::vector<u32> image_data; std::vector<u32> image_data;
u8 delay; u8 delay = 0;
}; };
// size of a single memory card block in bytes // size of a single memory card block in bytes

View File

@ -23,10 +23,8 @@ public:
virtual void ClearAll() = 0; virtual void ClearAll() = 0;
virtual void DoState(PointerWrap& p) = 0; virtual void DoState(PointerWrap& p) = 0;
u32 GetCardId() const { return m_nintendo_card_id; } u32 GetCardId() const { return m_nintendo_card_id; }
bool IsAddressInBounds(u32 address) const { return address <= (m_memory_card_size - 1); }
protected: protected:
int m_card_index; int m_card_index;
u16 m_nintendo_card_id; u16 m_nintendo_card_id;
u32 m_memory_card_size;
}; };

View File

@ -31,6 +31,8 @@ public:
void DoState(PointerWrap& p) override; void DoState(PointerWrap& p) override;
private: private:
bool IsAddressInBounds(u32 address) const { return address <= (m_memory_card_size - 1); }
std::string m_filename; std::string m_filename;
std::unique_ptr<u8[]> m_memcard_data; std::unique_ptr<u8[]> m_memcard_data;
std::unique_ptr<u8[]> m_flush_buffer; std::unique_ptr<u8[]> m_flush_buffer;
@ -38,4 +40,5 @@ private:
std::mutex m_flush_mutex; std::mutex m_flush_mutex;
Common::Event m_flush_trigger; Common::Event m_flush_trigger;
Common::Flag m_dirty; Common::Flag m_dirty;
u32 m_memory_card_size;
}; };

View File

@ -96,9 +96,9 @@ union USIChannelIn_Lo
// SI Channel // SI Channel
struct SSIChannel struct SSIChannel
{ {
USIChannelOut out; USIChannelOut out{};
USIChannelIn_Hi in_hi; USIChannelIn_Hi in_hi{};
USIChannelIn_Lo in_lo; USIChannelIn_Lo in_lo{};
std::unique_ptr<ISIDevice> device; std::unique_ptr<ISIDevice> device;
bool has_recent_device_change = false; bool has_recent_device_change = false;

View File

@ -60,7 +60,7 @@ private:
GBASockServer m_sock_server; GBASockServer m_sock_server;
NextAction m_next_action = NextAction::SendCommand; NextAction m_next_action = NextAction::SendCommand;
EBufferCommands m_last_cmd; EBufferCommands m_last_cmd = EBufferCommands::CMD_STATUS;
u64 m_timestamp_sent = 0; u64 m_timestamp_sent = 0;
}; };
} // namespace SerialInterface } // namespace SerialInterface

View File

@ -91,8 +91,9 @@ public:
File = 1, File = 1,
Directory = 2, Directory = 2,
}; };
u8 mode, attributes; u8 mode = 0;
Type type; u8 attributes = 0;
Type type{};
/// File name relative to the title data directory. /// File name relative to the title data directory.
std::string path; std::string path;
// Only valid for regular (i.e. non-directory) files. // Only valid for regular (i.e. non-directory) files.

View File

@ -49,7 +49,7 @@ public:
virtual u32 GetDataSize() const = 0; virtual u32 GetDataSize() const = 0;
u8* data_ptr; u8* data_ptr = nullptr;
}; };
std::unique_ptr<DataReportManipulator> MakeDataReportManipulator(InputReportID rpt_id, std::unique_ptr<DataReportManipulator> MakeDataReportManipulator(InputReportID rpt_id,

View File

@ -94,7 +94,7 @@ void CameraLogic::Update(const Common::Matrix44& transform, Common::Vec2 field_o
struct CameraPoint struct CameraPoint
{ {
IRBasic::IRObject position; IRBasic::IRObject position;
u8 size; u8 size = 0;
}; };
std::array<CameraPoint, leds.size()> camera_points; std::array<CameraPoint, leds.size()> camera_points;

View File

@ -155,10 +155,10 @@ private:
int BusRead(u8 slave_addr, u8 addr, int count, u8* data_out) override; 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; 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. // When disabled the camera does not respond on the bus.
// Change is triggered by wiimote report 0x13. // Change is triggered by wiimote report 0x13.
bool m_is_enabled; bool m_is_enabled = false;
}; };
} // namespace WiimoteEmu } // namespace WiimoteEmu

View File

@ -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, void EmulateShake(PositionalState* state, ControllerEmu::Shake* const shake_group,
float time_elapsed) float time_elapsed)
{ {

View File

@ -23,27 +23,25 @@ using MathUtil::GRAVITY_ACCELERATION;
struct PositionalState struct PositionalState
{ {
// meters // meters
Common::Vec3 position; Common::Vec3 position{};
// meters/second // meters/second
Common::Vec3 velocity; Common::Vec3 velocity{};
// meters/second^2 // meters/second^2
Common::Vec3 acceleration; Common::Vec3 acceleration{};
}; };
struct RotationalState struct RotationalState
{ {
// radians // radians
Common::Vec3 angle; Common::Vec3 angle{};
// radians/second // radians/second
Common::Vec3 angular_velocity; Common::Vec3 angular_velocity{};
}; };
struct IMUCursorState struct IMUCursorState
{ {
IMUCursorState();
// Rotation of world around device. // Rotation of world around device.
Common::Quaternion rotation; Common::Quaternion rotation = Common::Quaternion::Identity();
float recentered_pitch = {}; float recentered_pitch = {};
}; };
@ -51,6 +49,7 @@ struct IMUCursorState
// Contains both positional and rotational state. // Contains both positional and rotational state.
struct MotionState : PositionalState, RotationalState struct MotionState : PositionalState, RotationalState
{ {
MotionState() = default;
}; };
// Note that 'gyroscope' is rotation of world around device. // Note that 'gyroscope' is rotation of world around device.

View File

@ -112,10 +112,10 @@ private:
ControllerEmu::SettingValue<double> m_hit_strength_setting; ControllerEmu::SettingValue<double> m_hit_strength_setting;
// Holds previous user input state to watch for "new" hits. // 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. // 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. // 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 } // namespace WiimoteEmu

View File

@ -64,11 +64,11 @@ private:
int BusRead(u8 slave_addr, u8 addr, int count, u8* data_out) override; 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; 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? // TODO: What actions reset this state?
// Is this actually in the register somewhere? // Is this actually in the register somewhere?
ADPCMState adpcm_state; ADPCMState adpcm_state{};
ControllerEmu::SettingValue<double> m_speaker_pan_setting; ControllerEmu::SettingValue<double> m_speaker_pan_setting;
}; };

View File

@ -232,8 +232,8 @@ public:
void LoadDefaults(const ControllerInterface& ciface) override; void LoadDefaults(const ControllerInterface& ciface) override;
private: private:
std::array<ControllerEmu::Buttons*, NUM_HOTKEY_GROUPS> m_keys; std::array<ControllerEmu::Buttons*, NUM_HOTKEY_GROUPS> m_keys{};
std::array<ControllerEmu::ControlGroup*, NUM_HOTKEY_GROUPS> m_hotkey_groups; std::array<ControllerEmu::ControlGroup*, NUM_HOTKEY_GROUPS> m_hotkey_groups{};
}; };
namespace HotkeyManagerEmu namespace HotkeyManagerEmu

View File

@ -110,12 +110,9 @@ private:
struct ExecutingCommandInfo struct ExecutingCommandInfo
{ {
ExecutingCommandInfo() {} ExecutingCommandInfo() {}
ExecutingCommandInfo(u32 request_address) ExecutingCommandInfo(u32 request_address) : m_request_address(request_address) {}
: m_request_address(request_address), m_copy_diimmbuf(false) u32 m_request_address = 0;
{ bool m_copy_diimmbuf = false;
}
u32 m_request_address;
bool m_copy_diimmbuf;
}; };
friend class ::CBoot; friend class ::CBoot;

View File

@ -377,9 +377,9 @@ private:
struct OpenedContent struct OpenedContent
{ {
bool m_opened = false; bool m_opened = false;
u64 m_fd; u64 m_fd = 0;
u64 m_title_id = 0; u64 m_title_id = 0;
ES::Content m_content; ES::Content m_content{};
u32 m_uid = 0; u32 m_uid = 0;
}; };

View File

@ -237,8 +237,8 @@ private:
void DoState(PointerWrap& p); void DoState(PointerWrap& p);
bool in_use = false; bool in_use = false;
ObjectType type; ObjectType type{};
ObjectSubType subtype; ObjectSubType subtype{};
std::vector<u8> data; std::vector<u8> data;
u32 misc_data = 0; u32 misc_data = 0;
u32 owner_mask = 0; u32 owner_mask = 0;

View File

@ -137,7 +137,7 @@ private:
}; };
#pragma pack(pop) #pragma pack(pop)
ConfigData m_data; ConfigData m_data{};
}; };
} // namespace Net } // namespace Net
} // namespace IOS::HLE } // namespace IOS::HLE

View File

@ -65,18 +65,18 @@ enum SSL_IOCTL
struct WII_SSL struct WII_SSL
{ {
mbedtls_ssl_context ctx; mbedtls_ssl_context ctx{};
mbedtls_ssl_config config; mbedtls_ssl_config config{};
mbedtls_ssl_session session; mbedtls_ssl_session session{};
mbedtls_entropy_context entropy; mbedtls_entropy_context entropy{};
mbedtls_ctr_drbg_context ctr_drbg; mbedtls_ctr_drbg_context ctr_drbg{};
mbedtls_x509_crt cacert; mbedtls_x509_crt cacert{};
mbedtls_x509_crt clicert; mbedtls_x509_crt clicert{};
mbedtls_pk_context pk; mbedtls_pk_context pk{};
int sockfd = -1; int sockfd = -1;
int hostfd = -1; int hostfd = -1;
std::string hostname; std::string hostname;
bool active; bool active = false;
}; };
class NetSSLDevice : public Device class NetSSLDevice : public Device

View File

@ -233,10 +233,10 @@ public:
struct PollCommand struct PollCommand
{ {
u32 request_addr; u32 request_addr = 0;
u32 buffer_out; u32 buffer_out = 0;
std::vector<pollfd_t> wii_fds; std::vector<pollfd_t> wii_fds;
s64 timeout; s64 timeout = 0;
}; };
static s32 GetNetErrorCode(s32 ret, std::string_view caller, bool is_rw); static s32 GetNetErrorCode(s32 ret, std::string_view caller, bool is_rw);
@ -292,7 +292,7 @@ private:
void UpdatePollCommands(); void UpdatePollCommands();
std::unordered_map<s32, WiiSocket> WiiSockets; std::unordered_map<s32, WiiSocket> WiiSockets;
s32 errno_last; s32 errno_last = 0;
std::vector<PollCommand> pending_polls; std::vector<PollCommand> pending_polls;
std::chrono::time_point<std::chrono::high_resolution_clock> last_time = std::chrono::time_point<std::chrono::high_resolution_clock> last_time =
std::chrono::high_resolution_clock::now(); std::chrono::high_resolution_clock::now();

View File

@ -159,7 +159,7 @@ private:
u32 m_block_length = 0; u32 m_block_length = 0;
u32 m_bus_width = 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; File::IOFile m_card;
}; };

View File

@ -50,20 +50,20 @@ private:
std::string m_device_name; 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_key[0x10] = {};
u8 m_aes_iv[0x10] = {}; u8 m_aes_iv[0x10] = {};
ES::TMDReader m_tmd; ES::TMDReader m_tmd;
std::string m_base_extract_path; std::string m_base_extract_path;
u64 m_current_title_id; u64 m_current_title_id = 0;
std::string m_current_title_id_str; 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; 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; 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; std::string m_import_group_id_str;
// Set on IMPORT_TITLE_INIT when the next profile application should not delete // Set on IMPORT_TITLE_INIT when the next profile application should not delete

View File

@ -84,10 +84,10 @@ private:
struct FileDescriptor struct FileDescriptor
{ {
bool in_use; bool in_use = false;
std::string path; std::string path;
int mode; int mode = 0;
size_t position; size_t position = 0;
File::IOFile file; File::IOFile file;
bool Open(); bool Open();

View File

@ -82,11 +82,11 @@ public:
class Player class Player
{ {
public: public:
PlayerId pid; PlayerId pid{};
std::string name; std::string name;
std::string revision; std::string revision;
u32 ping; u32 ping = 0;
SyncIdentifierComparison game_status; SyncIdentifierComparison game_status = SyncIdentifierComparison::Unknown;
bool IsHost() const { return pid == 1; } bool IsHost() const { return pid == 1; }
}; };
@ -153,7 +153,7 @@ protected:
struct AsyncQueueEntry struct AsyncQueueEntry
{ {
sf::Packet packet; sf::Packet packet;
u8 channel_id; u8 channel_id = 0;
}; };
void ClearBuffers(); void ClearBuffers();

View File

@ -28,84 +28,84 @@ namespace NetPlay
{ {
struct NetSettings struct NetSettings
{ {
bool m_CPUthread; bool m_CPUthread = false;
PowerPC::CPUCore m_CPUcore; PowerPC::CPUCore m_CPUcore{};
bool m_EnableCheats; bool m_EnableCheats = false;
int m_SelectedLanguage; int m_SelectedLanguage = 0;
bool m_OverrideRegionSettings; bool m_OverrideRegionSettings = false;
bool m_DSPHLE; bool m_DSPHLE = false;
bool m_DSPEnableJIT; bool m_DSPEnableJIT = false;
bool m_WriteToMemcard; bool m_WriteToMemcard = false;
bool m_RAMOverrideEnable; bool m_RAMOverrideEnable = false;
u32 m_Mem1Size; u32 m_Mem1Size = 0;
u32 m_Mem2Size; u32 m_Mem2Size = 0;
DiscIO::Region m_FallbackRegion; DiscIO::Region m_FallbackRegion{};
bool m_AllowSDWrites; bool m_AllowSDWrites = false;
bool m_CopyWiiSave; bool m_CopyWiiSave = false;
bool m_OCEnable; bool m_OCEnable = false;
float m_OCFactor; float m_OCFactor = 0;
std::array<ExpansionInterface::TEXIDevices, 3> m_EXIDevice; std::array<ExpansionInterface::TEXIDevices, 3> m_EXIDevice{};
std::array<u32, Config::SYSCONF_SETTINGS.size()> m_SYSCONFSettings; std::array<u32, Config::SYSCONF_SETTINGS.size()> m_SYSCONFSettings{};
bool m_EFBAccessEnable; bool m_EFBAccessEnable = false;
bool m_BBoxEnable; bool m_BBoxEnable = false;
bool m_ForceProgressive; bool m_ForceProgressive = false;
bool m_EFBToTextureEnable; bool m_EFBToTextureEnable = false;
bool m_XFBToTextureEnable; bool m_XFBToTextureEnable = false;
bool m_DisableCopyToVRAM; bool m_DisableCopyToVRAM = false;
bool m_ImmediateXFBEnable; bool m_ImmediateXFBEnable = false;
bool m_EFBEmulateFormatChanges; bool m_EFBEmulateFormatChanges = false;
int m_SafeTextureCacheColorSamples; int m_SafeTextureCacheColorSamples = 0;
bool m_PerfQueriesEnable; bool m_PerfQueriesEnable = false;
bool m_FloatExceptions; bool m_FloatExceptions = false;
bool m_DivideByZeroExceptions; bool m_DivideByZeroExceptions = false;
bool m_FPRF; bool m_FPRF = false;
bool m_AccurateNaNs; bool m_AccurateNaNs = false;
bool m_DisableICache; bool m_DisableICache = false;
bool m_SyncOnSkipIdle; bool m_SyncOnSkipIdle = false;
bool m_SyncGPU; bool m_SyncGPU = false;
int m_SyncGpuMaxDistance; int m_SyncGpuMaxDistance = 0;
int m_SyncGpuMinDistance; int m_SyncGpuMinDistance = 0;
float m_SyncGpuOverclock; float m_SyncGpuOverclock = 0;
bool m_JITFollowBranch; bool m_JITFollowBranch = false;
bool m_FastDiscSpeed; bool m_FastDiscSpeed = false;
bool m_MMU; bool m_MMU = false;
bool m_Fastmem; bool m_Fastmem = false;
bool m_SkipIPL; bool m_SkipIPL = false;
bool m_LoadIPLDump; bool m_LoadIPLDump = false;
bool m_VertexRounding; bool m_VertexRounding = false;
int m_InternalResolution; int m_InternalResolution = 0;
bool m_EFBScaledCopy; bool m_EFBScaledCopy = false;
bool m_FastDepthCalc; bool m_FastDepthCalc = false;
bool m_EnablePixelLighting; bool m_EnablePixelLighting = false;
bool m_WidescreenHack; bool m_WidescreenHack = false;
bool m_ForceFiltering; bool m_ForceFiltering = false;
int m_MaxAnisotropy; int m_MaxAnisotropy = 0;
bool m_ForceTrueColor; bool m_ForceTrueColor = false;
bool m_DisableCopyFilter; bool m_DisableCopyFilter = false;
bool m_DisableFog; bool m_DisableFog = false;
bool m_ArbitraryMipmapDetection; bool m_ArbitraryMipmapDetection = false;
float m_ArbitraryMipmapDetectionThreshold; float m_ArbitraryMipmapDetectionThreshold = 0;
bool m_EnableGPUTextureDecoding; bool m_EnableGPUTextureDecoding = false;
bool m_DeferEFBCopies; bool m_DeferEFBCopies = false;
int m_EFBAccessTileSize; int m_EFBAccessTileSize = 0;
bool m_EFBAccessDeferInvalidation; bool m_EFBAccessDeferInvalidation = false;
bool m_StrictSettingsSync; bool m_StrictSettingsSync = false;
bool m_SyncSaveData; bool m_SyncSaveData = false;
bool m_SyncCodes; bool m_SyncCodes = false;
std::string m_SaveDataRegion; std::string m_SaveDataRegion;
bool m_SyncAllWiiSaves; bool m_SyncAllWiiSaves = false;
std::array<int, 4> m_WiimoteExtension; std::array<int, 4> m_WiimoteExtension{};
bool m_GolfMode; bool m_GolfMode = false;
bool m_UseFMA; bool m_UseFMA = false;
bool m_HideRemoteGBAs; bool m_HideRemoteGBAs = false;
// These aren't sent over the network directly // These aren't sent over the network directly
bool m_IsHosting; bool m_IsHosting = false;
bool m_HostInputAuthority; bool m_HostInputAuthority = false;
std::array<std::string, 4> m_GBARomPaths; std::array<std::string, 4> m_GBARomPaths{};
}; };
struct NetTraversalConfig struct NetTraversalConfig
@ -226,7 +226,7 @@ enum : u8
struct WiimoteInput struct WiimoteInput
{ {
u8 report_id; u8 report_id = 0;
std::vector<u8> data; std::vector<u8> data;
}; };
using PlayerId = u8; using PlayerId = u8;
@ -235,19 +235,19 @@ using PadIndex = s8;
using PadMappingArray = std::array<PlayerId, 4>; using PadMappingArray = std::array<PlayerId, 4>;
struct GBAConfig struct GBAConfig
{ {
bool enabled; bool enabled = false;
bool has_rom; bool has_rom = false;
std::string title; std::string title;
std::array<u8, 20> hash; std::array<u8, 20> hash{};
}; };
using GBAConfigArray = std::array<GBAConfig, 4>; using GBAConfigArray = std::array<GBAConfig, 4>;
struct PadDetails struct PadDetails
{ {
std::string player_name; std::string player_name{};
bool is_local; bool is_local = false;
int local_pad; int local_pad = 0;
bool hide_gba; bool hide_gba = false;
}; };
std::string GetPlayerMappingString(PlayerId pid, const PadMappingArray& pad_map, std::string GetPlayerMappingString(PlayerId pid, const PadMappingArray& pad_map,

View File

@ -80,16 +80,16 @@ private:
class Client class Client
{ {
public: public:
PlayerId pid; PlayerId pid{};
std::string name; std::string name;
std::string revision; std::string revision;
SyncIdentifierComparison game_status; SyncIdentifierComparison game_status = SyncIdentifierComparison::Unknown;
bool has_ipl_dump; bool has_ipl_dump = false;
bool has_hardware_fma; bool has_hardware_fma = false;
ENetPeer* socket; ENetPeer* socket = nullptr;
u32 ping; u32 ping = 0;
u32 current_game; u32 current_game = 0;
Common::QoSSession qos_session; Common::QoSSession qos_session;
@ -106,16 +106,16 @@ private:
struct AsyncQueueEntry struct AsyncQueueEntry
{ {
sf::Packet packet; sf::Packet packet;
PlayerId target_pid; PlayerId target_pid{};
TargetMode target_mode; TargetMode target_mode{};
u8 channel_id; u8 channel_id = 0;
}; };
struct ChunkedDataQueueEntry struct ChunkedDataQueueEntry
{ {
sf::Packet packet; sf::Packet packet;
PlayerId target_pid; PlayerId target_pid{};
TargetMode target_mode; TargetMode target_mode{};
std::string title; std::string title;
}; };
@ -171,7 +171,7 @@ private:
std::map<PlayerId, Client> m_players; std::map<PlayerId, Client> m_players;
std::unordered_map<u32, std::vector<std::pair<PlayerId, u64>>> m_timebase_by_frame; std::unordered_map<u32, std::vector<std::pair<PlayerId, u64>>> m_timebase_by_frame;
bool m_desync_detected; bool m_desync_detected = false;
struct struct
{ {
@ -191,7 +191,7 @@ private:
Common::Event m_chunked_data_event; Common::Event m_chunked_data_event;
Common::Event m_chunked_data_complete_event; Common::Event m_chunked_data_complete_event;
std::thread m_chunked_data_thread; 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; std::unordered_map<u32, unsigned int> m_chunked_data_complete_count;
bool m_abort_chunked_data = false; bool m_abort_chunked_data = false;

View File

@ -266,9 +266,9 @@ private:
Jit64AsmRoutineManager asm_routines{*this}; Jit64AsmRoutineManager asm_routines{*this};
bool m_enable_blr_optimization; bool m_enable_blr_optimization = false;
bool m_cleanup_after_stackfault; bool m_cleanup_after_stackfault = false;
u8* m_stack; u8* m_stack = nullptr;
HyoutaUtilities::RangeSizeSet<u8*> m_free_ranges_near; HyoutaUtilities::RangeSizeSet<u8*> m_free_ranges_near;
HyoutaUtilities::RangeSizeSet<u8*> m_free_ranges_far; HyoutaUtilities::RangeSizeSet<u8*> m_free_ranges_far;

View File

@ -134,9 +134,9 @@ protected:
FarCodeCache m_far_code; FarCodeCache m_far_code;
// Backed up when we switch to far code. // Backed up when we switch to far code.
u8* m_near_code; u8* m_near_code = nullptr;
u8* m_near_code_end; u8* m_near_code_end = nullptr;
bool m_near_code_write_failed; bool m_near_code_write_failed = false;
std::unordered_map<u8*, TrampolineInfo> m_back_patch_info; std::unordered_map<u8*, TrampolineInfo> m_back_patch_info;
std::unordered_map<u8*, u8*> m_exception_handler_at_loc; std::unordered_map<u8*, u8*> m_exception_handler_at_loc;

View File

@ -205,5 +205,5 @@ private:
// This array is indexed with the masked PC and likely holds the correct block id. // 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. // 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
}; };

View File

@ -3,7 +3,6 @@
#include "Core/PowerPC/MMU.h" #include "Core/PowerPC/MMU.h"
#include <cassert>
#include <cstddef> #include <cstddef>
#include <cstring> #include <cstring>
#include <string> #include <string>
@ -469,34 +468,35 @@ u32 HostRead_Instruction(const u32 address)
return ReadFromHardware<XCheckTLBFlag::OpcodeNoException, 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)) if (!HostIsInstructionRAMAddress(address, space))
return TryReadResult<u32>(); return std::nullopt;
switch (space) switch (space)
{ {
case RequestedAddressSpace::Effective: case RequestedAddressSpace::Effective:
{ {
const u32 value = ReadFromHardware<XCheckTLBFlag::OpcodeNoException, u32>(address); const u32 value = ReadFromHardware<XCheckTLBFlag::OpcodeNoException, u32>(address);
return TryReadResult<u32>(!!MSR.DR, value); return ReadResult<u32>(!!MSR.DR, value);
} }
case RequestedAddressSpace::Physical: case RequestedAddressSpace::Physical:
{ {
const u32 value = ReadFromHardware<XCheckTLBFlag::OpcodeNoException, u32, true>(address); const u32 value = ReadFromHardware<XCheckTLBFlag::OpcodeNoException, u32, true>(address);
return TryReadResult<u32>(false, value); return ReadResult<u32>(false, value);
} }
case RequestedAddressSpace::Virtual: case RequestedAddressSpace::Virtual:
{ {
if (!MSR.DR) if (!MSR.DR)
return TryReadResult<u32>(); return std::nullopt;
const u32 value = ReadFromHardware<XCheckTLBFlag::OpcodeNoException, u32>(address); const u32 value = ReadFromHardware<XCheckTLBFlag::OpcodeNoException, u32>(address);
return TryReadResult<u32>(true, value); return ReadResult<u32>(true, value);
} }
} }
assert(0); ASSERT(0);
return TryReadResult<u32>(); return std::nullopt;
} }
static void Memcheck(u32 address, u64 var, bool write, size_t size) 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> 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)) if (!HostIsRAMAddress(address, space))
return TryReadResult<T>(); return std::nullopt;
switch (space) switch (space)
{ {
case RequestedAddressSpace::Effective: case RequestedAddressSpace::Effective:
{ {
T value = ReadFromHardware<XCheckTLBFlag::NoException, T>(address); 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: case RequestedAddressSpace::Physical:
{ {
T value = ReadFromHardware<XCheckTLBFlag::NoException, T, true>(address); 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: case RequestedAddressSpace::Virtual:
{ {
if (!MSR.DR) if (!MSR.DR)
return TryReadResult<T>(); return std::nullopt;
T value = ReadFromHardware<XCheckTLBFlag::NoException, T>(address); T value = ReadFromHardware<XCheckTLBFlag::NoException, T>(address);
return TryReadResult<T>(true, std::move(value)); return ReadResult<T>(true, std::move(value));
} }
} }
assert(0); ASSERT(0);
return TryReadResult<T>(); return std::nullopt;
} }
TryReadResult<u8> HostTryReadU8(u32 address, RequestedAddressSpace space) std::optional<ReadResult<u8>> HostTryReadU8(u32 address, RequestedAddressSpace space)
{ {
return HostTryReadUX<u8>(address, 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); 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); 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); 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); const auto result = HostTryReadUX<u32>(address, space);
if (!result) if (!result)
return TryReadResult<float>(); return std::nullopt;
return TryReadResult<float>(result.translated, Common::BitCast<float>(result.value)); 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); const auto result = HostTryReadUX<u64>(address, space);
if (!result) if (!result)
return TryReadResult<double>(); return std::nullopt;
return TryReadResult<double>(result.translated, Common::BitCast<double>(result.value)); return ReadResult<double>(result->translated, Common::BitCast<double>(result->value));
} }
u32 Read_U8_ZX(const u32 address) u32 Read_U8_ZX(const u32 address)
@ -764,62 +764,68 @@ void HostWrite_F64(const double var, const u32 address)
HostWrite_U64(integral, address); HostWrite_U64(integral, address);
} }
static TryWriteResult HostTryWriteUX(const u32 var, const u32 address, const u32 size, static std::optional<WriteResult> HostTryWriteUX(const u32 var, const u32 address, const u32 size,
RequestedAddressSpace space) RequestedAddressSpace space)
{ {
if (!HostIsRAMAddress(address, space)) if (!HostIsRAMAddress(address, space))
return TryWriteResult(); return std::nullopt;
switch (space) switch (space)
{ {
case RequestedAddressSpace::Effective: case RequestedAddressSpace::Effective:
WriteToHardware<XCheckTLBFlag::NoException>(address, var, size); WriteToHardware<XCheckTLBFlag::NoException>(address, var, size);
return TryWriteResult(!!MSR.DR); return WriteResult(!!MSR.DR);
case RequestedAddressSpace::Physical: case RequestedAddressSpace::Physical:
WriteToHardware<XCheckTLBFlag::NoException, true>(address, var, size); WriteToHardware<XCheckTLBFlag::NoException, true>(address, var, size);
return TryWriteResult(false); return WriteResult(false);
case RequestedAddressSpace::Virtual: case RequestedAddressSpace::Virtual:
if (!MSR.DR) if (!MSR.DR)
return TryWriteResult(); return std::nullopt;
WriteToHardware<XCheckTLBFlag::NoException>(address, var, size); WriteToHardware<XCheckTLBFlag::NoException>(address, var, size);
return TryWriteResult(true); return WriteResult(true);
} }
assert(0); ASSERT(0);
return TryWriteResult(); 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); 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); 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); 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) if (!result)
return result; return result;
return HostTryWriteUX(static_cast<u32>(var), address + 4, 4, space); 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); const u32 integral = Common::BitCast<u32>(var);
return HostTryWriteU32(integral, address, space); 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); const u64 integral = Common::BitCast<u64>(var);
return HostTryWriteU64(integral, address, space); return HostTryWriteU64(integral, address, space);
@ -841,25 +847,26 @@ std::string HostGetString(u32 address, size_t size)
return s; 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); auto c = HostTryReadU8(address, space);
if (!c) if (!c)
return TryReadResult<std::string>(); return std::nullopt;
if (c.value == 0) if (c->value == 0)
return TryReadResult<std::string>(c.translated, ""); return ReadResult<std::string>(c->translated, "");
std::string s; std::string s;
s += static_cast<char>(c.value); s += static_cast<char>(c->value);
while (size == 0 || s.length() < size) while (size == 0 || s.length() < size)
{ {
++address; ++address;
const auto res = HostTryReadU8(address, space); const auto res = HostTryReadU8(address, space);
if (!res || res.value == 0) if (!res || res->value == 0)
break; 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) bool IsOptimizableRAMAddress(const u32 address)
@ -925,7 +932,7 @@ bool HostIsRAMAddress(u32 address, RequestedAddressSpace space)
return IsRAMAddress<XCheckTLBFlag::NoException>(address, true); return IsRAMAddress<XCheckTLBFlag::NoException>(address, true);
} }
assert(0); ASSERT(0);
return false; return false;
} }
@ -947,7 +954,7 @@ bool HostIsInstructionRAMAddress(u32 address, RequestedAddressSpace space)
return IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(address, true); return IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(address, true);
} }
assert(0); ASSERT(0);
return false; return false;
} }

View File

@ -37,11 +37,8 @@ u32 HostRead_Instruction(u32 address);
std::string HostGetString(u32 address, size_t size = 0); std::string HostGetString(u32 address, size_t size = 0);
template <typename T> 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 // whether the address had to be translated (given address was treated as virtual) or not (given
// address was treated as physical) // address was treated as physical)
bool translated; bool translated;
@ -49,37 +46,31 @@ struct TryReadResult
// the actual value that was read // the actual value that was read
T value; T value;
TryReadResult() : success(false) {} ReadResult(bool translated_, T&& value_) : translated(translated_), value(std::forward<T>(value_))
TryReadResult(bool translated_, T&& value_)
: success(true), translated(translated_), value(std::move(value_))
{ {
} }
TryReadResult(bool translated_, const T& value_) ReadResult(bool translated_, const T& value_) : translated(translated_), value(value_) {}
: success(true), translated(translated_), value(value_)
{
}
explicit operator bool() const { return success; }
}; };
// Try to read a value from emulated memory at the given address in the given memory space. // 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 // If the read succeeds, the returned value will be present and the ReadResult contains the read
// whether the given address had to be translated or not. Unlike the HostRead functions, this does // value and information on whether the given address had to be translated or not. Unlike the
// not raise a user-visible alert on failure. // HostRead functions, this does not raise a user-visible alert on failure.
TryReadResult<u8> HostTryReadU8(u32 address, std::optional<ReadResult<u8>>
RequestedAddressSpace space = RequestedAddressSpace::Effective); HostTryReadU8(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryReadResult<u16> HostTryReadU16(u32 address, std::optional<ReadResult<u16>>
RequestedAddressSpace space = RequestedAddressSpace::Effective); HostTryReadU16(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryReadResult<u32> HostTryReadU32(u32 address, std::optional<ReadResult<u32>>
RequestedAddressSpace space = RequestedAddressSpace::Effective); HostTryReadU32(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryReadResult<u64> HostTryReadU64(u32 address, std::optional<ReadResult<u64>>
RequestedAddressSpace space = RequestedAddressSpace::Effective); HostTryReadU64(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryReadResult<float> HostTryReadF32(u32 address, std::optional<ReadResult<float>>
RequestedAddressSpace space = RequestedAddressSpace::Effective); HostTryReadF32(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryReadResult<double> std::optional<ReadResult<double>>
HostTryReadF64(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective); HostTryReadF64(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryReadResult<u32> std::optional<ReadResult<u32>>
HostTryReadInstruction(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective); HostTryReadInstruction(u32 address, RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryReadResult<std::string> std::optional<ReadResult<std::string>>
HostTryReadString(u32 address, size_t size = 0, HostTryReadString(u32 address, size_t size = 0,
RequestedAddressSpace space = RequestedAddressSpace::Effective); RequestedAddressSpace space = RequestedAddressSpace::Effective);
@ -93,35 +84,36 @@ void HostWrite_U64(u64 var, u32 address);
void HostWrite_F32(float var, u32 address); void HostWrite_F32(float var, u32 address);
void HostWrite_F64(double 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 // whether the address had to be translated (given address was treated as virtual) or not (given
// address was treated as physical) // address was treated as physical)
bool translated; bool translated;
TryWriteResult() : success(false) {} explicit WriteResult(bool translated_) : translated(translated_) {}
TryWriteResult(bool translated_) : success(true), translated(translated_) {}
explicit operator bool() const { return success; }
}; };
// Try to a write a value to memory at the given address in the given memory space. // 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 // 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 // address had to be translated or not. Unlike the HostWrite functions, this does not raise a
// user-visible alert on failure. // user-visible alert on failure.
TryWriteResult HostTryWriteU8(u32 var, const u32 address, std::optional<WriteResult>
HostTryWriteU8(u32 var, const u32 address,
RequestedAddressSpace space = RequestedAddressSpace::Effective); RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryWriteResult HostTryWriteU16(u32 var, const u32 address, std::optional<WriteResult>
HostTryWriteU16(u32 var, const u32 address,
RequestedAddressSpace space = RequestedAddressSpace::Effective); RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryWriteResult HostTryWriteU32(u32 var, const u32 address, std::optional<WriteResult>
HostTryWriteU32(u32 var, const u32 address,
RequestedAddressSpace space = RequestedAddressSpace::Effective); RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryWriteResult HostTryWriteU64(u64 var, const u32 address, std::optional<WriteResult>
HostTryWriteU64(u64 var, const u32 address,
RequestedAddressSpace space = RequestedAddressSpace::Effective); RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryWriteResult HostTryWriteF32(float var, const u32 address, std::optional<WriteResult>
HostTryWriteF32(float var, const u32 address,
RequestedAddressSpace space = RequestedAddressSpace::Effective); RequestedAddressSpace space = RequestedAddressSpace::Effective);
TryWriteResult HostTryWriteF64(double var, const u32 address, std::optional<WriteResult>
HostTryWriteF64(double var, const u32 address,
RequestedAddressSpace space = RequestedAddressSpace::Effective); RequestedAddressSpace space = RequestedAddressSpace::Effective);
// Returns whether a read or write to the given address will resolve to a RAM access in the given // Returns whether a read or write to the given address will resolve to a RAM access in the given

View File

@ -24,29 +24,29 @@ namespace PPCAnalyst
struct CodeOp // 16B struct CodeOp // 16B
{ {
UGeckoInstruction inst; UGeckoInstruction inst;
GekkoOPInfo* opinfo; GekkoOPInfo* opinfo = nullptr;
u32 address; u32 address = 0;
u32 branchTo; // if UINT32_MAX, not a branch u32 branchTo = 0; // if UINT32_MAX, not a branch
BitSet32 regsOut; BitSet32 regsOut;
BitSet32 regsIn; BitSet32 regsIn;
BitSet32 fregsIn; BitSet32 fregsIn;
s8 fregOut; s8 fregOut = 0;
bool isBranchTarget; bool isBranchTarget = false;
bool branchUsesCtr; bool branchUsesCtr = false;
bool branchIsIdleLoop; bool branchIsIdleLoop = false;
bool wantsCR0; bool wantsCR0 = false;
bool wantsCR1; bool wantsCR1 = false;
bool wantsFPRF; bool wantsFPRF = false;
bool wantsCA; bool wantsCA = false;
bool wantsCAInFlags; bool wantsCAInFlags = false;
bool outputCR0; bool outputCR0 = false;
bool outputCR1; bool outputCR1 = false;
bool outputFPRF; bool outputFPRF = false;
bool outputCA; bool outputCA = false;
bool canEndBlock; bool canEndBlock = false;
bool canCauseException; bool canCauseException = false;
bool skipLRStack; bool skipLRStack = false;
bool skip; // followed BL-s for example bool skip = false; // followed BL-s for example
// which registers are still needed after this instruction in this block // which registers are still needed after this instruction in this block
BitSet32 fprInUse; BitSet32 fprInUse;
BitSet32 gprInUse; BitSet32 gprInUse;
@ -138,23 +138,24 @@ using CodeBuffer = std::vector<CodeOp>;
struct CodeBlock struct CodeBlock
{ {
// Beginning PPC address. // Beginning PPC address.
u32 m_address; u32 m_address = 0;
// Number of instructions // Number of instructions
// Gives us the size of the block. // Gives us the size of the block.
u32 m_num_instructions; u32 m_num_instructions = 0;
// Some basic statistics about the block. // Some basic statistics about the block.
BlockStats* m_stats; BlockStats* m_stats = nullptr;
// Register statistics about the block. // Register statistics about the block.
BlockRegStats *m_gpa, *m_fpa; BlockRegStats* m_gpa = nullptr;
BlockRegStats* m_fpa = nullptr;
// Are we a broken block? // Are we a broken block?
bool m_broken; bool m_broken = false;
// Did we have a memory_exception? // Did we have a memory_exception?
bool m_memory_exception; bool m_memory_exception = false;
// Which GQRs this block uses, if any. // Which GQRs this block uses, if any.
BitSet8 m_gqr_used; BitSet8 m_gqr_used;

View File

@ -87,10 +87,6 @@ constexpr std::array<u32, 128> s_way_from_plru = [] {
}(); }();
} // Anonymous namespace } // Anonymous namespace
InstructionCache::InstructionCache()
{
}
void InstructionCache::Reset() void InstructionCache::Reset()
{ {
valid.fill(0); valid.fill(0);

View File

@ -21,16 +21,16 @@ constexpr u32 ICACHE_VMEM_BIT = 0x20000000;
struct InstructionCache struct InstructionCache
{ {
std::array<std::array<std::array<u32, ICACHE_BLOCK_SIZE>, ICACHE_WAYS>, ICACHE_SETS> data; 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<std::array<u32, ICACHE_WAYS>, ICACHE_SETS> tags{};
std::array<u32, ICACHE_SETS> plru; std::array<u32, ICACHE_SETS> plru{};
std::array<u32, ICACHE_SETS> valid; std::array<u32, ICACHE_SETS> valid{};
std::array<u8, 1 << 20> lookup_table; std::array<u8, 1 << 20> lookup_table{};
std::array<u8, 1 << 21> lookup_table_ex; std::array<u8, 1 << 21> lookup_table_ex{};
std::array<u8, 1 << 20> lookup_table_vmem; std::array<u8, 1 << 20> lookup_table_vmem{};
InstructionCache(); InstructionCache() = default;
u32 ReadInstruction(u32 addr); u32 ReadInstruction(u32 addr);
void Invalidate(u32 addr); void Invalidate(u32 addr);
void Init(); void Init();

View File

@ -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. // Unfortunately not all of those fit in 520 bytes, but we can fit most of ps and all of the rest.
struct PowerPCState struct PowerPCState
{ {
u32 pc; // program counter u32 pc = 0; // program counter
u32 npc; u32 npc = 0;
// gather pipe pointer for JIT access // gather pipe pointer for JIT access
u8* gather_pipe_ptr; u8* gather_pipe_ptr = nullptr;
u8* gather_pipe_base_ptr; 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 #ifndef _M_X86_64
// The paired singles are strange : PS0 is stored in the full 64 bits of each FPR // 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]; alignas(16) PairedSingle ps[32];
#endif #endif
ConditionRegister cr; ConditionRegister cr{};
UReg_MSR msr; // machine state register UReg_MSR msr; // machine state register
UReg_FPSCR fpscr; // floating point flags/status bits UReg_FPSCR fpscr; // floating point flags/status bits
// Exception management. // Exception management.
u32 Exceptions; u32 Exceptions = 0;
// Downcount for determining when we need to do timing // 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 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. // 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. // XER, reformatted into byte fields for easier access.
u8 xer_ca; u8 xer_ca = 0;
u8 xer_so_ov; // format: (SO << 1) | OV 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 // The Broadway CPU implements bits 16-23 of the XER register... even though it doesn't support
// lscbx // lscbx
u16 xer_stringctrl; u16 xer_stringctrl = 0;
#if _M_X86_64 #if _M_X86_64
// This member exists only for the purpose of an assertion that its offset <= 0x100. // 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]; alignas(16) PairedSingle ps[32];
#endif #endif
u32 sr[16]; // Segment registers. u32 sr[16]{}; // Segment registers.
// special purpose registers - controls quantizers, DMA, and lots of other misc extensions. // special purpose registers - controls quantizers, DMA, and lots of other misc extensions.
// also for power management, but we don't care about that. // 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. // 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; std::array<std::array<TLBEntry, TLB_SIZE / TLB_WAYS>, NUM_TLBS> tlb;
u32 pagetable_base; u32 pagetable_base = 0;
u32 pagetable_hashmask; u32 pagetable_hashmask = 0;
InstructionCache iCache; InstructionCache iCache;

View File

@ -28,9 +28,9 @@ struct BlockStat
struct ProfileStats struct ProfileStats
{ {
std::vector<BlockStat> block_stats; std::vector<BlockStat> block_stats;
u64 cost_sum; u64 cost_sum = 0;
u64 timecost_sum; u64 timecost_sum = 0;
u64 countsPerSec; u64 countsPerSec = 0;
}; };
} // namespace Profiler } // namespace Profiler

View File

@ -298,10 +298,10 @@ static std::map<double, int> GetSavedStates()
struct CompressAndDumpState_args struct CompressAndDumpState_args
{ {
std::vector<u8>* buffer_vector; std::vector<u8>* buffer_vector = nullptr;
std::mutex* buffer_mutex; std::mutex* buffer_mutex = nullptr;
std::string filename; std::string filename;
bool wait; bool wait = false;
}; };
static void CompressAndDumpState(CompressAndDumpState_args save_args) static void CompressAndDumpState(CompressAndDumpState_args save_args)

View File

@ -13,18 +13,18 @@ namespace NetPlay
{ {
struct SyncIdentifier struct SyncIdentifier
{ {
u64 dol_elf_size; u64 dol_elf_size = 0;
std::string game_id; std::string game_id;
u16 revision; u16 revision = 0;
u8 disc_number; u8 disc_number = 0;
bool is_datel; bool is_datel = false;
// This hash is intended to be (but is not guaranteed to be): // This hash is intended to be (but is not guaranteed to be):
// 1. Identical for discs with no differences that affect netplay/TAS sync // 1. Identical for discs with no differences that affect netplay/TAS sync
// 2. Different for discs with 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 // 3. Much faster than hashing the entire disc
// The way the hash is calculated may change with updates to Dolphin. // 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 bool operator==(const SyncIdentifier& s) const
{ {

View File

@ -173,17 +173,17 @@ struct CompressThreadState
struct CompressParameters struct CompressParameters
{ {
std::vector<u8> data; std::vector<u8> data{};
u32 block_number; u32 block_number = 0;
u64 inpos; u64 inpos = 0;
}; };
struct OutputParameters struct OutputParameters
{ {
std::vector<u8> data; std::vector<u8> data{};
u32 block_number; u32 block_number = 0;
bool compressed; bool compressed = false;
u64 inpos; u64 inpos = 0;
}; };
static ConversionResultCode SetUpCompressThreadState(CompressThreadState* state) static ConversionResultCode SetUpCompressThreadState(CompressThreadState* state)

View File

@ -132,14 +132,14 @@ private:
std::vector<u8> m_apploader; std::vector<u8> m_apploader;
std::vector<u8> m_fst_data; 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; std::string m_root_directory;
bool m_is_wii = false; bool m_is_wii = false;
// GameCube has no shift, Wii has 2 bit shift // GameCube has no shift, Wii has 2 bit shift
u32 m_address_shift = 0; u32 m_address_shift = 0;
u64 m_data_size; u64 m_data_size = 0;
}; };
class DirectoryBlobReader : public BlobReader class DirectoryBlobReader : public BlobReader

View File

@ -46,7 +46,7 @@ private:
bool ParsePartitionData(const Partition& partition); bool ParsePartitionData(const Partition& partition);
void ParseFileSystemData(u64 partition_data_offset, const FileInfo& directory); void ParseFileSystemData(u64 partition_data_offset, const FileInfo& directory);
const Volume* m_disc; const Volume* m_disc = nullptr;
std::vector<u8> m_free_table; std::vector<u8> m_free_table;
u64 m_file_size = 0; u64 m_file_size = 0;

View File

@ -43,7 +43,7 @@ private:
static constexpr size_t LFG_K = 521; static constexpr size_t LFG_K = 521;
static constexpr size_t LFG_J = 32; 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; size_t m_position_bytes = 0;
}; };

View File

@ -78,7 +78,7 @@ private:
struct PotentialMatch struct PotentialMatch
{ {
u64 size; u64 size = 0;
Hashes<std::vector<u8>> hashes; Hashes<std::vector<u8>> hashes;
}; };
@ -87,9 +87,9 @@ private:
std::vector<PotentialMatch> ScanDatfile(const std::vector<u8>& data, const std::string& system); std::vector<PotentialMatch> ScanDatfile(const std::vector<u8>& data, const std::string& system);
std::string m_game_id; std::string m_game_id;
u16 m_revision; u16 m_revision = 0;
u8 m_disc_number; u8 m_disc_number = 0;
u64 m_size; u64 m_size = 0;
std::future<std::vector<PotentialMatch>> m_future; std::future<std::vector<PotentialMatch>> m_future;
Result m_result; Result m_result;
@ -173,8 +173,8 @@ private:
Hashes<bool> m_hashes_to_calculate{}; Hashes<bool> m_hashes_to_calculate{};
bool m_calculating_any_hash = false; bool m_calculating_any_hash = false;
unsigned long m_crc32_context = 0; unsigned long m_crc32_context = 0;
mbedtls_md5_context m_md5_context; mbedtls_md5_context m_md5_context{};
mbedtls_sha1_context m_sha1_context; mbedtls_sha1_context m_sha1_context{};
u64 m_excess_bytes = 0; u64 m_excess_bytes = 0;
std::vector<u8> m_data; std::vector<u8> m_data;

View File

@ -122,7 +122,7 @@ private:
Common::Lazy<std::vector<u8>> h3_table; Common::Lazy<std::vector<u8>> h3_table;
Common::Lazy<std::unique_ptr<FileSystem>> file_system; Common::Lazy<std::unique_ptr<FileSystem>> file_system;
Common::Lazy<u64> data_offset; Common::Lazy<u64> data_offset;
u32 type; u32 type = 0;
}; };
std::unique_ptr<BlobReader> m_reader; std::unique_ptr<BlobReader> m_reader;
@ -131,7 +131,7 @@ private:
bool m_encrypted; bool m_encrypted;
mutable u64 m_last_decrypted_block; 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 } // namespace DiscIO

View File

@ -168,7 +168,10 @@ private:
bool is_partition; bool is_partition;
u8 partition_data_index; 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_) DataEntry(size_t index_, size_t partition_data_index_)
: index(static_cast<u32>(index_)), is_partition(true), : index(static_cast<u32>(index_)), is_partition(true),
partition_data_index(static_cast<u8>(partition_data_index_)) partition_data_index(static_cast<u8>(partition_data_index_))
@ -281,11 +284,11 @@ private:
struct CompressParameters struct CompressParameters
{ {
std::vector<u8> data; std::vector<u8> data{};
const DataEntry* data_entry; const DataEntry* data_entry = nullptr;
u64 data_offset; u64 data_offset = 0;
u64 bytes_read; u64 bytes_read = 0;
size_t group_index; size_t group_index = 0;
}; };
struct WIAOutputParametersEntry struct WIAOutputParametersEntry
@ -312,8 +315,8 @@ private:
struct OutputParameters struct OutputParameters
{ {
std::vector<OutputParametersEntry> entries; std::vector<OutputParametersEntry> entries;
u64 bytes_read; u64 bytes_read = 0;
size_t group_index; size_t group_index = 0;
}; };
static bool PadTo4(File::IOFile* file, u64* bytes_written); static bool PadTo4(File::IOFile* file, u64* bytes_written);

View File

@ -141,7 +141,7 @@ private:
u32 m_rvz_packed_size; u32 m_rvz_packed_size;
u32 m_size = 0; u32 m_size = 0;
bool m_junk; bool m_junk = false;
LaggedFibonacciGenerator m_lfg; LaggedFibonacciGenerator m_lfg;
}; };
@ -178,7 +178,7 @@ public:
private: private:
std::vector<u8> m_buffer; std::vector<u8> m_buffer;
size_t m_bytes_written; size_t m_bytes_written = 0;
mbedtls_sha1_context m_sha1_context; mbedtls_sha1_context m_sha1_context;
}; };
@ -244,7 +244,7 @@ private:
void ExpandBuffer(size_t bytes_to_add); void ExpandBuffer(size_t bytes_to_add);
ZSTD_CStream* m_stream; ZSTD_CStream* m_stream;
ZSTD_outBuffer m_out_buffer; ZSTD_outBuffer m_out_buffer{};
std::vector<u8> m_buffer; std::vector<u8> m_buffer;
}; };

View File

@ -50,7 +50,7 @@ public:
private: private:
BlobReader* m_blob; BlobReader* m_blob;
std::unique_ptr<std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>> m_cache; std::unique_ptr<std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>> m_cache;
u64 m_cached_offset; u64 m_cached_offset = 0;
}; };
} // namespace DiscIO } // namespace DiscIO

View File

@ -52,7 +52,7 @@ private:
u32 AddInteger(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row); u32 AddInteger(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row);
u32 AddFloat(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<QSlider*> m_sliders;
std::vector<QLineEdit*> m_value_boxes; std::vector<QLineEdit*> m_value_boxes;

View File

@ -207,7 +207,7 @@ public:
private: private:
std::function<ControlState()> m_state_evaluator; 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, IOWindow::IOWindow(MappingWidget* parent, ControllerEmu::EmulatedController* controller,

View File

@ -35,10 +35,10 @@
struct CodeViewBranch struct CodeViewBranch
{ {
u32 src_addr; u32 src_addr = 0;
u32 dst_addr; u32 dst_addr = 0;
u32 indentation = 0; u32 indentation = 0;
bool is_link; bool is_link = false;
}; };
constexpr u32 WIDTH_PER_BRANCH_ARROW = 16; constexpr u32 WIDTH_PER_BRANCH_ARROW = 16;

View File

@ -21,7 +21,7 @@ protected:
private: private:
const TASInputWindow* m_parent; const TASInputWindow* m_parent;
int m_frame_turbo_started; int m_frame_turbo_started = 0;
int m_turbo_press_frames; int m_turbo_press_frames = 0;
int m_turbo_total_frames; int m_turbo_total_frames = 0;
}; };

View File

@ -58,9 +58,7 @@ std::optional<std::string> ControlReference::SetExpression(std::string expr)
return parse_result.description; return parse_result.description;
} }
ControlReference::ControlReference() : range(1), m_parsed_expression(nullptr) ControlReference::ControlReference() = default;
{
}
ControlReference::~ControlReference() = default; ControlReference::~ControlReference() = default;

View File

@ -41,13 +41,14 @@ public:
// Returns a human-readable error description when the given expression is invalid. // Returns a human-readable error description when the given expression is invalid.
std::optional<std::string> SetExpression(std::string expr); std::optional<std::string> SetExpression(std::string expr);
ControlState range; ControlState range = 1;
protected: protected:
ControlReference(); ControlReference();
std::string m_expression; std::string m_expression;
std::unique_ptr<ciface::ExpressionParser::Expression> m_parsed_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 <> template <>

View File

@ -181,7 +181,7 @@ public:
static ParseResult MakeSuccessfulResult(std::unique_ptr<Expression>&& expr); static ParseResult MakeSuccessfulResult(std::unique_ptr<Expression>&& expr);
static ParseResult MakeErrorResult(Token token, std::string description); static ParseResult MakeErrorResult(Token token, std::string description);
ParseStatus status; ParseStatus status = ParseStatus::EmptyExpression;
std::unique_ptr<Expression> expr; std::unique_ptr<Expression> expr;
// Used for parse errors: // Used for parse errors:

View File

@ -174,7 +174,7 @@ protected:
void AddCombinedInput(std::string name, const std::pair<std::string, std::string>& inputs); void AddCombinedInput(std::string name, const std::pair<std::string, std::string>& inputs);
private: private:
int m_id; int m_id = 0;
std::vector<Input*> m_inputs; std::vector<Input*> m_inputs;
std::vector<Output*> m_outputs; std::vector<Output*> m_outputs;
}; };
@ -216,10 +216,10 @@ public:
struct InputDetection struct InputDetection
{ {
std::shared_ptr<Device> device; std::shared_ptr<Device> device;
Device::Input* input; Device::Input* input = nullptr;
Clock::time_point press_time; Clock::time_point press_time;
std::optional<Clock::time_point> release_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; Device::Input* FindInput(std::string_view name, const Device* def_dev) const;

View File

@ -177,9 +177,6 @@ Joystick::Joystick(const LPDIRECTINPUTDEVICE8 device) : m_device(device)
InitForceFeedback(m_device, num_ff_axes); InitForceFeedback(m_device, num_ff_axes);
} }
// Zero inputs:
m_state_in = {};
// Set hats to center: // Set hats to center:
// "The center position is normally reported as -1" -MSDN // "The center position is normally reported as -1" -MSDN
std::fill(std::begin(m_state_in.rgdwPOV), std::end(m_state_in.rgdwPOV), -1); std::fill(std::begin(m_state_in.rgdwPOV), std::end(m_state_in.rgdwPOV), -1);

View File

@ -70,7 +70,7 @@ public:
private: private:
const LPDIRECTINPUTDEVICE8 m_device; const LPDIRECTINPUTDEVICE8 m_device;
DIJOYSTATE m_state_in; DIJOYSTATE m_state_in{};
bool m_buffered; bool m_buffered;
}; };

View File

@ -22,10 +22,10 @@ class KeyboardMouse : public Core::Device
private: private:
struct State struct State
{ {
BYTE keyboard[256]; BYTE keyboard[256]{};
// Old smoothed relative mouse movement. // Old smoothed relative mouse movement.
DIMOUSESTATE2 mouse; DIMOUSESTATE2 mouse{};
// Normalized mouse cursor position. // Normalized mouse cursor position.
Common::TVec2<ControlState> cursor; Common::TVec2<ControlState> cursor;

View File

@ -191,7 +191,7 @@ struct Server
std::string m_description; std::string m_description;
std::string m_address; std::string m_address;
u16 m_port; 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; sf::UdpSocket m_socket;
SteadyClock::time_point m_disconnect_time = SteadyClock::now(); SteadyClock::time_point m_disconnect_time = SteadyClock::now();
}; };

View File

@ -30,16 +30,16 @@ enum PadButton
struct GCPadStatus struct GCPadStatus
{ {
u16 button; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits u16 button = 0; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
u8 stickX; // 0 <= stickX <= 255 u8 stickX = 0; // 0 <= stickX <= 255
u8 stickY; // 0 <= stickY <= 255 u8 stickY = 0; // 0 <= stickY <= 255
u8 substickX; // 0 <= substickX <= 255 u8 substickX = 0; // 0 <= substickX <= 255
u8 substickY; // 0 <= substickY <= 255 u8 substickY = 0; // 0 <= substickY <= 255
u8 triggerLeft; // 0 <= triggerLeft <= 255 u8 triggerLeft = 0; // 0 <= triggerLeft <= 255
u8 triggerRight; // 0 <= triggerRight <= 255 u8 triggerRight = 0; // 0 <= triggerRight <= 255
u8 analogA; // 0 <= analogA <= 255 u8 analogA = 0; // 0 <= analogA <= 255
u8 analogB; // 0 <= analogB <= 255 u8 analogB = 0; // 0 <= analogB <= 255
bool isConnected{true}; bool isConnected = true;
static const u8 MAIN_STICK_CENTER_X = 0x80; static const u8 MAIN_STICK_CENTER_X = 0x80;
static const u8 MAIN_STICK_CENTER_Y = 0x80; static const u8 MAIN_STICK_CENTER_Y = 0x80;

View File

@ -23,11 +23,11 @@ struct NetPlaySession
std::string game_id; std::string game_id;
std::string version; std::string version;
int player_count; int player_count = 0;
int port; int port = 0;
bool has_password; bool has_password = false;
bool in_game; bool in_game = false;
bool EncryptID(std::string_view password); bool EncryptID(std::string_view password);
std::optional<std::string> DecryptID(std::string_view password) const; std::optional<std::string> DecryptID(std::string_view password) const;

View File

@ -49,7 +49,7 @@ struct TodoList
struct DownloadOp struct DownloadOp
{ {
Manifest::Filename filename; Manifest::Filename filename;
Manifest::Hash hash; Manifest::Hash hash{};
}; };
std::vector<DownloadOp> to_download; std::vector<DownloadOp> to_download;
@ -57,14 +57,14 @@ struct TodoList
{ {
Manifest::Filename filename; Manifest::Filename filename;
std::optional<Manifest::Hash> old_hash; std::optional<Manifest::Hash> old_hash;
Manifest::Hash new_hash; Manifest::Hash new_hash{};
}; };
std::vector<UpdateOp> to_update; std::vector<UpdateOp> to_update;
struct DeleteOp struct DeleteOp
{ {
Manifest::Filename filename; Manifest::Filename filename;
Manifest::Hash old_hash; Manifest::Hash old_hash{};
}; };
std::vector<DeleteOp> to_delete; std::vector<DeleteOp> to_delete;

View File

@ -26,7 +26,7 @@ private:
struct ActiveQuery struct ActiveQuery
{ {
ComPtr<ID3D11Query> query; ComPtr<ID3D11Query> query;
PerfQueryGroup query_type; PerfQueryGroup query_type{};
}; };
void WeakFlush(); void WeakFlush();

View File

@ -34,7 +34,7 @@ private:
ComPtr<ID3D12Resource> m_gpu_buffer; ComPtr<ID3D12Resource> m_gpu_buffer;
ComPtr<ID3D12Resource> m_readback_buffer; ComPtr<ID3D12Resource> m_readback_buffer;
StreamBuffer m_upload_buffer; StreamBuffer m_upload_buffer;
DescriptorHandle m_gpu_descriptor; DescriptorHandle m_gpu_descriptor{};
}; };
} // namespace DX12 } // namespace DX12

View File

@ -66,7 +66,7 @@ private:
u32 m_descriptor_increment_size = 0; u32 m_descriptor_increment_size = 0;
u32 m_current_offset = 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; std::unordered_map<SamplerState::StorageType, D3D12_CPU_DESCRIPTOR_HANDLE> m_sampler_map;
}; };

View File

@ -59,7 +59,7 @@ struct PipelineProgramKeyHash
struct PipelineProgram struct PipelineProgram
{ {
PipelineProgramKey key; PipelineProgramKey key{};
SHADER shader; SHADER shader;
std::atomic_size_t reference_count{1}; std::atomic_size_t reference_count{1};
bool binary_retrieved = false; bool binary_retrieved = false;

View File

@ -25,6 +25,6 @@ protected:
void SetFormat(u8 attributeIndex, u8 primitiveType); void SetFormat(u8 attributeIndex, u8 primitiveType);
void ParseVertex(const PortableVertexDeclaration& vdec, int index); void ParseVertex(const PortableVertexDeclaration& vdec, int index);
InputVertexData m_vertex; InputVertexData m_vertex{};
SetupUnit m_setup_unit; SetupUnit m_setup_unit;
}; };

View File

@ -8,12 +8,12 @@
class SetupUnit class SetupUnit
{ {
u8 m_PrimType; u8 m_PrimType = 0;
int m_VertexCounter; int m_VertexCounter = 0;
OutputVertexData m_Vertices[3]; OutputVertexData m_Vertices[3];
OutputVertexData* m_VertPointer[3]; OutputVertexData* m_VertPointer[3]{};
OutputVertexData* m_VertWritePointer; OutputVertexData* m_VertWritePointer{};
void SetupQuad(); void SetupQuad();
void SetupTriangle(); void SetupTriangle();

View File

@ -11,7 +11,7 @@ class Vec3
public: public:
float x, y, z; float x, y, z;
Vec3() {} Vec3() = default;
explicit Vec3(float f) { x = y = z = f; } explicit Vec3(float f) { x = y = z = f; }
explicit Vec3(const float* f) explicit Vec3(const float* f)
{ {

View File

@ -120,7 +120,7 @@ private:
u64 m_completed_fence_counter = 0; u64 m_completed_fence_counter = 0;
std::array<FrameResources, NUM_COMMAND_BUFFERS> m_frame_resources; std::array<FrameResources, NUM_COMMAND_BUFFERS> m_frame_resources;
u32 m_current_frame; u32 m_current_frame = 0;
// Threaded command buffer execution // Threaded command buffer execution
// Semaphore determines when a command buffer can be queued // Semaphore determines when a command buffer can be queued

View File

@ -86,7 +86,7 @@ private:
struct SwapChainImage struct SwapChainImage
{ {
VkImage image; VkImage image{};
std::unique_ptr<VKTexture> texture; std::unique_ptr<VKTexture> texture;
std::unique_ptr<VKFramebuffer> framebuffer; std::unique_ptr<VKFramebuffer> framebuffer;
}; };

Some files were not shown because too many files have changed in this diff Show More