From 10e2b560b9df6ab7b3ca5b0a153498460dffcb5f Mon Sep 17 00:00:00 2001 From: Yoshi Sugawara Date: Thu, 23 Sep 2021 22:48:30 -1000 Subject: [PATCH] Fixed video displaying in iOS 15 --- ActiveGS_iOS/activegs.plist | 2 +- kegs/OSX/macdriver_activegs.cpp | 17 ++++++++++++----- kegs/iOS/emulatorView.h | 2 +- kegs/iOS/emulatorView.mm | 20 +++++++++++++------- kegs/iOS/zoomEmulatorView.mm | 2 +- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/ActiveGS_iOS/activegs.plist b/ActiveGS_iOS/activegs.plist index d3f6440..b33c8a0 100644 --- a/ActiveGS_iOS/activegs.plist +++ b/ActiveGS_iOS/activegs.plist @@ -74,7 +74,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.42 + $(MARKETING_VERSION) CFBundleSignature ???? CFBundleVersion diff --git a/kegs/OSX/macdriver_activegs.cpp b/kegs/OSX/macdriver_activegs.cpp index 4145ab1..35ba2c1 100644 --- a/kegs/OSX/macdriver_activegs.cpp +++ b/kegs/OSX/macdriver_activegs.cpp @@ -55,7 +55,7 @@ int messageLineVBL=0; -void x_async_refresh(CGContextRef myContext,CGRect myBoundingBox) +void x_async_refresh(CGContextRef myContext,CGRect myBoundingBox, CGImageRef *imageRef) { #ifdef ENABLEQD @@ -92,10 +92,17 @@ void x_async_refresh(CGContextRef myContext,CGRect myBoundingBox) CGImageRef myImage = CGBitmapContextCreateImage((CGContextRef)g_kimage_offscreen.dev_handle); - - - - CGContextDrawImage(myContext, myBoundingBox, myImage);// 6 + *imageRef = CGBitmapContextCreateImage((CGContextRef)g_kimage_offscreen.dev_handle); + + // Yoshi debugging: iOS 15 issue + // CGContextDrawImage draws a blank if the target rect width values in 233 ... 235 + // Raw image size of screen is 704x221. + // Rect size here is 234.6667 x 77 for 3x retina size display (iPhone) + // Calling CGContextDrawImage using this rect results in a blank image + // width of 234.0 and 235.0 does not work + // adding 3 to the width here renders the image + CGRect newRect = CGRectMake(myBoundingBox.origin.x, myBoundingBox.origin.y, myBoundingBox.size.width + 3.0, myBoundingBox.size.height); + CGContextDrawImage(myContext, newRect, myImage);// 6 #ifndef VIDEO_SINGLEVLINE if (r_sim65816.get_video_fx() == VIDEOFX_CRT) diff --git a/kegs/iOS/emulatorView.h b/kegs/iOS/emulatorView.h index cbc5dd1..02de7b3 100644 --- a/kegs/iOS/emulatorView.h +++ b/kegs/iOS/emulatorView.h @@ -9,7 +9,7 @@ #import #include -extern void x_async_refresh(CGContextRef myContext,CGRect r); +extern void x_async_refresh(CGContextRef myContext,CGRect r, CGImageRef *imageRef); extern void add_event_key(int,int); extern void add_event_mouse(int _x,int _y, int _state, int _button); extern void add_event_modifier(unsigned int state) ; diff --git a/kegs/iOS/emulatorView.mm b/kegs/iOS/emulatorView.mm index 91530c8..00a8afb 100644 --- a/kegs/iOS/emulatorView.mm +++ b/kegs/iOS/emulatorView.mm @@ -86,13 +86,19 @@ void x_invalidrect() { CGContextRef g = UIGraphicsGetCurrentContext(); - x_async_refresh(g,rect); - -// // yoshi test... -// CGImageRef imgRef = CGBitmapContextCreateImage(g); -// UIImage *image = [UIImage imageWithCGImage:imgRef]; -// CGImageRelease(imgRef); -// NSLog(@"yoshi buffer image = %@",image); + + CGImageRef imageRef; + x_async_refresh(g,rect,&imageRef); + // // yoshi test... + // CGImageRef imgRef = CGBitmapContextCreateImage(g); + // UIImage *image = [UIImage imageWithCGImage:imgRef]; + // CGImageRelease(imgRef); + // NSLog(@"yoshi buffer image = %@",image); +// if ( imageRef != nil ) { +// UIImage *image = [[UIImage alloc] initWithCGImage:imageRef]; +// NSLog(@"yoshi debug: image = %@",image.description); +// CGContextDrawImage(g, CGRectMake(0, 0, 275, 77), imageRef); +// } } diff --git a/kegs/iOS/zoomEmulatorView.mm b/kegs/iOS/zoomEmulatorView.mm index 07c90dc..fe5ff01 100644 --- a/kegs/iOS/zoomEmulatorView.mm +++ b/kegs/iOS/zoomEmulatorView.mm @@ -133,7 +133,7 @@ float refScaleLandscape; self->viewSize = frame.size; self->dpiRatio = ratio; - CGRect r = CGRectMake(0.0,0.0,X_A2_WINDOW_WIDTH/self->dpiRatio ,X_A2_WINDOW_HEIGHT/self->dpiRatio ); + CGRect r = CGRectMake(0.0,0.0, X_A2_WINDOW_WIDTH/self->dpiRatio, X_A2_WINDOW_HEIGHT/self->dpiRatio ); self.contentSize = CGSizeMake(r.size.width,r.size.height); [self.ew setFrame:r];