PDA

View Full Version : Help with QProcess please



aguayro
19th March 2012, 00:43
hi, i have a simple code:



void lAtari2600(QString rom) {
QSettings settings("frontend.ini", QSettings::IniFormat);
QProcess *launchProcess = new QProcess;
QStringList comm;

comm << "z:/emu/Atari 2600/roms/Asterix (1988) (Atari) (PAL) [!].zip";
launchProcess->start( settings.value("Atari2600/StellaEXE").toString(), comm );
}


That works

but the next one doesnt work:


void lAtari2600(QString rom) {
QSettings settings("frontend.ini", QSettings::IniFormat);
QProcess *launchProcess = new QProcess;
QStringList comm;

comm << rom;
launchProcess->start( settings.value("Atari2600/StellaEXE").toString(), comm );
}


i've been hours with this but can't make it work.
any help?

wysota
19th March 2012, 00:52
Add a qDebug() statement outputting the contents of the "rom" variable to make sure the value passed is what you expect it to be.

aguayro
19th March 2012, 00:54
value its ok, qDebug() was the fits thing i did, all seems be ok, qDebug() output always shows the selected rom name:

("Z:/emu/Atari 2600/Roms/Asterix (1988) (Atari) (PAL) [!].zip") is the oputput of qDebug() << comm

wysota
19th March 2012, 01:06
Did you check the problem is not with StellaEXE failing to open the file or something? Does it get executed at all?

aguayro
19th March 2012, 01:09
Ok, was some strange character, it works with rom.simplified()

But, still doing strange things, now:

launchProcess->start( settings.value("Atari2600/StellaEXE").toString(), QStringList() << "-fullscreen 1" << rom.simplified() ); <---doesnt works

launchProcess->start( settings.value("Atari2600/StellaEXE").toString(), QStringList() << rom.simplified() ); <--- Works

this is killing me, a lot hours spent :(

if i type via cmd.exe: "z:\emu\atari 2600\Stella.exe" -fullscreen 1 "z:\emu\atari 2600\roms\Romname.zip" <-- works ok

aguayro
19th March 2012, 15:23
i think the problem coud be taht QProcess pass "-fullscreen 1" instead -fullscreen 1, if its quoted doesn't work, i tested it in windows command line
i've been 1 day stucked with this :(

wysota
19th March 2012, 15:43
You need to pass -fullscreen and 1 as two separate strings into your comm object.

aguayro
19th March 2012, 16:10
Thanks!!!! you saved my project!!
All is working fine now