SI_DeviceGBA: In-class initialize variables

This commit is contained in:
Lioncash 2017-03-13 13:52:45 -04:00
parent 70b1933661
commit ea59d30e9f
2 changed files with 11 additions and 16 deletions

View File

@ -166,16 +166,12 @@ static bool GetNextClock(std::unique_ptr<sf::TcpSocket>& 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()

View File

@ -33,14 +33,14 @@ public:
private:
std::unique_ptr<sf::TcpSocket> client;
std::unique_ptr<sf::TcpSocket> 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;
};