From eefd17ed4ce3961e816fba9158227b80a06e9d4a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 5 Mar 2016 21:52:22 -0500 Subject: [PATCH] Fixed sync response in composite scan output generation and stored texture coordinates. --- Machines/Electron/Electron.cpp | 2 +- Outputs/CRT/CRT.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 5f791a349..4023ceabd 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -40,7 +40,7 @@ Machine::Machine() : "float texValue = texture(texID, coordinate).r;" "return vec3(step(4.0/256.0, mod(texValue, 8.0/256.0)), step(2.0/256.0, mod(texValue, 4.0/256.0)), step(1.0/256.0, mod(texValue, 2.0/256.0)));" "}"); - _crt->set_output_device(Outputs::CRT::Monitor); + _crt->set_output_device(Outputs::CRT::Television); // _crt->set_visible_area(Outputs::Rect(0.23108f, 0.0f, 0.8125f, 0.98f)); //1875 memset(_key_states, 0, sizeof(_key_states)); diff --git a/Outputs/CRT/CRT.cpp b/Outputs/CRT/CRT.cpp index 21019fb99..4f524ad3c 100644 --- a/Outputs/CRT/CRT.cpp +++ b/Outputs/CRT/CRT.cpp @@ -249,7 +249,9 @@ void CRT::advance_cycles(unsigned int number_of_cycles, unsigned int source_divi // if this is horizontal retrace then advance the output line counter and bookend an output run if(_output_device == CRT::Television) { - Flywheel::SyncEvent honoured_event = (next_run_length == time_until_vertical_sync_event) ? next_vertical_sync_event : next_horizontal_sync_event; + Flywheel::SyncEvent honoured_event = Flywheel::SyncEvent::None; + if(next_run_length == time_until_vertical_sync_event && next_vertical_sync_event != Flywheel::SyncEvent::None) honoured_event = next_vertical_sync_event; + if(next_run_length == time_until_horizontal_sync_event && next_horizontal_sync_event != Flywheel::SyncEvent::None) honoured_event = next_horizontal_sync_event; bool needs_endpoint = (honoured_event == Flywheel::SyncEvent::StartRetrace && _is_writing_composite_run) || (honoured_event == Flywheel::SyncEvent::EndRetrace && !_horizontal_flywheel->is_in_retrace() && !_vertical_flywheel->is_in_retrace()); @@ -261,8 +263,8 @@ void CRT::advance_cycles(unsigned int number_of_cycles, unsigned int source_divi output_position_x(0) = output_position_x(1) = output_position_x(2) = (uint16_t)_horizontal_flywheel->get_current_output_position(); output_position_y(0) = output_position_y(1) = output_position_y(2) = (uint16_t)(_vertical_flywheel->get_current_output_position() / _vertical_flywheel_output_divider); output_timestamp(0) = output_timestamp(1) = output_timestamp(2) = _run_builders[_run_write_pointer]->duration; - output_tex_x(0) = output_tex_x(1) = output_tex_x(2) = tex_x; - output_tex_y(0) = output_tex_y(1) = output_tex_y(2) = tex_y; + output_tex_x(0) = output_tex_x(1) = output_tex_x(2) = (uint16_t)_horizontal_flywheel->get_current_output_position(); + output_tex_y(0) = output_tex_y(1) = output_tex_y(2) = _composite_src_output_y; output_lateral(0) = 0; output_lateral(1) = _is_writing_composite_run ? 1 : 0; output_lateral(2) = 1;