Skip to content

Commit

Permalink
added 1920x1440 screen mode, debugger hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
aberranthacker committed Sep 5, 2023
1 parent 9d76923 commit 0568d6c
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 40 deletions.
55 changes: 23 additions & 32 deletions emulator/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions emulator/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class MainWindow : public QMainWindow

public:
void updateMenu();
void updateCentralWidgetSize();
void updateAllViews();
void redrawDebugView();
void redrawDisasmView();
Expand Down Expand Up @@ -86,6 +87,7 @@ public slots:
void viewSizeUpscaled175();
void viewSizeUpscaled4();
void viewSizeUpscaled5();
void viewSizeUpscaled6();
void soundEnabled();
void emulatorSoundAY();
void scriptRun();
Expand Down
15 changes: 15 additions & 0 deletions emulator/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<addaction name="actionViewSizeUpscaled4"/>
<addaction name="actionViewSizeUpscaled175"/>
<addaction name="actionViewSizeUpscaled5"/>
<addaction name="actionViewSizeUpscaled6"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuView"/>
Expand Down Expand Up @@ -333,6 +334,9 @@
<iconset resource="QtUkncBtl.qrc">
<normaloff>:/images/iconStepInto.svg</normaloff>:/images/iconStepInto.svg</iconset>
</property>
<property name="shortcut">
<string>F7</string>
</property>
<property name="text">
<string>Step Into</string>
</property>
Expand All @@ -342,6 +346,9 @@
<iconset resource="QtUkncBtl.qrc">
<normaloff>:/images/iconStepOver.svg</normaloff>:/images/iconStepOver.svg</iconset>
</property>
<property name="shortcut">
<string>F8</string>
</property>
<property name="text">
<string>Step Over</string>
</property>
Expand Down Expand Up @@ -466,6 +473,14 @@
<string>1280 x 864 Interlaced</string>
</property>
</action>
<action name="actionViewSizeUpscaled6">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>1920 x 1440 4:3 Interlaced</string>
</property>
</action>
<action name="actionSaveStateImage">
<property name="text">
<string>Save State...</string>
Expand Down
2 changes: 1 addition & 1 deletion emulator/qmemoryview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
48 changes: 48 additions & 0 deletions emulator/qscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const quint32*>(pSrcBits);
quint32* pbits = static_cast<quint32*>(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--;
}
}
}


//////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
15 changes: 8 additions & 7 deletions emulator/qscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0568d6c

Please sign in to comment.