mirror of
https://github.com/libretro/Mu.git
synced 2026-09-23 15:15:43 +00:00
Debug path setting
for some reason nothing is written to the debug path
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.6.1, 2018-05-26T11:34:24. -->
|
||||
<!-- Written by QtCreator 4.6.1, 2018-05-29T11:40:09. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
@@ -32,6 +32,9 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
dependencyBlob = "";
|
||||
testProgram = "";
|
||||
|
||||
//temporary
|
||||
testEnv.setErrorPath("/Users/Hoppy/Desktop/projects/PalmEmuRedo/libretro-palmm515emu/localTester/jsError.log");
|
||||
|
||||
refreshWindow = new QTimer(this);
|
||||
connect(refreshWindow, SIGNAL(timeout()), this, SLOT(updateWindow()));
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdexcept>
|
||||
@@ -11,7 +12,7 @@
|
||||
|
||||
SerialPortIO::SerialPortIO(QString serialDeviceFilePath) : QObject(nullptr){
|
||||
deviceFilePath = serialDeviceFilePath;
|
||||
deviceFile = open(serialDeviceFilePath.toStdString().c_str(), O_RDWR | O_NOCTTY | O_NONBLOCK);
|
||||
deviceFile = open(serialDeviceFilePath.toStdString().c_str(), O_RDWR | O_NOCTTY);
|
||||
if(deviceFile < 0)
|
||||
throw std::invalid_argument("Cant open file!");
|
||||
}
|
||||
@@ -29,11 +30,11 @@ unsigned int SerialPortIO::bytesAvailable(){
|
||||
|
||||
void SerialPortIO::transmitUint8(unsigned int data){
|
||||
uint8_t realData = data;
|
||||
write(deviceFile, &realData, 1);
|
||||
send(deviceFile, &realData, 1, MSG_DONTWAIT);
|
||||
}
|
||||
|
||||
unsigned int SerialPortIO::receiveUint8(){
|
||||
uint8_t data = 0x00;
|
||||
read(deviceFile, &data, 1);
|
||||
recv(deviceFile, &data, 1, MSG_DONTWAIT);
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
TestExecutionEnviroment::TestExecutionEnviroment(){
|
||||
jsRunning = false;
|
||||
errorFilePath = "";
|
||||
lastProgramReturnValue = "";
|
||||
engine = new QJSEngine();
|
||||
}
|
||||
@@ -25,15 +26,19 @@ void TestExecutionEnviroment::jsThreadFunction(QString program, QString args, bo
|
||||
if(callMain){
|
||||
QJSValue jsGlobal = engine->globalObject();
|
||||
jsGlobal.setProperty("__programArgs", QJSValue(args));
|
||||
engine->evaluate(program);
|
||||
lastProgramReturnValue = engine->evaluate("main(__programArgs);").toString();
|
||||
engine->evaluate(program, errorFilePath);
|
||||
lastProgramReturnValue = engine->evaluate("main(__programArgs);", errorFilePath).toString();
|
||||
}
|
||||
else{
|
||||
engine->evaluate(program);
|
||||
engine->evaluate(program, errorFilePath);
|
||||
}
|
||||
jsRunning = false;
|
||||
}
|
||||
|
||||
void TestExecutionEnviroment::setErrorPath(QString path){
|
||||
errorFilePath = path;
|
||||
}
|
||||
|
||||
void TestExecutionEnviroment::clearExecutionEnviroment(){
|
||||
finish();
|
||||
engine->collectGarbage();
|
||||
|
||||
@@ -13,6 +13,7 @@ private:
|
||||
QJSEngine* engine;
|
||||
std::thread jsThread;
|
||||
std::atomic<bool> jsRunning;
|
||||
QString errorFilePath;
|
||||
QString lastProgramReturnValue;
|
||||
|
||||
void jsThreadFunction(QString program, QString args, bool callMain);
|
||||
@@ -21,6 +22,7 @@ public:
|
||||
TestExecutionEnviroment();
|
||||
~TestExecutionEnviroment();
|
||||
|
||||
void setErrorPath(QString path);
|
||||
void clearExecutionEnviroment();
|
||||
void installClass(QString name, QObject* jsClass);
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
var __BlobVersion = 1.0;
|
||||
var irdaCommands;
|
||||
var trapNames;
|
||||
var trapNumbers;
|
||||
var trapNameFromNumber;
|
||||
var trapNumberFromName;
|
||||
|
||||
|
||||
//constructors and converters
|
||||
@@ -1180,11 +1180,14 @@ var __trapList = [
|
||||
["sysTrapLastTrapNumber", 0xA475]
|
||||
];
|
||||
|
||||
for(var i in __trapList){
|
||||
trapNames[this[0]] = this[1];
|
||||
trapNumbers[this[1]] = this[0];
|
||||
/*
|
||||
//currently causing crasing, just disable for now
|
||||
for(var i = 0; i < __trapList.length; i++){
|
||||
trapNameFromNumber[__trapList[i][1]] = __trapList[i][0];
|
||||
trapNumberFromName[__trapList[i][0]] = __trapList[i][1];
|
||||
}
|
||||
__trapList = undefined;//free the memory
|
||||
*/
|
||||
//__trapList = undefined;//free the memory
|
||||
|
||||
|
||||
//functions
|
||||
@@ -1194,7 +1197,27 @@ jsSystem.validDependencyBlob = function (version){
|
||||
return false;
|
||||
}
|
||||
|
||||
serialPort.receiveBuffer = function (size){
|
||||
var array = [0];
|
||||
|
||||
for(var index = 0; index < size; index++)
|
||||
array[index] = serialPort.receiveUint8();
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
serialPort.flushFifo = function (){
|
||||
var buffer = [0];
|
||||
var size = serialPort.bytesAvailable();
|
||||
userIo.writeStringJs("Type of size:" + typeof size);
|
||||
jsSystem.uSleep(16666 * 2);
|
||||
serialPort.receiveBuffer(buffer, size);
|
||||
}
|
||||
|
||||
function isAlphanumeric(char){
|
||||
if(typeof char === 'string')
|
||||
char = char.charCodeAt(0);
|
||||
|
||||
if(!(char > 47 && char < 58)/*numeric (0-9)*/ && !(char > 64 && char < 91)/*upper alpha (A-Z)*/ && !(char > 96 && char < 123)/*lower alpha (a-z)*/)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
@@ -1,16 +1,27 @@
|
||||
function main(args){
|
||||
//copy 100 chars from the serial port to user output
|
||||
userIo.writeStringJs("Started, wating on serial port");
|
||||
var string;
|
||||
for(var count = 0; count < 100; count++){
|
||||
if(serialPort.bytesAvailable() > 0){
|
||||
var letter = serialPort.receiveUint8();
|
||||
var string = "";
|
||||
//userIo.writeStringJs("Type of serialPort:" + typeof serialPort);
|
||||
//userIo.writeStringJs(trapNameFromNumber[0xA474].toString());
|
||||
//userIo.writeStringJs("Type of serialPort.flushFifo:" + typeof serialPort.flushFifo);
|
||||
//serialPort.flushFifo = 2;
|
||||
//userIo.writeStringJs("Type of serialPort.flushFifo:" + typeof serialPort.flushFifo);
|
||||
userIo.writeStringJs("Blob is valid:" + jsSystem.validDependencyBlob(1.0).toString());
|
||||
userIo.writeStringJs("Bytes in FIFO before flush:" + serialPort.bytesAvailable().toString());
|
||||
serialPort.flushFifo();
|
||||
userIo.writeStringJs("Bytes in FIFO after flush:" + serialPort.bytesAvailable().toString());
|
||||
for(var count = 0; count < 10000; count++){
|
||||
//if(serialPort.bytesAvailable() > 0){
|
||||
var letter = String.fromCharCode(serialPort.receiveUint8());
|
||||
if(isAlphanumeric(letter))
|
||||
string += String.fromCharCode(letter);
|
||||
}
|
||||
else{
|
||||
jsSystem.uSleep(16666);
|
||||
}
|
||||
string += letter;
|
||||
else
|
||||
string += " ";
|
||||
//}
|
||||
//else{
|
||||
// jsSystem.uSleep(16666);
|
||||
//}
|
||||
}
|
||||
userIo.writeStringJs(string);
|
||||
userIo.writeStringJs("Ended");
|
||||
|
||||
Reference in New Issue
Block a user