SI_DeviceGBA: make GBASockServer a member instead of parent

This commit is contained in:
Michael Maltese 2017-03-31 14:13:48 -07:00
parent ff78327643
commit 05ab03a551
2 changed files with 7 additions and 6 deletions

View File

@ -293,14 +293,14 @@ int CSIDevice_GBA::RunBuffer(u8* buffer, int length)
{ {
case NextAction::SendCommand: case NextAction::SendCommand:
{ {
ClockSync(); m_sock_server.ClockSync();
if (Connect()) if (m_sock_server.Connect())
{ {
#ifdef _DEBUG #ifdef _DEBUG
NOTICE_LOG(SERIALINTERFACE, "%01d cmd %02x [> %02x%02x%02x%02x]", m_device_number, buffer[3], NOTICE_LOG(SERIALINTERFACE, "%01d cmd %02x [> %02x%02x%02x%02x]", m_device_number, buffer[3],
buffer[2], buffer[1], buffer[0], buffer[7]); buffer[2], buffer[1], buffer[0], buffer[7]);
#endif #endif
Send(buffer); m_sock_server.Send(buffer);
} }
m_last_cmd = buffer[3]; m_last_cmd = buffer[3];
m_timestamp_sent = CoreTiming::GetTicks(); m_timestamp_sent = CoreTiming::GetTicks();
@ -320,8 +320,8 @@ int CSIDevice_GBA::RunBuffer(u8* buffer, int length)
// [[fallthrough]] // [[fallthrough]]
case NextAction::ReceiveResponse: case NextAction::ReceiveResponse:
{ {
int num_data_received = Receive(buffer); int num_data_received = m_sock_server.Receive(buffer);
if (IsConnected()) if (m_sock_server.IsConnected())
{ {
#ifdef _DEBUG #ifdef _DEBUG
LogTypes::LOG_LEVELS log_level = (m_last_cmd == CMD_STATUS || m_last_cmd == CMD_RESET) ? LogTypes::LOG_LEVELS log_level = (m_last_cmd == CMD_STATUS || m_last_cmd == CMD_RESET) ?

View File

@ -40,7 +40,7 @@ private:
bool m_booted = false; bool m_booted = false;
}; };
class CSIDevice_GBA : public ISIDevice, private GBASockServer class CSIDevice_GBA : public ISIDevice
{ {
public: public:
CSIDevice_GBA(SIDevices device, int device_number); CSIDevice_GBA(SIDevices device, int device_number);
@ -58,6 +58,7 @@ private:
ReceiveResponse ReceiveResponse
}; };
GBASockServer m_sock_server;
NextAction m_next_action = NextAction::SendCommand; NextAction m_next_action = NextAction::SendCommand;
u8 m_last_cmd; u8 m_last_cmd;
u64 m_timestamp_sent = 0; u64 m_timestamp_sent = 0;