Cocoa Port: New feature - The Main and Touch displays can now be individually assigned the engine that feeds them video. This can be done on a per-display window basis.

This commit is contained in:
rogerman 2017-08-12 23:04:53 -07:00
parent 623d490393
commit 9a5e52a7fa
14 changed files with 2556 additions and 1275 deletions

View File

@ -3855,7 +3855,7 @@ bool GPUEngineBase::_ComputeSpriteVars(GPUEngineCompositorInfo &compInfo, const
if (y >= sprSize.height)
return false;
if ((sprX == GPU_FRAMEBUFFER_NATIVE_WIDTH) || (sprX+sprSize.width <= 0)) /* sprite pixels outside of line */
if ((sprX == GPU_FRAMEBUFFER_NATIVE_WIDTH) || ((sprX+sprSize.width) <= 0)) /* sprite pixels outside of line */
return false; /* not to be drawn */
// sprite portion out of the screen (LEFT)
@ -3866,7 +3866,7 @@ bool GPUEngineBase::_ComputeSpriteVars(GPUEngineCompositorInfo &compInfo, const
sprX = 0;
}
// sprite portion out of the screen (RIGHT)
if (sprX+sprSize.width >= GPU_FRAMEBUFFER_NATIVE_WIDTH)
if ((sprX+sprSize.width) >= GPU_FRAMEBUFFER_NATIVE_WIDTH)
lg = GPU_FRAMEBUFFER_NATIVE_WIDTH - sprX;
// switch TOP<-->BOTTOM
@ -7610,6 +7610,9 @@ void GPUSubsystem::Reset()
this->_displayInfo.renderedHeight[NDSDisplayID_Touch] = GPU_FRAMEBUFFER_NATIVE_HEIGHT;
this->_displayInfo.renderedBuffer[NDSDisplayID_Touch] = this->_displayInfo.nativeBuffer[NDSDisplayID_Touch];
this->_displayInfo.engineID[NDSDisplayID_Main] = GPUEngineID_Main;
this->_displayInfo.engineID[NDSDisplayID_Touch] = GPUEngineID_Sub;
this->_display[NDSDisplayID_Main]->SetEngineByID(GPUEngineID_Main);
this->_display[NDSDisplayID_Touch]->SetEngineByID(GPUEngineID_Sub);
@ -8246,10 +8249,13 @@ void GPUSubsystem::RenderLine(const size_t l)
this->_displayInfo.renderedWidth[NDSDisplayID_Touch] = this->_display[NDSDisplayID_Touch]->GetEngine()->renderedWidth;
this->_displayInfo.renderedHeight[NDSDisplayID_Touch] = this->_display[NDSDisplayID_Touch]->GetEngine()->renderedHeight;
this->_displayInfo.isDisplayEnabled[NDSDisplayID_Main] = CommonSettings.showGpu.screens[this->_display[NDSDisplayID_Main]->GetEngineID()];
this->_displayInfo.isDisplayEnabled[NDSDisplayID_Touch] = CommonSettings.showGpu.screens[this->_display[NDSDisplayID_Touch]->GetEngineID()];
this->_displayInfo.engineID[NDSDisplayID_Main] = this->_display[NDSDisplayID_Main]->GetEngineID();
this->_displayInfo.engineID[NDSDisplayID_Touch] = this->_display[NDSDisplayID_Touch]->GetEngineID();
this->_displayInfo.needConvertColorFormat[NDSDisplayID_Main] = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev);
this->_displayInfo.isDisplayEnabled[NDSDisplayID_Main] = CommonSettings.showGpu.screens[this->_displayInfo.engineID[NDSDisplayID_Main]];
this->_displayInfo.isDisplayEnabled[NDSDisplayID_Touch] = CommonSettings.showGpu.screens[this->_displayInfo.engineID[NDSDisplayID_Touch]];
this->_displayInfo.needConvertColorFormat[NDSDisplayID_Main] = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev);
this->_displayInfo.needConvertColorFormat[NDSDisplayID_Touch] = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev);
this->_engineMain->UpdateMasterBrightnessDisplayInfo(this->_displayInfo);

View File

@ -1103,6 +1103,8 @@ typedef struct
size_t renderedHeight[2]; // The display rendered at this height, measured in pixels.
void *renderedBuffer[2]; // The display rendered to this buffer.
GPUEngineID engineID[2]; // ID of the engine sourcing the display.
bool didPerformCustomRender[2]; // Reports that the display actually rendered at a custom size for this frame.
// true - The display performed a custom-sized render.
// false - The display performed a native-sized render.

View File

