From e32ae6c191e8c05f724c64a4ad53cf0d6a332ba8 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 10 Sep 2020 22:10:24 -0400 Subject: [PATCH] Adds UGLY HACKs to workaround uncovered issues in the OpenGL scan target. --- Machines/Apple/AppleII/Video.hpp | 12 +++++++++++- Machines/Apple/Macintosh/Video.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Machines/Apple/AppleII/Video.hpp b/Machines/Apple/AppleII/Video.hpp index d75fd3f4e..67124fae4 100644 --- a/Machines/Apple/AppleII/Video.hpp +++ b/Machines/Apple/AppleII/Video.hpp @@ -541,7 +541,17 @@ template class Video: public VideoBase { const int colour_burst_start = std::max(first_sync_column + sync_length + 1, column_); const int colour_burst_end = std::min(first_sync_column + sync_length + 4, ending_column); if(colour_burst_end > colour_burst_start) { - crt_.output_colour_burst((colour_burst_end - colour_burst_start) * 14, 0); + // UGLY HACK AHOY! + // The OpenGL scan target introduces a phase error of 1/8th of a wave. The Metal one does not. + // Supply the real phase value if this is an Apple build. + // TODO: eliminate UGLY HACK. +#ifdef __APPLE__ + constexpr int phase = 224; +#else + constexpr int phase = 0; +#endif + + crt_.output_colour_burst((colour_burst_end - colour_burst_start) * 14, phase); } second_blank_start = std::max(first_sync_column + sync_length + 3, column_); diff --git a/Machines/Apple/Macintosh/Video.cpp b/Machines/Apple/Macintosh/Video.cpp index 8d1bfcdf1..f0975979e 100644 --- a/Machines/Apple/Macintosh/Video.cpp +++ b/Machines/Apple/Macintosh/Video.cpp @@ -29,7 +29,17 @@ Video::Video(DeferredAudio &audio, DriveSpeedAccumulator &drive_speed_accumulato crt_(704, 1, 370, 6, Outputs::Display::InputDataType::Luminance1) { crt_.set_display_type(Outputs::Display::DisplayType::RGB); -// crt_.set_visible_area(Outputs::Display::Rect(0.08f, -0.025f, 0.82f, 0.82f)); + + // UGLY HACK. UGLY, UGLY HACK. UGLY! + // The OpenGL scan target fails properly to place visible areas which are not 4:3. + // The [newer] Metal scan target has no such issue. So assume that Apple => Metal, + // and set a visible area to work around the OpenGL issue if required. + // TODO: eliminate UGLY HACK. +#ifdef __APPLE__ + crt_.set_visible_area(Outputs::Display::Rect(0.08f, 10.0f / 368.0f, 0.82f, 344.0f / 368.0f)); +#else + crt_.set_visible_area(Outputs::Display::Rect(0.08f, -0.025f, 0.82f, 0.82f)); +#endif crt_.set_aspect_ratio(1.73f); // The Mac uses a non-standard scanning area. }