From 0568d6cef8de238a18c617b09dd511b9127feb07 Mon Sep 17 00:00:00 2001 From: Oleg Tsymbalyuk Date: Tue, 5 Sep 2023 14:25:45 +0300 Subject: [PATCH] added 1920x1440 screen mode, debugger hotkeys --- emulator/mainwindow.cpp | 55 +++++++++++++++++----------------------- emulator/mainwindow.h | 2 ++ emulator/mainwindow.ui | 15 +++++++++++ emulator/qmemoryview.cpp | 2 +- emulator/qscreen.cpp | 48 +++++++++++++++++++++++++++++++++++ emulator/qscreen.h | 15 ++++++----- 6 files changed, 97 insertions(+), 40 deletions(-) diff --git a/emulator/mainwindow.cpp b/emulator/mainwindow.cpp index aacef89..697a5e1 100644 --- a/emulator/mainwindow.cpp +++ b/emulator/mainwindow.cpp @@ -72,6 +72,7 @@ MainWindow::MainWindow(QWidget *parent) : QObject::connect(ui->actionViewSizeUpscaled4, SIGNAL(triggered()), this, SLOT(viewSizeUpscaled4())); QObject::connect(ui->actionViewSizeUpscaled175, SIGNAL(triggered()), this, SLOT(viewSizeUpscaled175())); QObject::connect(ui->actionViewSizeUpscaled5, SIGNAL(triggered()), this, SLOT(viewSizeUpscaled5())); + QObject::connect(ui->actionViewSizeUpscaled6, SIGNAL(triggered()), this, SLOT(viewSizeUpscaled6())); QObject::connect(ui->actionSoundEnabled, SIGNAL(triggered()), this, SLOT(soundEnabled())); QObject::connect(ui->actionSoundAY, SIGNAL(triggered()), this, SLOT(emulatorSoundAY())); @@ -182,6 +183,7 @@ void MainWindow::closeEvent(QCloseEvent *) Global_getSettings()->setValue("MainWindow/Geometry", saveGeometry()); Global_getSettings()->setValue("MainWindow/WindowState", saveState()); + Global_getSettings()->setValue("MainWindow/OnscreenKeyboard", m_keyboard->isVisible()); Global_getSettings()->setValue("MainWindow/ConsoleView", m_dockConsole->isVisible()); Global_getSettings()->setValue("MainWindow/DebugView", m_dockDebug->isVisible()); Global_getSettings()->setValue("MainWindow/DisasmView", m_dockDisasm->isVisible()); @@ -205,6 +207,7 @@ void MainWindow::restoreSettings() restoreGeometry(Global_getSettings()->value("MainWindow/Geometry").toByteArray()); restoreState(Global_getSettings()->value("MainWindow/WindowState").toByteArray()); + m_keyboard->setVisible(Global_getSettings()->value("MainWindow/OnscreenKeyboard", false).toBool()); m_dockConsole->setVisible(Global_getSettings()->value("MainWindow/ConsoleView", false).toBool()); m_dockDebug->setVisible(Global_getSettings()->value("MainWindow/DebugView", false).toBool()); m_dockDisasm->setVisible(Global_getSettings()->value("MainWindow/DisasmView", false).toBool()); @@ -232,6 +235,7 @@ void MainWindow::updateMenu() ui->actionViewSizeUpscaled4->setChecked(m_screen->sizeMode() == UpscaledScreen4); ui->actionViewSizeUpscaled175->setChecked(m_screen->sizeMode() == UpscaledScreen175); ui->actionViewSizeUpscaled5->setChecked(m_screen->sizeMode() == UpscaledScreen5); + ui->actionViewSizeUpscaled6->setChecked(m_screen->sizeMode() == UpscaledScreen6); ui->actionViewKeyboard->setChecked(m_keyboard->isVisible()); @@ -458,77 +462,64 @@ void MainWindow::viewGrayscaleScreen() updateMenu(); } +void MainWindow::updateCentralWidgetSize() +{ + ui->centralWidget->setMaximumHeight(m_screen->maximumHeight() + m_keyboard->maximumHeight()); + ui->centralWidget->setMaximumWidth(m_screen->maximumWidth()); +} void MainWindow::viewSizeRegular() { m_screen->setSizeMode(RegularScreen); updateMenu(); - - //Update centralWidget size - ui->centralWidget->setMaximumHeight(m_screen->maximumHeight() + m_keyboard->maximumHeight()); - ui->centralWidget->setMaximumWidth(m_screen->maximumWidth()); + updateCentralWidgetSize(); } void MainWindow::viewSizeUpscaled() { m_screen->setSizeMode(UpscaledScreen); updateMenu(); - - //Update centralWidget size - ui->centralWidget->setMaximumHeight(m_screen->maximumHeight() + m_keyboard->maximumHeight()); - ui->centralWidget->setMaximumWidth(m_screen->maximumWidth()); + updateCentralWidgetSize(); } void MainWindow::viewSizeDoubleInterlaced() { m_screen->setSizeMode(DoubleInterlacedScreen); updateMenu(); - - //Update centralWidget size - ui->centralWidget->setMaximumHeight(m_screen->maximumHeight() + m_keyboard->maximumHeight()); - ui->centralWidget->setMaximumWidth(m_screen->maximumWidth()); + updateCentralWidgetSize(); } void MainWindow::viewSizeDouble() { m_screen->setSizeMode(DoubleScreen); updateMenu(); - - //Update centralWidget size - ui->centralWidget->setMaximumHeight(m_screen->maximumHeight() + m_keyboard->maximumHeight()); - ui->centralWidget->setMaximumWidth(m_screen->maximumWidth()); + updateCentralWidgetSize(); } void MainWindow::viewSizeUpscaled3() { m_screen->setSizeMode(UpscaledScreen3); updateMenu(); - - //Update centralWidget size - ui->centralWidget->setMaximumHeight(m_screen->maximumHeight() + m_keyboard->maximumHeight()); - ui->centralWidget->setMaximumWidth(m_screen->maximumWidth()); + updateCentralWidgetSize(); } void MainWindow::viewSizeUpscaled4() { m_screen->setSizeMode(UpscaledScreen4); updateMenu(); - - //Update centralWidget size - ui->centralWidget->setMaximumHeight(m_screen->maximumHeight() + m_keyboard->maximumHeight()); - ui->centralWidget->setMaximumWidth(m_screen->maximumWidth()); + updateCentralWidgetSize(); } void MainWindow::viewSizeUpscaled175() { m_screen->setSizeMode(UpscaledScreen175); updateMenu(); - - //Update centralWidget size - ui->centralWidget->setMaximumHeight(m_screen->maximumHeight() + m_keyboard->maximumHeight()); - ui->centralWidget->setMaximumWidth(m_screen->maximumWidth()); + updateCentralWidgetSize(); } void MainWindow::viewSizeUpscaled5() { m_screen->setSizeMode(UpscaledScreen5); updateMenu(); - - //Update centralWidget size - ui->centralWidget->setMaximumHeight(m_screen->maximumHeight() + m_keyboard->maximumHeight()); - ui->centralWidget->setMaximumWidth(m_screen->maximumWidth()); + updateCentralWidgetSize(); +} +void MainWindow::viewSizeUpscaled6() +{ + m_screen->setSizeMode(UpscaledScreen6); + updateMenu(); + updateCentralWidgetSize(); } void MainWindow::emulatorFrame() diff --git a/emulator/mainwindow.h b/emulator/mainwindow.h index 3cb0662..230a1ac 100644 --- a/emulator/mainwindow.h +++ b/emulator/mainwindow.h @@ -25,6 +25,7 @@ class MainWindow : public QMainWindow public: void updateMenu(); + void updateCentralWidgetSize(); void updateAllViews(); void redrawDebugView(); void redrawDisasmView(); @@ -86,6 +87,7 @@ public slots: void viewSizeUpscaled175(); void viewSizeUpscaled4(); void viewSizeUpscaled5(); + void viewSizeUpscaled6(); void soundEnabled(); void emulatorSoundAY(); void scriptRun(); diff --git a/emulator/mainwindow.ui b/emulator/mainwindow.ui index f620342..2f9dc2a 100644 --- a/emulator/mainwindow.ui +++ b/emulator/mainwindow.ui @@ -106,6 +106,7 @@ + @@ -333,6 +334,9 @@ :/images/iconStepInto.svg:/images/iconStepInto.svg + + F7 + Step Into @@ -342,6 +346,9 @@ :/images/iconStepOver.svg:/images/iconStepOver.svg + + F8 + Step Over @@ -466,6 +473,14 @@ 1280 x 864 Interlaced + + + true + + + 1920 x 1440 4:3 Interlaced + + Save State... diff --git a/emulator/qmemoryview.cpp b/emulator/qmemoryview.cpp index 26fb828..572582b 100644 --- a/emulator/qmemoryview.cpp +++ b/emulator/qmemoryview.cpp @@ -265,7 +265,7 @@ void QMemoryView::paintEvent(QPaintEvent * /*event*/) painter.drawText(30, cyLine, ADDRESS_LINE); for (int j = 0; j < 8; j++) { - _snprintf(buffer, 7, "%d", j * 2); + _snprintf(buffer, 7, "%o", j * 2); painter.drawText(38 + (9 + j * 7) * cxChar, cyLine, buffer); } diff --git a/emulator/qscreen.cpp b/emulator/qscreen.cpp index a318431..dd070fc 100644 --- a/emulator/qscreen.cpp +++ b/emulator/qscreen.cpp @@ -282,6 +282,47 @@ static void UpscaleScreen5(const void* pSrcBits, void* pImageBits) } } +// Upscale screen width 640->1920, height 288->1440 with "interlaced" effect +static void UpscaleScreen6(const void* pSrcBits, void* pImageBits) +{ + const quint32* psrcbits = static_cast(pSrcBits); + quint32* pbits = static_cast(pImageBits); + for (int ukncline = 287; ukncline >= 0; ukncline--) + { + const quint32* psrc = psrcbits + ukncline * UKNC_SCREEN_WIDTH; + quint32* pdest = pbits + (ukncline * 5) * 1920; + psrc += UKNC_SCREEN_WIDTH - 1; + pdest += 1920 - 1; + quint32* pdest2 = pdest + 1920; + quint32* pdest3 = pdest2 + 1920; + quint32* pdest4 = pdest3 + 1920; + quint32* pdest5 = pdest4 + 1920; + for (int i = 0; i < UKNC_SCREEN_WIDTH; i++) + { + quint32 color = *psrc; psrc--; + *pdest = color; pdest--; + *pdest = color; pdest--; + *pdest = color; pdest--; + + *pdest2 = color; pdest2--; + *pdest2 = color; pdest2--; + *pdest2 = color; pdest2--; + + *pdest3 = color; pdest3--; + *pdest3 = color; pdest3--; + *pdest3 = color; pdest3--; + + *pdest4 = color; pdest4--; + *pdest4 = color; pdest4--; + *pdest4 = color; pdest4--; + + *pdest5 = 0xFF000000; pdest5--; + *pdest5 = 0xFF000000; pdest5--; + *pdest5 = 0xFF000000; pdest5--; + } + } +} + ////////////////////////////////////////////////////////////////////// @@ -359,6 +400,11 @@ void QEmulatorScreen::createDisplay() cxScreenWidth = UKNC_SCREEN_WIDTH * 2; cyScreenHeight = UKNC_SCREEN_HEIGHT * 3; } + else if (m_sizeMode == UpscaledScreen6) + { + cxScreenWidth = UKNC_SCREEN_WIDTH * 3; + cyScreenHeight = UKNC_SCREEN_HEIGHT * 5; + } m_image = new QImage(cxScreenWidth, cyScreenHeight, QImage::Format_RGB32); @@ -397,6 +443,8 @@ void QEmulatorScreen::paintEvent(QPaintEvent * /*event*/) UpscaleScreen175(m_bits, m_image->bits()); else if (m_sizeMode == UpscaledScreen5) UpscaleScreen5(m_bits, m_image->bits()); + else if (m_sizeMode == UpscaledScreen6) + UpscaleScreen6(m_bits, m_image->bits()); QPainter painter(this); painter.drawImage(0, 0, *m_image); diff --git a/emulator/qscreen.h b/emulator/qscreen.h index 7eaa38b..31c62dd 100644 --- a/emulator/qscreen.h +++ b/emulator/qscreen.h @@ -13,14 +13,15 @@ enum ScreenViewMode enum ScreenSizeMode { - RegularScreen = 1, + RegularScreen = 1, DoubleInterlacedScreen = 2, - DoubleScreen = 3, - UpscaledScreen = 4, - UpscaledScreen3 = 5, - UpscaledScreen4 = 6, - UpscaledScreen175 = 7, - UpscaledScreen5 = 8 + DoubleScreen = 3, + UpscaledScreen = 4, + UpscaledScreen3 = 5, + UpscaledScreen4 = 6, + UpscaledScreen175 = 7, + UpscaledScreen5 = 8, + UpscaledScreen6 = 9 }; class QEmulatorScreen : public QWidget