diff --git a/src/86box.c b/src/86box.c index 498c86871..7b67e3ba9 100644 --- a/src/86box.c +++ b/src/86box.c @@ -231,6 +231,9 @@ int is_pcjr = 0; /* The current int portable_mode = 0; /* We are running in portable mode (global dirs = exe path) */ +int monitor_edid = 0; /* (C) Which EDID to use. 0=default, 1=custom. */ +char monitor_edid_path[1024] = { 0 }; /* (C) Path to custom EDID */ + // Accelerator key array struct accelKey acc_keys[NUM_ACCELS]; diff --git a/src/config.c b/src/config.c index e88a4753e..af3f39cb8 100644 --- a/src/config.c +++ b/src/config.c @@ -501,6 +501,11 @@ load_video(void) p = "none"; gfxcard[i] = video_get_video_from_internal_name(p); } + + monitor_edid = ini_section_get_int(cat, "monitor_edid", 0); + + monitor_edid_path[0] = 0; + strncpy(monitor_edid_path, ini_section_get_string(cat, "monitor_edid_path", (char*)""), sizeof(monitor_edid_path)); } /* Load "Input Devices" section. */ @@ -2487,6 +2492,15 @@ save_video(void) ini_section_set_string(cat, "gfxcard", video_get_internal_name(gfxcard[0])); + if (monitor_edid) + ini_section_set_int(cat, "monitor_edid", monitor_edid); + else + ini_section_delete_var(cat, "monitor_edid"); + + if (monitor_edid_path[0]) + ini_section_set_string(cat, "monitor_edid_path", monitor_edid_path); + else + ini_section_delete_var(cat, "monitor_edid_path"); if (vid_cga_comp_brightness) ini_section_set_int(cat, "vid_cga_comp_brightness", vid_cga_comp_brightness); diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 521e50965..8696cbabd 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -201,6 +201,9 @@ extern int start_vmm; /* the current execution will start the manag extern int portable_mode; /* we are running in portable mode (global dirs = exe path) */ +extern int monitor_edid; /* (C) Which EDID to use. 0=default, 1=custom. */ +extern char monitor_edid_path[1024]; /* (C) Path to custom EDID */ + #ifndef USE_NEW_DYNAREC extern FILE *stdlog; /* file to log output to */ #endif diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 7b8a34857..552b074f7 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -52,7 +52,8 @@ enum { STRING_GHOSTPCL_ERROR_TITLE, /* "Unable to initialize GhostPCL" */ STRING_GHOSTPCL_ERROR_DESC, /* "gpcl6dll32.dll/gpcl6dll64.dll/libgpcl6 is required..." */ STRING_ESCP_ERROR_TITLE, /* "Unable to find Dot-Matrix fonts" */ - STRING_ESCP_ERROR_DESC /* "TrueType fonts in the \"roms/printer/fonts\" directory..." */ + STRING_ESCP_ERROR_DESC, /* "TrueType fonts in the \"roms/printer/fonts\" directory..." */ + STRING_EDID_TOO_LARGE, /* "EDID file \"%ls\" is too large (%lld bytes)." */ }; /* The Win32 API uses _wcsicmp. */ diff --git a/src/include/86box/vid_ddc.h b/src/include/86box/vid_ddc.h index 144cca406..8d68d0adf 100644 --- a/src/include/86box/vid_ddc.h +++ b/src/include/86box/vid_ddc.h @@ -22,5 +22,6 @@ extern void *ddc_init(void *i2c); extern void ddc_close(void *eeprom); +extern void *ddc_create_default_edid(ssize_t* size_out); #endif /*EMU_VID_DDC_H*/ diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index bcce43afd..e46f15107 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -2954,3 +2954,15 @@ msgstr "" msgid "CGA composite settings" msgstr "" + +msgid "Monitor EDID" +msgstr "" + +msgid "Export..." +msgstr "" + +msgid "Export EDID" +msgid "" + +msgid "EDID file \"%ls\" is too large." +msgstr "" \ No newline at end of file diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index a0a072866..662c11e96 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -2954,3 +2954,15 @@ msgstr "Nastavení kompozitního výstupu &CGA..." msgid "CGA composite settings" msgstr "Nastavení kompozitního výstupu CGA" + +msgid "Monitor EDID" +msgstr "EDID monitoru" + +msgid "Export..." +msgstr "Exportovat..." + +msgid "Export EDID" +msgstr "Exportovat EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "Soubor EDID \"%ls\" je příliš velký." diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 28caf0d71..b790c0c46 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -2954,3 +2954,15 @@ msgstr "Optionen des &CGA-Composite-Modus..." msgid "CGA composite settings" msgstr "Optionen des CGA-Composite-Modus" + +msgid "Monitor EDID" +msgstr "EDID des Monitors" + +msgid "Export..." +msgstr "Exportieren..." + +msgid "Export EDID" +msgstr "EDID exportieren" + +msgid "EDID file \"%ls\" is too large." +msgstr "Die EDID-Datei \"%ls\" ist zu groß." diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index 021cc36ab..712128dd3 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -2954,3 +2954,15 @@ msgstr "Configuración del modo compuesto &CGA..." msgid "CGA composite settings" msgstr "Configuración del modo compuesto CGA" + +msgid "Monitor EDID" +msgstr "EDID du moniteur" + +msgid "Export..." +msgstr "Exporter..." + +msgid "Export EDID" +msgstr "EDID exportieren" + +msgid "EDID file \"%ls\" is too large." +msgstr "El archivo EDID \"%ls\" es demasiado grande." diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index cdce435db..2935365e7 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -2954,3 +2954,6 @@ msgstr "&CGA:n komposiittiasetukset..." msgid "CGA composite settings" msgstr "CGA:n komposiittiasetukset" + +msgid "EDID file \"%ls\" is too large." +msgstr "EDID-tiedosto \"%ls\" on liian suuri." diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index d5b5b7fdb..bb6e8d461 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -2954,3 +2954,6 @@ msgstr "Réglages du mode composite &CGA..." msgid "CGA composite settings" msgstr "Réglages du mode composite CGA" + +msgid "EDID file \"%ls\" is too large." +msgstr "Le fichier EDID \"%ls\" est trop volumineux." diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index bdb980839..0a76f5a82 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -2954,3 +2954,15 @@ msgstr "Opcije kompozitnog načina &CGA..." msgid "CGA composite settings" msgstr "Opcije kompozitnog načina CGA" + +msgid "Monitor EDID" +msgstr "EDID monitora" + +msgid "Export..." +msgstr "Izvoz..." + +msgid "Export EDID" +msgstr "Izvoz EDID-a" + +msgid "EDID file \"%ls\" is too large." +msgstr "EDID datoteka \"%ls\" je prevelika." diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index 43fe84461..506047165 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -2954,3 +2954,15 @@ msgstr "Impostazioni video composito &CGA..." msgid "CGA composite settings" msgstr "Impostazioni video composito CGA" + +msgid "Monitor EDID" +msgstr "EDID del monitor" + +msgid "Export..." +msgstr "Esporta..." + +msgid "Export EDID" +msgstr "Esporta EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "Il file EDID \"%ls\" è troppo grande." diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index 149170ae0..f33a9e968 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -2954,3 +2954,15 @@ msgstr "CGA複合モードの設定...(&C)" msgid "CGA composite settings" msgstr "CGA複合モードの設定" + +msgid "Monitor EDID" +msgstr "モニターのEDID" + +msgid "Export..." +msgstr "エクスポート..." + +msgid "Export EDID" +msgstr "EDIDのエクスポート" + +msgid "EDID file \"%ls\" is too large." +msgstr "EDIDファイル \"%ls\" が大きすぎます。" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 066b8a3f8..f55243c48 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -2954,3 +2954,15 @@ msgstr "CGA 복합 모드의 설정...(&C)" msgid "CGA composite settings" msgstr "CGA 복합 모드의 설정" + +msgid "Monitor EDID" +msgstr "모니터의 EDID" + +msgid "Export..." +msgstr "수출..." + +msgid "Export EDID" +msgstr "EDID 내보내기" + +msgid "EDID file \"%ls\" is too large." +msgstr "EDID 파일 \"%ls\"가 너무 큽니다." diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index cde1d942e..b7af957a6 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -2954,3 +2954,15 @@ msgstr "&CGA-komposittinnstillinger..." msgid "CGA composite settings" msgstr "CGA-komposittinnstillinger" + +msgid "Monitor EDID" +msgstr "EDID for skjerm" + +msgid "Export..." +msgstr "Eksporter..." + +msgid "Export EDID" +msgstr "Eksporter EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "EDID-filen \"%ls\" er for stor." diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index 6408cf21c..345323e38 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -2954,3 +2954,15 @@ msgstr "Instellingen van de &CGA-compositemodus..." msgid "CGA composite settings" msgstr "Instellingen van de CGA-compositemodus" + +msgid "Monitor EDID" +msgstr "EDID-monitor" + +msgid "Export..." +msgstr "Exporteren..." + +msgid "Export EDID" +msgstr "EDID exporteren" + +msgid "EDID file \"%ls\" is too large." +msgstr "Het EDID-bestand \"%ls\" is te groot." diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index 8d722817a..a6e7fc8a5 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -2954,3 +2954,15 @@ msgstr "Ustawienia trybu kompozytowego &CGA..." msgid "CGA composite settings" msgstr "Ustawienia trybu kompozytowego CGA" + +msgid "Monitor EDID" +msgstr "EDID monitora" + +msgid "Export..." +msgstr "Eksportuj..." + +msgid "Export EDID" +msgstr "Eksportuj EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "Plik EDID \"%ls\" jest zbyt duży." diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index 68e13e876..7057209be 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -2954,3 +2954,15 @@ msgstr "Configurações do modo composto &CGA..." msgid "CGA composite settings" msgstr "Configurações do modo composto CGA" + +msgid "Monitor EDID" +msgstr "EDID do monitor" + +msgid "Export..." +msgstr "Exportar..." + +msgid "Export EDID" +msgstr "Exportar EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "O arquivo EDID \"%ls\" é muito grande." \ No newline at end of file diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index 61512ed9e..d9abb9ac6 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -2954,3 +2954,15 @@ msgstr "Definições do modo compósito &CGA..." msgid "CGA composite settings" msgstr "Definições do modo compósito CGA" + +msgid "Monitor EDID" +msgstr "EDID do monitor" + +msgid "Export..." +msgstr "Exportar..." + +msgid "Export EDID" +msgstr "Exportar EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "O ficheiro EDID \"%ls\" é demasiado grande." diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index 9b9d3756f..b9eb7d25c 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -2954,3 +2954,15 @@ msgstr "Настройки композитного видео &CGA..." msgid "CGA composite settings" msgstr "Настройки композитного видео CGA" + +msgid "Monitor EDID" +msgstr "EDID монитора" + +msgid "Export..." +msgstr "Экспорт..." + +msgid "Export EDID" +msgstr "Экспорт EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "Файл EDID \"%ls\" слишком велик." diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index a4169fac9..cac5cc081 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -2954,3 +2954,15 @@ msgstr "Nastavenia kompozitného režimu &CGA..." msgid "CGA composite settings" msgstr "Nastavenia kompozitného režimu CGA" + +msgid "Monitor EDID" +msgstr "EDID monitora" + +msgid "Export..." +msgstr "Exportovať..." + +msgid "Export EDID" +msgstr "Exportovať EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "Súbor EDID \"%ls\" je príliš veľký." diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index 47a99b915..0f85bb3ce 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -2954,3 +2954,15 @@ msgstr "Nastavitve kompozitnega načina &CGA..." msgid "CGA composite settings" msgstr "Nastavitve kompozitnega načina CGA" + +msgid "Monitor EDID" +msgstr "EDID monitorja" + +msgid "Export..." +msgstr "Izvoz..." + +msgid "Export EDID" +msgstr "Izvoz EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "Datoteka EDID \"%ls\" je prevelika." diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index a0b4a0752..10655e430 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -2954,3 +2954,15 @@ msgstr "Inställningar för &CGA-kompositläget..." msgid "CGA composite settings" msgstr "Inställningar för CGA-kompositläget" + +msgid "Monitor EDID" +msgstr "EDID för bildskärm" + +msgid "Export..." +msgstr "Exportera..." + +msgid "Export EDID" +msgstr "Exportera EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "EDID-filen \"%ls\" är för stor." diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index 4a9109b13..8a52346db 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -2954,3 +2954,15 @@ msgstr "&CGA kompozit modunun ayarları..." msgid "CGA composite settings" msgstr "CGA kompozit modunun ayarları" + +msgid "Monitor EDID" +msgstr "Monitörün EDID'si" + +msgid "Export..." +msgstr "Dışa aktar..." + +msgid "Export EDID" +msgstr "EDID'i dışa aktar" + +msgid "EDID file \"%ls\" is too large." +msgstr "EDID dosyası \"%ls\" çok büyük." diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index dfe8d9d42..70307d446 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -2954,3 +2954,15 @@ msgstr "Налаштування композитного відео &CGA..." msgid "CGA composite settings" msgstr "Налаштування композитного відео CGA" + +msgid "Monitor EDID" +msgstr "EDID монітора" + +msgid "Export..." +msgstr "Експорт..." + +msgid "Export EDID" +msgstr "Експорт EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "Файл EDID \"%ls\" занадто великий." diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 9a3521afb..97043bbc1 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -2954,3 +2954,15 @@ msgstr "Cài đặt chế độ tổng hợp &CGA..." msgid "CGA composite settings" msgstr "Cài đặt chế độ tổng hợp CGA" + +msgid "Monitor EDID" +msgstr "EDID của màn hình" + +msgid "Export..." +msgstr "Xuất khẩu..." + +msgid "Export EDID" +msgstr "Xuất khẩu EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "Tệp EDID \"%ls\" quá lớn." diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index 6f9ee1c4f..1b36b9850 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -2954,3 +2954,15 @@ msgstr "CGA 复合模式设置...(&C)" msgid "CGA composite settings" msgstr "CGA 复合模式设置" + +msgid "Monitor EDID" +msgstr "显示器的EDID" + +msgid "Export..." +msgstr "导出..." + +msgid "Export EDID" +msgstr "导出EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "EDID文件 \"%ls\" 过大。" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index ad03bd44d..8294be218 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -2954,3 +2954,15 @@ msgstr "CGA 複合模式的設定...(&C)" msgid "CGA composite settings" msgstr "CGA 複合模式的設定" + +msgid "Monitor EDID" +msgstr "監視器的 EDID" + +msgid "Export..." +msgstr "出口..." + +msgid "Export EDID" +msgstr "匯出 EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "EDID 檔案 \"%ls\" 太大。" diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 653926071..a817c1346 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -649,6 +649,7 @@ ProgSettings::reloadStrings() translatedstrings[STRING_NET_ERROR_DESC] = QCoreApplication::translate("", "The network configuration will be switched to the null driver").toStdWString(); translatedstrings[STRING_ESCP_ERROR_TITLE] = QCoreApplication::translate("", "Unable to find Dot-Matrix fonts").toStdWString(); translatedstrings[STRING_ESCP_ERROR_DESC] = QCoreApplication::translate("", "TrueType fonts in the \"roms/printer/fonts\" directory are required for the emulation of the Generic ESC/P Dot-Matrix Printer.").toStdWString(); + translatedstrings[STRING_EDID_TOO_LARGE] = QCoreApplication::translate("", "EDID file \"%ls\" is too large.").toStdWString(); } wchar_t * diff --git a/src/qt/qt_settingsdisplay.cpp b/src/qt/qt_settingsdisplay.cpp index 15b2f4588..dd8c953a9 100644 --- a/src/qt/qt_settingsdisplay.cpp +++ b/src/qt/qt_settingsdisplay.cpp @@ -17,7 +17,11 @@ #include "qt_settingsdisplay.hpp" #include "ui_qt_settingsdisplay.h" +#include "qt_util.hpp" + #include +#include +#include extern "C" { #include <86box/86box.h> @@ -27,6 +31,7 @@ extern "C" { #include <86box/vid_8514a_device.h> #include <86box/vid_xga_device.h> #include <86box/vid_ps55da2.h> +#include <86box/vid_ddc.h> } #include "qt_deviceconfig.hpp" @@ -40,6 +45,9 @@ SettingsDisplay::SettingsDisplay(QWidget *parent) for (uint8_t i = 0; i < GFXCARD_MAX; i ++) videoCard[i] = gfxcard[i]; + + ui->lineEdit->setFilter(tr("EDID") % util::DlgFilter({ "bin", "dat", "edid" }) % tr("All files") % util::DlgFilter({ "*" }, true)); + onCurrentMachineChanged(machine); } @@ -67,6 +75,9 @@ SettingsDisplay::save() ibm8514_standalone_enabled = ui->checkBox8514->isChecked() ? 1 : 0; xga_standalone_enabled = ui->checkBoxXga->isChecked() ? 1 : 0; da2_standalone_enabled = ui->checkBoxDa2->isChecked() ? 1 : 0; + monitor_edid = ui->radioButtonCustom->isChecked() ? 1 : 0; + + strncpy(monitor_edid_path, ui->lineEdit->fileName().toUtf8().data(), sizeof(monitor_edid_path) - 1); } void @@ -121,6 +132,11 @@ SettingsDisplay::onCurrentMachineChanged(int machineId) for (uint8_t i = 1; i < GFXCARD_MAX; i ++) if (gfxcard[i] == 0) ui->pushButtonConfigureVideoSecondary->setEnabled(false); + + ui->radioButtonDefault->setChecked(monitor_edid == 0); + ui->radioButtonCustom->setChecked(monitor_edid == 1); + ui->lineEdit->setFileName(monitor_edid_path); + ui->lineEdit->setEnabled(monitor_edid == 1); } void @@ -305,3 +321,33 @@ SettingsDisplay::on_pushButtonConfigureVideoSecondary_clicked() auto *device = video_card_getdevice(ui->comboBoxVideoSecondary->currentData().toInt()); DeviceConfig::ConfigureDevice(device); } + +void SettingsDisplay::on_radioButtonDefault_clicked() +{ + ui->radioButtonDefault->setChecked(true); + ui->radioButtonCustom->setChecked(false); + ui->lineEdit->setEnabled(false); +} + + +void SettingsDisplay::on_radioButtonCustom_clicked() +{ + ui->radioButtonDefault->setChecked(false); + ui->radioButtonCustom->setChecked(true); + ui->lineEdit->setEnabled(true); +} + +void SettingsDisplay::on_pushButtonExportDefault_clicked() +{ + auto str = QFileDialog::getSaveFileName(this, tr("Export EDID...")); + if (!str.isEmpty()) { + QFile file(str); + if (file.open(QFile::WriteOnly)) { + ssize_t size = 0; + auto bytes = ddc_create_default_edid(&size); + file.write((char*)bytes, size); + file.close(); + } + } +} + diff --git a/src/qt/qt_settingsdisplay.hpp b/src/qt/qt_settingsdisplay.hpp index 7eca7cc60..8854b0373 100644 --- a/src/qt/qt_settingsdisplay.hpp +++ b/src/qt/qt_settingsdisplay.hpp @@ -40,6 +40,12 @@ private slots: void on_checkBoxDa2_stateChanged(int state); void on_pushButtonConfigureDa2_clicked(); + void on_radioButtonDefault_clicked(); + + void on_radioButtonCustom_clicked(); + + void on_pushButtonExportDefault_clicked(); + private: Ui::SettingsDisplay *ui; int machineId = 0; diff --git a/src/qt/qt_settingsdisplay.ui b/src/qt/qt_settingsdisplay.ui index c5eba7adf..6e4c14152 100644 --- a/src/qt/qt_settingsdisplay.ui +++ b/src/qt/qt_settingsdisplay.ui @@ -7,13 +7,13 @@ 0 0 400 - 300 + 466 Form - + 0 @@ -26,45 +26,27 @@ 0 - - - - - 0 - 0 - - + + - Video: + Voodoo 1 or 2 Graphics - - - - - 0 - 0 - - - - 30 - - - - - - - - 0 - 0 - - + + Configure + + + + IBM 8514/A Graphics + + + @@ -78,6 +60,83 @@ + + + + Configure + + + + + + + Configure + + + + + + + + 0 + 0 + + + + Monitor EDID + + + + + + + + Default + + + + + + + + 0 + 0 + + + + Export... + + + + + + + + + QLayout::SizeConstraint::SetNoConstraint + + + + + Custom... + + + + + + + + 0 + 0 + + + + + + + + + @@ -91,19 +150,18 @@ - - - - Configure + + + + Qt::Orientation::Vertical - - - - - - Voodoo 1 or 2 Graphics + + + 20 + 40 + - + @@ -112,20 +170,52 @@ - - + + + + + 0 + 0 + + - IBM 8514/A Graphics + Configure - - + + + + + 0 + 0 + + + + Video: + + + + + Configure + + + + + 0 + 0 + + + + 30 + + + @@ -133,13 +223,6 @@ - - - - Configure - - - @@ -147,28 +230,26 @@ - - - - Configure + + + + + 0 + 0 + - - - - Qt::Vertical - - - - 20 - 40 - - - - + + + FileField + QWidget +
qt_filefield.hpp
+ 1 +
+
diff --git a/src/video/vid_ddc.c b/src/video/vid_ddc.c index 787e7560e..d6c9095ef 100644 --- a/src/video/vid_ddc.c +++ b/src/video/vid_ddc.c @@ -23,6 +23,9 @@ #include #include <86box/86box.h> #include <86box/i2c.h> +#include <86box/vid_ddc.h> +#include <86box/plat.h> +#include <86box/ui.h> #define PIXEL_MM(px) (((px) * 25.4) / 96.0) #define STANDARD_TIMING(slot, width, aspect_ratio, refresh) \ @@ -126,8 +129,8 @@ typedef struct { uint8_t padding[15], checksum2; } edid_t; -void * -ddc_init(void *i2c) +void* +ddc_create_default_edid(ssize_t* size_out) { edid_t *edid = malloc(sizeof(edid_t)); memset(edid, 0, sizeof(edid_t)); @@ -222,7 +225,94 @@ ddc_init(void *i2c) edid->checksum2 += edid_bytes[c]; edid->checksum2 = 256 - edid->checksum2; - return i2c_eeprom_init(i2c, 0x50, edid_bytes, sizeof(edid_t), 0); + if (size_out) + *size_out = sizeof(edid_t); + + return edid; +} + +void * +ddc_init(void *i2c) +{ + ssize_t edid_size = 0; + uint8_t* edid_bytes = NULL; + if (monitor_edid == 1 && monitor_edid_path[0]) { + FILE* file = plat_fopen(monitor_edid_path, "rb"); + + if (!file) + goto default_init; + + if (fseek(file, 0, SEEK_END) == -1) { + fclose(file); + goto default_init; + } + + edid_size = ftell(file); + fseek(file, 0, SEEK_SET); + + if (edid_size <= 0) { + fclose(file); + goto default_init; + } + + if (edid_size > 256) { + wchar_t errmsg[2048] = { 0 }; + wchar_t path[2048] = { 0 }; + +#ifdef _WIN32 + mbstoc16s(path, monitor_edid_path, sizeof_w(path)); +#else + mbstowcs(path, monitor_edid_path, sizeof_w(path)); +#endif + swprintf(errmsg, sizeof_w(errmsg), plat_get_string(STRING_EDID_TOO_LARGE), path); + ui_msgbox_header(MBX_ERROR, L"EDID", errmsg); + fclose(file); + goto default_init; + } + + edid_bytes = calloc(1, edid_size); + if (!edid_bytes) { + fclose(file); + goto default_init; + } + + if (fread(edid_bytes, edid_size, 1, file) <= 0) { + free(edid_bytes); + fclose(file); + goto default_init; + } + + if (edid_size < 128) { + edid_bytes = realloc(edid_bytes, 128); + edid_size = 128; + } else if (edid_size < 256) { + edid_bytes = realloc(edid_bytes, 256); + edid_size = 256; + } + + { + int checksum = 0; + for (uint8_t c = 0; c < 127; c++) + checksum += edid_bytes[c]; + edid_bytes[127] = 256 - checksum; + + if (edid_size == 256) { + checksum = 0; + + for (uint8_t c = 128; c < 255; c++) { + checksum += edid_bytes[c]; + } + edid_bytes[255] = 256 - checksum; + } + } + + fclose(file); + return i2c_eeprom_init(i2c, 0x50, edid_bytes, edid_size, 0); + } +default_init: + edid_size = sizeof(edid_t); + edid_bytes = ddc_create_default_edid(&edid_size); + return i2c_eeprom_init(i2c, 0x50, edid_bytes, edid_size, 0); } void diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 21ea23c93..bbdd2df58 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -1146,7 +1146,6 @@ svga_recalctimings(svga_t *svga) if (dev->dispofftime < TIMER_USEC) dev->dispofftime = TIMER_USEC; - svga->monitor->mon_interlace = !!dev->interlace; ibm8514_set_poll(svga); } else svga_set_poll(svga); @@ -1165,7 +1164,6 @@ svga_recalctimings(svga_t *svga) if (xga->dispofftime < TIMER_USEC) xga->dispofftime = TIMER_USEC; - svga->monitor->mon_interlace = !!xga->interlace; xga_set_poll(svga); } else svga_set_poll(svga); @@ -1184,7 +1182,6 @@ svga_recalctimings(svga_t *svga) if (dev->dispofftime < TIMER_USEC) dev->dispofftime = TIMER_USEC; - svga->monitor->mon_interlace = !!dev->interlace; ibm8514_set_poll(svga); } else if (xga->on) { _dispofftime_xga = disptime_xga - _dispontime_xga; @@ -1198,7 +1195,6 @@ svga_recalctimings(svga_t *svga) if (xga->dispofftime < TIMER_USEC) xga->dispofftime = TIMER_USEC; - svga->monitor->mon_interlace = !!xga->interlace; xga_set_poll(svga); } else svga_set_poll(svga); @@ -1253,8 +1249,34 @@ svga_recalctimings(svga_t *svga) } svga->monitor->mon_interlace = 0; - if (!svga->override && svga->interlace) - svga->monitor->mon_interlace = 1; + if (!svga->override) { + switch (set_timer) { + default: + case 0: /*VGA only*/ + svga->monitor->mon_interlace = !!svga->interlace; + break; + case 1: /*Plus 8514/A*/ + if (dev->on) + svga->monitor->mon_interlace = !!dev->interlace; + else + svga->monitor->mon_interlace = !!svga->interlace; + break; + case 2: /*Plus XGA*/ + if (xga->on) + svga->monitor->mon_interlace = !!xga->interlace; + else + svga->monitor->mon_interlace = !!svga->interlace; + break; + case 3: /*Plus 8514/A and XGA*/ + if (dev->on) + svga->monitor->mon_interlace = !!dev->interlace; + else if (xga->on) + svga->monitor->mon_interlace = !!xga->interlace; + else + svga->monitor->mon_interlace = !!svga->interlace; + break; + } + } } static void