From b80f7c5f508206df40850f7138e3d97103536a2b Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Sun, 12 Dec 2021 19:15:40 +0000 Subject: [PATCH] QApple: fix VidHD. Signed-off-by: Andrea Odetti --- source/frontends/qt/options.cpp | 8 +++++ source/frontends/qt/options.h | 1 + source/frontends/qt/preferences.cpp | 5 ++++ source/frontends/qt/preferences.ui | 45 ++++++++++++++++++++++++----- source/frontends/qt/qapple.pro | 2 ++ source/frontends/qt/qvideo.cpp | 5 +++- source/frontends/qt/qvideo.h | 3 ++ 7 files changed, 61 insertions(+), 8 deletions(-) diff --git a/source/frontends/qt/options.cpp b/source/frontends/qt/options.cpp index b3fa362cc..31d7da258 100644 --- a/source/frontends/qt/options.cpp +++ b/source/frontends/qt/options.cpp @@ -60,6 +60,9 @@ namespace void insertHD(HarddiskInterfaceCard * pHarddiskCard, const QString & filename, const int disk) { + if (!pHarddiskCard) + return; + if (filename.isEmpty()) { pHarddiskCard->Unplug(disk); @@ -200,6 +203,7 @@ void getAppleWinPreferences(PreferenceData & data) } data.enhancedSpeed = pDisk2Card && pDisk2Card->GetEnhanceDisk(); + data.cardInSlot3 = cardManager.QuerySlot(SLOT3); data.cardInSlot4 = cardManager.QuerySlot(SLOT4); data.cardInSlot5 = cardManager.QuerySlot(SLOT5); data.hdInSlot7 = pHarddiskCard; @@ -257,6 +261,10 @@ void setAppleWinPreferences(const std::shared_ptr & frame, const Prefer SetMainCpu(cpu); REGSAVE(TEXT(REGVALUE_CPU_TYPE), cpu); } + if (currentData.cardInSlot3 != newData.cardInSlot3) + { + SetSlot(SLOT3, newData.cardInSlot3); + } if (currentData.cardInSlot4 != newData.cardInSlot4) { SetSlot(SLOT4, newData.cardInSlot4); diff --git a/source/frontends/qt/options.h b/source/frontends/qt/options.h index 24058f5e0..986c20288 100644 --- a/source/frontends/qt/options.h +++ b/source/frontends/qt/options.h @@ -32,6 +32,7 @@ struct PreferenceData GlobalOptions options; eApple2Type apple2Type; + SS_CARDTYPE cardInSlot3; SS_CARDTYPE cardInSlot4; SS_CARDTYPE cardInSlot5; bool hdInSlot7; diff --git a/source/frontends/qt/preferences.cpp b/source/frontends/qt/preferences.cpp index 34d602ec4..7ec7d091d 100644 --- a/source/frontends/qt/preferences.cpp +++ b/source/frontends/qt/preferences.cpp @@ -121,6 +121,7 @@ namespace const std::vector computerTypes = {A2TYPE_APPLE2, A2TYPE_APPLE2PLUS, A2TYPE_APPLE2JPLUS, A2TYPE_APPLE2E, A2TYPE_APPLE2EENHANCED, A2TYPE_PRAVETS82, A2TYPE_PRAVETS8M, A2TYPE_PRAVETS8A, A2TYPE_BASE64A, A2TYPE_TK30002E}; + const std::vector cardsInSlot3 = {CT_Empty, CT_Uthernet, CT_Uthernet2, CT_VidHD}; const std::vector cardsInSlot4 = {CT_Empty, CT_MouseInterface, CT_MockingboardC, CT_Phasor}; const std::vector cardsInSlot5 = {CT_Empty, CT_Z80, CT_MockingboardC, CT_SAM}; @@ -219,6 +220,9 @@ void Preferences::setData(const PreferenceData & data) const int apple2Index = getIndexInList(computerTypes, data.apple2Type, 2); ui->apple2Type->setCurrentIndex(apple2Index); + const int slot3Index = getIndexInList(cardsInSlot3, data.cardInSlot3, 0); + ui->slot3_combo->setCurrentIndex(slot3Index); + const int slot4Index = getIndexInList(cardsInSlot4, data.cardInSlot4, 0); ui->slot4_combo->setCurrentIndex(slot4Index); @@ -266,6 +270,7 @@ PreferenceData Preferences::getData() const data.mockingboardVolume = ui->mb_volume->maximum() - ui->mb_volume->value(); data.enhancedSpeed = ui->enhanced_speed->isChecked(); data.apple2Type = computerTypes[ui->apple2Type->currentIndex()]; + data.cardInSlot3 = cardsInSlot3[ui->slot3_combo->currentIndex()]; data.cardInSlot4 = cardsInSlot4[ui->slot4_combo->currentIndex()]; data.cardInSlot5 = cardsInSlot5[ui->slot5_combo->currentIndex()]; data.hdInSlot7 = ui->hd_7->isChecked(); diff --git a/source/frontends/qt/preferences.ui b/source/frontends/qt/preferences.ui index b34cba4d5..0675162c6 100644 --- a/source/frontends/qt/preferences.ui +++ b/source/frontends/qt/preferences.ui @@ -7,7 +7,7 @@ 0 0 648 - 319 + 335 @@ -40,28 +40,28 @@ Slots - + Slot 4 - + Slot 5 - + Slot 7 - + Hard Disk @@ -118,7 +118,7 @@ - + @@ -142,7 +142,7 @@ - + @@ -166,6 +166,37 @@ + + + + Slot 3 + + + + + + + + Empty + + + + + Uthernet + + + + + Uthernet II + + + + + Video HD + + + + diff --git a/source/frontends/qt/qapple.pro b/source/frontends/qt/qapple.pro index 33c9b8257..5e7410fb4 100644 --- a/source/frontends/qt/qapple.pro +++ b/source/frontends/qt/qapple.pro @@ -52,6 +52,8 @@ LIBS += -L$$PWD/../../../build/source/frontends/qt/QHexView -lqhexview-lib LIBS += -levdev INCLUDEPATH += $$PWD/../../../source +INCLUDEPATH += $$PWD/../../../source/linux/libwindows INCLUDEPATH += $$PWD/QHexView +INCLUDEPATH += /usr/include/minizip QMAKE_RPATHDIR += $ORIGIN/../.. diff --git a/source/frontends/qt/qvideo.cpp b/source/frontends/qt/qvideo.cpp index 76cc7149d..3848d4527 100644 --- a/source/frontends/qt/qvideo.cpp +++ b/source/frontends/qt/qvideo.cpp @@ -31,6 +31,9 @@ void QVideo::loadVideoSettings() myWidth = video.GetFrameBufferWidth(); myHeight = video.GetFrameBufferHeight(); + myLogoX = mySX + video.GetFrameBufferCentringOffsetX(); + myLogoY = mySY + video.GetFrameBufferCentringOffsetY(); + myFrameBuffer = video.GetFrameBuffer(); } @@ -58,7 +61,7 @@ void QVideo::displayLogo() QImage frameBuffer = getScreenImage(); QPainter painter(&frameBuffer); - painter.drawImage(mySX, mySY, myLogo); + painter.drawImage(myLogoX, myLogoY, myLogo); } void QVideo::paintEvent(QPaintEvent *) diff --git a/source/frontends/qt/qvideo.h b/source/frontends/qt/qvideo.h index 1f7deec26..e815c907d 100644 --- a/source/frontends/qt/qvideo.h +++ b/source/frontends/qt/qvideo.h @@ -41,6 +41,9 @@ public slots: int myWidth; int myHeight; + int myLogoX; + int myLogoY; + quint8 * myFrameBuffer; QImage getScreenImage() const;