diff --git a/QtScrcpy/device/controller/controller.cpp b/QtScrcpy/device/controller/controller.cpp index c4a5791..992b5bd 100644 --- a/QtScrcpy/device/controller/controller.cpp +++ b/QtScrcpy/device/controller/controller.cpp @@ -5,13 +5,18 @@ #include "videosocket.h" #include "controlmsg.h" #include "receiver.h" +#include "inputconvertgame.h" -Controller::Controller(QObject* parent) : QObject(parent) +Controller::Controller(bool supportGame, QObject* parent) : QObject(parent) { m_receiver = new Receiver(this); Q_ASSERT(m_receiver); - m_inputConvert = new InputConvertNormal(this); + if (supportGame) { + m_inputConvert = new InputConvertGame(this); + } else { + m_inputConvert = new InputConvertNormal(this); + } Q_ASSERT(m_inputConvert); connect(m_inputConvert, &InputConvertBase::grabCursor, this, &Controller::grabCursor); } diff --git a/QtScrcpy/device/controller/controller.h b/QtScrcpy/device/controller/controller.h index a2e99bf..9f6b962 100644 --- a/QtScrcpy/device/controller/controller.h +++ b/QtScrcpy/device/controller/controller.h @@ -4,15 +4,16 @@ #include #include -#include "inputconvertnormal.h" +#include "inputconvertbase.h" class QTcpSocket; class Receiver; +class InputConvertBase; class Controller : public QObject { Q_OBJECT public: - Controller(QObject* parent = Q_NULLPTR); + Controller(bool supportGame = false, QObject* parent = Q_NULLPTR); virtual ~Controller(); void setControlSocket(QTcpSocket* controlSocket); diff --git a/QtScrcpy/device/device.cpp b/QtScrcpy/device/device.cpp index 3a95f3a..20283fe 100644 --- a/QtScrcpy/device/device.cpp +++ b/QtScrcpy/device/device.cpp @@ -26,7 +26,7 @@ Device::Device(DeviceParams params, QObject *parent) m_vb->init(); m_decoder = new Decoder(m_vb, this); m_fileHandler = new FileHandler(this); - m_controller = new Controller(this); + m_controller = new Controller(params.supportGame, this); m_videoForm = new VideoForm(); m_videoForm->setSerial(m_params.serial); if (m_controller) { diff --git a/QtScrcpy/device/device.h b/QtScrcpy/device/device.h index 8697df3..1a0731f 100644 --- a/QtScrcpy/device/device.h +++ b/QtScrcpy/device/device.h @@ -25,6 +25,7 @@ public: bool closeScreen = false; // 启动时自动息屏 bool useReverse = true; // true:先使用adb reverse,失败后自动使用adb forward;false:直接使用adb forward bool display = true; // 是否显示画面(或者仅仅后台录制) + bool supportGame = false; // 是否支持游戏映射 }; explicit Device(DeviceParams params, QObject *parent = nullptr); virtual ~Device(); diff --git a/QtScrcpy/dialog.cpp b/QtScrcpy/dialog.cpp index 7a566b3..082af31 100644 --- a/QtScrcpy/dialog.cpp +++ b/QtScrcpy/dialog.cpp @@ -21,6 +21,8 @@ Dialog::Dialog(QWidget *parent) : bool newLine = true; switch (processResult) { + case AdbProcess::AER_ERROR_START: + break; case AdbProcess::AER_SUCCESS_START: log = "adb run"; newLine = false; @@ -131,6 +133,7 @@ void Dialog::on_startServerBtn_clicked() params.closeScreen = ui->closeScreenCheck->isChecked(); params.useReverse = ui->useReverseCheck->isChecked(); params.display = !ui->notDisplayCheck->isChecked(); + params.supportGame = ui->gameForPeaceCheck->isChecked(); m_deviceManage.connectDevice(params); /* diff --git a/QtScrcpy/dialog.ui b/QtScrcpy/dialog.ui index b8a0112..f794425 100644 --- a/QtScrcpy/dialog.ui +++ b/QtScrcpy/dialog.ui @@ -113,81 +113,7 @@ Start Config - - - - true - - - - - - - - - - - - - - - - - - - - record format: - - - - - - - - - - - - - - select path - - - false - - - - - - - always top - - - false - - - - - - - not display - - - false - - - - - - - record save path: - - - recordPathEdt - - - - + use reverse @@ -197,7 +123,41 @@ - + + + + + + + + + + + select path + + + false + + + + + + + record format: + + + + + + + video size: + + + + + + + close screen @@ -211,10 +171,57 @@ - - + + - video size: + record save path: + + + recordPathEdt + + + + + + + + + + + + + + + + + true + + + + + + + Game for Peace + + + + + + + always top + + + false + + + + + + + not display + + + false