From 9cbd61e7091c01c77dc526f4490d71fbae9a87e8 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 15 Jan 2018 18:37:09 -0500 Subject: [PATCH] Replaces CRT quantity assert with test. Primarily to handle television/composite target switches that can unsync the buffers. --- Outputs/CRT/CRT.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Outputs/CRT/CRT.cpp b/Outputs/CRT/CRT.cpp index e4fe5437f..2e1fb5c65 100644 --- a/Outputs/CRT/CRT.cpp +++ b/Outputs/CRT/CRT.cpp @@ -221,11 +221,13 @@ void CRT::advance_cycles(unsigned int number_of_cycles, bool hsync_requested, bo [=] (uint8_t *input_buffer, std::size_t input_size, uint8_t *output_buffer, std::size_t output_size) { openGL_output_builder_.texture_builder.flush( [=] (const std::vector &write_areas, std::size_t number_of_write_areas) { - assert(number_of_write_areas * SourceVertexSize == input_size); - for(std::size_t run = 0; run < number_of_write_areas; run++) { - *reinterpret_cast(&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfInputStart + 0]) = write_areas[run].x; - *reinterpret_cast(&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfInputStart + 2]) = write_areas[run].y; - *reinterpret_cast(&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfEnds + 0]) = write_areas[run].x + write_areas[run].length; +// assert(number_of_write_areas * SourceVertexSize == input_size); + if(number_of_write_areas * SourceVertexSize == input_size) { + for(std::size_t run = 0; run < number_of_write_areas; run++) { + *reinterpret_cast(&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfInputStart + 0]) = write_areas[run].x; + *reinterpret_cast(&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfInputStart + 2]) = write_areas[run].y; + *reinterpret_cast(&input_buffer[run * SourceVertexSize + SourceVertexOffsetOfEnds + 0]) = write_areas[run].x + write_areas[run].length; + } } }); for(std::size_t position = 0; position < input_size; position += SourceVertexSize) {