@ -72,6 +72,13 @@ void ClientDisplayView::__InstanceInit(const ClientDisplayViewProperties &props)
_pixelScaler = VideoFilterTypeID_None;
_outputFilter = OutputFilterTypeID_Bilinear;
_displaySourceSelect[NDSDisplayID_Main] = ClientDisplaySource_DeterminedByNDS;
_displaySourceSelect[NDSDisplayID_Touch] = ClientDisplaySource_DeterminedByNDS;
_isSelectedDisplayEnabled[NDSDisplayID_Main] = true;
_isSelectedDisplayEnabled[NDSDisplayID_Touch] = true;
_selectedSourceForDisplay[NDSDisplayID_Main] = NDSDisplayID_Main;
_selectedSourceForDisplay[NDSDisplayID_Touch] = NDSDisplayID_Touch;
_useVerticalSync = false;
_scaleFactor = 1.0;
@ -317,6 +324,26 @@ double ClientDisplayView::GetGapDistance() const
return this->_renderProperty.gapDistance;
}
ClientDisplaySource ClientDisplayView::GetDisplayVideoSource(const NDSDisplayID displayID) const
{
return this->_displaySourceSelect[displayID];
}
void ClientDisplayView::SetDisplayVideoSource(const NDSDisplayID displayID, ClientDisplaySource displaySrc)
{
this->_displaySourceSelect[displayID] = displaySrc;
}
NDSDisplayID ClientDisplayView::GetSelectedDisplaySourceForDisplay(const NDSDisplayID displayID) const
{
return this->_selectedSourceForDisplay[displayID];
}
bool ClientDisplayView::IsSelectedDisplayEnabled(const NDSDisplayID displayID) const
{
return this->_isSelectedDisplayEnabled[displayID];
}
// NDS screen filters
bool ClientDisplayView::GetSourceDeposterize()
{
@ -561,30 +588,125 @@ void ClientDisplayView::LoadDisplays()
{
this->_emuDisplayInfo = this->_fetchObject->GetFetchDisplayInfoForBufferIndex(this->_fetchObject->GetLastFetchIndex());
const bool loadMainScreen = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Main] && ((this->_renderProperty.mode == ClientDisplayMode_Main) || (this->_renderProperty.mode == ClientDisplayMode_Dual));
const bool loadTouchScreen = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch] && ((this->_renderProperty.mode == ClientDisplayMode_Touch) || (this->_renderProperty.mode == ClientDisplayMode_Dual));
this->_selectedSourceForDisplay[NDSDisplayID_Main] = NDSDisplayID_Main;
this->_selectedSourceForDisplay[NDSDisplayID_Touch] = NDSDisplayID_Touch;
this->_isSelectedDisplayEnabled[NDSDisplayID_Main] = false;
this->_isSelectedDisplayEnabled[NDSDisplayID_Touch] = false;
// Select the display source
const ClientDisplaySource mainDisplaySrc = this->_displaySourceSelect[NDSDisplayID_Main];
const ClientDisplaySource touchDisplaySrc = this->_displaySourceSelect[NDSDisplayID_Touch];
switch (mainDisplaySrc)
{
case ClientDisplaySource_DeterminedByNDS:
this->_selectedSourceForDisplay[NDSDisplayID_Main] = NDSDisplayID_Main;
this->_isSelectedDisplayEnabled[NDSDisplayID_Main] = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Main];
break;
case ClientDisplaySource_EngineMain:
{
if ( (this->_emuDisplayInfo.engineID[NDSDisplayID_Main] == GPUEngineID_Main) && (mainDisplaySrc == ClientDisplaySource_EngineMain) )
{
this->_selectedSourceForDisplay[NDSDisplayID_Main] = NDSDisplayID_Main;
this->_isSelectedDisplayEnabled[NDSDisplayID_Main] = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Main];
}
else
{
this->_selectedSourceForDisplay[NDSDisplayID_Main] = NDSDisplayID_Touch;
this->_isSelectedDisplayEnabled[NDSDisplayID_Main] = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch];
}
break;
}
case ClientDisplaySource_EngineSub:
{
if ( (this->_emuDisplayInfo.engineID[NDSDisplayID_Main] == GPUEngineID_Sub) && (mainDisplaySrc == ClientDisplaySource_EngineSub) )
{
this->_selectedSourceForDisplay[NDSDisplayID_Main] = NDSDisplayID_Main;
this->_isSelectedDisplayEnabled[NDSDisplayID_Main] = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Main];
}
else
{
this->_selectedSourceForDisplay[NDSDisplayID_Main] = NDSDisplayID_Touch;
this->_isSelectedDisplayEnabled[NDSDisplayID_Main] = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch];
}
break;
}
case ClientDisplaySource_None:
default:
this->_isSelectedDisplayEnabled[NDSDisplayID_Main] = false;
break;
}
switch (touchDisplaySrc)
{
case ClientDisplaySource_DeterminedByNDS:
this->_selectedSourceForDisplay[NDSDisplayID_Touch] = NDSDisplayID_Touch;
this->_isSelectedDisplayEnabled[NDSDisplayID_Touch] = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch];
break;
case ClientDisplaySource_EngineMain:
{
if ( (this->_emuDisplayInfo.engineID[NDSDisplayID_Touch] == GPUEngineID_Main) && (touchDisplaySrc == ClientDisplaySource_EngineMain) )
{
this->_selectedSourceForDisplay[NDSDisplayID_Touch] = NDSDisplayID_Touch;
this->_isSelectedDisplayEnabled[NDSDisplayID_Touch] = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch];
}
else
{
this->_selectedSourceForDisplay[NDSDisplayID_Touch] = NDSDisplayID_Main;
this->_isSelectedDisplayEnabled[NDSDisplayID_Touch] = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Main];
}
break;
}
case ClientDisplaySource_EngineSub:
{
if ( (this->_emuDisplayInfo.engineID[NDSDisplayID_Touch] == GPUEngineID_Sub) && (touchDisplaySrc == ClientDisplaySource_EngineSub) )
{
this->_selectedSourceForDisplay[NDSDisplayID_Touch] = NDSDisplayID_Touch;
this->_isSelectedDisplayEnabled[NDSDisplayID_Touch] = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch];
}
else
{
this->_selectedSourceForDisplay[NDSDisplayID_Touch] = NDSDisplayID_Main;
this->_isSelectedDisplayEnabled[NDSDisplayID_Touch] = this->_emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Main];
}
break;
}
case ClientDisplaySource_None:
default:
this->_isSelectedDisplayEnabled[NDSDisplayID_Touch] = false;
break;
}
const bool loadMainScreen = this->_isSelectedDisplayEnabled[NDSDisplayID_Main] && ((this->_renderProperty.mode == ClientDisplayMode_Main) || (this->_renderProperty.mode == ClientDisplayMode_Dual));
const bool loadTouchScreen = this->_isSelectedDisplayEnabled[NDSDisplayID_Touch] && ((this->_renderProperty.mode == ClientDisplayMode_Touch) || (this->_renderProperty.mode == ClientDisplayMode_Dual)) && (this->_selectedSourceForDisplay[NDSDisplayID_Main] != this->_selectedSourceForDisplay[NDSDisplayID_Touch]);
if (loadMainScreen)
{
if (!this->_emuDisplayInfo.didPerformCustomRender[NDSDisplayID_Main])
if (!this->_emuDisplayInfo.didPerformCustomRender[this->_selectedSourceForDisplay[NDSDisplayID_Main]])
{
this->_LoadNativeDisplayByID(NDSDisplayID_Main);
this->_LoadNativeDisplayByID(this->_selectedSourceForDisplay[NDSDisplayID_Main]);
}
else
{
this->_LoadCustomDisplayByID(NDSDisplayID_Main);
this->_LoadCustomDisplayByID(this->_selectedSourceForDisplay[NDSDisplayID_Main]);
}
}
if (loadTouchScreen)
{
if (!this->_emuDisplayInfo.didPerformCustomRender[NDSDisplayID_Touch])
if (!this->_emuDisplayInfo.didPerformCustomRender[this->_selectedSourceForDisplay[NDSDisplayID_Touch]])
{
this->_LoadNativeDisplayByID(NDSDisplayID_Touch);
this->_LoadNativeDisplayByID(this->_selectedSourceForDisplay[NDSDisplayID_Touch]);
}
else
{
this->_LoadCustomDisplayByID(NDSDisplayID_Touch);
this->_LoadCustomDisplayByID(this->_selectedSourceForDisplay[NDSDisplayID_Touch]);
}
}
}

