mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-10 12:29:01 +00:00
Attempts to start updating a started machine.
No real progress on graphics output though.
This commit is contained in:
parent
11c28357a1
commit
e2ceb77501
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "../../Numeric/CRC.hpp"
|
#include "../../Numeric/CRC.hpp"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
General Qt implementation notes:
|
General Qt implementation notes:
|
||||||
|
|
||||||
@ -35,11 +36,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
|
|
||||||
connect(qTimer.get(), SIGNAL(timeout()), timer.get(), SLOT(tick()));
|
connect(qTimer.get(), SIGNAL(timeout()), timer.get(), SLOT(tick()));
|
||||||
|
|
||||||
// Start the thread and timer.
|
|
||||||
// TODO: not until there's actually something to display.
|
|
||||||
timerThread->start();
|
|
||||||
qTimer->start();
|
|
||||||
|
|
||||||
// Hide the missing ROMs box unless or until it's needed; grab the text it
|
// Hide the missing ROMs box unless or until it's needed; grab the text it
|
||||||
// began with as a prefix for future mutation.
|
// began with as a prefix for future mutation.
|
||||||
ui->missingROMsBox->setVisible(false);
|
ui->missingROMsBox->setVisible(false);
|
||||||
@ -144,12 +140,26 @@ void MainWindow::launchMachine() {
|
|||||||
std::unique_ptr<Machine::DynamicMachine> machine(Machine::MachineForTargets(targets, rom_fetcher, error));
|
std::unique_ptr<Machine::DynamicMachine> machine(Machine::MachineForTargets(targets, rom_fetcher, error));
|
||||||
|
|
||||||
switch(error) {
|
switch(error) {
|
||||||
default:
|
default: {
|
||||||
ui->missingROMsBox->setVisible(false);
|
ui->missingROMsBox->setVisible(false);
|
||||||
uiPhase = UIPhase::RunningMachine;
|
uiPhase = UIPhase::RunningMachine;
|
||||||
|
|
||||||
// TODO: launch machine.
|
// TODO: Install the OpenGL scan target.
|
||||||
break;
|
// This is subject to having created an OpenGL context.
|
||||||
|
// const auto scan_producer = machine->scan_producer();
|
||||||
|
// if(scan_producer) {
|
||||||
|
// scan_producer->set_scan_target(&scanTarget);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// If this is a timed machine, start up the timer.
|
||||||
|
const auto timedMachine = machine->timed_machine();
|
||||||
|
if(timedMachine) {
|
||||||
|
timer->setMachine(timedMachine);
|
||||||
|
timerThread->start();
|
||||||
|
qTimer->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
} break;
|
||||||
|
|
||||||
case Machine::Error::MissingROM: {
|
case Machine::Error::MissingROM: {
|
||||||
ui->missingROMsBox->setVisible(true);
|
ui->missingROMsBox->setVisible(true);
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "../../Analyser/Static/StaticAnalyser.hpp"
|
#include "../../Analyser/Static/StaticAnalyser.hpp"
|
||||||
#include "../../Machines/Utility/MachineForTarget.hpp"
|
#include "../../Machines/Utility/MachineForTarget.hpp"
|
||||||
|
#include "../../Outputs/OpenGL/ScanTarget.hpp"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
@ -42,6 +43,9 @@ class MainWindow : public QMainWindow {
|
|||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
void dropEvent(QDropEvent* event) override;
|
void dropEvent(QDropEvent* event) override;
|
||||||
|
|
||||||
|
// Output.
|
||||||
|
Outputs::Display::OpenGL::ScanTarget scanTarget;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void open();
|
void open();
|
||||||
};
|
};
|
||||||
|
@ -2,13 +2,19 @@
|
|||||||
|
|
||||||
#include "../../ClockReceiver/TimeTypes.hpp"
|
#include "../../ClockReceiver/TimeTypes.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
Timer::Timer(QObject *parent) : QObject(parent) {}
|
Timer::Timer(QObject *parent) : QObject(parent) {}
|
||||||
|
|
||||||
void Timer::tick() {
|
void Timer::setMachine(MachineTypes::TimedMachine *machine) {
|
||||||
// static int64_t last = 0;
|
this->machine = machine;
|
||||||
// const auto now = Time::nanos_now();
|
}
|
||||||
// qDebug() << now - last;
|
|
||||||
// last = now;
|
void Timer::tick() {
|
||||||
|
const auto now = Time::nanos_now();
|
||||||
|
const auto duration = std::min(now - lastTickNanos, int64_t(500'000));
|
||||||
|
lastTickNanos = now;
|
||||||
|
|
||||||
|
machine->run_for(double(duration) / 1e9);
|
||||||
}
|
}
|
||||||
|
@ -3,15 +3,22 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "../../Machines/Utility/MachineForTarget.hpp"
|
||||||
|
|
||||||
class Timer : public QObject
|
class Timer : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Timer(QObject *parent = nullptr);
|
explicit Timer(QObject *parent = nullptr);
|
||||||
|
void setMachine(MachineTypes::TimedMachine *machine);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void tick();
|
void tick();
|
||||||
|
|
||||||
|
private:
|
||||||
|
MachineTypes::TimedMachine *machine = nullptr;
|
||||||
|
int64_t lastTickNanos = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TIMER_H
|
#endif // TIMER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user