mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-26 09:29:45 +00:00
This then is what the serial dispatch queue and the triple buffer achieve together: I can post the runs over to the main thread for processing while emulation continues separately.
This commit is contained in:
parent
e7237c7bd5
commit
0611646181
@ -26,36 +26,43 @@ struct Atari2600CRTDelegate: public Outputs::CRT::CRTDelegate {
|
||||
}
|
||||
|
||||
- (void)crtDidEndFrame:(Outputs::CRTFrame *)frame {
|
||||
printf("\n\n===\n\n");
|
||||
int c = 0;
|
||||
for(int run = 0; run < frame->number_of_runs; run++)
|
||||
{
|
||||
char character = ' ';
|
||||
switch(frame->runs[run].type)
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
printf("\n\n===\n\n");
|
||||
int c = 0;
|
||||
for(int run = 0; run < frame->number_of_runs; run++)
|
||||
{
|
||||
case Outputs::CRTRun::Type::Sync: character = '<'; break;
|
||||
case Outputs::CRTRun::Type::Level: character = '_'; break;
|
||||
case Outputs::CRTRun::Type::Data: character = '-'; break;
|
||||
case Outputs::CRTRun::Type::Blank: character = ' '; break;
|
||||
char character = ' ';
|
||||
switch(frame->runs[run].type)
|
||||
{
|
||||
case Outputs::CRTRun::Type::Sync: character = '<'; break;
|
||||
case Outputs::CRTRun::Type::Level: character = '_'; break;
|
||||
case Outputs::CRTRun::Type::Data: character = '-'; break;
|
||||
case Outputs::CRTRun::Type::Blank: character = ' '; break;
|
||||
}
|
||||
|
||||
if(frame->runs[run].start_point.dst_x < 1.0 / 224.0)
|
||||
{
|
||||
printf("\n[%0.2f]: ", frame->runs[run].start_point.dst_y);
|
||||
c++;
|
||||
}
|
||||
|
||||
printf("(%0.2f): ", frame->runs[run].start_point.dst_x);
|
||||
float length = fabsf(frame->runs[run].end_point.dst_x - frame->runs[run].start_point.dst_x);
|
||||
int iLength = (int)(length * 64.0);
|
||||
for(int c = 0; c < iLength; c++)
|
||||
{
|
||||
putc(character, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
if(frame->runs[run].start_point.dst_x < 1.0 / 224.0)
|
||||
{
|
||||
printf("\n[%0.2f]: ", frame->runs[run].start_point.dst_y);
|
||||
c++;
|
||||
}
|
||||
printf("\n\n[%d]\n\n", c);
|
||||
|
||||
printf("(%0.2f): ", frame->runs[run].start_point.dst_x);
|
||||
float length = fabsf(frame->runs[run].end_point.dst_x - frame->runs[run].start_point.dst_x);
|
||||
int iLength = (int)(length * 64.0);
|
||||
for(int c = 0; c < iLength; c++)
|
||||
{
|
||||
putc(character, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n\n[%d]\n\n", c);
|
||||
_atari2600.get_crt()->return_frame();
|
||||
dispatch_async(_serialDispatchQueue, ^{
|
||||
_atari2600.get_crt()->return_frame();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
- (void)runForNumberOfCycles:(int)cycles {
|
||||
@ -76,7 +83,7 @@ struct Atari2600CRTDelegate: public Outputs::CRT::CRTDelegate {
|
||||
if (self) {
|
||||
_crtDelegate.atari = self;
|
||||
_atari2600.get_crt()->set_delegate(&_crtDelegate);
|
||||
_serialDispatchQueue = dispatch_queue_create("Atari 2600 quuue", DISPATCH_QUEUE_SERIAL);
|
||||
_serialDispatchQueue = dispatch_queue_create("Atari 2600 queue", DISPATCH_QUEUE_SERIAL);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
Loading…
Reference in New Issue
Block a user