Add benchmark and fix timerID values.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
ede695bcd6
commit
c6789ece7b
5 changed files with 42 additions and 8 deletions
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "linux/data.h"
|
||||
#include "linux/configuration.h"
|
||||
#include "linux/benchmark.h"
|
||||
|
||||
#include "emulator.h"
|
||||
|
||||
|
@ -123,7 +124,7 @@ BYTE __stdcall SpkrToggle (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCycle
|
|||
void VideoInitialize() {}
|
||||
|
||||
QApple::QApple(QWidget *parent) :
|
||||
QMainWindow(parent), myDiskFileDialog(this)
|
||||
QMainWindow(parent), myDiskFileDialog(this), myTimerID(0)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
|
@ -133,7 +134,7 @@ QApple::QApple(QWidget *parent) :
|
|||
myEmulatorWindow = mdiArea->addSubWindow(myEmulator, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
|
||||
myEmulatorWindow->setWindowTitle(g_pAppTitle);
|
||||
|
||||
myMSGap = 5;
|
||||
myMSGap = 10;
|
||||
|
||||
initialiseEmulator();
|
||||
|
||||
|
@ -143,6 +144,7 @@ QApple::QApple(QWidget *parent) :
|
|||
|
||||
void QApple::closeEvent(QCloseEvent *)
|
||||
{
|
||||
stopTimer();
|
||||
uninitialiseEmulator();
|
||||
}
|
||||
|
||||
|
@ -169,27 +171,36 @@ void QApple::timerEvent(QTimerEvent *)
|
|||
setNextTimer(nextGap);
|
||||
}
|
||||
|
||||
void QApple::stopTimer()
|
||||
{
|
||||
if (myTimerID)
|
||||
{
|
||||
killTimer(myTimerID);
|
||||
myTimerID = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void QApple::setNextTimer(const int ms)
|
||||
{
|
||||
if (ms != myCurrentGap)
|
||||
{
|
||||
killTimer(myTimerID);
|
||||
stopTimer();
|
||||
myCurrentGap = ms;
|
||||
myTimerID = startTimer(myCurrentGap);
|
||||
myTimerID = startTimer(myCurrentGap, Qt::PreciseTimer);
|
||||
}
|
||||
}
|
||||
|
||||
void QApple::on_actionStart_triggered()
|
||||
{
|
||||
// always restart with the same timer gap that was last used
|
||||
myTimerID = startTimer(myCurrentGap);
|
||||
myTimerID = startTimer(myCurrentGap, Qt::PreciseTimer);
|
||||
actionPause->setEnabled(true);
|
||||
actionStart->setEnabled(false);
|
||||
}
|
||||
|
||||
void QApple::on_actionPause_triggered()
|
||||
{
|
||||
killTimer(myTimerID);
|
||||
stopTimer();
|
||||
actionPause->setEnabled(false);
|
||||
actionStart->setEnabled(true);
|
||||
}
|
||||
|
@ -238,3 +249,9 @@ void QApple::on_actionReboot_triggered()
|
|||
startEmulator();
|
||||
setNextTimer(myMSGap);
|
||||
}
|
||||
|
||||
void QApple::on_actionBenchmark_triggered()
|
||||
{
|
||||
VideoBenchmark([this]() { myEmulator->redrawScreen(); });
|
||||
on_actionReboot_triggered();
|
||||
}
|
||||
|
|
|
@ -35,9 +35,12 @@ private slots:
|
|||
|
||||
void on_actionReboot_triggered();
|
||||
|
||||
void on_actionBenchmark_triggered();
|
||||
|
||||
private:
|
||||
|
||||
void setNextTimer(const int ms);
|
||||
void stopTimer();
|
||||
void insertDisk(const int disk);
|
||||
|
||||
QFileDialog myDiskFileDialog;
|
||||
|
|
|
@ -51,8 +51,15 @@
|
|||
<addaction name="actionDisk_1"/>
|
||||
<addaction name="actionDisk_2"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuVideo">
|
||||
<property name="title">
|
||||
<string>Video</string>
|
||||
</property>
|
||||
<addaction name="actionBenchmark"/>
|
||||
</widget>
|
||||
<addaction name="menuSystem"/>
|
||||
<addaction name="menuDisks"/>
|
||||
<addaction name="menuVideo"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<attribute name="toolBarArea">
|
||||
|
@ -109,6 +116,11 @@
|
|||
<string>Reboot</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionBenchmark">
|
||||
<property name="text">
|
||||
<string>Benchmark</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "Disk.h"
|
||||
#include "CPU.h"
|
||||
|
||||
void VideoBenchmark(void (*VideoRedrawScreen)())
|
||||
void VideoBenchmark(std::function<void()> VideoRedrawScreen)
|
||||
{
|
||||
// PREPARE TWO DIFFERENT FRAME BUFFERS, EACH OF WHICH HAVE HALF OF THE
|
||||
// BYTES SET TO 0x14 AND THE OTHER HALF SET TO 0xAA
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
void VideoBenchmark(void (*VideoRedrawScreen)());
|
||||
#include <functional>
|
||||
|
||||
void VideoBenchmark(std::function<void()> VideoRedrawScreen);
|
||||
|
|
Loading…
Add table
Reference in a new issue