View File

@ -57,6 +57,14 @@ enum ClientDisplayOrder
ClientDisplayOrder_TouchFirst
};
enum ClientDisplaySource
{
ClientDisplaySource_None = 0,
ClientDisplaySource_DeterminedByNDS = 1,
ClientDisplaySource_EngineMain = 2,
ClientDisplaySource_EngineSub = 3
};
enum OutputFilterTypeID
{
OutputFilterTypeID_NearestNeighbor = 0,
@ -139,6 +147,10 @@ protected:
VideoFilterTypeID _pixelScaler;
OutputFilterTypeID _outputFilter;
ClientDisplaySource _displaySourceSelect[2];
bool _isSelectedDisplayEnabled[2];
NDSDisplayID _selectedSourceForDisplay[2];
bool _useVerticalSync;
double _scaleFactor;
@ -206,6 +218,11 @@ public:
double GetGapScale() const;
double GetGapDistance() const;
ClientDisplaySource GetDisplayVideoSource(const NDSDisplayID displayID) const;
virtual void SetDisplayVideoSource(const NDSDisplayID displayID, ClientDisplaySource displaySrc);
NDSDisplayID GetSelectedDisplaySourceForDisplay(const NDSDisplayID displayID) const;
bool IsSelectedDisplayEnabled(const NDSDisplayID displayID) const;
// NDS screen filters
bool GetSourceDeposterize();
virtual void SetSourceDeposterize(const bool useDeposterize);

View File

@ -32,6 +32,10 @@
<integer>1</integer>
<key>DisplayView_Rotation</key>
<integer>0</integer>
<key>DisplayView_DisplayMainVideoSource</key>
<integer>1</integer>
<key>DisplayView_DisplayTouchVideoSource</key>
<integer>1</integer>
<key>DisplayView_EnableHUD</key>
<false/>
<key>DisplayView_ShowStatusBar</key>

View File

@ -6926,20 +6926,21 @@ void OGLDisplayLayer::ProcessOGL()
const OGLClientFetchObject &fetchObj = (const OGLClientFetchObject &)this->_output->GetFetchObject();
const NDSDisplayInfo &emuDisplayInfo = this->_output->GetEmuDisplayInfo();
const ClientDisplayMode mode = this->_output->GetViewProperties().mode;
const NDSDisplayID selectedDisplaySource[2] = { this->_output->GetSelectedDisplaySourceForDisplay(NDSDisplayID_Main), this->_output->GetSelectedDisplaySourceForDisplay(NDSDisplayID_Touch) };
const bool didRenderNative[2] = { !emuDisplayInfo.didPerformCustomRender[NDSDisplayID_Main], !emuDisplayInfo.didPerformCustomRender[NDSDisplayID_Touch] };
GLuint texVideoSourceID[2] = { (didRenderNative[NDSDisplayID_Main]) ? fetchObj.GetTexNative(NDSDisplayID_Main, emuDisplayInfo.bufferIndex) : fetchObj.GetTexCustom(NDSDisplayID_Main, emuDisplayInfo.bufferIndex),
(didRenderNative[NDSDisplayID_Touch]) ? fetchObj.GetTexNative(NDSDisplayID_Touch, emuDisplayInfo.bufferIndex) : fetchObj.GetTexCustom(NDSDisplayID_Touch, emuDisplayInfo.bufferIndex) };
GLsizei width[2] = { emuDisplayInfo.renderedWidth[NDSDisplayID_Main], emuDisplayInfo.renderedWidth[NDSDisplayID_Touch] };
GLsizei height[2] = { emuDisplayInfo.renderedHeight[NDSDisplayID_Main], emuDisplayInfo.renderedHeight[NDSDisplayID_Touch] };
const bool didRenderNative[2] = { !emuDisplayInfo.didPerformCustomRender[selectedDisplaySource[NDSDisplayID_Main]], !emuDisplayInfo.didPerformCustomRender[selectedDisplaySource[NDSDisplayID_Touch]] };
GLuint texVideoSourceID[2] = { (didRenderNative[NDSDisplayID_Main]) ? fetchObj.GetTexNative(selectedDisplaySource[NDSDisplayID_Main], emuDisplayInfo.bufferIndex) : fetchObj.GetTexCustom(selectedDisplaySource[NDSDisplayID_Main], emuDisplayInfo.bufferIndex),
(didRenderNative[NDSDisplayID_Touch]) ? fetchObj.GetTexNative(selectedDisplaySource[NDSDisplayID_Touch], emuDisplayInfo.bufferIndex) : fetchObj.GetTexCustom(selectedDisplaySource[NDSDisplayID_Touch], emuDisplayInfo.bufferIndex) };
GLsizei width[2] = { emuDisplayInfo.renderedWidth[selectedDisplaySource[NDSDisplayID_Main]], emuDisplayInfo.renderedWidth[selectedDisplaySource[NDSDisplayID_Touch]] };
GLsizei height[2] = { emuDisplayInfo.renderedHeight[selectedDisplaySource[NDSDisplayID_Main]], emuDisplayInfo.renderedHeight[selectedDisplaySource[NDSDisplayID_Touch]] };
if (emuDisplayInfo.pixelBytes != 0)
{
// Run the video source filters and the pixel scalers
const bool willFilterOnGPU = this->_output->WillFilterOnGPU();
const bool useDeposterize = this->_output->GetSourceDeposterize();
const bool needProcessDisplay[2] = { (didRenderNative[NDSDisplayID_Main] || !emuDisplayInfo.isCustomSizeRequested) && emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Main] && (mode == ClientDisplayMode_Main || mode == ClientDisplayMode_Dual),
(didRenderNative[NDSDisplayID_Touch] || !emuDisplayInfo.isCustomSizeRequested) && emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch] && (mode == ClientDisplayMode_Touch || mode == ClientDisplayMode_Dual) };
const bool needProcessDisplay[2] = { (didRenderNative[NDSDisplayID_Main] || !emuDisplayInfo.isCustomSizeRequested) && this->_output->IsSelectedDisplayEnabled(NDSDisplayID_Main) && (mode == ClientDisplayMode_Main || mode == ClientDisplayMode_Dual),
(didRenderNative[NDSDisplayID_Touch] || !emuDisplayInfo.isCustomSizeRequested) && this->_output->IsSelectedDisplayEnabled(NDSDisplayID_Touch) && (mode == ClientDisplayMode_Touch || mode == ClientDisplayMode_Dual) && (selectedDisplaySource[NDSDisplayID_Main] != selectedDisplaySource[NDSDisplayID_Touch]) };
const bool needsLock = (willFilterOnGPU || useDeposterize) && (needProcessDisplay[NDSDisplayID_Main] || needProcessDisplay[NDSDisplayID_Touch]);
if (needsLock)
@ -6964,15 +6965,25 @@ void OGLDisplayLayer::ProcessOGL()
}
// Set the final output texture IDs
this->_texVideoOutputID[NDSDisplayID_Main] = texVideoSourceID[NDSDisplayID_Main];
this->_texVideoOutputID[NDSDisplayID_Touch] = texVideoSourceID[NDSDisplayID_Touch];
this->_texVideoOutputID[NDSDisplayID_Main] = texVideoSourceID[NDSDisplayID_Main];
if (selectedDisplaySource[NDSDisplayID_Touch] != selectedDisplaySource[NDSDisplayID_Main])
{
this->_texVideoOutputID[NDSDisplayID_Touch] = texVideoSourceID[NDSDisplayID_Touch];
}
else
{
this->_texVideoOutputID[NDSDisplayID_Touch] = texVideoSourceID[NDSDisplayID_Main];
width[NDSDisplayID_Touch] = width[NDSDisplayID_Main];
height[NDSDisplayID_Touch] = height[NDSDisplayID_Main];
}
// Update the texture coordinates
glBindBufferARB(GL_ARRAY_BUFFER_ARB, this->_vboTexCoordID);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, (4 * 8) * sizeof(GLfloat), NULL, GL_STREAM_DRAW_ARB);
float *texCoordPtr = (float *)glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
this->_output->SetScreenTextureCoordinates((float)width[NDSDisplayID_Main], (float)height[NDSDisplayID_Main],
this->_output->SetScreenTextureCoordinates((float)width[NDSDisplayID_Main], (float)height[NDSDisplayID_Main],
(float)width[NDSDisplayID_Touch], (float)height[NDSDisplayID_Touch],
texCoordPtr);
@ -7028,7 +7039,7 @@ void OGLDisplayLayer::RenderOGL()
{
case ClientDisplayMode_Main:
{
if (emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Main])
if (this->_output->IsSelectedDisplayEnabled(NDSDisplayID_Main))
{
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texVideoOutputID[NDSDisplayID_Main]);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, this->_displayTexFilter[NDSDisplayID_Main]);
@ -7040,7 +7051,7 @@ void OGLDisplayLayer::RenderOGL()
case ClientDisplayMode_Touch:
{
if (emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch])
if (this->_output->IsSelectedDisplayEnabled(NDSDisplayID_Touch))
{
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texVideoOutputID[NDSDisplayID_Touch]);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, this->_displayTexFilter[NDSDisplayID_Touch]);
@ -7061,7 +7072,7 @@ void OGLDisplayLayer::RenderOGL()
case ClientDisplayLayout_Hybrid_16_9:
case ClientDisplayLayout_Hybrid_16_10:
{
if (emuDisplayInfo.isDisplayEnabled[majorDisplayID])
if (this->_output->IsSelectedDisplayEnabled(majorDisplayID))
{
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texVideoOutputID[majorDisplayID]);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, this->_displayTexFilter[majorDisplayID]);
@ -7075,7 +7086,7 @@ void OGLDisplayLayer::RenderOGL()
break;
}
if (emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Main])
if (this->_output->IsSelectedDisplayEnabled(NDSDisplayID_Main))
{
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texVideoOutputID[NDSDisplayID_Main]);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, this->_displayTexFilter[NDSDisplayID_Main]);
@ -7083,7 +7094,7 @@ void OGLDisplayLayer::RenderOGL()
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
if (emuDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch])
if (this->_output->IsSelectedDisplayEnabled(NDSDisplayID_Touch))
{
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texVideoOutputID[NDSDisplayID_Touch]);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, this->_displayTexFilter[NDSDisplayID_Touch]);

