Cocoa Port:
- Add support for separating the DS screens while in Combo display mode.
This commit is contained in:
parent
d6c2dfa7dc
commit
749badfd22
|
@ -168,6 +168,7 @@
|
||||||
#define GPU_SCREEN_SIZE_BYTES (GPU_DISPLAY_WIDTH * GPU_DISPLAY_HEIGHT * GPU_DISPLAY_COLOR_DEPTH) // The numbers are: 256px width, 192px height, 16bit color depth
|
#define GPU_SCREEN_SIZE_BYTES (GPU_DISPLAY_WIDTH * GPU_DISPLAY_HEIGHT * GPU_DISPLAY_COLOR_DEPTH) // The numbers are: 256px width, 192px height, 16bit color depth
|
||||||
|
|
||||||
#define DS_DISPLAY_VERTICAL_GAP_TO_HEIGHT_RATIO (21.0/46.0) // Based on the official DS specification: 21mm/46mm
|
#define DS_DISPLAY_VERTICAL_GAP_TO_HEIGHT_RATIO (21.0/46.0) // Based on the official DS specification: 21mm/46mm
|
||||||
|
#define DS_DISPLAY_GAP (GPU_DISPLAY_HEIGHT * DS_DISPLAY_VERTICAL_GAP_TO_HEIGHT_RATIO)
|
||||||
|
|
||||||
#define WINDOW_STATUS_BAR_HEIGHT 24 // Height of an emulation window status bar in pixels.
|
#define WINDOW_STATUS_BAR_HEIGHT 24 // Height of an emulation window status bar in pixels.
|
||||||
|
|
||||||
|
@ -377,6 +378,7 @@ enum
|
||||||
MESSAGE_CHANGE_DISPLAY_TYPE,
|
MESSAGE_CHANGE_DISPLAY_TYPE,
|
||||||
MESSAGE_CHANGE_DISPLAY_ORIENTATION,
|
MESSAGE_CHANGE_DISPLAY_ORIENTATION,
|
||||||
MESSAGE_CHANGE_DISPLAY_ORDER,
|
MESSAGE_CHANGE_DISPLAY_ORDER,
|
||||||
|
MESSAGE_CHANGE_DISPLAY_GAP,
|
||||||
MESSAGE_CHANGE_BILINEAR_OUTPUT,
|
MESSAGE_CHANGE_BILINEAR_OUTPUT,
|
||||||
MESSAGE_CHANGE_VERTICAL_SYNC,
|
MESSAGE_CHANGE_VERTICAL_SYNC,
|
||||||
MESSAGE_CHANGE_VIDEO_FILTER,
|
MESSAGE_CHANGE_VIDEO_FILTER,
|
||||||
|
|
|
@ -134,6 +134,7 @@ typedef struct
|
||||||
- (void) doRedraw;
|
- (void) doRedraw;
|
||||||
- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID;
|
- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID;
|
||||||
- (void) doDisplayOrderChanged:(NSInteger)displayOrderID;
|
- (void) doDisplayOrderChanged:(NSInteger)displayOrderID;
|
||||||
|
- (void) doDisplayGapChanged:(float)displayGapScalar;
|
||||||
- (void) doBilinearOutputChanged:(BOOL)useBilinear;
|
- (void) doBilinearOutputChanged:(BOOL)useBilinear;
|
||||||
- (void) doVerticalSyncChanged:(BOOL)useVerticalSync;
|
- (void) doVerticalSyncChanged:(BOOL)useVerticalSync;
|
||||||
- (void) doVideoFilterChanged:(NSInteger)videoFilterTypeID frameSize:(NSSize)videoFilterDestSize;
|
- (void) doVideoFilterChanged:(NSInteger)videoFilterTypeID frameSize:(NSSize)videoFilterDestSize;
|
||||||
|
@ -186,6 +187,7 @@ typedef struct
|
||||||
- (void) handleRedrawView;
|
- (void) handleRedrawView;
|
||||||
- (void) handleChangeDisplayOrientation:(NSData *)displayOrientationIdData;
|
- (void) handleChangeDisplayOrientation:(NSData *)displayOrientationIdData;
|
||||||
- (void) handleChangeDisplayOrder:(NSData *)displayOrderIdData;
|
- (void) handleChangeDisplayOrder:(NSData *)displayOrderIdData;
|
||||||
|
- (void) handleChangeDisplayGap:(NSData *)displayGapScalarData;
|
||||||
- (void) handleChangeBilinearOutput:(NSData *)bilinearStateData;
|
- (void) handleChangeBilinearOutput:(NSData *)bilinearStateData;
|
||||||
- (void) handleChangeVerticalSync:(NSData *)verticalSyncStateData;
|
- (void) handleChangeVerticalSync:(NSData *)verticalSyncStateData;
|
||||||
- (void) handleChangeVideoFilter:(NSData *)videoFilterTypeIdData;
|
- (void) handleChangeVideoFilter:(NSData *)videoFilterTypeIdData;
|
||||||
|
|
|
@ -892,6 +892,10 @@
|
||||||
[self handleChangeDisplayOrder:[messageComponents objectAtIndex:0]];
|
[self handleChangeDisplayOrder:[messageComponents objectAtIndex:0]];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MESSAGE_CHANGE_DISPLAY_GAP:
|
||||||
|
[self handleChangeDisplayGap:[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;
|
||||||
|
@ -1002,6 +1006,17 @@
|
||||||
[videoDelegate doDisplayOrderChanged:theOrder];
|
[videoDelegate doDisplayOrderChanged:theOrder];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) handleChangeDisplayGap:(NSData *)displayGapScalarData
|
||||||
|
{
|
||||||
|
if (videoDelegate == nil || ![videoDelegate respondsToSelector:@selector(doDisplayGapChanged:)])
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float gapScalar = *(float *)[displayGapScalarData bytes];
|
||||||
|
[videoDelegate doDisplayGapChanged:gapScalar];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) handleChangeBilinearOutput:(NSData *)bilinearStateData
|
- (void) handleChangeBilinearOutput:(NSData *)bilinearStateData
|
||||||
{
|
{
|
||||||
if (videoDelegate == nil || ![videoDelegate respondsToSelector:@selector(doBilinearOutputChanged:)])
|
if (videoDelegate == nil || ![videoDelegate respondsToSelector:@selector(doBilinearOutputChanged:)])
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
NSInteger lastDisplayMode;
|
NSInteger lastDisplayMode;
|
||||||
NSInteger currentDisplayOrientation;
|
NSInteger currentDisplayOrientation;
|
||||||
|
GLfloat currentGapScalar;
|
||||||
GLenum glTexPixelFormat;
|
GLenum glTexPixelFormat;
|
||||||
GLvoid *glTexBack;
|
GLvoid *glTexBack;
|
||||||
NSSize glTexBackSize;
|
NSSize glTexBackSize;
|
||||||
|
@ -76,7 +77,7 @@
|
||||||
- (void) uploadTexCoords;
|
- (void) uploadTexCoords;
|
||||||
- (void) uploadDisplayTextures:(const GLvoid *)textureData displayMode:(const NSInteger)displayModeID width:(const GLsizei)texWidth height:(const GLsizei)texHeight;
|
- (void) uploadDisplayTextures:(const GLvoid *)textureData displayMode:(const NSInteger)displayModeID width:(const GLsizei)texWidth height:(const GLsizei)texHeight;
|
||||||
- (void) renderDisplayUsingDisplayMode:(const NSInteger)displayModeID;
|
- (void) renderDisplayUsingDisplayMode:(const NSInteger)displayModeID;
|
||||||
- (void) updateDisplayVerticesUsingDisplayMode:(const NSInteger)displayModeID orientation:(const NSInteger)displayOrientationID;
|
- (void) updateDisplayVerticesUsingDisplayMode:(const NSInteger)displayModeID orientation:(const NSInteger)displayOrientationID gap:(const GLfloat)gapScalar;
|
||||||
- (void) updateTexCoordS:(GLfloat)s T:(GLfloat)t;
|
- (void) updateTexCoordS:(GLfloat)s T:(GLfloat)t;
|
||||||
|
|
||||||
- (NSPoint) dsPointFromEvent:(NSEvent *)theEvent;
|
- (NSPoint) dsPointFromEvent:(NSEvent *)theEvent;
|
||||||
|
@ -105,6 +106,7 @@
|
||||||
NSInteger _displayMode;
|
NSInteger _displayMode;
|
||||||
NSInteger _displayOrientation;
|
NSInteger _displayOrientation;
|
||||||
NSInteger _displayOrder;
|
NSInteger _displayOrder;
|
||||||
|
double _displayGap;
|
||||||
NSInteger _videoFilterType;
|
NSInteger _videoFilterType;
|
||||||
NSInteger screenshotFileFormat;
|
NSInteger screenshotFileFormat;
|
||||||
|
|
||||||
|
@ -120,6 +122,7 @@
|
||||||
OSSpinLock spinlockDisplayMode;
|
OSSpinLock spinlockDisplayMode;
|
||||||
OSSpinLock spinlockDisplayOrientation;
|
OSSpinLock spinlockDisplayOrientation;
|
||||||
OSSpinLock spinlockDisplayOrder;
|
OSSpinLock spinlockDisplayOrder;
|
||||||
|
OSSpinLock spinlockDisplayGap;
|
||||||
OSSpinLock spinlockVideoFilterType;
|
OSSpinLock spinlockVideoFilterType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +140,7 @@
|
||||||
@property (assign) NSInteger displayMode;
|
@property (assign) NSInteger displayMode;
|
||||||
@property (assign) NSInteger displayOrientation;
|
@property (assign) NSInteger displayOrientation;
|
||||||
@property (assign) NSInteger displayOrder;
|
@property (assign) NSInteger displayOrder;
|
||||||
|
@property (assign) double displayGap;
|
||||||
@property (assign) NSInteger videoFilterType;
|
@property (assign) NSInteger videoFilterType;
|
||||||
@property (assign) NSInteger screenshotFileFormat;
|
@property (assign) NSInteger screenshotFileFormat;
|
||||||
@property (assign) BOOL isMinSizeNormal;
|
@property (assign) BOOL isMinSizeNormal;
|
||||||
|
|
|
@ -91,6 +91,7 @@ enum OGLVertexAttributeID
|
||||||
@dynamic displayMode;
|
@dynamic displayMode;
|
||||||
@dynamic displayOrientation;
|
@dynamic displayOrientation;
|
||||||
@dynamic displayOrder;
|
@dynamic displayOrder;
|
||||||
|
@dynamic displayGap;
|
||||||
@dynamic videoFilterType;
|
@dynamic videoFilterType;
|
||||||
@synthesize screenshotFileFormat;
|
@synthesize screenshotFileFormat;
|
||||||
@dynamic isMinSizeNormal;
|
@dynamic isMinSizeNormal;
|
||||||
|
@ -116,18 +117,20 @@ enum OGLVertexAttributeID
|
||||||
spinlockDisplayMode = OS_SPINLOCK_INIT;
|
spinlockDisplayMode = OS_SPINLOCK_INIT;
|
||||||
spinlockDisplayOrientation = OS_SPINLOCK_INIT;
|
spinlockDisplayOrientation = OS_SPINLOCK_INIT;
|
||||||
spinlockDisplayOrder = OS_SPINLOCK_INIT;
|
spinlockDisplayOrder = OS_SPINLOCK_INIT;
|
||||||
|
spinlockDisplayGap = OS_SPINLOCK_INIT;
|
||||||
spinlockVideoFilterType = OS_SPINLOCK_INIT;
|
spinlockVideoFilterType = OS_SPINLOCK_INIT;
|
||||||
|
|
||||||
screenshotFileFormat = NSTIFFFileType;
|
screenshotFileFormat = NSTIFFFileType;
|
||||||
|
|
||||||
_minDisplayViewSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2);
|
// These need to be initialized first since there are dependencies on these.
|
||||||
_isMinSizeNormal = YES;
|
_displayGap = 0.0;
|
||||||
_statusBarHeight = WINDOW_STATUS_BAR_HEIGHT;
|
|
||||||
|
|
||||||
// These need to be initialized since these have dependencies on each other.
|
|
||||||
_displayMode = DS_DISPLAY_TYPE_COMBO;
|
_displayMode = DS_DISPLAY_TYPE_COMBO;
|
||||||
_displayOrientation = DS_DISPLAY_ORIENTATION_VERTICAL;
|
_displayOrientation = DS_DISPLAY_ORIENTATION_VERTICAL;
|
||||||
|
|
||||||
|
_minDisplayViewSize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT*2.0 + (DS_DISPLAY_GAP*_displayGap));
|
||||||
|
_isMinSizeNormal = YES;
|
||||||
|
_statusBarHeight = WINDOW_STATUS_BAR_HEIGHT;
|
||||||
|
|
||||||
// Setup default values per user preferences.
|
// Setup default values per user preferences.
|
||||||
[self setupUserDefaults];
|
[self setupUserDefaults];
|
||||||
|
|
||||||
|
@ -303,18 +306,21 @@ enum OGLVertexAttributeID
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DS_DISPLAY_TYPE_COMBO:
|
case DS_DISPLAY_TYPE_COMBO:
|
||||||
|
{
|
||||||
|
const double gapScalar = [self displayGap];
|
||||||
modeString = NSSTRING_DISPLAYMODE_COMBO;
|
modeString = NSSTRING_DISPLAYMODE_COMBO;
|
||||||
|
|
||||||
if ([self displayOrientation] == DS_DISPLAY_ORIENTATION_VERTICAL)
|
if ([self displayOrientation] == DS_DISPLAY_ORIENTATION_VERTICAL)
|
||||||
{
|
{
|
||||||
newDisplaySize.height *= 2;
|
newDisplaySize.height = newDisplaySize.height * 2.0 + (DS_DISPLAY_GAP * gapScalar);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newDisplaySize.width *= 2;
|
newDisplaySize.width = newDisplaySize.width * 2.0 + (DS_DISPLAY_GAP * gapScalar);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -360,15 +366,16 @@ enum OGLVertexAttributeID
|
||||||
|
|
||||||
if ([self displayMode] == DS_DISPLAY_TYPE_COMBO)
|
if ([self displayMode] == DS_DISPLAY_TYPE_COMBO)
|
||||||
{
|
{
|
||||||
|
const double gapScalar = [self displayGap];
|
||||||
NSSize newDisplaySize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT);
|
NSSize newDisplaySize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT);
|
||||||
|
|
||||||
if (theOrientation == DS_DISPLAY_ORIENTATION_VERTICAL)
|
if (theOrientation == DS_DISPLAY_ORIENTATION_VERTICAL)
|
||||||
{
|
{
|
||||||
newDisplaySize.height *= 2;
|
newDisplaySize.height = newDisplaySize.height * 2.0 + (DS_DISPLAY_GAP * gapScalar);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newDisplaySize.width *= 2;
|
newDisplaySize.width = newDisplaySize.width * 2.0 + (DS_DISPLAY_GAP * gapScalar);
|
||||||
}
|
}
|
||||||
|
|
||||||
OSSpinLockLock(&spinlockNormalSize);
|
OSSpinLockLock(&spinlockNormalSize);
|
||||||
|
@ -409,6 +416,45 @@ enum OGLVertexAttributeID
|
||||||
return theOrder;
|
return theOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setDisplayGap:(double)gapScalar
|
||||||
|
{
|
||||||
|
OSSpinLockLock(&spinlockDisplayGap);
|
||||||
|
_displayGap = gapScalar;
|
||||||
|
OSSpinLockUnlock(&spinlockDisplayGap);
|
||||||
|
|
||||||
|
if ([self displayMode] == DS_DISPLAY_TYPE_COMBO)
|
||||||
|
{
|
||||||
|
NSSize newDisplaySize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT);
|
||||||
|
|
||||||
|
if ([self displayOrientation] == DS_DISPLAY_ORIENTATION_VERTICAL)
|
||||||
|
{
|
||||||
|
newDisplaySize.height = newDisplaySize.height * 2.0 + (DS_DISPLAY_GAP * gapScalar);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newDisplaySize.width = newDisplaySize.width * 2.0 + (DS_DISPLAY_GAP * gapScalar);
|
||||||
|
}
|
||||||
|
|
||||||
|
OSSpinLockLock(&spinlockNormalSize);
|
||||||
|
_normalSize = newDisplaySize;
|
||||||
|
OSSpinLockUnlock(&spinlockNormalSize);
|
||||||
|
|
||||||
|
[self setIsMinSizeNormal:[self isMinSizeNormal]];
|
||||||
|
[self resizeWithTransform:[self normalSize] scalar:[self displayScale] rotation:[self displayRotation]];
|
||||||
|
}
|
||||||
|
|
||||||
|
[CocoaDSUtil messageSendOneWayWithFloat:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_CHANGE_DISPLAY_GAP floatValue:(float)gapScalar];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (double) displayGap
|
||||||
|
{
|
||||||
|
OSSpinLockLock(&spinlockDisplayGap);
|
||||||
|
const double gapScalar = _displayGap;
|
||||||
|
OSSpinLockUnlock(&spinlockDisplayGap);
|
||||||
|
|
||||||
|
return gapScalar;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setVideoFilterType:(NSInteger)typeID
|
- (void) setVideoFilterType:(NSInteger)typeID
|
||||||
{
|
{
|
||||||
OSSpinLockLock(&spinlockVideoFilterType);
|
OSSpinLockLock(&spinlockVideoFilterType);
|
||||||
|
@ -429,19 +475,23 @@ enum OGLVertexAttributeID
|
||||||
|
|
||||||
- (void) setIsMinSizeNormal:(BOOL)theState
|
- (void) setIsMinSizeNormal:(BOOL)theState
|
||||||
{
|
{
|
||||||
|
OSSpinLockLock(&spinlockDisplayGap);
|
||||||
|
const double gapScalar = _displayGap;
|
||||||
|
OSSpinLockUnlock(&spinlockDisplayGap);
|
||||||
|
|
||||||
_isMinSizeNormal = theState;
|
_isMinSizeNormal = theState;
|
||||||
|
|
||||||
if ([self displayMode] == DS_DISPLAY_TYPE_COMBO)
|
if ([self displayMode] == DS_DISPLAY_TYPE_COMBO)
|
||||||
{
|
{
|
||||||
if ([self displayOrientation] == DS_DISPLAY_ORIENTATION_HORIZONTAL)
|
if ([self displayOrientation] == DS_DISPLAY_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
_minDisplayViewSize.width = GPU_DISPLAY_WIDTH * 2;
|
_minDisplayViewSize.width = GPU_DISPLAY_WIDTH*2.0 + (DS_DISPLAY_GAP*gapScalar);
|
||||||
_minDisplayViewSize.height = GPU_DISPLAY_HEIGHT;
|
_minDisplayViewSize.height = GPU_DISPLAY_HEIGHT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_minDisplayViewSize.width = GPU_DISPLAY_WIDTH;
|
_minDisplayViewSize.width = GPU_DISPLAY_WIDTH;
|
||||||
_minDisplayViewSize.height = GPU_DISPLAY_HEIGHT * 2;
|
_minDisplayViewSize.height = GPU_DISPLAY_HEIGHT*2.0 + (DS_DISPLAY_GAP*gapScalar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -516,6 +566,7 @@ enum OGLVertexAttributeID
|
||||||
[self setIsShowingStatusBar:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"]];
|
[self setIsShowingStatusBar:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"]];
|
||||||
|
|
||||||
// Set the display settings per user preferences.
|
// Set the display settings per user preferences.
|
||||||
|
[self setDisplayGap:([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayViewCombo_Gap"] / 100.0)];
|
||||||
[self setDisplayMode:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_Mode"]];
|
[self setDisplayMode:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_Mode"]];
|
||||||
[self setDisplayOrientation:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Orientation"]];
|
[self setDisplayOrientation:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Orientation"]];
|
||||||
[self setDisplayOrder:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Order"]];
|
[self setDisplayOrder:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Order"]];
|
||||||
|
@ -876,10 +927,11 @@ enum OGLVertexAttributeID
|
||||||
|
|
||||||
lastDisplayMode = DS_DISPLAY_TYPE_COMBO;
|
lastDisplayMode = DS_DISPLAY_TYPE_COMBO;
|
||||||
currentDisplayOrientation = DS_DISPLAY_ORIENTATION_VERTICAL;
|
currentDisplayOrientation = DS_DISPLAY_ORIENTATION_VERTICAL;
|
||||||
|
currentGapScalar = 0.0f;
|
||||||
glTexPixelFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
glTexPixelFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||||
|
|
||||||
UInt32 w = GetNearestPositivePOT((UInt32)GPU_DISPLAY_WIDTH);
|
UInt32 w = GetNearestPositivePOT((UInt32)GPU_DISPLAY_WIDTH);
|
||||||
UInt32 h = GetNearestPositivePOT((UInt32)(GPU_DISPLAY_HEIGHT * 2.0));
|
UInt32 h = GetNearestPositivePOT((UInt32)(GPU_DISPLAY_HEIGHT*2.0 + (DS_DISPLAY_GAP*currentGapScalar)));
|
||||||
glTexBack = (GLvoid *)calloc(w * h, sizeof(UInt16));
|
glTexBack = (GLvoid *)calloc(w * h, sizeof(UInt16));
|
||||||
glTexBackSize = NSMakeSize(w, h);
|
glTexBackSize = NSMakeSize(w, h);
|
||||||
vtxBufferOffset = 0;
|
vtxBufferOffset = 0;
|
||||||
|
@ -910,7 +962,7 @@ enum OGLVertexAttributeID
|
||||||
|
|
||||||
- (void) startupOpenGL
|
- (void) startupOpenGL
|
||||||
{
|
{
|
||||||
[self updateDisplayVerticesUsingDisplayMode:lastDisplayMode orientation:currentDisplayOrientation];
|
[self updateDisplayVerticesUsingDisplayMode:lastDisplayMode orientation:currentDisplayOrientation gap:currentGapScalar];
|
||||||
[self updateTexCoordS:1.0f T:2.0f];
|
[self updateTexCoordS:1.0f T:2.0f];
|
||||||
|
|
||||||
// Set up initial vertex elements
|
// Set up initial vertex elements
|
||||||
|
@ -954,7 +1006,7 @@ enum OGLVertexAttributeID
|
||||||
|
|
||||||
glUniform1f(uniformAngleDegrees, 0.0f);
|
glUniform1f(uniformAngleDegrees, 0.0f);
|
||||||
glUniform1f(uniformScalar, 1.0f);
|
glUniform1f(uniformScalar, 1.0f);
|
||||||
glUniform2f(uniformViewSize, GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT * 2);
|
glUniform2f(uniformViewSize, GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT*2.0 + (DS_DISPLAY_GAP*currentGapScalar));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1168,7 +1220,7 @@ enum OGLVertexAttributeID
|
||||||
if (lastDisplayMode != displayModeID)
|
if (lastDisplayMode != displayModeID)
|
||||||
{
|
{
|
||||||
lastDisplayMode = displayModeID;
|
lastDisplayMode = displayModeID;
|
||||||
[self updateDisplayVerticesUsingDisplayMode:displayModeID orientation:currentDisplayOrientation];
|
[self updateDisplayVerticesUsingDisplayMode:displayModeID orientation:currentDisplayOrientation gap:currentGapScalar];
|
||||||
[self uploadVertices];
|
[self uploadVertices];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1184,37 +1236,38 @@ enum OGLVertexAttributeID
|
||||||
glBindVertexArrayAPPLE(0);
|
glBindVertexArrayAPPLE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) updateDisplayVerticesUsingDisplayMode:(const NSInteger)displayModeID orientation:(const NSInteger)displayOrientationID
|
- (void) updateDisplayVerticesUsingDisplayMode:(const NSInteger)displayModeID orientation:(const NSInteger)displayOrientationID gap:(const GLfloat)gapScalar
|
||||||
{
|
{
|
||||||
const GLint w = (GLint)GPU_DISPLAY_WIDTH;
|
const GLfloat w = GPU_DISPLAY_WIDTH;
|
||||||
const GLint h = (GLint)GPU_DISPLAY_HEIGHT;
|
const GLfloat h = GPU_DISPLAY_HEIGHT;
|
||||||
|
const GLfloat gap = DS_DISPLAY_GAP * gapScalar / 2.0;
|
||||||
|
|
||||||
if (displayModeID == DS_DISPLAY_TYPE_COMBO)
|
if (displayModeID == DS_DISPLAY_TYPE_COMBO)
|
||||||
{
|
{
|
||||||
// displayOrder == DS_DISPLAY_ORDER_MAIN_FIRST
|
// displayOrder == DS_DISPLAY_ORDER_MAIN_FIRST
|
||||||
if (displayOrientationID == DS_DISPLAY_ORIENTATION_VERTICAL)
|
if (displayOrientationID == DS_DISPLAY_ORIENTATION_VERTICAL)
|
||||||
{
|
{
|
||||||
vtxBuffer[0] = -w/2; vtxBuffer[1] = h; // Top display, top left
|
vtxBuffer[0] = -w/2; vtxBuffer[1] = h+gap; // Top display, top left
|
||||||
vtxBuffer[2] = w/2; vtxBuffer[3] = h; // Top display, top right
|
vtxBuffer[2] = w/2; vtxBuffer[3] = h+gap; // Top display, top right
|
||||||
vtxBuffer[4] = w/2; vtxBuffer[5] = 0; // Top display, bottom right
|
vtxBuffer[4] = w/2; vtxBuffer[5] = gap; // Top display, bottom right
|
||||||
vtxBuffer[6] = -w/2; vtxBuffer[7] = 0; // Top display, bottom left
|
vtxBuffer[6] = -w/2; vtxBuffer[7] = gap; // Top display, bottom left
|
||||||
|
|
||||||
vtxBuffer[8] = -w/2; vtxBuffer[9] = 0; // Bottom display, top left
|
vtxBuffer[8] = -w/2; vtxBuffer[9] = -gap; // Bottom display, top left
|
||||||
vtxBuffer[10] = w/2; vtxBuffer[11] = 0; // Bottom display, top right
|
vtxBuffer[10] = w/2; vtxBuffer[11] = -gap; // Bottom display, top right
|
||||||
vtxBuffer[12] = w/2; vtxBuffer[13] = -h; // Bottom display, bottom right
|
vtxBuffer[12] = w/2; vtxBuffer[13] = -(h+gap); // Bottom display, bottom right
|
||||||
vtxBuffer[14] = -w/2; vtxBuffer[15] = -h; // Bottom display, bottom left
|
vtxBuffer[14] = -w/2; vtxBuffer[15] = -(h+gap); // Bottom display, bottom left
|
||||||
}
|
}
|
||||||
else // displayOrientationID == DS_DISPLAY_ORIENTATION_HORIZONTAL
|
else // displayOrientationID == DS_DISPLAY_ORIENTATION_HORIZONTAL
|
||||||
{
|
{
|
||||||
vtxBuffer[0] = -w; vtxBuffer[1] = h/2; // Left display, top left
|
vtxBuffer[0] = -(w+gap); vtxBuffer[1] = h/2; // Left display, top left
|
||||||
vtxBuffer[2] = 0; vtxBuffer[3] = h/2; // Left display, top right
|
vtxBuffer[2] = -gap; vtxBuffer[3] = h/2; // Left display, top right
|
||||||
vtxBuffer[4] = 0; vtxBuffer[5] = -h/2; // Left display, bottom right
|
vtxBuffer[4] = -gap; vtxBuffer[5] = -h/2; // Left display, bottom right
|
||||||
vtxBuffer[6] = -w; vtxBuffer[7] = -h/2; // Left display, bottom left
|
vtxBuffer[6] = -(w+gap); vtxBuffer[7] = -h/2; // Left display, bottom left
|
||||||
|
|
||||||
vtxBuffer[8] = 0; vtxBuffer[9] = h/2; // Right display, top left
|
vtxBuffer[8] = gap; vtxBuffer[9] = h/2; // Right display, top left
|
||||||
vtxBuffer[10] = w; vtxBuffer[11] = h/2; // Right display, top right
|
vtxBuffer[10] = w+gap; vtxBuffer[11] = h/2; // Right display, top right
|
||||||
vtxBuffer[12] = w; vtxBuffer[13] = -h/2; // Right display, bottom right
|
vtxBuffer[12] = w+gap; vtxBuffer[13] = -h/2; // Right display, bottom right
|
||||||
vtxBuffer[14] = 0; vtxBuffer[15] = -h/2; // Right display, bottom left
|
vtxBuffer[14] = gap; vtxBuffer[15] = -h/2; // Right display, bottom left
|
||||||
}
|
}
|
||||||
|
|
||||||
// displayOrder == DS_DISPLAY_ORDER_TOUCH_FIRST
|
// displayOrder == DS_DISPLAY_ORDER_TOUCH_FIRST
|
||||||
|
@ -1280,14 +1333,15 @@ enum OGLVertexAttributeID
|
||||||
{
|
{
|
||||||
const NSInteger theOrientation = [windowController displayOrientation];
|
const NSInteger theOrientation = [windowController displayOrientation];
|
||||||
const NSInteger theOrder = [windowController displayOrder];
|
const NSInteger theOrder = [windowController displayOrder];
|
||||||
|
const double gap = DS_DISPLAY_GAP * [windowController displayGap];
|
||||||
|
|
||||||
if (theOrientation == DS_DISPLAY_ORIENTATION_VERTICAL && theOrder == DS_DISPLAY_ORDER_TOUCH_FIRST)
|
if (theOrientation == DS_DISPLAY_ORIENTATION_VERTICAL && theOrder == DS_DISPLAY_ORDER_TOUCH_FIRST)
|
||||||
{
|
{
|
||||||
touchLoc.y -= GPU_DISPLAY_HEIGHT;
|
touchLoc.y -= (GPU_DISPLAY_HEIGHT+gap);
|
||||||
}
|
}
|
||||||
else if (theOrientation == DS_DISPLAY_ORIENTATION_HORIZONTAL && theOrder == DS_DISPLAY_ORDER_MAIN_FIRST)
|
else if (theOrientation == DS_DISPLAY_ORIENTATION_HORIZONTAL && theOrder == DS_DISPLAY_ORDER_MAIN_FIRST)
|
||||||
{
|
{
|
||||||
touchLoc.x -= GPU_DISPLAY_WIDTH;
|
touchLoc.x -= (GPU_DISPLAY_WIDTH+gap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1658,7 +1712,7 @@ enum OGLVertexAttributeID
|
||||||
- (void)doDisplayModeChanged:(NSInteger)displayModeID
|
- (void)doDisplayModeChanged:(NSInteger)displayModeID
|
||||||
{
|
{
|
||||||
lastDisplayMode = displayModeID;
|
lastDisplayMode = displayModeID;
|
||||||
[self updateDisplayVerticesUsingDisplayMode:displayModeID orientation:currentDisplayOrientation];
|
[self updateDisplayVerticesUsingDisplayMode:displayModeID orientation:currentDisplayOrientation gap:currentGapScalar];
|
||||||
|
|
||||||
CGLLockContext(cglDisplayContext);
|
CGLLockContext(cglDisplayContext);
|
||||||
CGLSetCurrentContext(cglDisplayContext);
|
CGLSetCurrentContext(cglDisplayContext);
|
||||||
|
@ -1686,7 +1740,7 @@ enum OGLVertexAttributeID
|
||||||
- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID
|
- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID
|
||||||
{
|
{
|
||||||
currentDisplayOrientation = displayOrientationID;
|
currentDisplayOrientation = displayOrientationID;
|
||||||
[self updateDisplayVerticesUsingDisplayMode:lastDisplayMode orientation:displayOrientationID];
|
[self updateDisplayVerticesUsingDisplayMode:lastDisplayMode orientation:displayOrientationID gap:currentGapScalar];
|
||||||
|
|
||||||
CGLLockContext(cglDisplayContext);
|
CGLLockContext(cglDisplayContext);
|
||||||
CGLSetCurrentContext(cglDisplayContext);
|
CGLSetCurrentContext(cglDisplayContext);
|
||||||
|
@ -1721,6 +1775,19 @@ enum OGLVertexAttributeID
|
||||||
CGLUnlockContext(cglDisplayContext);
|
CGLUnlockContext(cglDisplayContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) doDisplayGapChanged:(float)displayGapScalar
|
||||||
|
{
|
||||||
|
currentGapScalar = (GLfloat)displayGapScalar;
|
||||||
|
[self updateDisplayVerticesUsingDisplayMode:lastDisplayMode orientation:currentDisplayOrientation gap:(GLfloat)displayGapScalar];
|
||||||
|
|
||||||
|
CGLLockContext(cglDisplayContext);
|
||||||
|
CGLSetCurrentContext(cglDisplayContext);
|
||||||
|
|
||||||
|
[self uploadVertices];
|
||||||
|
|
||||||
|
CGLUnlockContext(cglDisplayContext);
|
||||||
|
}
|
||||||
|
|
||||||
- (void)doVerticalSyncChanged:(BOOL)useVerticalSync
|
- (void)doVerticalSyncChanged:(BOOL)useVerticalSync
|
||||||
{
|
{
|
||||||
const GLint swapInt = useVerticalSync ? 1 : 0;
|
const GLint swapInt = useVerticalSync ? 1 : 0;
|
||||||
|
|
|
@ -168,6 +168,7 @@ class AudioSampleBlockGenerator;
|
||||||
- (IBAction) changeDisplayMode:(id)sender;
|
- (IBAction) changeDisplayMode:(id)sender;
|
||||||
- (IBAction) changeDisplayOrientation:(id)sender;
|
- (IBAction) changeDisplayOrientation:(id)sender;
|
||||||
- (IBAction) changeDisplayOrder:(id)sender;
|
- (IBAction) changeDisplayOrder:(id)sender;
|
||||||
|
- (IBAction) changeDisplayGap:(id)sender;
|
||||||
- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender;
|
- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender;
|
||||||
- (IBAction) toggleStatusBar:(id)sender;
|
- (IBAction) toggleStatusBar:(id)sender;
|
||||||
- (IBAction) toggleToolbarShown:(id)sender;
|
- (IBAction) toggleToolbarShown:(id)sender;
|
||||||
|
@ -189,6 +190,7 @@ class AudioSampleBlockGenerator;
|
||||||
|
|
||||||
// Misc IBActions
|
// Misc IBActions
|
||||||
- (IBAction) writeDefaultsDisplayRotation:(id)sender;
|
- (IBAction) writeDefaultsDisplayRotation:(id)sender;
|
||||||
|
- (IBAction) writeDefaultsDisplayGap:(id)sender;
|
||||||
- (IBAction) writeDefaultsHUDSettings:(id)sender;
|
- (IBAction) writeDefaultsHUDSettings:(id)sender;
|
||||||
- (IBAction) writeDefaultsDisplayVideoSettings:(id)sender;
|
- (IBAction) writeDefaultsDisplayVideoSettings:(id)sender;
|
||||||
- (IBAction) writeDefaults3DRenderingSettings:(id)sender;
|
- (IBAction) writeDefaults3DRenderingSettings:(id)sender;
|
||||||
|
|
|
@ -905,11 +905,21 @@
|
||||||
[mainWindow setDisplayOrder:[CocoaDSUtil getIBActionSenderTag:sender]];
|
[mainWindow setDisplayOrder:[CocoaDSUtil getIBActionSenderTag:sender]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction) changeDisplayGap:(id)sender
|
||||||
|
{
|
||||||
|
[mainWindow setDisplayGap:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0];
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction) writeDefaultsDisplayRotation:(id)sender
|
- (IBAction) writeDefaultsDisplayRotation:(id)sender
|
||||||
{
|
{
|
||||||
[[NSUserDefaults standardUserDefaults] setDouble:[mainWindow displayRotation] forKey:@"DisplayView_Rotation"];
|
[[NSUserDefaults standardUserDefaults] setDouble:[mainWindow displayRotation] forKey:@"DisplayView_Rotation"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction) writeDefaultsDisplayGap:(id)sender
|
||||||
|
{
|
||||||
|
[[NSUserDefaults standardUserDefaults] setDouble:([mainWindow displayGap] * 100.0) forKey:@"DisplayViewCombo_Gap"];
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction) writeDefaultsHUDSettings:(id)sender
|
- (IBAction) writeDefaultsHUDSettings:(id)sender
|
||||||
{
|
{
|
||||||
// TODO: Not implemented.
|
// TODO: Not implemented.
|
||||||
|
@ -2029,7 +2039,7 @@
|
||||||
}
|
}
|
||||||
else if (theAction == @selector(changeRotation:))
|
else if (theAction == @selector(changeRotation:))
|
||||||
{
|
{
|
||||||
NSInteger viewRotation = (NSInteger)([mainWindow displayRotation]);
|
const NSInteger viewRotation = (NSInteger)[mainWindow displayRotation];
|
||||||
|
|
||||||
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||||
{
|
{
|
||||||
|
@ -2074,6 +2084,36 @@
|
||||||
[(NSMenuItem*)theItem setState:([mainWindow displayOrder] == [theItem tag]) ? NSOnState : NSOffState];
|
[(NSMenuItem*)theItem setState:([mainWindow displayOrder] == [theItem tag]) ? NSOnState : NSOffState];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (theAction == @selector(changeDisplayGap:))
|
||||||
|
{
|
||||||
|
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||||
|
{
|
||||||
|
const NSInteger gapScalar = (NSInteger)([mainWindow displayGap] * 100.0);
|
||||||
|
|
||||||
|
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||||
|
{
|
||||||
|
if ([theItem tag] == -1)
|
||||||
|
{
|
||||||
|
if (gapScalar == 0 ||
|
||||||
|
gapScalar == 50 ||
|
||||||
|
gapScalar == 100 ||
|
||||||
|
gapScalar == 150 ||
|
||||||
|
gapScalar == 200)
|
||||||
|
{
|
||||||
|
[(NSMenuItem*)theItem setState:NSOffState];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[(NSMenuItem*)theItem setState:NSOnState];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[(NSMenuItem*)theItem setState:(gapScalar == [theItem tag]) ? NSOnState : NSOffState];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (theAction == @selector(hudDisable:))
|
else if (theAction == @selector(hudDisable:))
|
||||||
{
|
{
|
||||||
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||||
|
|
Loading…
Reference in New Issue