14164
|
1 |
#include "runqueue.h"
|
|
2 |
|
|
3 |
#include "flib.h"
|
|
4 |
|
|
5 |
extern "C" {
|
|
6 |
extern RunEngine_t* flibRunEngine;
|
|
7 |
extern ipcToEngineRaw_t* flibIpcToEngineRaw;
|
|
8 |
extern ipcSetEngineBarrier_t* flibIpcSetEngineBarrier;
|
|
9 |
extern ipcRemoveBarrierFromEngineQueue_t* flibIpcRemoveBarrierFromEngineQueue;
|
|
10 |
}
|
|
11 |
|
|
12 |
RunQueue::RunQueue(QObject* parent)
|
|
13 |
: QObject(parent)
|
|
14 |
{
|
|
15 |
}
|
|
16 |
|
|
17 |
void RunQueue::queue(const GameConfig& config)
|
|
18 |
{
|
|
19 |
m_runQueue.prepend(config);
|
|
20 |
|
|
21 |
flibIpcSetEngineBarrier();
|
|
22 |
for (const QByteArray& b : m_runQueue.last().config()) {
|
|
23 |
flibIpcToEngineRaw(b.data(), b.size());
|
|
24 |
}
|
|
25 |
|
|
26 |
if (m_runQueue.size() == 1)
|
|
27 |
nextRun();
|
|
28 |
}
|
|
29 |
|
|
30 |
void RunQueue::onGameFinished()
|
|
31 |
{
|
|
32 |
m_runQueue.pop_front();
|
|
33 |
|
|
34 |
nextRun();
|
|
35 |
}
|
|
36 |
|
|
37 |
void RunQueue::nextRun()
|
|
38 |
{
|
|
39 |
if (!m_runQueue.isEmpty()) {
|
|
40 |
if (m_runQueue[0].isPreview())
|
|
41 |
emit previewIsRendering();
|
|
42 |
|
|
43 |
flibIpcRemoveBarrierFromEngineQueue();
|
|
44 |
|
|
45 |
flibRunEngine(m_runQueue[0].argc(), m_runQueue[0].argv());
|
|
46 |
}
|
|
47 |
}
|