Cocoa Port:
- Rewrite the display code to be much more flexible (the OpenGL blitter now uses cached vertices instead of calculating the vertices per frame). - New feature: The DS screens can now be arranged horizontally as well as vertically. - New feature: The order of the DS screens can now be set. - Misc. code cleanup.
This commit is contained in:
parent
df04471b41
commit
2b82193674
Binary file not shown.
|
@ -346,6 +346,8 @@ enum
|
||||||
MESSAGE_REDRAW_VIEW,
|
MESSAGE_REDRAW_VIEW,
|
||||||
MESSAGE_SET_GPU_STATE_FLAGS,
|
MESSAGE_SET_GPU_STATE_FLAGS,
|
||||||
MESSAGE_CHANGE_DISPLAY_TYPE,
|
MESSAGE_CHANGE_DISPLAY_TYPE,
|
||||||
|
MESSAGE_CHANGE_DISPLAY_ORIENTATION,
|
||||||
|
MESSAGE_CHANGE_DISPLAY_ORDER,
|
||||||
MESSAGE_CHANGE_BILINEAR_OUTPUT,
|
MESSAGE_CHANGE_BILINEAR_OUTPUT,
|
||||||
MESSAGE_CHANGE_VERTICAL_SYNC,
|
MESSAGE_CHANGE_VERTICAL_SYNC,
|
||||||
MESSAGE_CHANGE_VIDEO_FILTER,
|
MESSAGE_CHANGE_VIDEO_FILTER,
|
||||||
|
@ -381,6 +383,18 @@ enum
|
||||||
DS_DISPLAY_TYPE_COMBO
|
DS_DISPLAY_TYPE_COMBO
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
DS_DISPLAY_ORIENTATION_VERTICAL = 0,
|
||||||
|
DS_DISPLAY_ORIENTATION_HORIZONTAL
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
DS_DISPLAY_ORDER_MAIN_FIRST = 0,
|
||||||
|
DS_DISPLAY_ORDER_TOUCH_FIRST
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
DS GPU TYPES
|
DS GPU TYPES
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -104,6 +104,8 @@
|
||||||
- (void) doResizeView:(NSRect)rect;
|
- (void) doResizeView:(NSRect)rect;
|
||||||
- (void) doRedraw;
|
- (void) doRedraw;
|
||||||
- (void) doDisplayTypeChanged:(NSInteger)displayTypeID;
|
- (void) doDisplayTypeChanged:(NSInteger)displayTypeID;
|
||||||
|
- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID;
|
||||||
|
- (void) doDisplayOrderChanged:(NSInteger)displayOrderID;
|
||||||
- (void) doBilinearOutputChanged:(BOOL)useBilinear;
|
- (void) doBilinearOutputChanged:(BOOL)useBilinear;
|
||||||
- (void) doVerticalSyncChanged:(BOOL)useVerticalSync;
|
- (void) doVerticalSyncChanged:(BOOL)useVerticalSync;
|
||||||
- (void) doVideoFilterChanged:(NSInteger)videoFilterTypeID;
|
- (void) doVideoFilterChanged:(NSInteger)videoFilterTypeID;
|
||||||
|
@ -164,6 +166,8 @@
|
||||||
- (void) handleRedrawView;
|
- (void) handleRedrawView;
|
||||||
- (void) handleChangeGpuStateFlags:(NSData *)flagsData;
|
- (void) handleChangeGpuStateFlags:(NSData *)flagsData;
|
||||||
- (void) handleChangeDisplayType:(NSData *)displayTypeIdData;
|
- (void) handleChangeDisplayType:(NSData *)displayTypeIdData;
|
||||||
|
- (void) handleChangeDisplayOrientation:(NSData *)displayOrientationIdData;
|
||||||
|
- (void) handleChangeDisplayOrder:(NSData *)displayOrderIdData;
|
||||||
- (void) handleChangeBilinearOutput:(NSData *)bilinearStateData;
|
- (void) handleChangeBilinearOutput:(NSData *)bilinearStateData;
|
||||||
- (void) handleChangeVerticalSync:(NSData *)verticalSyncStateData;
|
- (void) handleChangeVerticalSync:(NSData *)verticalSyncStateData;
|
||||||
- (void) handleChangeVideoFilter:(NSData *)videoFilterTypeIdData;
|
- (void) handleChangeVideoFilter:(NSData *)videoFilterTypeIdData;
|
||||||
|
|
|
@ -1053,6 +1053,14 @@ GPU3DInterface *core3DList[] = {
|
||||||
[self handleChangeDisplayType:[messageComponents objectAtIndex:0]];
|
[self handleChangeDisplayType:[messageComponents objectAtIndex:0]];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MESSAGE_CHANGE_DISPLAY_ORIENTATION:
|
||||||
|
[self handleChangeDisplayOrientation:[messageComponents objectAtIndex:0]];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MESSAGE_CHANGE_DISPLAY_ORDER:
|
||||||
|
[self handleChangeDisplayOrder:[messageComponents objectAtIndex:0]];
|
||||||
|
break;
|
||||||
|
|
||||||
case MESSAGE_CHANGE_BILINEAR_OUTPUT:
|
case MESSAGE_CHANGE_BILINEAR_OUTPUT:
|
||||||
[self handleChangeBilinearOutput:[messageComponents objectAtIndex:0]];
|
[self handleChangeBilinearOutput:[messageComponents objectAtIndex:0]];
|
||||||
break;
|
break;
|
||||||
|
@ -1181,6 +1189,28 @@ GPU3DInterface *core3DList[] = {
|
||||||
[delegate doDisplayTypeChanged:*theType];
|
[delegate doDisplayTypeChanged:*theType];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) handleChangeDisplayOrientation:(NSData *)displayOrientationIdData
|
||||||
|
{
|
||||||
|
if (delegate == nil || ![delegate respondsToSelector:@selector(doDisplayOrientationChanged:)])
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const NSInteger *theOrientation = (NSInteger *)[displayOrientationIdData bytes];
|
||||||
|
[delegate doDisplayOrientationChanged:*theOrientation];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) handleChangeDisplayOrder:(NSData *)displayOrderIdData
|
||||||
|
{
|
||||||
|
if (delegate == nil || ![delegate respondsToSelector:@selector(doDisplayOrderChanged:)])
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const NSInteger *theOrder = (NSInteger *)[displayOrderIdData bytes];
|
||||||
|
[delegate doDisplayOrderChanged:*theOrder];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) handleChangeBilinearOutput:(NSData *)bilinearStateData
|
- (void) handleChangeBilinearOutput:(NSData *)bilinearStateData
|
||||||
{
|
{
|
||||||
if (delegate == nil || ![delegate respondsToSelector:@selector(doBilinearOutputChanged:)])
|
if (delegate == nil || ![delegate respondsToSelector:@selector(doBilinearOutputChanged:)])
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -38,6 +38,8 @@
|
||||||
- (void) doResizeView:(NSRect)rect;
|
- (void) doResizeView:(NSRect)rect;
|
||||||
- (void) doRedraw;
|
- (void) doRedraw;
|
||||||
- (void) doDisplayTypeChanged:(NSInteger)displayTypeID;
|
- (void) doDisplayTypeChanged:(NSInteger)displayTypeID;
|
||||||
|
- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID;
|
||||||
|
- (void) doDisplayOrderChanged:(NSInteger)displayOrderID;
|
||||||
- (void) doBilinearOutputChanged:(BOOL)useBilinear;
|
- (void) doBilinearOutputChanged:(BOOL)useBilinear;
|
||||||
- (void) doVerticalSyncChanged:(BOOL)useVerticalSync;
|
- (void) doVerticalSyncChanged:(BOOL)useVerticalSync;
|
||||||
- (void) doVideoFilterChanged:(NSInteger)videoFilterTypeID;
|
- (void) doVideoFilterChanged:(NSInteger)videoFilterTypeID;
|
||||||
|
@ -58,38 +60,31 @@
|
||||||
NSSize normalSize;
|
NSSize normalSize;
|
||||||
NSMutableDictionary *bindings;
|
NSMutableDictionary *bindings;
|
||||||
|
|
||||||
OSSpinLock spinlockGpuStateFlags;
|
|
||||||
OSSpinLock spinlockDisplayType;
|
|
||||||
OSSpinLock spinlockNormalSize;
|
OSSpinLock spinlockNormalSize;
|
||||||
|
OSSpinLock spinlockGpuStateFlags;
|
||||||
OSSpinLock spinlockScale;
|
OSSpinLock spinlockScale;
|
||||||
OSSpinLock spinlockRotation;
|
OSSpinLock spinlockRotation;
|
||||||
OSSpinLock spinlockUseBilinearOutput;
|
OSSpinLock spinlockUseBilinearOutput;
|
||||||
OSSpinLock spinlockUseVerticalSync;
|
OSSpinLock spinlockUseVerticalSync;
|
||||||
|
OSSpinLock spinlockDisplayType;
|
||||||
|
OSSpinLock spinlockDisplayOrientation;
|
||||||
|
OSSpinLock spinlockDisplayOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (retain) NSView <DisplayViewDelegate> *view;
|
@property (retain) NSView <DisplayViewDelegate> *view;
|
||||||
@property (retain) NSPort *sendPortInput;
|
@property (retain) NSPort *sendPortInput;
|
||||||
@property (retain) CocoaDSController *cdsController;
|
@property (retain) CocoaDSController *cdsController;
|
||||||
@property (readonly) NSSize normalSize;
|
@property (readonly) NSSize normalSize;
|
||||||
|
@property (assign) UInt32 gpuStateFlags;
|
||||||
@property (assign) double scale;
|
@property (assign) double scale;
|
||||||
@property (assign) double rotation;
|
@property (assign) double rotation;
|
||||||
@property (assign) BOOL useBilinearOutput;
|
@property (assign) BOOL useBilinearOutput;
|
||||||
@property (assign) BOOL useVerticalSync;
|
@property (assign) BOOL useVerticalSync;
|
||||||
@property (assign) NSInteger displayType;
|
@property (assign) NSInteger displayType;
|
||||||
|
@property (assign) NSInteger displayOrientation;
|
||||||
|
@property (assign) NSInteger displayOrder;
|
||||||
@property (readonly) NSMutableDictionary *bindings;
|
@property (readonly) NSMutableDictionary *bindings;
|
||||||
|
|
||||||
- (void) setGpuStateFlags:(UInt32)flags;
|
|
||||||
- (UInt32) gpuStateFlags;
|
|
||||||
- (void) setScale:(double)s;
|
|
||||||
- (double) scale;
|
|
||||||
- (void) setRotation:(double)angleDegrees;
|
|
||||||
- (double) rotation;
|
|
||||||
- (void) setUseBilinearOutput:(BOOL)theState;
|
|
||||||
- (BOOL) useBilinearOutput;
|
|
||||||
- (void) setUseVerticalSync:(BOOL)theState;
|
|
||||||
- (BOOL) useVerticalSync;
|
|
||||||
- (void) setDisplayType:(NSInteger)theType;
|
|
||||||
- (NSInteger) displayType;
|
|
||||||
- (void) setVideoFilterType:(NSInteger)theType;
|
- (void) setVideoFilterType:(NSInteger)theType;
|
||||||
- (void) setRender3DRenderingEngine:(NSInteger)methodID;
|
- (void) setRender3DRenderingEngine:(NSInteger)methodID;
|
||||||
- (void) setRender3DHighPrecisionColorInterpolation:(BOOL)state;
|
- (void) setRender3DHighPrecisionColorInterpolation:(BOOL)state;
|
||||||
|
@ -125,12 +120,16 @@
|
||||||
@interface OpenGLDisplayView : NSOpenGLView <DisplayViewDelegate>
|
@interface OpenGLDisplayView : NSOpenGLView <DisplayViewDelegate>
|
||||||
{
|
{
|
||||||
DisplayViewDelegate *dispViewDelegate;
|
DisplayViewDelegate *dispViewDelegate;
|
||||||
NSSize lastFrameSize;
|
|
||||||
GLint glTexRenderStyle;
|
GLint glTexRenderStyle;
|
||||||
GLenum glTexPixelFormat;
|
GLenum glTexPixelFormat;
|
||||||
GLvoid *glTexBack;
|
GLvoid *glTexBack;
|
||||||
NSSize glTexBackSize;
|
NSSize glTexBackSize;
|
||||||
|
|
||||||
GLuint swRasterizerDrawTexture[2];
|
GLuint swRasterizerDrawTexture[2];
|
||||||
|
GLfloat swRasterizerMainTexCoord[4][2];
|
||||||
|
GLfloat swRasterizerMainVertex[4][2];
|
||||||
|
GLfloat swRasterizerTouchTexCoord[4][2];
|
||||||
|
GLfloat swRasterizerTouchVertex[4][2];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawVideoFrame;
|
- (void) drawVideoFrame;
|
||||||
|
@ -138,6 +137,7 @@
|
||||||
mainBytes:(const GLvoid *)mainBytes
|
mainBytes:(const GLvoid *)mainBytes
|
||||||
touchBytes:(const GLvoid *)touchBytes;
|
touchBytes:(const GLvoid *)touchBytes;
|
||||||
- (void) renderSWRasterizer;
|
- (void) renderSWRasterizer;
|
||||||
|
- (void) setupSWRasterizerVertices;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,14 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
@synthesize isHudEnabled;
|
@synthesize isHudEnabled;
|
||||||
@synthesize isHudEditingModeEnabled;
|
@synthesize isHudEditingModeEnabled;
|
||||||
@dynamic normalSize;
|
@dynamic normalSize;
|
||||||
|
@dynamic gpuStateFlags;
|
||||||
@dynamic scale;
|
@dynamic scale;
|
||||||
@dynamic rotation;
|
@dynamic rotation;
|
||||||
@dynamic useBilinearOutput;
|
@dynamic useBilinearOutput;
|
||||||
@dynamic useVerticalSync;
|
@dynamic useVerticalSync;
|
||||||
@dynamic displayType;
|
@dynamic displayType;
|
||||||
|
@dynamic displayOrientation;
|
||||||
|
@dynamic displayOrder;
|
||||||
@synthesize bindings;
|
@synthesize bindings;
|
||||||
|
|
||||||
- (id)init
|
- (id)init
|
||||||
|
@ -64,13 +67,15 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
view = nil;
|
view = nil;
|
||||||
spinlockGpuStateFlags = OS_SPINLOCK_INIT;
|
|
||||||
spinlockDisplayType = OS_SPINLOCK_INIT;
|
|
||||||
spinlockNormalSize = OS_SPINLOCK_INIT;
|
spinlockNormalSize = OS_SPINLOCK_INIT;
|
||||||
|
spinlockGpuStateFlags = OS_SPINLOCK_INIT;
|
||||||
spinlockScale = OS_SPINLOCK_INIT;
|
spinlockScale = OS_SPINLOCK_INIT;
|
||||||
spinlockRotation = OS_SPINLOCK_INIT;
|
spinlockRotation = OS_SPINLOCK_INIT;
|
||||||
spinlockUseBilinearOutput = OS_SPINLOCK_INIT;
|
spinlockUseBilinearOutput = OS_SPINLOCK_INIT;
|
||||||
spinlockUseVerticalSync = OS_SPINLOCK_INIT;
|
spinlockUseVerticalSync = OS_SPINLOCK_INIT;
|
||||||
|
spinlockDisplayType = OS_SPINLOCK_INIT;
|
||||||
|
spinlockDisplayOrientation = OS_SPINLOCK_INIT;
|
||||||
|
spinlockDisplayOrder = OS_SPINLOCK_INIT;
|
||||||
|
|
||||||
normalSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2.0);
|
normalSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2.0);
|
||||||
sendPortDisplay = nil;
|
sendPortDisplay = nil;
|
||||||
|
@ -218,7 +223,7 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
|
|
||||||
- (void) setDisplayType:(NSInteger)theType
|
- (void) setDisplayType:(NSInteger)theType
|
||||||
{
|
{
|
||||||
NSSize theSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT);
|
NSSize newDisplaySize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT);
|
||||||
NSString *modeString = @"Unknown";
|
NSString *modeString = @"Unknown";
|
||||||
|
|
||||||
switch (theType)
|
switch (theType)
|
||||||
|
@ -232,8 +237,17 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DS_DISPLAY_TYPE_COMBO:
|
case DS_DISPLAY_TYPE_COMBO:
|
||||||
theSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2);
|
|
||||||
modeString = NSSTRING_DISPLAYMODE_COMBO;
|
modeString = NSSTRING_DISPLAYMODE_COMBO;
|
||||||
|
|
||||||
|
if ([self displayOrientation] == DS_DISPLAY_ORIENTATION_VERTICAL)
|
||||||
|
{
|
||||||
|
newDisplaySize.height *= 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newDisplaySize.width *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -246,7 +260,7 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
OSSpinLockUnlock(&spinlockDisplayType);
|
OSSpinLockUnlock(&spinlockDisplayType);
|
||||||
|
|
||||||
OSSpinLockLock(&spinlockNormalSize);
|
OSSpinLockLock(&spinlockNormalSize);
|
||||||
normalSize = theSize;
|
normalSize = newDisplaySize;
|
||||||
OSSpinLockUnlock(&spinlockNormalSize);
|
OSSpinLockUnlock(&spinlockNormalSize);
|
||||||
|
|
||||||
[CocoaDSUtil messageSendOneWayWithInteger:self.sendPortDisplay msgID:MESSAGE_CHANGE_DISPLAY_TYPE integerValue:theType];
|
[CocoaDSUtil messageSendOneWayWithInteger:self.sendPortDisplay msgID:MESSAGE_CHANGE_DISPLAY_TYPE integerValue:theType];
|
||||||
|
@ -261,6 +275,60 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
return theType;
|
return theType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setDisplayOrientation:(NSInteger)theOrientation
|
||||||
|
{
|
||||||
|
OSSpinLockLock(&spinlockDisplayOrientation);
|
||||||
|
[bindings setValue:[NSNumber numberWithInteger:theOrientation] forKey:@"displayOrientation"];
|
||||||
|
OSSpinLockUnlock(&spinlockDisplayOrientation);
|
||||||
|
|
||||||
|
if ([self displayType] == DS_DISPLAY_TYPE_COMBO)
|
||||||
|
{
|
||||||
|
NSSize newDisplaySize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT);
|
||||||
|
|
||||||
|
if (theOrientation == DS_DISPLAY_ORIENTATION_VERTICAL)
|
||||||
|
{
|
||||||
|
newDisplaySize.height *= 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newDisplaySize.width *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
OSSpinLockLock(&spinlockNormalSize);
|
||||||
|
normalSize = newDisplaySize;
|
||||||
|
OSSpinLockUnlock(&spinlockNormalSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
[CocoaDSUtil messageSendOneWayWithInteger:self.sendPortDisplay msgID:MESSAGE_CHANGE_DISPLAY_ORIENTATION integerValue:theOrientation];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger) displayOrientation
|
||||||
|
{
|
||||||
|
OSSpinLockLock(&spinlockDisplayOrientation);
|
||||||
|
NSInteger theOrientation = [[bindings valueForKey:@"displayOrientation"] integerValue];
|
||||||
|
OSSpinLockUnlock(&spinlockDisplayOrientation);
|
||||||
|
|
||||||
|
return theOrientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setDisplayOrder:(NSInteger)theOrder
|
||||||
|
{
|
||||||
|
OSSpinLockLock(&spinlockDisplayOrder);
|
||||||
|
[bindings setValue:[NSNumber numberWithInteger:theOrder] forKey:@"displayOrder"];
|
||||||
|
OSSpinLockUnlock(&spinlockDisplayOrder);
|
||||||
|
|
||||||
|
[CocoaDSUtil messageSendOneWayWithInteger:self.sendPortDisplay msgID:MESSAGE_CHANGE_DISPLAY_ORDER integerValue:theOrder];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger) displayOrder
|
||||||
|
{
|
||||||
|
OSSpinLockLock(&spinlockDisplayOrder);
|
||||||
|
NSInteger theOrder = [[bindings valueForKey:@"displayOrder"] integerValue];
|
||||||
|
OSSpinLockUnlock(&spinlockDisplayOrder);
|
||||||
|
|
||||||
|
return theOrder;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setVideoFilterType:(NSInteger)theType
|
- (void) setVideoFilterType:(NSInteger)theType
|
||||||
{
|
{
|
||||||
[bindings setValue:[NSNumber numberWithInteger:theType] forKey:@"videoFilterType"];
|
[bindings setValue:[NSNumber numberWithInteger:theType] forKey:@"videoFilterType"];
|
||||||
|
@ -348,6 +416,21 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
NSPoint touchLoc = GetNormalPointFromTransformedPoint(clickLoc, self.normalSize, [[self view] bounds].size, [self scale], viewAngle);
|
NSPoint touchLoc = GetNormalPointFromTransformedPoint(clickLoc, self.normalSize, [[self view] bounds].size, [self scale], viewAngle);
|
||||||
|
|
||||||
// Normalize the y-coordinate to the DS.
|
// Normalize the y-coordinate to the DS.
|
||||||
|
if ([self displayType] == DS_DISPLAY_TYPE_COMBO)
|
||||||
|
{
|
||||||
|
NSInteger theOrientation = [self displayOrientation];
|
||||||
|
NSInteger theOrder = [self displayOrder];
|
||||||
|
|
||||||
|
if (theOrientation == DS_DISPLAY_ORIENTATION_VERTICAL && theOrder == DS_DISPLAY_ORDER_TOUCH_FIRST)
|
||||||
|
{
|
||||||
|
touchLoc.y -= GPU_DISPLAY_HEIGHT;
|
||||||
|
}
|
||||||
|
else if (theOrientation == DS_DISPLAY_ORIENTATION_HORIZONTAL && theOrder == DS_DISPLAY_ORDER_MAIN_FIRST)
|
||||||
|
{
|
||||||
|
touchLoc.x -= GPU_DISPLAY_WIDTH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
touchLoc.y = GPU_DISPLAY_HEIGHT - touchLoc.y;
|
touchLoc.y = GPU_DISPLAY_HEIGHT - touchLoc.y;
|
||||||
|
|
||||||
// Constrain the touch point to the DS dimensions.
|
// Constrain the touch point to the DS dimensions.
|
||||||
|
@ -527,6 +610,26 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
[view doDisplayTypeChanged:displayTypeID];
|
[view doDisplayTypeChanged:displayTypeID];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID
|
||||||
|
{
|
||||||
|
if (view == nil || ![view respondsToSelector:@selector(doDisplayOrientationChanged:)])
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[view doDisplayOrientationChanged:displayOrientationID];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) doDisplayOrderChanged:(NSInteger)displayOrderID
|
||||||
|
{
|
||||||
|
if (view == nil || ![view respondsToSelector:@selector(doDisplayOrderChanged:)])
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[view doDisplayOrderChanged:displayOrderID];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) doBilinearOutputChanged:(BOOL)useBilinear
|
- (void) doBilinearOutputChanged:(BOOL)useBilinear
|
||||||
{
|
{
|
||||||
if (view == nil || ![view respondsToSelector:@selector(doBilinearOutputChanged:)])
|
if (view == nil || ![view respondsToSelector:@selector(doBilinearOutputChanged:)])
|
||||||
|
@ -790,12 +893,11 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispViewDelegate = nil;
|
dispViewDelegate = nil;
|
||||||
lastFrameSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2.0);
|
|
||||||
glTexPixelFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
glTexPixelFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||||
glTexRenderStyle = GL_LINEAR;
|
glTexRenderStyle = GL_LINEAR;
|
||||||
|
|
||||||
UInt32 w = GetNearestPositivePOT((UInt32)lastFrameSize.width);
|
UInt32 w = GetNearestPositivePOT((UInt32)GPU_DISPLAY_WIDTH);
|
||||||
UInt32 h = GetNearestPositivePOT((UInt32)lastFrameSize.height);
|
UInt32 h = GetNearestPositivePOT((UInt32)(GPU_DISPLAY_HEIGHT * 2.0));
|
||||||
glTexBack = (GLvoid *)calloc(w * h, sizeof(UInt16));
|
glTexBack = (GLvoid *)calloc(w * h, sizeof(UInt16));
|
||||||
glTexBackSize = NSMakeSize(w, h);
|
glTexBackSize = NSMakeSize(w, h);
|
||||||
|
|
||||||
|
@ -888,6 +990,24 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swRasterizerMainTexCoord[0][0] = 0.0f;
|
||||||
|
swRasterizerMainTexCoord[0][1] = 0.0f;
|
||||||
|
swRasterizerMainTexCoord[1][0] = (GLfloat)(textureSize.width / w);
|
||||||
|
swRasterizerMainTexCoord[1][1] = 0.0f;
|
||||||
|
swRasterizerMainTexCoord[2][0] = (GLfloat)(textureSize.width / w);
|
||||||
|
swRasterizerMainTexCoord[2][1] = (GLfloat)(textureSize.height / h);
|
||||||
|
swRasterizerMainTexCoord[3][0] = 0.0f;
|
||||||
|
swRasterizerMainTexCoord[3][1] = (GLfloat)(textureSize.height / h);
|
||||||
|
|
||||||
|
swRasterizerTouchTexCoord[0][0] = 0.0f;
|
||||||
|
swRasterizerTouchTexCoord[0][1] = 0.0f;
|
||||||
|
swRasterizerTouchTexCoord[1][0] = (GLfloat)(textureSize.width / w);
|
||||||
|
swRasterizerTouchTexCoord[1][1] = 0.0f;
|
||||||
|
swRasterizerTouchTexCoord[2][0] = (GLfloat)(textureSize.width / w);
|
||||||
|
swRasterizerTouchTexCoord[2][1] = (GLfloat)(textureSize.height / h);
|
||||||
|
swRasterizerTouchTexCoord[3][0] = 0.0f;
|
||||||
|
swRasterizerTouchTexCoord[3][1] = (GLfloat)(textureSize.height / h);
|
||||||
|
|
||||||
// Main screen
|
// Main screen
|
||||||
glBindTexture(GL_TEXTURE_2D, swRasterizerDrawTexture[0]);
|
glBindTexture(GL_TEXTURE_2D, swRasterizerDrawTexture[0]);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, (GLsizei)w, (GLsizei)h, 0, GL_RGBA, glTexPixelFormat, glTexBack);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, (GLsizei)w, (GLsizei)h, 0, GL_RGBA, glTexPixelFormat, glTexBack);
|
||||||
|
@ -906,81 +1026,157 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
- (void) renderSWRasterizer
|
- (void) renderSWRasterizer
|
||||||
{
|
{
|
||||||
NSInteger displayType = [dispViewDelegate displayType];
|
NSInteger displayType = [dispViewDelegate displayType];
|
||||||
GLfloat w = (GLfloat)dispViewDelegate.normalSize.width;
|
|
||||||
GLfloat h = (GLfloat)dispViewDelegate.normalSize.height;
|
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
if (displayType == DS_DISPLAY_TYPE_COMBO)
|
// Render the main screen
|
||||||
|
if (displayType == DS_DISPLAY_TYPE_MAIN || displayType == DS_DISPLAY_TYPE_COMBO)
|
||||||
{
|
{
|
||||||
GLfloat texRatioMainW = (GLfloat)lastFrameSize.width / (GLfloat)GetNearestPositivePOT((uint32_t)lastFrameSize.width);
|
|
||||||
GLfloat texRatioMainH = (GLfloat)lastFrameSize.height / (GLfloat)GetNearestPositivePOT((uint32_t)lastFrameSize.height);
|
|
||||||
GLfloat texRatioTouchW = (GLfloat)lastFrameSize.width / (GLfloat)GetNearestPositivePOT((uint32_t)lastFrameSize.width);
|
|
||||||
GLfloat texRatioTouchH = (GLfloat)lastFrameSize.height / (GLfloat)GetNearestPositivePOT((uint32_t)lastFrameSize.height);
|
|
||||||
|
|
||||||
// Main screen
|
|
||||||
glBindTexture(GL_TEXTURE_2D, swRasterizerDrawTexture[0]);
|
glBindTexture(GL_TEXTURE_2D, swRasterizerDrawTexture[0]);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
glTexCoord2f(0.0f, 0.0f);
|
|
||||||
glVertex3f(-(w/2.0f), (h/2.0f), 0.0f);
|
|
||||||
|
|
||||||
glTexCoord2f(texRatioMainW, 0.0f);
|
|
||||||
glVertex3f((w/2.0f), (h/2.0f), 0.0f);
|
|
||||||
|
|
||||||
glTexCoord2f(texRatioMainW, texRatioMainH);
|
|
||||||
glVertex3f((w/2.0f), 0.0f, 0.0f);
|
|
||||||
|
|
||||||
glTexCoord2f(0.0f, texRatioMainH);
|
|
||||||
glVertex3f(-(w/2.0f), 0.0f, 0.0f);
|
|
||||||
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
// Touch screen
|
for (unsigned int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
glTexCoord2f(swRasterizerMainTexCoord[i][0], swRasterizerMainTexCoord[i][1]);
|
||||||
|
glVertex2f(swRasterizerMainVertex[i][0], swRasterizerMainVertex[i][1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render the touch screen
|
||||||
|
if (displayType == DS_DISPLAY_TYPE_TOUCH || displayType == DS_DISPLAY_TYPE_COMBO)
|
||||||
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, swRasterizerDrawTexture[1]);
|
glBindTexture(GL_TEXTURE_2D, swRasterizerDrawTexture[1]);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
glTexCoord2f(0.0f, 0.0f);
|
for (unsigned int i = 0; i < 4; i++)
|
||||||
glVertex3f(-(w/2.0f), 0.0f, 0.0f);
|
{
|
||||||
|
glTexCoord2f(swRasterizerTouchTexCoord[i][0], swRasterizerTouchTexCoord[i][1]);
|
||||||
glTexCoord2f(texRatioTouchW, 0.0f);
|
glVertex2f(swRasterizerTouchVertex[i][0], swRasterizerTouchVertex[i][1]);
|
||||||
glVertex3f((w/2.0f), 0.0f, 0.0f);
|
}
|
||||||
|
|
||||||
glTexCoord2f(texRatioTouchW, texRatioTouchH);
|
|
||||||
glVertex3f((w/2.0f), -(h/2.0f), 0.0f);
|
|
||||||
|
|
||||||
glTexCoord2f(0.0f, texRatioTouchH);
|
|
||||||
glVertex3f(-(w/2.0f), -(h/2.0f), 0.0f);
|
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setupSWRasterizerVertices
|
||||||
|
{
|
||||||
|
NSInteger displayType = [dispViewDelegate displayType];
|
||||||
|
GLfloat w = (GLfloat)dispViewDelegate.normalSize.width * [dispViewDelegate scale];
|
||||||
|
GLfloat h = (GLfloat)dispViewDelegate.normalSize.height * [dispViewDelegate scale];
|
||||||
|
|
||||||
|
if (displayType == DS_DISPLAY_TYPE_COMBO)
|
||||||
|
{
|
||||||
|
NSInteger displayOrientation = [dispViewDelegate displayOrientation];
|
||||||
|
NSInteger displayOrder = [dispViewDelegate displayOrder];
|
||||||
|
|
||||||
|
if (displayOrientation == DS_DISPLAY_ORIENTATION_VERTICAL)
|
||||||
|
{
|
||||||
|
if (displayOrder == DS_DISPLAY_ORDER_MAIN_FIRST)
|
||||||
|
{
|
||||||
|
swRasterizerMainVertex[0][0] = -w/2.0f;
|
||||||
|
swRasterizerMainVertex[0][1] = h/2.0f;
|
||||||
|
swRasterizerMainVertex[1][0] = w/2.0f;
|
||||||
|
swRasterizerMainVertex[1][1] = h/2.0f;
|
||||||
|
swRasterizerMainVertex[2][0] = w/2.0f;
|
||||||
|
swRasterizerMainVertex[2][1] = 0.0f;
|
||||||
|
swRasterizerMainVertex[3][0] = -w/2.0f;
|
||||||
|
swRasterizerMainVertex[3][1] = 0.0f;
|
||||||
|
|
||||||
|
swRasterizerTouchVertex[0][0] = -w/2.0f;
|
||||||
|
swRasterizerTouchVertex[0][1] = 0.0f;
|
||||||
|
swRasterizerTouchVertex[1][0] = w/2.0f;
|
||||||
|
swRasterizerTouchVertex[1][1] = 0.0f;
|
||||||
|
swRasterizerTouchVertex[2][0] = w/2.0f;
|
||||||
|
swRasterizerTouchVertex[2][1] = -h/2.0f;
|
||||||
|
swRasterizerTouchVertex[3][0] = -w/2.0f;
|
||||||
|
swRasterizerTouchVertex[3][1] = -h/2.0f;
|
||||||
|
}
|
||||||
|
else // displayOrder == DS_DISPLAY_ORDER_TOUCH_FIRST
|
||||||
|
{
|
||||||
|
swRasterizerTouchVertex[0][0] = -w/2.0f;
|
||||||
|
swRasterizerTouchVertex[0][1] = h/2.0f;
|
||||||
|
swRasterizerTouchVertex[1][0] = w/2.0f;
|
||||||
|
swRasterizerTouchVertex[1][1] = h/2.0f;
|
||||||
|
swRasterizerTouchVertex[2][0] = w/2.0f;
|
||||||
|
swRasterizerTouchVertex[2][1] = 0.0f;
|
||||||
|
swRasterizerTouchVertex[3][0] = -w/2.0f;
|
||||||
|
swRasterizerTouchVertex[3][1] = 0.0f;
|
||||||
|
|
||||||
|
swRasterizerMainVertex[0][0] = -w/2.0f;
|
||||||
|
swRasterizerMainVertex[0][1] = 0.0f;
|
||||||
|
swRasterizerMainVertex[1][0] = w/2.0f;
|
||||||
|
swRasterizerMainVertex[1][1] = 0.0f;
|
||||||
|
swRasterizerMainVertex[2][0] = w/2.0f;
|
||||||
|
swRasterizerMainVertex[2][1] = -h/2.0f;
|
||||||
|
swRasterizerMainVertex[3][0] = -w/2.0f;
|
||||||
|
swRasterizerMainVertex[3][1] = -h/2.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // displayOrientation == DS_DISPLAY_ORIENTATION_HORIZONTAL
|
||||||
|
{
|
||||||
|
if (displayOrder == DS_DISPLAY_ORDER_MAIN_FIRST)
|
||||||
|
{
|
||||||
|
swRasterizerMainVertex[0][0] = -w/2.0f;
|
||||||
|
swRasterizerMainVertex[0][1] = h/2.0f;
|
||||||
|
swRasterizerMainVertex[1][0] = 0.0f;
|
||||||
|
swRasterizerMainVertex[1][1] = h/2.0f;
|
||||||
|
swRasterizerMainVertex[2][0] = 0.0f;
|
||||||
|
swRasterizerMainVertex[2][1] = -h/2.0f;
|
||||||
|
swRasterizerMainVertex[3][0] = -w/2.0f;
|
||||||
|
swRasterizerMainVertex[3][1] = -h/2.0f;
|
||||||
|
|
||||||
|
swRasterizerTouchVertex[0][0] = 0.0f;
|
||||||
|
swRasterizerTouchVertex[0][1] = h/2.0f;
|
||||||
|
swRasterizerTouchVertex[1][0] = w/2.0f;
|
||||||
|
swRasterizerTouchVertex[1][1] = h/2.0f;
|
||||||
|
swRasterizerTouchVertex[2][0] = w/2.0f;
|
||||||
|
swRasterizerTouchVertex[2][1] = -h/2.0f;
|
||||||
|
swRasterizerTouchVertex[3][0] = 0.0f;
|
||||||
|
swRasterizerTouchVertex[3][1] = -h/2.0f;
|
||||||
|
}
|
||||||
|
else // displayOrder == DS_DISPLAY_ORDER_TOUCH_FIRST
|
||||||
|
{
|
||||||
|
swRasterizerTouchVertex[0][0] = -w/2.0f;
|
||||||
|
swRasterizerTouchVertex[0][1] = h/2.0f;
|
||||||
|
swRasterizerTouchVertex[1][0] = 0.0f;
|
||||||
|
swRasterizerTouchVertex[1][1] = h/2.0f;
|
||||||
|
swRasterizerTouchVertex[2][0] = 0.0f;
|
||||||
|
swRasterizerTouchVertex[2][1] = -h/2.0f;
|
||||||
|
swRasterizerTouchVertex[3][0] = -w/2.0f;
|
||||||
|
swRasterizerTouchVertex[3][1] = -h/2.0f;
|
||||||
|
|
||||||
|
swRasterizerMainVertex[0][0] = 0.0f;
|
||||||
|
swRasterizerMainVertex[0][1] = h/2.0f;
|
||||||
|
swRasterizerMainVertex[1][0] = w/2.0f;
|
||||||
|
swRasterizerMainVertex[1][1] = h/2.0f;
|
||||||
|
swRasterizerMainVertex[2][0] = w/2.0f;
|
||||||
|
swRasterizerMainVertex[2][1] = -h/2.0f;
|
||||||
|
swRasterizerMainVertex[3][0] = 0.0f;
|
||||||
|
swRasterizerMainVertex[3][1] = -h/2.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GLfloat texRatioW = (GLfloat)lastFrameSize.width / (GLfloat)GetNearestPositivePOT((uint32_t)lastFrameSize.width);
|
swRasterizerMainVertex[0][0] = -w/2.0f;
|
||||||
GLfloat texRatioH = (GLfloat)lastFrameSize.height / (GLfloat)GetNearestPositivePOT((uint32_t)lastFrameSize.height);
|
swRasterizerMainVertex[0][1] = h/2.0f;
|
||||||
GLuint drawTexture = swRasterizerDrawTexture[0];
|
swRasterizerMainVertex[1][0] = w/2.0f;
|
||||||
|
swRasterizerMainVertex[1][1] = h/2.0f;
|
||||||
|
swRasterizerMainVertex[2][0] = w/2.0f;
|
||||||
|
swRasterizerMainVertex[2][1] = -h/2.0f;
|
||||||
|
swRasterizerMainVertex[3][0] = -w/2.0f;
|
||||||
|
swRasterizerMainVertex[3][1] = -h/2.0f;
|
||||||
|
|
||||||
if (displayType == DS_DISPLAY_TYPE_TOUCH)
|
swRasterizerTouchVertex[0][0] = -w/2.0f;
|
||||||
{
|
swRasterizerTouchVertex[0][1] = h/2.0f;
|
||||||
drawTexture = swRasterizerDrawTexture[1];
|
swRasterizerTouchVertex[1][0] = w/2.0f;
|
||||||
}
|
swRasterizerTouchVertex[1][1] = h/2.0f;
|
||||||
|
swRasterizerTouchVertex[2][0] = w/2.0f;
|
||||||
glBindTexture(GL_TEXTURE_2D, drawTexture);
|
swRasterizerTouchVertex[2][1] = -h/2.0f;
|
||||||
glBegin(GL_QUADS);
|
swRasterizerTouchVertex[3][0] = -w/2.0f;
|
||||||
|
swRasterizerTouchVertex[3][1] = -h/2.0f;
|
||||||
glTexCoord2f(0.0f, 0.0f);
|
|
||||||
glVertex3f(-(w/2.0f), (h/2.0f), 0.0f);
|
|
||||||
|
|
||||||
glTexCoord2f(texRatioW, 0.0f);
|
|
||||||
glVertex3f((w/2.0f), (h/2.0f), 0.0f);
|
|
||||||
|
|
||||||
glTexCoord2f(texRatioW, texRatioH);
|
|
||||||
glVertex3f((w/2.0f), -(h/2.0f), 0.0f);
|
|
||||||
|
|
||||||
glTexCoord2f(0.0f, texRatioH);
|
|
||||||
glVertex3f(-(w/2.0f), -(h/2.0f), 0.0f);
|
|
||||||
|
|
||||||
glEnd();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1104,8 +1300,6 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
|
|
||||||
- (void)doProcessVideoFrame:(const void *)videoFrameData frameSize:(NSSize)frameSize
|
- (void)doProcessVideoFrame:(const void *)videoFrameData frameSize:(NSSize)frameSize
|
||||||
{
|
{
|
||||||
lastFrameSize = frameSize;
|
|
||||||
|
|
||||||
CGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
|
CGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
|
||||||
|
|
||||||
[[self openGLContext] makeCurrentContext];
|
[[self openGLContext] makeCurrentContext];
|
||||||
|
@ -1163,6 +1357,8 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
[[self openGLContext] update];
|
[[self openGLContext] update];
|
||||||
|
|
||||||
CGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
|
CGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
|
||||||
|
|
||||||
|
[self setupSWRasterizerVertices];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)doRedraw
|
- (void)doRedraw
|
||||||
|
@ -1176,7 +1372,12 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
CGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
|
CGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) doBilinearOutputChanged:(BOOL)useBilinear
|
- (void)doDisplayTypeChanged:(NSInteger)displayTypeID
|
||||||
|
{
|
||||||
|
[self setupSWRasterizerVertices];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)doBilinearOutputChanged:(BOOL)useBilinear
|
||||||
{
|
{
|
||||||
glTexRenderStyle = GL_NEAREST;
|
glTexRenderStyle = GL_NEAREST;
|
||||||
if (useBilinear)
|
if (useBilinear)
|
||||||
|
@ -1185,7 +1386,22 @@ NSOpenGLContext *OSXDefaultOpenGLContext = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) doVerticalSyncChanged:(BOOL)useVerticalSync
|
- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID
|
||||||
|
{
|
||||||
|
[self setupSWRasterizerVertices];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) doDisplayOrderChanged:(NSInteger)displayOrderID
|
||||||
|
{
|
||||||
|
[self setupSWRasterizerVertices];
|
||||||
|
|
||||||
|
if ([dispViewDelegate displayType] == DS_DISPLAY_TYPE_COMBO)
|
||||||
|
{
|
||||||
|
[self doRedraw];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)doVerticalSyncChanged:(BOOL)useVerticalSync
|
||||||
{
|
{
|
||||||
GLint swapInt = 0;
|
GLint swapInt = 0;
|
||||||
|
|
||||||
|
@ -1213,11 +1429,8 @@ void SetupOpenGLView(GLsizei width, GLsizei height, GLfloat scalar, GLfloat angl
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
|
glOrtho(-width/2.0, width/2.0, -height/2.0, height/2.0, -1.0, 1.0);
|
||||||
|
|
||||||
glTranslatef(width / 2.0f, height / 2.0f, 0.0f);
|
|
||||||
glRotatef((GLfloat)CLOCKWISE_DEGREES(angleDegrees), 0.0f, 0.0f, 1.0f);
|
glRotatef((GLfloat)CLOCKWISE_DEGREES(angleDegrees), 0.0f, 0.0f, 1.0f);
|
||||||
glScalef(scalar, scalar, 0.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OSXOpenGLRendererInit()
|
bool OSXOpenGLRendererInit()
|
||||||
|
|
|
@ -189,6 +189,8 @@
|
||||||
- (IBAction) changeBilinearOutput:(id)sender;
|
- (IBAction) changeBilinearOutput:(id)sender;
|
||||||
- (IBAction) changeVerticalSync:(id)sender;
|
- (IBAction) changeVerticalSync:(id)sender;
|
||||||
- (IBAction) changeDisplayMode:(id)sender;
|
- (IBAction) changeDisplayMode:(id)sender;
|
||||||
|
- (IBAction) changeDisplayOrientation:(id)sender;
|
||||||
|
- (IBAction) changeDisplayOrder:(id)sender;
|
||||||
- (IBAction) changeVideoFilter:(id)sender;
|
- (IBAction) changeVideoFilter:(id)sender;
|
||||||
- (IBAction) change3DRenderMethod:(id)sender;
|
- (IBAction) change3DRenderMethod:(id)sender;
|
||||||
- (IBAction) change3DRenderHighPrecisionColorInterpolation:(id)sender;
|
- (IBAction) change3DRenderHighPrecisionColorInterpolation:(id)sender;
|
||||||
|
|
|
@ -869,6 +869,21 @@
|
||||||
[self resizeWithTransform:[dispViewDelegate normalSize] scalar:[dispViewDelegate scale] rotation:[dispViewDelegate rotation]];
|
[self resizeWithTransform:[dispViewDelegate normalSize] scalar:[dispViewDelegate scale] rotation:[dispViewDelegate rotation]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction) changeDisplayOrientation:(id)sender
|
||||||
|
{
|
||||||
|
[dispViewDelegate setDisplayOrientation:[CocoaDSUtil getIBActionSenderTag:sender]];
|
||||||
|
|
||||||
|
if ([dispViewDelegate displayType] == DS_DISPLAY_TYPE_COMBO)
|
||||||
|
{
|
||||||
|
[self resizeWithTransform:[dispViewDelegate normalSize] scalar:[dispViewDelegate scale] rotation:[dispViewDelegate rotation]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction) changeDisplayOrder:(id)sender
|
||||||
|
{
|
||||||
|
[dispViewDelegate setDisplayOrder:[CocoaDSUtil getIBActionSenderTag:sender]];
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction) changeVideoFilter:(id)sender
|
- (IBAction) changeVideoFilter:(id)sender
|
||||||
{
|
{
|
||||||
[dispViewDelegate setVideoFilterType:[CocoaDSUtil getIBActionSenderTag:sender]];
|
[dispViewDelegate setVideoFilterType:[CocoaDSUtil getIBActionSenderTag:sender]];
|
||||||
|
@ -1709,6 +1724,34 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (theAction == @selector(changeDisplayOrientation:))
|
||||||
|
{
|
||||||
|
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||||
|
{
|
||||||
|
if ([dispViewDelegate displayOrientation] == [theItem tag])
|
||||||
|
{
|
||||||
|
[(NSMenuItem*)theItem setState:NSOnState];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[(NSMenuItem*)theItem setState:NSOffState];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (theAction == @selector(changeDisplayOrder:))
|
||||||
|
{
|
||||||
|
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||||
|
{
|
||||||
|
if ([dispViewDelegate displayOrder] == [theItem tag])
|
||||||
|
{
|
||||||
|
[(NSMenuItem*)theItem setState:NSOnState];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[(NSMenuItem*)theItem setState:NSOffState];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (theAction == @selector(openEmuSaveState:) ||
|
else if (theAction == @selector(openEmuSaveState:) ||
|
||||||
theAction == @selector(saveEmuSaveState:) ||
|
theAction == @selector(saveEmuSaveState:) ||
|
||||||
theAction == @selector(saveEmuSaveStateAs:))
|
theAction == @selector(saveEmuSaveStateAs:))
|
||||||
|
@ -1985,10 +2028,12 @@
|
||||||
// Set the display window per user preferences.
|
// Set the display window per user preferences.
|
||||||
[self setShowStatusBar:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"]];
|
[self setShowStatusBar:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"]];
|
||||||
|
|
||||||
// Set the display mode, sizing, and rotation.
|
// Set the display settings per user preferences.
|
||||||
double displayScalar = (double)([[NSUserDefaults standardUserDefaults] floatForKey:@"DisplayView_Size"] / 100.0);
|
double displayScalar = (double)([[NSUserDefaults standardUserDefaults] floatForKey:@"DisplayView_Size"] / 100.0);
|
||||||
double displayRotation = (double)[[NSUserDefaults standardUserDefaults] floatForKey:@"DisplayView_Rotation"];
|
double displayRotation = (double)[[NSUserDefaults standardUserDefaults] floatForKey:@"DisplayView_Rotation"];
|
||||||
[dispViewDelegate setDisplayType:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_Mode"]];
|
[dispViewDelegate setDisplayType:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_Mode"]];
|
||||||
|
[dispViewDelegate setDisplayOrientation:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Orientation"]];
|
||||||
|
[dispViewDelegate setDisplayOrder:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Order"]];
|
||||||
[self setContentScalar:displayScalar];
|
[self setContentScalar:displayScalar];
|
||||||
[self setContentRotation:displayRotation];
|
[self setContentRotation:displayRotation];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue