1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Fixed Oric SCART mode by having it change what it's giving to the CRT based on which shader it knows will be active.

This commit is contained in:
Thomas Harte 2016-12-10 13:55:56 -05:00
parent a549fd1ecc
commit 580f347727
5 changed files with 35 additions and 19 deletions

View File

@ -218,6 +218,11 @@ void Machine::set_use_fast_tape_hack(bool activate)
use_fast_tape_hack_ = activate; use_fast_tape_hack_ = activate;
} }
void Machine::set_output_device(Outputs::CRT::OutputDevice output_device)
{
video_output_->set_output_device(output_device);
}
void Machine::tape_did_change_input(Storage::Tape::BinaryTapePlayer *tape_player) void Machine::tape_did_change_input(Storage::Tape::BinaryTapePlayer *tape_player)
{ {
// set CB1 // set CB1

View File

@ -73,6 +73,7 @@ class Machine:
void clear_all_keys(); void clear_all_keys();
void set_use_fast_tape_hack(bool activate); void set_use_fast_tape_hack(bool activate);
void set_output_device(Outputs::CRT::OutputDevice output_device);
// to satisfy ConfigurationTarget::Machine // to satisfy ConfigurationTarget::Machine
void configure_as_target(const StaticAnalyser::Target &target); void configure_as_target(const StaticAnalyser::Target &target);

View File

@ -33,7 +33,6 @@ VideoOutput::VideoOutput(uint8_t *memory) :
"vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)" "vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)"
"{" "{"
"uint texValue = texture(sampler, coordinate).r;" "uint texValue = texture(sampler, coordinate).r;"
"texValue >>= 4 - (int(icoordinate.x * 8) & 4);"
"return vec3( uvec3(texValue) & uvec3(4u, 2u, 1u));" "return vec3( uvec3(texValue) & uvec3(4u, 2u, 1u));"
"}"); "}");
crt_->set_composite_sampling_function( crt_->set_composite_sampling_function(
@ -46,10 +45,16 @@ VideoOutput::VideoOutput(uint8_t *memory) :
"}" "}"
); );
crt_->set_output_device(Outputs::CRT::Television); set_output_device(Outputs::CRT::Television);
crt_->set_visible_area(crt_->get_rect_for_area(50, 224, 16 * 6, 40 * 6, 4.0f / 3.0f)); crt_->set_visible_area(crt_->get_rect_for_area(50, 224, 16 * 6, 40 * 6, 4.0f / 3.0f));
} }
void VideoOutput::set_output_device(Outputs::CRT::OutputDevice output_device)
{
output_device_ = output_device;
crt_->set_output_device(output_device);
}
void VideoOutput::set_colour_rom(const std::vector<uint8_t> &rom) void VideoOutput::set_colour_rom(const std::vector<uint8_t> &rom)
{ {
for(size_t c = 0; c < 8; c++) for(size_t c = 0; c < 8; c++)
@ -135,19 +140,17 @@ void VideoOutput::run_for_cycles(int number_of_cycles)
{ {
if(pixel_target_) if(pixel_target_)
{ {
// uint8_t colours[2] = { uint16_t colours[2];
// (uint8_t)(paper_ ^ inverse_mask), if(output_device_ == Outputs::CRT::Monitor)
// (uint8_t)(ink_ ^ inverse_mask), {
// }; colours[0] = (uint8_t)((paper_ ^ inverse_mask) & 0xf);
// colours[1] = (uint8_t)((ink_ ^ inverse_mask) & 0xf);
// pixel_target_[0] = (colours[(pixels >> 4)&1] & 0x0f) | (colours[(pixels >> 5)&1] & 0xf0); }
// pixel_target_[1] = (colours[(pixels >> 2)&1] & 0x0f) | (colours[(pixels >> 3)&1] & 0xf0); else
// pixel_target_[2] = (colours[(pixels >> 0)&1] & 0x0f) | (colours[(pixels >> 1)&1] & 0xf0); {
colours[0] = colour_forms_[(paper_ ^ inverse_mask)&0xf];
uint16_t colours[2] = { colours[1] = colour_forms_[(ink_ ^ inverse_mask)&0xf];
colour_forms_[(paper_ ^ inverse_mask)&0xf], }
colour_forms_[(ink_ ^ inverse_mask)&0xf],
};
pixel_target_[0] = colours[(pixels >> 5)&1]; pixel_target_[0] = colours[(pixels >> 5)&1];
pixel_target_[1] = colours[(pixels >> 4)&1]; pixel_target_[1] = colours[(pixels >> 4)&1];
pixel_target_[2] = colours[(pixels >> 3)&1]; pixel_target_[2] = colours[(pixels >> 3)&1];
@ -194,8 +197,13 @@ void VideoOutput::run_for_cycles(int number_of_cycles)
default: break; default: break;
} }
// if(pixel_target_) pixel_target_[0] = pixel_target_[1] = pixel_target_[2] = (uint8_t)(paper_ ^ inverse_mask); if(pixel_target_)
if(pixel_target_) pixel_target_[0] = pixel_target_[1] = pixel_target_[2] = pixel_target_[3] = pixel_target_[4] = pixel_target_[5] = colour_forms_[(paper_&0xf) ^ inverse_mask]; {
pixel_target_[0] = pixel_target_[1] =
pixel_target_[2] = pixel_target_[3] =
pixel_target_[4] = pixel_target_[5] =
(output_device_ == Outputs::CRT::Monitor) ? (paper_ ^ inverse_mask)&0xf : colour_forms_[(paper_ ^ inverse_mask)&0xf];
}
} }
if(pixel_target_) pixel_target_ += 6; if(pixel_target_) pixel_target_ += 6;
h_counter++; h_counter++;

View File

@ -19,6 +19,7 @@ class VideoOutput {
std::shared_ptr<Outputs::CRT::CRT> get_crt(); std::shared_ptr<Outputs::CRT::CRT> get_crt();
void run_for_cycles(int number_of_cycles); void run_for_cycles(int number_of_cycles);
void set_colour_rom(const std::vector<uint8_t> &rom); void set_colour_rom(const std::vector<uint8_t> &rom);
void set_output_device(Outputs::CRT::OutputDevice output_device);
private: private:
uint8_t *ram_; uint8_t *ram_;
@ -28,9 +29,10 @@ class VideoOutput {
int counter_, frame_counter_; int counter_, frame_counter_;
int v_sync_start_position_, v_sync_end_position_, counter_period_; int v_sync_start_position_, v_sync_end_position_, counter_period_;
// Output target // Output target and device
uint16_t *pixel_target_; uint16_t *pixel_target_;
uint16_t colour_forms_[8]; uint16_t colour_forms_[8];
Outputs::CRT::OutputDevice output_device_;
// Registers // Registers
uint8_t ink_, paper_; uint8_t ink_, paper_;

View File

@ -152,7 +152,7 @@
- (void)setUseCompositeOutput:(BOOL)useCompositeOutput { - (void)setUseCompositeOutput:(BOOL)useCompositeOutput {
@synchronized(self) { @synchronized(self) {
_useCompositeOutput = useCompositeOutput; _useCompositeOutput = useCompositeOutput;
_oric.get_crt()->set_output_device(useCompositeOutput ? Outputs::CRT::Television : Outputs::CRT::Monitor); _oric.set_output_device(useCompositeOutput ? Outputs::CRT::Television : Outputs::CRT::Monitor);
} }
} }