From ea59d30e9f7cb1be7a92b70b55584788ff31e3d2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 13 Mar 2017 13:52:45 -0400 Subject: [PATCH] SI_DeviceGBA: In-class initialize variables --- Source/Core/Core/HW/SI/SI_DeviceGBA.cpp | 7 +------ Source/Core/Core/HW/SI/SI_DeviceGBA.h | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Source/Core/Core/HW/SI/SI_DeviceGBA.cpp b/Source/Core/Core/HW/SI/SI_DeviceGBA.cpp index 90f654ba65..1df88990b2 100644 --- a/Source/Core/Core/HW/SI/SI_DeviceGBA.cpp +++ b/Source/Core/Core/HW/SI/SI_DeviceGBA.cpp @@ -166,16 +166,12 @@ static bool GetNextClock(std::unique_ptr& sock_to_fill) return sock_filled; } -GBASockServer::GBASockServer(int _iDeviceNumber) +GBASockServer::GBASockServer(int _iDeviceNumber) : device_number{_iDeviceNumber} { if (!connectionThread.joinable()) connectionThread = std::thread(GBAConnectionWaiter); - cmd = 0; num_connected = 0; - last_time_slice = 0; - booted = false; - device_number = _iDeviceNumber; } GBASockServer::~GBASockServer() @@ -326,7 +322,6 @@ int GBASockServer::Receive(u8* si_buffer) CSIDevice_GBA::CSIDevice_GBA(SIDevices _device, int _iDeviceNumber) : ISIDevice(_device, _iDeviceNumber), GBASockServer(_iDeviceNumber) { - waiting_for_response = false; } CSIDevice_GBA::~CSIDevice_GBA() diff --git a/Source/Core/Core/HW/SI/SI_DeviceGBA.h b/Source/Core/Core/HW/SI/SI_DeviceGBA.h index 877b25efc8..09c6041bad 100644 --- a/Source/Core/Core/HW/SI/SI_DeviceGBA.h +++ b/Source/Core/Core/HW/SI/SI_DeviceGBA.h @@ -33,14 +33,14 @@ public: private: std::unique_ptr client; std::unique_ptr clock_sync; - char send_data[5]; - char recv_data[5]; + char send_data[5] = {}; + char recv_data[5] = {}; - u64 time_cmd_sent; - u64 last_time_slice; + u64 time_cmd_sent = 0; + u64 last_time_slice = 0; int device_number; - u8 cmd; - bool booted; + u8 cmd = 0; + bool booted = false; }; class CSIDevice_GBA : public ISIDevice, private GBASockServer @@ -55,8 +55,8 @@ public: bool GetData(u32& _Hi, u32& _Low) override { return false; } void SendCommand(u32 _Cmd, u8 _Poll) override {} private: - u8 send_data[5]; - int num_data_received; - u64 timestamp_sent; - bool waiting_for_response; + u8 send_data[5] = {}; + int num_data_received = 0; + u64 timestamp_sent = 0; + bool waiting_for_response = false; };