forked from dolphin-emu/dolphin
clang-format'ed over every touched file
This commit is contained in:
@@ -11,11 +11,11 @@
|
|||||||
#include "Core/HW/EXI/EXI_DeviceAGP.h"
|
#include "Core/HW/EXI/EXI_DeviceAGP.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceDummy.h"
|
#include "Core/HW/EXI/EXI_DeviceDummy.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceEthernetTAP.h"
|
#include "Core/HW/EXI/EXI_DeviceEthernetTAP.h"
|
||||||
|
#include "Core/HW/EXI/EXI_DeviceEthernetTCP.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceGecko.h"
|
#include "Core/HW/EXI/EXI_DeviceGecko.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceIPL.h"
|
#include "Core/HW/EXI/EXI_DeviceIPL.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceMemoryCard.h"
|
#include "Core/HW/EXI/EXI_DeviceMemoryCard.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceMic.h"
|
#include "Core/HW/EXI/EXI_DeviceMic.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceEthernetTCP.h"
|
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
|
|
||||||
namespace ExpansionInterface
|
namespace ExpansionInterface
|
||||||
|
@@ -47,7 +47,6 @@ CEXIEthernetBase::CEXIEthernetBase()
|
|||||||
mac_addr = parsed.value();
|
mac_addr = parsed.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
memcpy(&m_bba_mem[BBA_NAFR_PAR0], mac_addr.data(), mac_addr.size());
|
memcpy(&m_bba_mem[BBA_NAFR_PAR0], mac_addr.data(), mac_addr.size());
|
||||||
|
|
||||||
// HACK: .. fully established 100BASE-T link
|
// HACK: .. fully established 100BASE-T link
|
||||||
@@ -582,4 +581,4 @@ wait_for_next:
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
} // namespace ExpansionInterface
|
||||||
|
@@ -7,8 +7,8 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <vector>
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#include <vector>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Common/Flag.h"
|
#include "Common/Flag.h"
|
||||||
|
@@ -2,12 +2,12 @@
|
|||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "Core/HW/EXI/EXI_DeviceEthernetTAP_Win32.h"
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceEthernetTAP.h"
|
#include "Core/HW/EXI/EXI_DeviceEthernetTAP.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceEthernetTAP_Win32.h"
|
|
||||||
|
|
||||||
namespace Win32TAPHelper
|
namespace Win32TAPHelper
|
||||||
{
|
{
|
||||||
|
@@ -39,7 +39,8 @@ bool CEXIEthernetTCP::Activate()
|
|||||||
DEBUG_LOG(SP1, "Connecting...");
|
DEBUG_LOG(SP1, "Connecting...");
|
||||||
|
|
||||||
m_socket = std::make_unique<sf::TcpSocket>();
|
m_socket = std::make_unique<sf::TcpSocket>();
|
||||||
const sf::Socket::Status status = m_socket->connect(SConfig::GetInstance().m_bba_server, SConfig::GetInstance().m_bba_port);
|
const sf::Socket::Status status =
|
||||||
|
m_socket->connect(SConfig::GetInstance().m_bba_server, SConfig::GetInstance().m_bba_port);
|
||||||
if (status != sf::Socket::Done)
|
if (status != sf::Socket::Done)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Could not connect: %i", status);
|
ERROR_LOG(SP1, "Could not connect: %i", status);
|
||||||
@@ -102,9 +103,13 @@ void CEXIEthernetTCP::ReadThreadHandler(CEXIEthernetTCP* self)
|
|||||||
selector.add(*self->m_socket);
|
selector.add(*self->m_socket);
|
||||||
|
|
||||||
// are we currently waiting for size (4 bytes) or payload?
|
// are we currently waiting for size (4 bytes) or payload?
|
||||||
enum class SocketState { Size, Payload };
|
enum class SocketState
|
||||||
|
{
|
||||||
|
Size,
|
||||||
|
Payload
|
||||||
|
};
|
||||||
|
|
||||||
SocketState state { SocketState::Size };
|
SocketState state{SocketState::Size};
|
||||||
|
|
||||||
// buffer to store size temporarily
|
// buffer to store size temporarily
|
||||||
u8 size_buffer[sizeof(int)];
|
u8 size_buffer[sizeof(int)];
|
||||||
@@ -138,13 +143,13 @@ void CEXIEthernetTCP::ReadThreadHandler(CEXIEthernetTCP* self)
|
|||||||
|
|
||||||
// Have we got all bytes for size?
|
// Have we got all bytes for size?
|
||||||
offset += received;
|
offset += received;
|
||||||
if(offset < sizeof(int))
|
if (offset < sizeof(int))
|
||||||
continue;
|
continue;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
// convert char array to size int
|
// convert char array to size int
|
||||||
size = 0;
|
size = 0;
|
||||||
for(int i = 0; i < sizeof(int); i++)
|
for (int i = 0; i < sizeof(int); i++)
|
||||||
size |= size_buffer[i] << (i * 8);
|
size |= size_buffer[i] << (i * 8);
|
||||||
|
|
||||||
DEBUG_LOG(SP1, "Finished size %i", size);
|
DEBUG_LOG(SP1, "Finished size %i", size);
|
||||||
@@ -170,7 +175,7 @@ void CEXIEthernetTCP::ReadThreadHandler(CEXIEthernetTCP* self)
|
|||||||
|
|
||||||
// Have we got all bytes for payload?
|
// Have we got all bytes for payload?
|
||||||
offset += received;
|
offset += received;
|
||||||
if(offset < size)
|
if (offset < size)
|
||||||
continue;
|
continue;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
|
@@ -9,7 +9,10 @@
|
|||||||
#include "Common/Flag.h"
|
#include "Common/Flag.h"
|
||||||
#include "Core/HW/EXI/EXI_DeviceEthernetBase.h"
|
#include "Core/HW/EXI/EXI_DeviceEthernetBase.h"
|
||||||
|
|
||||||
namespace sf { class TcpSocket; }
|
namespace sf
|
||||||
|
{
|
||||||
|
class TcpSocket;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ExpansionInterface
|
namespace ExpansionInterface
|
||||||
{
|
{
|
||||||
|
@@ -4,21 +4,19 @@
|
|||||||
|
|
||||||
#include "DolphinQt/BBAClient.h"
|
#include "DolphinQt/BBAClient.h"
|
||||||
|
|
||||||
#include <QTcpSocket>
|
|
||||||
#include <QHostAddress>
|
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
|
#include <QHostAddress>
|
||||||
|
#include <QTcpSocket>
|
||||||
|
|
||||||
#include "DolphinQt/BBAServer.h"
|
|
||||||
#include "DolphinQt/BBADebug.h"
|
#include "DolphinQt/BBADebug.h"
|
||||||
|
#include "DolphinQt/BBAServer.h"
|
||||||
|
|
||||||
BBAClient::BBAClient(QTcpSocket &socket, BBAServer &server) :
|
BBAClient::BBAClient(QTcpSocket& socket, BBAServer& server)
|
||||||
QObject(&server),
|
: QObject(&server), m_socket(socket), m_server(server)
|
||||||
m_socket(socket),
|
|
||||||
m_server(server)
|
|
||||||
{
|
{
|
||||||
m_socket.setParent(this);
|
m_socket.setParent(this);
|
||||||
connect(&m_socket, &QIODevice::readyRead, this, &BBAClient::ReadyRead);
|
connect(&m_socket, &QIODevice::readyRead, this, &BBAClient::ReadyRead);
|
||||||
connect(&m_socket, &QAbstractSocket::disconnected, this, [this](){
|
connect(&m_socket, &QAbstractSocket::disconnected, this, [this]() {
|
||||||
LogInfo() << m_socket.peerAddress() << m_socket.peerPort() << "disconnected";
|
LogInfo() << m_socket.peerAddress() << m_socket.peerPort() << "disconnected";
|
||||||
deleteLater();
|
deleteLater();
|
||||||
});
|
});
|
||||||
@@ -31,7 +29,7 @@ BBADebug BBAClient::LogInfo()
|
|||||||
return m_server.LogInfo();
|
return m_server.LogInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BBAClient::SendMessage(const QByteArray &buffer)
|
void BBAClient::SendMessage(const QByteArray& buffer)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
QDataStream data_stream(&m_socket);
|
QDataStream data_stream(&m_socket);
|
||||||
@@ -47,7 +45,7 @@ void BBAClient::ReadyRead()
|
|||||||
|
|
||||||
while (m_buffer.size())
|
while (m_buffer.size())
|
||||||
{
|
{
|
||||||
switch(m_state)
|
switch (m_state)
|
||||||
{
|
{
|
||||||
case SocketState::Size:
|
case SocketState::Size:
|
||||||
if (m_buffer.size() < sizeof(int))
|
if (m_buffer.size() < sizeof(int))
|
||||||
|
@@ -16,29 +16,30 @@ class BBAClient : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BBAClient(QTcpSocket &socket, BBAServer &server);
|
explicit BBAClient(QTcpSocket& socket, BBAServer& server);
|
||||||
|
|
||||||
BBADebug LogInfo();
|
BBADebug LogInfo();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ReceivedMessage(const QByteArray &buffer);
|
void ReceivedMessage(const QByteArray& buffer);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void SendMessage(const QByteArray &buffer);
|
void SendMessage(const QByteArray& buffer);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ReadyRead();
|
void ReadyRead();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class SocketState {
|
enum class SocketState
|
||||||
|
{
|
||||||
Size,
|
Size,
|
||||||
Payload
|
Payload
|
||||||
};
|
};
|
||||||
|
|
||||||
QTcpSocket &m_socket;
|
QTcpSocket& m_socket;
|
||||||
BBAServer &m_server;
|
BBAServer& m_server;
|
||||||
|
|
||||||
QByteArray m_buffer;
|
QByteArray m_buffer;
|
||||||
SocketState m_state { SocketState::Size };
|
SocketState m_state{SocketState::Size};
|
||||||
int m_size;
|
int m_size;
|
||||||
};
|
};
|
||||||
|
@@ -8,9 +8,7 @@
|
|||||||
|
|
||||||
#include "DolphinQt/BBAServer.h"
|
#include "DolphinQt/BBAServer.h"
|
||||||
|
|
||||||
BBADebug::BBADebug(BBAServer &server) :
|
BBADebug::BBADebug(BBAServer& server) : QDebug(&m_log_line), m_server(server)
|
||||||
QDebug(&m_log_line),
|
|
||||||
m_server(server)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,10 +11,10 @@ class BBAServer;
|
|||||||
class BBADebug : public QDebug
|
class BBADebug : public QDebug
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit BBADebug(BBAServer &server);
|
explicit BBADebug(BBAServer& server);
|
||||||
~BBADebug();
|
~BBADebug();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BBAServer &m_server;
|
BBAServer& m_server;
|
||||||
QString m_log_line;
|
QString m_log_line;
|
||||||
};
|
};
|
||||||
|
@@ -4,32 +4,31 @@
|
|||||||
|
|
||||||
#include "DolphinQt/BBAServer.h"
|
#include "DolphinQt/BBAServer.h"
|
||||||
|
|
||||||
#include <QTcpServer>
|
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
|
#include <QTcpServer>
|
||||||
#include <QTimerEvent>
|
#include <QTimerEvent>
|
||||||
|
|
||||||
#include "DolphinQt/BBAClient.h"
|
#include "DolphinQt/BBAClient.h"
|
||||||
#include "DolphinQt/BBADebug.h"
|
#include "DolphinQt/BBADebug.h"
|
||||||
|
|
||||||
BBAServer::BBAServer(QObject *parent) :
|
BBAServer::BBAServer(QObject* parent) : QObject(parent), m_server(*new QTcpServer(this))
|
||||||
QObject(parent),
|
|
||||||
m_server(*new QTcpServer(this))
|
|
||||||
{
|
{
|
||||||
connect(&m_server, &QTcpServer::newConnection, this, &BBAServer::NewConnection);
|
connect(&m_server, &QTcpServer::newConnection, this, &BBAServer::NewConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BBAServer::Listen(const QHostAddress &address, quint16 port)
|
bool BBAServer::Listen(const QHostAddress& address, quint16 port)
|
||||||
{
|
{
|
||||||
const auto result = m_server.listen(address, port);
|
const auto result = m_server.listen(address, port);
|
||||||
if (result)
|
if (result)
|
||||||
LogInfo() << "Started listening on" << address << port;
|
LogInfo() << "Started listening on" << address << port;
|
||||||
else
|
else
|
||||||
LogInfo() << "Could not start listening on" << address << port << "because" << m_server.errorString();
|
LogInfo() << "Could not start listening on" << address << port << "because"
|
||||||
|
<< m_server.errorString();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BBAServer::Listen(const QString &address, quint16 port)
|
bool BBAServer::Listen(const QString& address, quint16 port)
|
||||||
{
|
{
|
||||||
return Listen(address.isEmpty() ? QHostAddress::Any : QHostAddress(address), port);
|
return Listen(address.isEmpty() ? QHostAddress::Any : QHostAddress(address), port);
|
||||||
}
|
}
|
||||||
@@ -81,7 +80,7 @@ void BBAServer::ResumeAccepting()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_NETWORKPROXY
|
#ifndef QT_NO_NETWORKPROXY
|
||||||
void BBAServer::SetProxy(const QNetworkProxy &network_proxy)
|
void BBAServer::SetProxy(const QNetworkProxy& network_proxy)
|
||||||
{
|
{
|
||||||
m_server.setProxy(network_proxy);
|
m_server.setProxy(network_proxy);
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ BBADebug BBAServer::LogInfo()
|
|||||||
return BBADebug(*this);
|
return BBADebug(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BBAServer::timerEvent(QTimerEvent *ev)
|
void BBAServer::timerEvent(QTimerEvent* ev)
|
||||||
{
|
{
|
||||||
if (ev->timerId() == m_timer_id)
|
if (ev->timerId() == m_timer_id)
|
||||||
{
|
{
|
||||||
@@ -120,15 +119,15 @@ void BBAServer::NewConnection()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto* client = new BBAClient(*socket, *this);
|
auto* client = new BBAClient(*socket, *this);
|
||||||
for(auto* other_client : m_clients)
|
for (auto* other_client : m_clients)
|
||||||
{
|
{
|
||||||
connect(client, &BBAClient::ReceivedMessage, other_client, &BBAClient::SendMessage);
|
connect(client, &BBAClient::ReceivedMessage, other_client, &BBAClient::SendMessage);
|
||||||
connect(other_client, &BBAClient::ReceivedMessage, client, &BBAClient::SendMessage);
|
connect(other_client, &BBAClient::ReceivedMessage, client, &BBAClient::SendMessage);
|
||||||
}
|
}
|
||||||
if (m_timer_id == -1)
|
if (m_timer_id == -1)
|
||||||
m_timer_id = startTimer(1000);
|
m_timer_id = startTimer(1000);
|
||||||
connect(client, &BBAClient::ReceivedMessage, this, [&counter=m_counter](){ counter++; });
|
connect(client, &BBAClient::ReceivedMessage, this, [& counter = m_counter]() { counter++; });
|
||||||
connect(client, &QObject::destroyed, this, [client,this](){
|
connect(client, &QObject::destroyed, this, [client, this]() {
|
||||||
m_clients.remove(client);
|
m_clients.remove(client);
|
||||||
if (m_clients.empty() && m_timer_id != -1)
|
if (m_clients.empty() && m_timer_id != -1)
|
||||||
killTimer(m_timer_id);
|
killTimer(m_timer_id);
|
||||||
|
@@ -19,10 +19,10 @@ class BBAServer : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BBAServer(QObject *parent = nullptr);
|
explicit BBAServer(QObject* parent = nullptr);
|
||||||
|
|
||||||
bool Listen(const QHostAddress &address, quint16 port = 0);
|
bool Listen(const QHostAddress& address, quint16 port = 0);
|
||||||
bool Listen(const QString &address, quint16 port = 0);
|
bool Listen(const QString& address, quint16 port = 0);
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
bool IsListening() const;
|
bool IsListening() const;
|
||||||
@@ -39,24 +39,24 @@ public:
|
|||||||
void ResumeAccepting();
|
void ResumeAccepting();
|
||||||
|
|
||||||
#ifndef QT_NO_NETWORKPROXY
|
#ifndef QT_NO_NETWORKPROXY
|
||||||
void SetProxy(const QNetworkProxy &network_proxy);
|
void SetProxy(const QNetworkProxy& network_proxy);
|
||||||
QNetworkProxy Proxy() const;
|
QNetworkProxy Proxy() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BBADebug LogInfo();
|
BBADebug LogInfo();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Information(const QDateTime ×tamp, const QString &message);
|
void Information(const QDateTime& timestamp, const QString& message);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *ev) override;
|
void timerEvent(QTimerEvent* ev) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void NewConnection();
|
void NewConnection();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSet<BBAClient*> m_clients;
|
QSet<BBAClient*> m_clients;
|
||||||
QTcpServer &m_server;
|
QTcpServer& m_server;
|
||||||
|
|
||||||
int m_counter = 0;
|
int m_counter = 0;
|
||||||
int m_timer_id = -1;
|
int m_timer_id = -1;
|
||||||
|
@@ -4,23 +4,21 @@
|
|||||||
|
|
||||||
#include "DolphinQt/BBAServerWindow.h"
|
#include "DolphinQt/BBAServerWindow.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QDialogButtonBox>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QPlainTextEdit>
|
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTime>
|
#include <QPlainTextEdit>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QTime>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
BBAServerWindow::BBAServerWindow(QWidget *parent) :
|
BBAServerWindow::BBAServerWindow(QWidget* parent) : QDialog(parent), m_server(this)
|
||||||
QDialog(parent),
|
|
||||||
m_server(this)
|
|
||||||
{
|
{
|
||||||
auto* vbox_layout = new QVBoxLayout(this);
|
auto* vbox_layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
@@ -78,15 +76,17 @@ void BBAServerWindow::Toggle()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!m_server.Listen(m_host_addr->text(), m_port->value()))
|
if (!m_server.Listen(m_host_addr->text(), m_port->value()))
|
||||||
QMessageBox::warning(this, tr("Could not start listening!"), tr("Could not start listening:\n\n%0").arg(m_server.ErrorString()));
|
QMessageBox::warning(this, tr("Could not start listening!"),
|
||||||
|
tr("Could not start listening:\n\n%0").arg(m_server.ErrorString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BBAServerWindow::LogOutput(const QDateTime ×tamp, const QString &log_line)
|
void BBAServerWindow::LogOutput(const QDateTime& timestamp, const QString& log_line)
|
||||||
{
|
{
|
||||||
m_log_output->appendPlainText(QStringLiteral("%0: %1").arg(timestamp.toString(QStringLiteral("HH:mm:ss.zzz")), log_line));
|
m_log_output->appendPlainText(
|
||||||
|
QStringLiteral("%0: %1").arg(timestamp.toString(QStringLiteral("HH:mm:ss.zzz")), log_line));
|
||||||
auto* scroll_bar = m_log_output->verticalScrollBar();
|
auto* scroll_bar = m_log_output->verticalScrollBar();
|
||||||
scroll_bar->setValue(scroll_bar->maximum());
|
scroll_bar->setValue(scroll_bar->maximum());
|
||||||
}
|
}
|
||||||
|
@@ -16,20 +16,20 @@ class BBAServerWindow : public QDialog
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit BBAServerWindow(QWidget *parent = nullptr);
|
explicit BBAServerWindow(QWidget* parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void Toggle();
|
void Toggle();
|
||||||
void LogOutput(const QDateTime ×tamp, const QString &log_line);
|
void LogOutput(const QDateTime& timestamp, const QString& log_line);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
BBAServer m_server;
|
BBAServer m_server;
|
||||||
|
|
||||||
QLineEdit *m_host_addr;
|
QLineEdit* m_host_addr;
|
||||||
QSpinBox *m_port;
|
QSpinBox* m_port;
|
||||||
QPushButton *m_toggle;
|
QPushButton* m_toggle;
|
||||||
|
|
||||||
QPlainTextEdit *m_log_output;
|
QPlainTextEdit* m_log_output;
|
||||||
};
|
};
|
||||||
|
@@ -3,18 +3,19 @@
|
|||||||
|
|
||||||
#include "DolphinQt/BBAServer.h"
|
#include "DolphinQt/BBAServer.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
QCoreApplication app(argc, argv);
|
QCoreApplication app(argc, argv);
|
||||||
|
|
||||||
BBAServer server(&app);
|
BBAServer server(&app);
|
||||||
|
|
||||||
QObject::connect(&server, &BBAServer::Information, [](const QDateTime ×tamp, const QString &logLine){
|
QObject::connect(&server, &BBAServer::Information,
|
||||||
|
[](const QDateTime& timestamp, const QString& logLine) {
|
||||||
Q_UNUSED(timestamp)
|
Q_UNUSED(timestamp)
|
||||||
qInfo().noquote() << logLine;
|
qInfo().noquote() << logLine;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!server.Listen(QString(), 50000))
|
if (!server.Listen(QString(), 50000))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
@@ -4,20 +4,19 @@
|
|||||||
|
|
||||||
#include "DolphinQt/Config/BBAConfigWidget.h"
|
#include "DolphinQt/Config/BBAConfigWidget.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QDialogButtonBox>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QToolButton>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QSpinBox>
|
#include <QLineEdit>
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "Common/Network.h"
|
#include "Common/Network.h"
|
||||||
|
|
||||||
BBAConfigWidget::BBAConfigWidget(bool show_server, QWidget* parent) :
|
BBAConfigWidget::BBAConfigWidget(bool show_server, QWidget* parent) : QDialog(parent)
|
||||||
QDialog(parent)
|
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Broadband Adapter Configuration"));
|
setWindowTitle(tr("Broadband Adapter Configuration"));
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
@@ -108,7 +107,7 @@ void BBAConfigWidget::SetPort(quint16 port)
|
|||||||
|
|
||||||
void BBAConfigWidget::Submit()
|
void BBAConfigWidget::Submit()
|
||||||
{
|
{
|
||||||
if(!MacAddr().isEmpty() && !Common::StringToMacAddress(MacAddr().toStdString()))
|
if (!MacAddr().isEmpty() && !Common::StringToMacAddress(MacAddr().toStdString()))
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Invalid MAC address!"), tr("Invalid MAC address!"));
|
QMessageBox::warning(this, tr("Invalid MAC address!"), tr("Invalid MAC address!"));
|
||||||
return;
|
return;
|
||||||
@@ -119,13 +118,14 @@ void BBAConfigWidget::Submit()
|
|||||||
|
|
||||||
void BBAConfigWidget::GenerateMac()
|
void BBAConfigWidget::GenerateMac()
|
||||||
{
|
{
|
||||||
m_mac_addr->setText(QString::fromStdString(Common::MacAddressToString(Common::GenerateMacAddress(Common::MACConsumer::BBA))));
|
m_mac_addr->setText(QString::fromStdString(
|
||||||
|
Common::MacAddressToString(Common::GenerateMacAddress(Common::MACConsumer::BBA))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BBAConfigWidget::TextChanged(const QString& text)
|
void BBAConfigWidget::TextChanged(const QString& text)
|
||||||
{
|
{
|
||||||
QString inputMask;
|
QString inputMask;
|
||||||
if(!text.isEmpty() && text != QStringLiteral(":::::"))
|
if (!text.isEmpty() && text != QStringLiteral(":::::"))
|
||||||
inputMask = QStringLiteral("HH:HH:HH:HH:HH:HH;_");
|
inputMask = QStringLiteral("HH:HH:HH:HH:HH:HH;_");
|
||||||
if (m_mac_addr->inputMask() != inputMask)
|
if (m_mac_addr->inputMask() != inputMask)
|
||||||
m_mac_addr->setInputMask(inputMask);
|
m_mac_addr->setInputMask(inputMask);
|
||||||
|
@@ -9,7 +9,8 @@
|
|||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QSpinBox;
|
class QSpinBox;
|
||||||
|
|
||||||
class BBAConfigWidget : public QDialog {
|
class BBAConfigWidget : public QDialog
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -30,7 +31,7 @@ private slots:
|
|||||||
void TextChanged(const QString& text);
|
void TextChanged(const QString& text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLineEdit *m_mac_addr;
|
QLineEdit* m_mac_addr;
|
||||||
QLineEdit *m_server { nullptr };
|
QLineEdit* m_server{nullptr};
|
||||||
QSpinBox *m_port { nullptr };
|
QSpinBox* m_port{nullptr};
|
||||||
};
|
};
|
||||||
|
@@ -200,7 +200,7 @@ void GameCubePane::OnConfigPressed(int slot)
|
|||||||
dialog.SetServer(QString::fromStdString(SConfig::GetInstance().m_bba_server));
|
dialog.SetServer(QString::fromStdString(SConfig::GetInstance().m_bba_server));
|
||||||
dialog.SetPort(SConfig::GetInstance().m_bba_port);
|
dialog.SetPort(SConfig::GetInstance().m_bba_port);
|
||||||
}
|
}
|
||||||
if(dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
SConfig::GetInstance().m_bba_mac = dialog.MacAddr().toStdString();
|
SConfig::GetInstance().m_bba_mac = dialog.MacAddr().toStdString();
|
||||||
if (is_tcp)
|
if (is_tcp)
|
||||||
|
Reference in New Issue
Block a user