diff --git a/src/device/keyboard_at.c b/src/device/keyboard_at.c index 9696956b1..d6fdaf4b7 100644 --- a/src/device/keyboard_at.c +++ b/src/device/keyboard_at.c @@ -36,11 +36,11 @@ const uint8_t id_bytes[24][4] = { { 0x00, 0x00, 0x00, 0x00 }, /* XT 83-key */ { 0x00, 0x00, 0x00, 0x00 }, /* AT 84-key */ - { 0x00, 0x00, 0x00, 0x00 }, /* XT/AT 101/102/106-key */ - { 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00 }, /* AT KSC */ - { 0x00, 0x00, 0x00, 0x00 }, /* AT ABNT2 */ + { 0xab, 0x83, 0x00, 0x00 }, /* XT/AT 101-key */ + { 0xab, 0x83, 0x00, 0x00 }, /* XT/AT 101-key */ + { 0xab, 0x90, 0x00, 0x00 }, /* XT/AT 106-key JIS */ + { 0xab, 0x90, 0x00, 0x00 }, /* AT KSC */ + { 0xab, 0x83, 0x00, 0x00 }, /* AT ABNT2 */ { 0x00, 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00, 0x00 }, /* FLAG_AX = 0x08 */ { 0x00, 0x00, 0x00, 0x00 }, diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 62fea0b9a..b991fa767 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -130,6 +130,8 @@ typedef struct monitor_t { int mon_force_resize; int mon_fullchange; int mon_changeframecount; + int mon_renderedframes; + atomic_int mon_actualrenderedframes; atomic_int mon_screenshots; uint32_t *mon_pal_lookup; int *mon_cga_palette; diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index e7a90e0c3..c39ef7cbc 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -220,6 +220,16 @@ MainWindow::MainWindow(QWidget *parent) kana_label->setToolTip(QShortcut::tr("Kana Lock")); statusBar()->addPermanentWidget(kana_label); + auto hertz_label = new QLabel; + QTimer* frameRateTimer = new QTimer(this); + frameRateTimer->setInterval(1000); + frameRateTimer->setSingleShot(false); + connect(frameRateTimer, &QTimer::timeout, [this, hertz_label] { + hertz_label->setText(QString("%1 Hz").arg(monitors[0].mon_actualrenderedframes)); + }); + statusBar()->addPermanentWidget(hertz_label); + frameRateTimer->start(1000); + QTimer* ledKeyboardTimer = new QTimer(this); ledKeyboardTimer->setTimerType(Qt::CoarseTimer); ledKeyboardTimer->setInterval(1); diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index 821b4c741..73cf75396 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -45,6 +45,8 @@ #include #include +#include + #include #include #include @@ -96,6 +98,17 @@ RendererStack::RendererStack(QWidget *parent, int monitor_index) ui->setupUi(this); m_monitor_index = monitor_index; + + + if (monitor_index >= 1) { + QTimer* frameRateTimer = new QTimer(this); + frameRateTimer->setSingleShot(false); + frameRateTimer->setInterval(1000); + connect(frameRateTimer, &QTimer::timeout, [this] { + this->setWindowTitle(QObject::tr("86Box Monitor #") + QString::number(m_monitor_index + 1) + QString(" - %1 Hz").arg(monitors[m_monitor_index].mon_actualrenderedframes)); + }); + frameRateTimer->start(1000); + } #if defined __unix__ && !defined __HAIKU__ memset(auto_mouse_type, 0, sizeof (auto_mouse_type)); mousedata.mouse_type = getenv("EMU86BOX_MOUSE"); diff --git a/src/video/vid_table.c b/src/video/vid_table.c index e8e945ab8..17ed64bdd 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -283,6 +283,22 @@ vid_table_log(const char *fmt, ...) # define vid_table_log(fmt, ...) #endif +static pc_timer_t framerate_timer; + +void +video_update_framerates(void* priv) +{ + (void)priv; + int i = 0; + + for (i = 0; i < GFXCARD_MAX; i++) { + monitors[i].mon_actualrenderedframes = monitors[i].mon_renderedframes; + monitors[i].mon_renderedframes = 0; + } + + timer_on_auto(&framerate_timer, 1000 * 1000); +} + void video_reset_close(void) { @@ -358,6 +374,7 @@ video_reset(int card) device_add(video_cards[card].device); } + timer_add(&framerate_timer, video_update_framerates, NULL, 1); was_reset = 1; } diff --git a/src/video/video.c b/src/video/video.c index c8dc137c5..e2f2801d3 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -476,6 +476,7 @@ video_blit_memtoscreen_monitor(int x, int y, int w, int h, int monitor_index) monitors[monitor_index].mon_blit_data_ptr->y = y; monitors[monitor_index].mon_blit_data_ptr->w = w; monitors[monitor_index].mon_blit_data_ptr->h = h; + monitors[monitor_index].mon_renderedframes++; thread_set_event(monitors[monitor_index].mon_blit_data_ptr->wake_blit_thread); MTR_END("video", "video_blit_memtoscreen");