From 011e7b092a9d17f534ca2963dc25a25a1f145fe5 Mon Sep 17 00:00:00 2001 From: XaviDCR92 Date: Mon, 24 Jul 2017 22:33:24 +0200 Subject: * Header data was being sent too quickly to PSX. Some sleep instructions have been placed to avoid this. + Provisional "stdout" dialog, still TODO. --- qpsxserial.cpp | 19 ++++++++++++++----- qpsxserial.h | 27 +++++++++++++++------------ release/QPSXSerial.exe | Bin 49152 -> 49664 bytes stdout_dialog.ui | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 17 deletions(-) create mode 100644 stdout_dialog.ui 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 #include #include +#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 index bc8b44e..7642f18 100644 Binary files a/release/QPSXSerial.exe and b/release/QPSXSerial.exe differ 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 @@ + + + Stdout_Console + + + + 0 + 0 + 400 + 258 + + + + QPSXSerial + + + + + + 340 + 230 + 51 + 23 + + + + Close + + + + + + 30 + 20 + 341 + 201 + + + + + + + + + -- cgit v1.2.3