View File

@ -138,6 +138,7 @@ struct NDSFrameInfo;
OSSpinLock spinlockOutputFilter;
OSSpinLock spinlockSourceDeposterize;
OSSpinLock spinlockPixelScaler;
OSSpinLock spinlockDisplayVideoSource;
}
@property (readonly, nonatomic) BOOL canFilterOnGPU;
@ -149,6 +150,8 @@ struct NDSFrameInfo;
@property (assign) BOOL isHUDLagFrameCountVisible;
@property (assign) BOOL isHUDCPULoadAverageVisible;
@property (assign) BOOL isHUDRealTimeClockVisible;
@property (assign) NSInteger displayMainVideoSource;
@property (assign) NSInteger displayTouchVideoSource;
@property (assign) BOOL useVerticalSync;
@property (assign) BOOL videoFiltersPreferGPU;
@property (assign) BOOL sourceDeposterize;

View File

@ -750,6 +750,8 @@
@dynamic sourceDeposterize;
@dynamic outputFilter;
@dynamic pixelScaler;
@dynamic displayMainVideoSource;
@dynamic displayTouchVideoSource;
- (id)init
{
@ -765,6 +767,7 @@
spinlockOutputFilter = OS_SPINLOCK_INIT;
spinlockSourceDeposterize = OS_SPINLOCK_INIT;
spinlockPixelScaler = OS_SPINLOCK_INIT;
spinlockDisplayVideoSource = OS_SPINLOCK_INIT;
return self;
}
@ -896,6 +899,38 @@
return theState;
}
- (void) setDisplayMainVideoSource:(NSInteger)displaySourceID
{
OSSpinLockLock(&spinlockDisplayVideoSource);
_cdv->SetDisplayVideoSource(NDSDisplayID_Main, (ClientDisplaySource)displaySourceID);
OSSpinLockUnlock(&spinlockDisplayVideoSource);
}
- (NSInteger) displayMainVideoSource
{
OSSpinLockLock(&spinlockDisplayVideoSource);
const NSInteger displayVideoSource = _cdv->GetDisplayVideoSource(NDSDisplayID_Main);
OSSpinLockUnlock(&spinlockDisplayVideoSource);
return displayVideoSource;
}
- (void) setDisplayTouchVideoSource:(NSInteger)displaySourceID
{
OSSpinLockLock(&spinlockDisplayVideoSource);
_cdv->SetDisplayVideoSource(NDSDisplayID_Touch, (ClientDisplaySource)displaySourceID);
OSSpinLockUnlock(&spinlockDisplayVideoSource);
}
- (NSInteger) displayTouchVideoSource
{
OSSpinLockLock(&spinlockDisplayVideoSource);
const NSInteger displayVideoSource = _cdv->GetDisplayVideoSource(NDSDisplayID_Touch);
OSSpinLockUnlock(&spinlockDisplayVideoSource);
return displayVideoSource;
}
- (void) setUseVerticalSync:(BOOL)theState
{
OSSpinLockLock(&spinlockUseVerticalSync);

View File

@ -26,6 +26,9 @@
#include "../ClientDisplayView.h"
#undef BOOL
#define DISPLAY_VIDEO_SOURCE_MAIN_TAG_BASE 1000
#define DISPLAY_VIDEO_SOURCE_TOUCH_TAG_BASE 2000
@class CocoaDSController;
@class EmuControllerDelegate;
class OGLVideoOutput;
@ -55,6 +58,8 @@ class OGLVideoOutput;
@property (assign) BOOL isHUDLagFrameCountVisible;
@property (assign) BOOL isHUDCPULoadAverageVisible;
@property (assign) BOOL isHUDRealTimeClockVisible;
@property (assign) NSInteger displayMainVideoSource;
@property (assign) NSInteger displayTouchVideoSource;
@property (assign) BOOL useVerticalSync;
@property (assign) BOOL videoFiltersPreferGPU;
@property (assign) BOOL sourceDeposterize;
@ -129,6 +134,8 @@ class OGLVideoOutput;
@property (assign, nonatomic) double displayGap;
@property (assign, nonatomic) double displayScale;
@property (assign, nonatomic) double displayRotation;
@property (assign, nonatomic) NSInteger displayMainVideoSource;
@property (assign, nonatomic) NSInteger displayTouchVideoSource;
@property (assign) BOOL videoFiltersPreferGPU;
@property (assign) BOOL videoSourceDeposterize;
@property (assign) NSInteger videoOutputFilter;
@ -145,10 +152,10 @@ class OGLVideoOutput;
outputFilter:(NSInteger)outputFilterID
pixelScaler:(NSInteger)pixelScalerID;
- (void) setDisplayMode:(ClientDisplayMode)mode
viewScale:(double)viewScale
rotation:(double)rotation
layout:(ClientDisplayLayout)layout
order:(ClientDisplayOrder)order
rotation:(double)rotation
viewScale:(double)viewScale
gapScale:(double)gapScale
isMinSizeNormal:(BOOL)isMinSizeNormal
isShowingStatusBar:(BOOL)isShowingStatusBar;
@ -183,6 +190,7 @@ class OGLVideoOutput;
- (IBAction) changeDisplayOrientation:(id)sender;
- (IBAction) changeDisplayOrder:(id)sender;
- (IBAction) changeDisplayGap:(id)sender;
- (IBAction) changeDisplayVideoSource:(id)sender;
- (IBAction) toggleVideoFiltersPreferGPU:(id)sender;
- (IBAction) toggleVideoSourceDeposterize:(id)sender;
- (IBAction) changeVideoOutputFilter:(id)sender;

View File

@ -63,6 +63,8 @@
@dynamic isFullScreen;
@dynamic displayScale;
@dynamic displayRotation;
@dynamic displayMainVideoSource;
@dynamic displayTouchVideoSource;
@dynamic videoFiltersPreferGPU;
@dynamic videoSourceDeposterize;
@dynamic videoOutputFilter;
@ -221,6 +223,28 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
return _localRotation;
}
- (void) setDisplayMainVideoSource:(NSInteger)displaySourceID
{
[[self view] setDisplayMainVideoSource:displaySourceID];
[CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_RELOAD_REPROCESS_REDRAW];
}
- (NSInteger) displayMainVideoSource
{
return [[self view] displayMainVideoSource];
}
- (void) setDisplayTouchVideoSource:(NSInteger)displaySourceID
{
[[self view] setDisplayTouchVideoSource:displaySourceID];
[CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_RELOAD_REPROCESS_REDRAW];
}
- (NSInteger) displayTouchVideoSource
{
return [[self view] displayTouchVideoSource];
}
- (void) setDisplayMode:(NSInteger)displayModeID
{
const BOOL willModeChangeSize = ( ((displayModeID == ClientDisplayMode_Main) || (displayModeID == ClientDisplayMode_Touch)) && (_localViewProps.mode == ClientDisplayMode_Dual) ) ||
@ -447,10 +471,10 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
}
- (void) setDisplayMode:(ClientDisplayMode)mode
viewScale:(double)viewScale
rotation:(double)rotation
layout:(ClientDisplayLayout)layout
order:(ClientDisplayOrder)order
rotation:(double)rotation
viewScale:(double)viewScale
gapScale:(double)gapScale
isMinSizeNormal:(BOOL)isMinSizeNormal
isShowingStatusBar:(BOOL)isShowingStatusBar
@ -524,24 +548,28 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
- (void) setupUserDefaults
{
[self setDisplayMode:(ClientDisplayMode)[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_Mode"]
viewScale:([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Size"] / 100.0)
rotation:[[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Rotation"]
layout:(ClientDisplayLayout)[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Orientation"]
order:(ClientDisplayOrder)[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Order"]
rotation:[[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Rotation"]
viewScale:([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Size"] / 100.0)
gapScale:([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayViewCombo_Gap"] / 100.0)
isMinSizeNormal:[self isMinSizeNormal]
isShowingStatusBar:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"]];
[self setDisplayMainVideoSource:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_DisplayMainVideoSource"]];
[self setDisplayTouchVideoSource:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_DisplayTouchVideoSource"]];
[self setVideoPropertiesWithoutUpdateUsingPreferGPU:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_FiltersPreferGPU"]
sourceDeposterize:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_Deposterize"]
outputFilter:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_OutputFilter"]
pixelScaler:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_OutputFilter"]];
pixelScaler:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_VideoFilter"]];
[[self view] setIsHUDVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_EnableHUD"]];
[[self view] setIsHUDVideoFPSVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowVideoFPS"]];
[[self view] setIsHUDRender3DFPSVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRender3DFPS"]];
[[self view] setIsHUDFrameIndexVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowFrameIndex"]];
[[self view] setIsHUDLagFrameCountVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowLagFrameCount"]];
[[self view] setIsHUDCPULoadAverageVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowCPULoadAverage"]];
[[self view] setIsHUDRealTimeClockVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRTC"]];
// TODO: Show HUD Input.
//[[self view] setIsHUDInputVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowInput"]];
@ -975,6 +1003,30 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
[self setDisplayGap:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0];
}
- (IBAction) changeDisplayVideoSource:(id)sender
{
NSInteger tag = [CocoaDSUtil getIBActionSenderTag:sender];
if (tag >= DISPLAY_VIDEO_SOURCE_TOUCH_TAG_BASE)
{
if ((tag-DISPLAY_VIDEO_SOURCE_TOUCH_TAG_BASE) == [self displayTouchVideoSource])
{
return;
}
[self setDisplayTouchVideoSource:tag-DISPLAY_VIDEO_SOURCE_TOUCH_TAG_BASE];
}
else
{
if ((tag-DISPLAY_VIDEO_SOURCE_MAIN_TAG_BASE) == [self displayMainVideoSource])
{
return;
}
[self setDisplayMainVideoSource:tag-DISPLAY_VIDEO_SOURCE_MAIN_TAG_BASE];
}
}
- (IBAction) toggleVideoFiltersPreferGPU:(id)sender
{
[self setVideoFiltersPreferGPU:![self videoFiltersPreferGPU]];
@ -1130,6 +1182,20 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
}
}
}
else if (theAction == @selector(changeDisplayVideoSource:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
if ([theItem tag] >= DISPLAY_VIDEO_SOURCE_TOUCH_TAG_BASE)
{
[(NSMenuItem *)theItem setState:([self displayTouchVideoSource] == ([theItem tag]-DISPLAY_VIDEO_SOURCE_TOUCH_TAG_BASE)) ? NSOnState : NSOffState];
}
else
{
[(NSMenuItem *)theItem setState:([self displayMainVideoSource] == ([theItem tag]-DISPLAY_VIDEO_SOURCE_MAIN_TAG_BASE)) ? NSOnState : NSOffState];
}
}
}
else if (theAction == @selector(changeVideoOutputFilter:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
@ -1605,6 +1671,8 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
@dynamic isHUDLagFrameCountVisible;
@dynamic isHUDCPULoadAverageVisible;
@dynamic isHUDRealTimeClockVisible;
@dynamic displayMainVideoSource;
@dynamic displayTouchVideoSource;
@dynamic useVerticalSync;
@dynamic videoFiltersPreferGPU;
@dynamic sourceDeposterize;
@ -1736,6 +1804,26 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
return [[self cdsVideoOutput] isHUDRealTimeClockVisible];
}
- (void) setDisplayMainVideoSource:(NSInteger)displaySourceID
{
[[self cdsVideoOutput] setDisplayMainVideoSource:displaySourceID];
}
- (NSInteger) displayMainVideoSource
{
return [[self cdsVideoOutput] displayMainVideoSource];
}
- (void) setDisplayTouchVideoSource:(NSInteger)displaySourceID
{
[[self cdsVideoOutput] setDisplayTouchVideoSource:displaySourceID];
}
- (NSInteger) displayTouchVideoSource
{
return [[self cdsVideoOutput] displayTouchVideoSource];
}
- (void) setUseVerticalSync:(BOOL)theState
{
[[self cdsVideoOutput] setUseVerticalSync:theState];

View File

@ -1243,15 +1243,31 @@
const NDSDisplayInfo &fetchDisplayInfo = _cdv->GetEmuDisplayInfo();
const ClientDisplayMode mode = _cdv->GetViewProperties().mode;
const bool useDeposterize = _cdv->GetSourceDeposterize();
const NDSDisplayID selectedDisplaySource[2] = { _cdv->GetSelectedDisplaySourceForDisplay(NDSDisplayID_Main), _cdv->GetSelectedDisplaySourceForDisplay(NDSDisplayID_Touch) };
_texDisplayOutput[NDSDisplayID_Main] = [sharedData texDisplaySrcTargetMain];
_texDisplayOutput[NDSDisplayID_Touch] = [sharedData texDisplaySrcTargetTouch];
if (selectedDisplaySource[NDSDisplayID_Main] == NDSDisplayID_Main)
{
_texDisplayOutput[NDSDisplayID_Main] = [sharedData texDisplaySrcTargetMain];
}
else
{
_texDisplayOutput[NDSDisplayID_Main] = [sharedData texDisplaySrcTargetTouch];
}
if (selectedDisplaySource[NDSDisplayID_Touch] == NDSDisplayID_Touch)
{
_texDisplayOutput[NDSDisplayID_Touch] = [sharedData texDisplaySrcTargetTouch];
}
else
{
_texDisplayOutput[NDSDisplayID_Touch] = [sharedData texDisplaySrcTargetMain];
}
if ( (fetchDisplayInfo.pixelBytes != 0) && (useDeposterize || (_cdv->GetPixelScaler() != VideoFilterTypeID_None)) )
{
const bool willFilterOnGPU = _cdv->WillFilterOnGPU();
const bool shouldProcessDisplay[2] = { (!fetchDisplayInfo.didPerformCustomRender[NDSDisplayID_Main] || !fetchDisplayInfo.isCustomSizeRequested) && fetchDisplayInfo.isDisplayEnabled[NDSDisplayID_Main] && (mode == ClientDisplayMode_Main || mode == ClientDisplayMode_Dual),
(!fetchDisplayInfo.didPerformCustomRender[NDSDisplayID_Touch] || !fetchDisplayInfo.isCustomSizeRequested) && fetchDisplayInfo.isDisplayEnabled[NDSDisplayID_Touch] && (mode == ClientDisplayMode_Touch || mode == ClientDisplayMode_Dual) };
const bool shouldProcessDisplay[2] = { (!fetchDisplayInfo.didPerformCustomRender[selectedDisplaySource[NDSDisplayID_Main]] || !fetchDisplayInfo.isCustomSizeRequested) && _cdv->IsSelectedDisplayEnabled(NDSDisplayID_Main) && (mode == ClientDisplayMode_Main || mode == ClientDisplayMode_Dual),
(!fetchDisplayInfo.didPerformCustomRender[selectedDisplaySource[NDSDisplayID_Touch]] || !fetchDisplayInfo.isCustomSizeRequested) && _cdv->IsSelectedDisplayEnabled(NDSDisplayID_Touch) && (mode == ClientDisplayMode_Touch || mode == ClientDisplayMode_Dual) && (selectedDisplaySource[NDSDisplayID_Main] != selectedDisplaySource[NDSDisplayID_Touch]) };
VideoFilter *vfMain = _cdv->GetPixelScalerObject(NDSDisplayID_Main);
VideoFilter *vfTouch = _cdv->GetPixelScalerObject(NDSDisplayID_Touch);
@ -1266,7 +1282,7 @@
if (shouldProcessDisplay[NDSDisplayID_Main])
{
[cce setTexture:[sharedData texDisplaySrcTargetMain] atIndex:0];
[cce setTexture:_texDisplayOutput[NDSDisplayID_Main] atIndex:0];
[cce setTexture:_texDisplaySrcDeposterize[NDSDisplayID_Main][0] atIndex:1];
[cce dispatchThreadgroups:[sharedData deposterizeThreadGroupsPerGrid]
threadsPerThreadgroup:[sharedData deposterizeThreadsPerGroup]];
@ -1281,7 +1297,7 @@
if (shouldProcessDisplay[NDSDisplayID_Touch])
{
[cce setTexture:[sharedData texDisplaySrcTargetTouch] atIndex:0];
[cce setTexture:_texDisplayOutput[NDSDisplayID_Touch] atIndex:0];
[cce setTexture:_texDisplaySrcDeposterize[NDSDisplayID_Touch][0] atIndex:1];
[cce dispatchThreadgroups:[sharedData deposterizeThreadGroupsPerGrid]
threadsPerThreadgroup:[sharedData deposterizeThreadsPerGroup]];
@ -1416,6 +1432,11 @@
[cb commit];
}
if (selectedDisplaySource[NDSDisplayID_Touch] == selectedDisplaySource[NDSDisplayID_Main])
{
_texDisplayOutput[NDSDisplayID_Touch] = _texDisplayOutput[NDSDisplayID_Main];
}
// Update the texture coordinates
_cdv->SetScreenTextureCoordinates((float)[_texDisplayOutput[NDSDisplayID_Main] width], (float)[_texDisplayOutput[NDSDisplayID_Main] height],
(float)[_texDisplayOutput[NDSDisplayID_Touch] width], (float)[_texDisplayOutput[NDSDisplayID_Touch] height],
@ -1502,7 +1523,7 @@
{
case ClientDisplayMode_Main:
{
if (displayInfo.isDisplayEnabled[NDSDisplayID_Main])
if (_cdv->IsSelectedDisplayEnabled(NDSDisplayID_Main))
{
[ce setFragmentTexture:_texDisplayOutput[NDSDisplayID_Main] atIndex:0];
[ce drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];
@ -1512,7 +1533,7 @@
case ClientDisplayMode_Touch:
{
if (displayInfo.isDisplayEnabled[NDSDisplayID_Touch])
if (_cdv->IsSelectedDisplayEnabled(NDSDisplayID_Touch))
{
[ce setFragmentTexture:_texDisplayOutput[NDSDisplayID_Touch] atIndex:0];
[ce drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:4 vertexCount:4];
@ -1531,7 +1552,7 @@
case ClientDisplayLayout_Hybrid_16_9:
case ClientDisplayLayout_Hybrid_16_10:
{
if (displayInfo.isDisplayEnabled[majorDisplayID])
if (_cdv->IsSelectedDisplayEnabled(majorDisplayID))
{
[ce setFragmentTexture:_texDisplayOutput[majorDisplayID] atIndex:0];
[ce drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:majorDisplayVtx vertexCount:4];
@ -1543,13 +1564,13 @@
break;
}
if (displayInfo.isDisplayEnabled[NDSDisplayID_Main])
if (_cdv->IsSelectedDisplayEnabled(NDSDisplayID_Main))
{
[ce setFragmentTexture:_texDisplayOutput[NDSDisplayID_Main] atIndex:0];
[ce drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];
}
if (displayInfo.isDisplayEnabled[NDSDisplayID_Touch])
if (_cdv->IsSelectedDisplayEnabled(NDSDisplayID_Touch))
{
[ce setFragmentTexture:_texDisplayOutput[NDSDisplayID_Touch] atIndex:0];
[ce drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:4 vertexCount:4];

View File

@ -621,34 +621,37 @@
continue;
}
const NSInteger displayMode = [(NSNumber *)[windowProperties valueForKey:@"displayMode"] integerValue];
const double displayScale = [(NSNumber *)[windowProperties valueForKey:@"displayScale"] doubleValue];
const double displayRotation = [(NSNumber *)[windowProperties valueForKey:@"displayRotation"] doubleValue];
const NSInteger displayOrientation = [(NSNumber *)[windowProperties valueForKey:@"displayOrientation"] integerValue];
const NSInteger displayOrder = [(NSNumber *)[windowProperties valueForKey:@"displayOrder"] integerValue];
const double displayGap = [(NSNumber *)[windowProperties valueForKey:@"displayGap"] doubleValue];
const NSInteger displayMode = ([windowProperties objectForKey:@"displayMode"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayMode"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_Mode"];
const double displayScale = ([windowProperties objectForKey:@"displayScale"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayScale"] doubleValue] : ([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Size"] / 100.0);
const double displayRotation = ([windowProperties objectForKey:@"displayRotation"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayRotation"] doubleValue] : [[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Rotation"];
const NSInteger displayOrientation = ([windowProperties objectForKey:@"displayOrientation"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayOrientation"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Orientation"];
const NSInteger displayOrder = ([windowProperties objectForKey:@"displayOrder"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayOrder"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Order"];
const double displayGap = ([windowProperties objectForKey:@"displayGap"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayGap"] doubleValue] : ([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayViewCombo_Gap"] / 100.0);
const BOOL videoFiltersPreferGPU = [(NSNumber *)[windowProperties valueForKey:@"videoFiltersPreferGPU"] boolValue];
const BOOL videoSourceDeposterize = [(NSNumber *)[windowProperties valueForKey:@"videoSourceDeposterize"] boolValue];
const NSInteger videoPixelScaler = [(NSNumber *)[windowProperties valueForKey:@"videoFilterType"] integerValue];
const NSInteger videoOutputFilter = [(NSNumber *)[windowProperties valueForKey:@"videoOutputFilter"] integerValue];
const NSInteger displayMainSource = ([windowProperties objectForKey:@"displayMainVideoSource"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayMainVideoSource"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_DisplayMainVideoSource"];
const NSInteger displayTouchSource = ([windowProperties objectForKey:@"displayTouchVideoSource"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"displayTouchVideoSource"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_DisplayTouchVideoSource"];
const BOOL hudEnable = [(NSNumber *)[windowProperties valueForKey:@"hudEnable"] boolValue];
const BOOL hudShowVideoFPS = [(NSNumber *)[windowProperties valueForKey:@"hudShowVideoFPS"] boolValue];
const BOOL hudShowRender3DFPS = [(NSNumber *)[windowProperties valueForKey:@"hudShowRender3DFPS"] boolValue];
const BOOL hudShowFrameIndex = [(NSNumber *)[windowProperties valueForKey:@"hudShowFrameIndex"] boolValue];
const BOOL hudShowLagFrameCount = [(NSNumber *)[windowProperties valueForKey:@"hudShowLagFrameCount"] boolValue];
const BOOL hudShowCPULoadAverage = [(NSNumber *)[windowProperties valueForKey:@"hudShowCPULoadAverage"] boolValue];
const BOOL hudShowRTC = [(NSNumber *)[windowProperties valueForKey:@"hudShowRTC"] boolValue];
const BOOL videoFiltersPreferGPU = ([windowProperties objectForKey:@"videoFiltersPreferGPU"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoFiltersPreferGPU"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_FiltersPreferGPU"];
const BOOL videoSourceDeposterize = ([windowProperties objectForKey:@"videoSourceDeposterize"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoSourceDeposterize"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_Deposterize"];
const NSInteger videoPixelScaler = ([windowProperties objectForKey:@"videoFilterType"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoFilterType"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_VideoFilter"];
const NSInteger videoOutputFilter = ([windowProperties objectForKey:@"videoOutputFilter"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"videoOutputFilter"] integerValue] : [[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_OutputFilter"];
const BOOL hudEnable = ([windowProperties objectForKey:@"hudEnable"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudEnable"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_EnableHUD"];
const BOOL hudShowVideoFPS = ([windowProperties objectForKey:@"hudShowVideoFPS"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowVideoFPS"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowVideoFPS"];
const BOOL hudShowRender3DFPS = ([windowProperties objectForKey:@"hudShowRender3DFPS"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowRender3DFPS"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRender3DFPS"];
const BOOL hudShowFrameIndex = ([windowProperties objectForKey:@"hudShowFrameIndex"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowFrameIndex"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowFrameIndex"];
const BOOL hudShowLagFrameCount = ([windowProperties objectForKey:@"hudShowLagFrameCount"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowLagFrameCount"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowLagFrameCount"];
const BOOL hudShowCPULoadAverage = ([windowProperties objectForKey:@"hudShowCPULoadAverage"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowCPULoadAverage"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowCPULoadAverage"];
const BOOL hudShowRTC = ([windowProperties objectForKey:@"hudShowRTC"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"hudShowRTC"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRTC"];
// TODO: Show HUD Input.
//const BOOL hudShowInput = [(NSNumber *)[windowProperties valueForKey:@"hudShowInput"] boolValue];
const NSInteger screenshotFileFormat = [(NSNumber *)[windowProperties valueForKey:@"screenshotFileFormat"] integerValue];
const BOOL useVerticalSync = [(NSNumber *)[windowProperties valueForKey:@"useVerticalSync"] boolValue];
const BOOL isMinSizeNormal = [(NSNumber *)[windowProperties valueForKey:@"isMinSizeNormal"] boolValue];
const BOOL isShowingStatusBar = [(NSNumber *)[windowProperties valueForKey:@"isShowingStatusBar"] boolValue];
const BOOL isInFullScreenMode = [(NSNumber *)[windowProperties valueForKey:@"isInFullScreenMode"] boolValue];
const NSUInteger screenIndex = [(NSNumber *)[windowProperties valueForKey:@"screenIndex"] unsignedIntegerValue];
const NSInteger screenshotFileFormat = ([windowProperties objectForKey:@"screenshotFileFormat"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"screenshotFileFormat"] integerValue] : NSTIFFFileType;
const BOOL useVerticalSync = ([windowProperties objectForKey:@"useVerticalSync"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"useVerticalSync"] boolValue] : YES;
const BOOL isMinSizeNormal = ([windowProperties objectForKey:@"isMinSizeNormal"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"isMinSizeNormal"] boolValue] : YES;
const BOOL isShowingStatusBar = ([windowProperties objectForKey:@"isShowingStatusBar"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"isShowingStatusBar"] boolValue] : [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"];
const BOOL isInFullScreenMode = ([windowProperties objectForKey:@"isInFullScreenMode"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"isInFullScreenMode"] boolValue] : NO;
const NSUInteger screenIndex = ([windowProperties objectForKey:@"screenIndex"] != nil) ? [(NSNumber *)[windowProperties valueForKey:@"screenIndex"] unsignedIntegerValue] : 0;
NSString *windowFrameStr = (NSString *)[windowProperties valueForKey:@"windowFrame"];
int frameX = 0;
@ -662,14 +665,17 @@
[windowController window];
[windowController setDisplayMode:(ClientDisplayMode)displayMode
viewScale:displayScale
rotation:displayRotation
layout:(ClientDisplayLayout)displayOrientation
order:(ClientDisplayOrder)displayOrder
rotation:displayRotation
viewScale:displayScale
gapScale:displayGap
isMinSizeNormal:isMinSizeNormal
isShowingStatusBar:isShowingStatusBar];
[windowController setDisplayMainVideoSource:displayMainSource];
[windowController setDisplayTouchVideoSource:displayTouchSource];
[windowController setVideoPropertiesWithoutUpdateUsingPreferGPU:videoFiltersPreferGPU
sourceDeposterize:videoSourceDeposterize
outputFilter:videoOutputFilter
@ -738,6 +744,8 @@
[NSNumber numberWithInteger:[windowController displayMode]], @"displayMode",
[NSNumber numberWithDouble:[windowController masterWindowScale]], @"displayScale",
[NSNumber numberWithDouble:[windowController displayRotation]], @"displayRotation",
[NSNumber numberWithInteger:[windowController displayMainVideoSource]], @"displayMainVideoSource",
[NSNumber numberWithInteger:[windowController displayTouchVideoSource]], @"displayTouchVideoSource",
[NSNumber numberWithInteger:[windowController displayOrientation]], @"displayOrientation",
[NSNumber numberWithInteger:[windowController displayOrder]], @"displayOrder",
[NSNumber numberWithDouble:[windowController displayGap]], @"displayGap",