diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-07-24 22:33:24 +0200 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-07-24 22:33:24 +0200 |
| commit | 011e7b092a9d17f534ca2963dc25a25a1f145fe5 (patch) | |
| tree | 4823e3470254e1525c28a7931f39864d9181f30e | |
| parent | 453da65223ee4fcda2e8247f41b7950ed50be6ea (diff) | |
* Header data was being sent too quickly to PSX. Some sleep instructions have been placed to avoid this.
+ Provisional "stdout" dialog, still TODO.
| -rw-r--r-- | qpsxserial.cpp | 19 | ||||
| -rw-r--r-- | qpsxserial.h | 27 | ||||
| -rw-r--r-- | release/QPSXSerial.exe | bin | 49152 -> 49664 bytes | |||
| -rw-r--r-- | stdout_dialog.ui | 45 |
4 files changed, 74 insertions, 17 deletions
diff --git a/qpsxserial.cpp b/qpsxserial.cpp index 6bc0a5a..e9ace2f 100644 --- a/qpsxserial.cpp +++ b/qpsxserial.cpp @@ -12,7 +12,7 @@ QPSXSerial::QPSXSerial(QWidget *parent) : lost_packet_timer = new QTimer(); connect(lost_packet_timer, SIGNAL(timeout()), this, SLOT(onPacketLost())); - + connect(ui->stdout_Button, SIGNAL(released()), this, SLOT(onStdOutButtonReleased())); connect(ui->loadFile_Btn, SIGNAL(released()), this, SLOT(onLoadFileBtnReleased())); connect(ui->updatePorts_Btn, SIGNAL(released()), this, SLOT(onUpdatePortsBtnReleased())); connect(ui->send_Btn, SIGNAL(released()), this, SLOT(onSendBtnReleased())); @@ -43,6 +43,13 @@ QPSXSerial::~QPSXSerial() delete ui; } +void QPSXSerial::onStdOutButtonReleased(void) +{ + QDialog* dialog_ui = new QDialog(); + + dialog_ui->show(); +} + void QPSXSerial::onLoadFileBtnReleased(void) { selectedFolder = QFileDialog::getExistingDirectory( this, @@ -116,8 +123,6 @@ void QPSXSerial::onUpdatePortsBtnReleased(void) void QPSXSerial::onSendBtnReleased(void) { - qDebug() << serial.isOpen(); - if(serial.isOpen() == false) { if(selectedPort.isEmpty() == true) @@ -262,6 +267,8 @@ void QPSXSerial::onReadyRead(void) qDebug() << "sendData for file..."; sendData(file_data, filePath); + + f.close(); } else { @@ -326,12 +333,14 @@ bool QPSXSerial::sendExe(void) QByteArray data = f.read(2048 /* PSX-EXE header */); qDebug () << "Sending PSX-EXE header..."; - for(int i = 0; i < 32; i++) + for(int i = 0; i < 32; i+=8) { QByteArray send; write_ready = false; - send.append(data[i]); + QThread::msleep(100); + + send.append(data.mid(i, 8)); serial.write(send); diff --git a/qpsxserial.h b/qpsxserial.h index 2728ce3..4349f5b 100644 --- a/qpsxserial.h +++ b/qpsxserial.h @@ -9,6 +9,7 @@ #include <QThread> #include <QTime> #include <QWinTaskbarButton> +#include "ui_stdout_dialog.h" namespace Ui { class QPSXSerial; @@ -27,18 +28,19 @@ private: void sendData(QByteArray data, QString fileName); void sendDataSize(quint32 size); - Ui::QPSXSerial *ui; - QString inputExe; - QString selectedPort; - QString selectedFolder; - QSerialPort serial; - bool ack; - bool exe_sent; - QTimer* init_timer; - bool write_ready; - bool byte_sent_received; - QByteArray last_packet_sent; - QTimer* lost_packet_timer; + Ui::QPSXSerial *ui; + Ui::Stdout_Console *stdout_ui; + QString inputExe; + QString selectedPort; + QString selectedFolder; + QSerialPort serial; + bool ack; + bool exe_sent; + QTimer* init_timer; + bool write_ready; + bool byte_sent_received; + QByteArray last_packet_sent; + QTimer* lost_packet_timer; private slots: void onLoadFileBtnReleased(void); @@ -49,6 +51,7 @@ private slots: void onReadyRead(void); void connectToPSXTimeout(void); void onPacketLost(void); + void onStdOutButtonReleased(void); }; #endif // QPSXSERIAL_H diff --git a/release/QPSXSerial.exe b/release/QPSXSerial.exe Binary files differindex bc8b44e..7642f18 100644 --- a/release/QPSXSerial.exe +++ b/release/QPSXSerial.exe diff --git a/stdout_dialog.ui b/stdout_dialog.ui new file mode 100644 index 0000000..ad110c1 --- /dev/null +++ b/stdout_dialog.ui @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Stdout_Console</class> + <widget class="QMainWindow" name="Stdout_Console"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>258</height> + </rect> + </property> + <property name="windowTitle"> + <string>QPSXSerial</string> + </property> + <widget class="QWidget" name="centralWidget"> + <widget class="QPushButton" name="close_Button"> + <property name="geometry"> + <rect> + <x>340</x> + <y>230</y> + <width>51</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>Close</string> + </property> + </widget> + <widget class="QTextEdit" name="textEdit"> + <property name="geometry"> + <rect> + <x>30</x> + <y>20</y> + <width>341</width> + <height>201</height> + </rect> + </property> + </widget> + </widget> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections/> +</ui> |
