Cocoa Port: Expose the new user-selectable MSAA sample size feature in the UI that was introduced in commit 94ddf1a.

- Also add some other future UI-related stuff that was already in-flight at the time of this commit.
This commit is contained in:
rogerman 2018-10-22 12:33:04 -07:00
parent 68174fb31f
commit 5d3e53d804
16 changed files with 99574 additions and 80576 deletions

View File

@ -165,6 +165,12 @@
AB3BF43E1E26289E003E2B24 /* MacMetalDisplayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3BF43B1E26289E003E2B24 /* MacMetalDisplayView.mm */; };
AB3BF4421E262959003E2B24 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3BF4401E262943003E2B24 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
AB3E34C9134AF4500056477A /* cocoa_output.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E34C8134AF4500056477A /* cocoa_output.mm */; };
AB3FBD802176DE95005722D0 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3FBD7F2176DE95005722D0 /* WifiSettingsPanel.mm */; };
AB3FBD812176DE95005722D0 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3FBD7F2176DE95005722D0 /* WifiSettingsPanel.mm */; };
AB3FBD822176DE95005722D0 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3FBD7F2176DE95005722D0 /* WifiSettingsPanel.mm */; };
AB3FBD832176DE95005722D0 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3FBD7F2176DE95005722D0 /* WifiSettingsPanel.mm */; };
AB3FBD842176DE95005722D0 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3FBD7F2176DE95005722D0 /* WifiSettingsPanel.mm */; };
AB3FBD852176DE95005722D0 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3FBD7F2176DE95005722D0 /* WifiSettingsPanel.mm */; };
AB40562A169F5DBB0016AC3E /* assembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB405600169F5DBB0016AC3E /* assembler.cpp */; };
AB40562B169F5DBB0016AC3E /* assembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB405600169F5DBB0016AC3E /* assembler.cpp */; };
AB40562C169F5DBB0016AC3E /* assembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB405600169F5DBB0016AC3E /* assembler.cpp */; };
@ -2391,6 +2397,8 @@
AB3BF4401E262943003E2B24 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
AB3E34C7134AF4500056477A /* cocoa_output.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_output.h; sourceTree = "<group>"; };
AB3E34C8134AF4500056477A /* cocoa_output.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_output.mm; sourceTree = "<group>"; };
AB3FBD7E2176DE95005722D0 /* WifiSettingsPanel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WifiSettingsPanel.h; sourceTree = "<group>"; };
AB3FBD7F2176DE95005722D0 /* WifiSettingsPanel.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WifiSettingsPanel.mm; sourceTree = "<group>"; };
AB4055ED169F59380016AC3E /* AsmJit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsmJit.h; sourceTree = "<group>"; };
AB4055EE169F59380016AC3E /* Config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Config.h; sourceTree = "<group>"; };
AB4055EF169F59380016AC3E /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = core.h; sourceTree = "<group>"; };
@ -3582,6 +3590,7 @@
ABAF0A3F1A96E67200B95B75 /* RomInfoPanel.h */,
AB564902186E6EBC002740F4 /* Slot2WindowDelegate.h */,
ABF2B9F81690412A000FF7C0 /* troubleshootingWindowDelegate.h */,
AB3FBD7E2176DE95005722D0 /* WifiSettingsPanel.h */,
AB54718A1E27610500508C5C /* MacMetalDisplayViewShaders.metal */,
AB3ACB6714C2361100D7D192 /* appDelegate.mm */,
AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */,
@ -3601,6 +3610,7 @@
ABAF0A401A96E67200B95B75 /* RomInfoPanel.mm */,
AB564903186E6EBC002740F4 /* Slot2WindowDelegate.mm */,
ABF2B9FA16904133000FF7C0 /* troubleshootingWindowDelegate.mm */,
AB3FBD7F2176DE95005722D0 /* WifiSettingsPanel.mm */,
);
path = userinterface;
sourceTree = "<group>";
@ -5512,6 +5522,7 @@
ABE6702D1415DE6C00E8E4C9 /* tinyxmlerror.cpp in Sources */,
ABA7316C1BB51FDC00B26147 /* psaux.c in Sources */,
ABE6702E1415DE6C00E8E4C9 /* tinyxmlparser.cpp in Sources */,
AB3FBD852176DE95005722D0 /* WifiSettingsPanel.mm in Sources */,
ABA7315B1BB51A8D00B26147 /* psnames.c in Sources */,
ABFEA8411BB4EC1100B08C25 /* ftpatent.c in Sources */,
ABD1FEFD1345AC8400AF11D1 /* version.cpp in Sources */,
@ -5738,6 +5749,7 @@
AB7900B8215B84E50082AE82 /* SPU.cpp in Sources */,
AB7900B9215B84E50082AE82 /* sse_optimized.cpp in Sources */,
AB7900BA215B84E50082AE82 /* task.cpp in Sources */,
AB3FBD822176DE95005722D0 /* WifiSettingsPanel.mm in Sources */,
AB7900BB215B84E50082AE82 /* TDStretch.cpp in Sources */,
AB7900BC215B84E50082AE82 /* texcache.cpp in Sources */,
AB7900BD215B84E50082AE82 /* async_job.c in Sources */,
@ -5930,6 +5942,7 @@
AB7901F3215B84F20082AE82 /* matrix.cpp in Sources */,
AB7901F4215B84F20082AE82 /* mc.cpp in Sources */,
AB7901F5215B84F20082AE82 /* metaspu.cpp in Sources */,
AB3FBD832176DE95005722D0 /* WifiSettingsPanel.mm in Sources */,
AB7901F6215B84F20082AE82 /* MMU.cpp in Sources */,
AB7901F7215B84F20082AE82 /* mmx_optimized.cpp in Sources */,
AB7901F8215B84F20082AE82 /* movie.cpp in Sources */,
@ -6191,6 +6204,7 @@
AB796D3815CDCBA200C59155 /* SPU.cpp in Sources */,
AB796D3915CDCBA200C59155 /* sse_optimized.cpp in Sources */,
AB796D3A15CDCBA200C59155 /* task.cpp in Sources */,
AB3FBD802176DE95005722D0 /* WifiSettingsPanel.mm in Sources */,
AB796D3B15CDCBA200C59155 /* TDStretch.cpp in Sources */,
AB796D3C15CDCBA200C59155 /* texcache.cpp in Sources */,
AB2ABA3B1C9F9CFA00173B15 /* async_job.c in Sources */,
@ -6383,6 +6397,7 @@
AB8F3C9C1A53AC2600A80BF6 /* matrix.cpp in Sources */,
AB8F3C9D1A53AC2600A80BF6 /* mc.cpp in Sources */,
AB8F3C9F1A53AC2600A80BF6 /* metaspu.cpp in Sources */,
AB3FBD812176DE95005722D0 /* WifiSettingsPanel.mm in Sources */,
AB8F3CA01A53AC2600A80BF6 /* MMU.cpp in Sources */,
AB8F3CA11A53AC2600A80BF6 /* mmx_optimized.cpp in Sources */,
AB8F3CA21A53AC2600A80BF6 /* movie.cpp in Sources */,
@ -6885,6 +6900,7 @@
ABE1457F1FBBA71A0097A4A8 /* operand.cpp in Sources */,
ABE145801FBBA71A0097A4A8 /* stringbuilder.cpp in Sources */,
ABE145811FBBA71A0097A4A8 /* ftgxval.c in Sources */,
AB3FBD842176DE95005722D0 /* WifiSettingsPanel.mm in Sources */,
ABE145821FBBA71A0097A4A8 /* stringutil.cpp in Sources */,
ABE145831FBBA71A0097A4A8 /* virtualmemory.cpp in Sources */,
ABE145841FBBA71A0097A4A8 /* zonememory.cpp in Sources */,

View File

@ -737,6 +737,11 @@
AB446DB41F69DB68002F32B6 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB446DA01F69DB56002F32B6 /* CoreVideo.framework */; };
AB446DB51F69DB69002F32B6 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB446DA01F69DB56002F32B6 /* CoreVideo.framework */; };
AB446DB61F69DB69002F32B6 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB446DA01F69DB56002F32B6 /* CoreVideo.framework */; };
AB4B5A21217E47E400381363 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB4B5A20217E47E400381363 /* WifiSettingsPanel.mm */; };
AB4B5A22217E47E400381363 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB4B5A20217E47E400381363 /* WifiSettingsPanel.mm */; };
AB4B5A23217E47E400381363 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB4B5A20217E47E400381363 /* WifiSettingsPanel.mm */; };
AB4B5A24217E47E400381363 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB4B5A20217E47E400381363 /* WifiSettingsPanel.mm */; };
AB4B5A25217E47E400381363 /* WifiSettingsPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB4B5A20217E47E400381363 /* WifiSettingsPanel.mm */; };
AB4C4C3F16F55C64002E07CD /* AAFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C4C2A16F55C64002E07CD /* AAFilter.cpp */; };
AB4C4C4016F55C64002E07CD /* cpu_detect_x86_gcc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C4C2B16F55C64002E07CD /* cpu_detect_x86_gcc.cpp */; };
AB4C4C4116F55C64002E07CD /* FIFOSampleBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C4C2C16F55C64002E07CD /* FIFOSampleBuffer.cpp */; };
@ -1951,6 +1956,8 @@
AB43528517D5BA95007417C8 /* fsnitro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fsnitro.h; sourceTree = "<group>"; };
AB43528617D5BA95007417C8 /* fsnitro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fsnitro.cpp; sourceTree = "<group>"; };
AB446DA01F69DB56002F32B6 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
AB4B5A1F217E47E400381363 /* WifiSettingsPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WifiSettingsPanel.h; sourceTree = "<group>"; };
AB4B5A20217E47E400381363 /* WifiSettingsPanel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WifiSettingsPanel.mm; sourceTree = "<group>"; };
AB4C4C2A16F55C64002E07CD /* AAFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AAFilter.cpp; sourceTree = "<group>"; };
AB4C4C2B16F55C64002E07CD /* cpu_detect_x86_gcc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cpu_detect_x86_gcc.cpp; sourceTree = "<group>"; };
AB4C4C2C16F55C64002E07CD /* FIFOSampleBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FIFOSampleBuffer.cpp; sourceTree = "<group>"; };
@ -3132,6 +3139,7 @@
ABC3DEBB1A96EA96009EC345 /* RomInfoPanel.h */,
ABAE2F7918682B6C00C92F4F /* Slot2WindowDelegate.h */,
ABA0356E169127BB00817C69 /* troubleshootingWindowDelegate.h */,
AB4B5A1F217E47E400381363 /* WifiSettingsPanel.h */,
AB3ACB6714C2361100D7D192 /* appDelegate.mm */,
AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */,
AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */,
@ -3149,6 +3157,7 @@
ABC3DEBC1A96EA96009EC345 /* RomInfoPanel.mm */,
ABAE2F7A18682B6C00C92F4F /* Slot2WindowDelegate.mm */,
ABA0356F169127C000817C69 /* troubleshootingWindowDelegate.mm */,
AB4B5A20217E47E400381363 /* WifiSettingsPanel.mm */,
);
path = userinterface;
sourceTree = "<group>";
@ -4681,6 +4690,7 @@
ABD1266A20AE80DF00EFE1B2 /* MacBaseCaptureTool.mm in Sources */,
ABD1267720AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
ABD1267820AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
AB4B5A22217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -4874,6 +4884,7 @@
ABD1266C20AE80DF00EFE1B2 /* MacBaseCaptureTool.mm in Sources */,
ABD1267920AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
ABD1267A20AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
AB4B5A23217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -5097,6 +5108,7 @@
ABD1266820AE80DF00EFE1B2 /* MacBaseCaptureTool.mm in Sources */,
ABD1267520AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
ABD1267620AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
AB4B5A21217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -5320,6 +5332,7 @@
ABD1267020AE80DF00EFE1B2 /* MacBaseCaptureTool.mm in Sources */,
ABD1267D20AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
ABD1267E20AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
AB4B5A25217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -5513,6 +5526,7 @@
ABD1266E20AE80DF00EFE1B2 /* MacBaseCaptureTool.mm in Sources */,
ABD1267B20AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
ABD1267C20AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
AB4B5A24217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -742,6 +742,8 @@
<true/>
<key>Render3D_Multisample</key>
<false/>
<key>Render3D_MultisampleSize</key>
<integer>0</integer>
<key>Render3D_RenderingEngine</key>
<integer>1</integer>
<key>Render3D_Textures</key>
@ -828,5 +830,15 @@
<integer>0</integer>
<key>SPU_SyncMode</key>
<integer>1</integer>
<key>Wifi_EmulationMode</key>
<integer>0</integer>
<key>Wifi_AddressSelection</key>
<integer>0</integer>
<key>Wifi_BridgeDeviceSelectionIndex</key>
<integer>0</integer>
<key>Wifi_BridgeDeviceSelectionName</key>
<string></string>
<key>Wifi_MyMACAddress</key>
<integer>0</integer>
</dict>
</plist>

View File

@ -124,6 +124,8 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
{
UInt32 gpuStateFlags;
uint8_t _gpuScale;
NSUInteger openglDeviceMaxMultisamples;
NSString *render3DMultisampleSizeString;
BOOL isCPUCoreCountAuto;
BOOL _needRestoreRender3DLock;
@ -138,6 +140,8 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
@property (assign) NSUInteger gpuScale;
@property (assign) NSUInteger gpuColorFormat;
@property (readonly) NSUInteger openglDeviceMaxMultisamples;
@property (assign) BOOL layerMainGPU;
@property (assign) BOOL layerMainBG0;
@property (assign) BOOL layerMainBG1;
@ -159,6 +163,8 @@ typedef std::map<CGDirectDisplayID, int64_t> DisplayLinkFlushTimeLimitMap;
@property (assign) NSUInteger render3DThreads;
@property (assign) BOOL render3DLineHack;
@property (assign) BOOL render3DMultisample;
@property (assign) NSUInteger render3DMultisampleSize;
@property (retain) NSString *render3DMultisampleSizeString;
@property (assign) BOOL render3DTextureDeposterize;
@property (assign) BOOL render3DTextureSmoothing;
@property (assign) NSUInteger render3DTextureScalingFactor;

View File

@ -93,6 +93,8 @@ public:
@dynamic gpuScale;
@dynamic gpuColorFormat;
@synthesize openglDeviceMaxMultisamples;
@dynamic layerMainGPU;
@dynamic layerMainBG0;
@dynamic layerMainBG1;
@ -114,6 +116,8 @@ public:
@dynamic render3DThreads;
@dynamic render3DLineHack;
@dynamic render3DMultisample;
@dynamic render3DMultisampleSize;
@synthesize render3DMultisampleSizeString;
@dynamic render3DTextureDeposterize;
@dynamic render3DTextureSmoothing;
@dynamic render3DTextureScalingFactor;
@ -192,6 +196,27 @@ public:
GPU->SetWillAutoResolveToCustomBuffer(false);
#endif
openglDeviceMaxMultisamples = 0;
render3DMultisampleSizeString = @"Off";
bool isTempContextCreated = OSXOpenGLRendererInit();
if (isTempContextCreated)
{
OSXOpenGLRendererBegin();
GLint maxSamplesOGL = 0;
#if defined(GL_MAX_SAMPLES)
glGetIntegerv(GL_MAX_SAMPLES, &maxSamplesOGL);
#elif defined(GL_MAX_SAMPLES_EXT)
glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamplesOGL);
#endif
openglDeviceMaxMultisamples = maxSamplesOGL;
OSXOpenGLRendererEnd();
DestroyOpenGLRenderer();
}
return self;
}
@ -202,6 +227,8 @@ public:
delete fetchObject;
delete gpuEvent;
[self setRender3DMultisampleSizeString:nil];
[super dealloc];
}
@ -470,7 +497,7 @@ public:
CommonSettings.num_cores = numberCores;
if (renderingEngineID == RENDERID_SOFTRASTERIZER)
if (renderingEngineID == CORE3DLIST_SWRASTERIZE)
{
GPU->Set3DRendererByID(renderingEngineID);
}
@ -519,6 +546,115 @@ public:
return state;
}
- (void) setRender3DMultisampleSize:(NSUInteger)msaaSize
{
gpuEvent->ApplyRender3DSettingsLock();
const int currentMSAASize = CommonSettings.GFX3D_Renderer_MultisampleSize;
if (currentMSAASize != msaaSize)
{
switch (currentMSAASize)
{
case 0:
{
if (msaaSize == (currentMSAASize+1))
{
msaaSize = 2;
}
break;
}
case 2:
{
if (msaaSize == (currentMSAASize-1))
{
msaaSize = 0;
}
else if (msaaSize == (currentMSAASize+1))
{
msaaSize = 4;
}
break;
}
case 4:
{
if (msaaSize == (currentMSAASize-1))
{
msaaSize = 2;
}
else if (msaaSize == (currentMSAASize+1))
{
msaaSize = 8;
}
break;
}
case 8:
{
if (msaaSize == (currentMSAASize-1))
{
msaaSize = 4;
}
else if (msaaSize == (currentMSAASize+1))
{
msaaSize = 16;
}
break;
}
case 16:
{
if (msaaSize == (currentMSAASize-1))
{
msaaSize = 8;
}
else if (msaaSize == (currentMSAASize+1))
{
msaaSize = 32;
}
break;
}
case 32:
{
if (msaaSize == (currentMSAASize-1))
{
msaaSize = 16;
}
else if (msaaSize == (currentMSAASize+1))
{
msaaSize = 32;
}
break;
}
}
if (msaaSize > openglDeviceMaxMultisamples)
{
msaaSize = openglDeviceMaxMultisamples;
}
msaaSize = GetNearestPositivePOT(msaaSize);
CommonSettings.GFX3D_Renderer_MultisampleSize = msaaSize;
}
gpuEvent->ApplyRender3DSettingsUnlock();
NSString *newMsaaSizeString = (msaaSize == 0) ? @"Off" : [NSString stringWithFormat:@"%d", (int)msaaSize];
[self setRender3DMultisampleSizeString:newMsaaSizeString];
}
- (NSUInteger) render3DMultisampleSize
{
gpuEvent->ApplyRender3DSettingsLock();
const NSInteger msaaSize = (NSUInteger)CommonSettings.GFX3D_Renderer_MultisampleSize;
gpuEvent->ApplyRender3DSettingsUnlock();
return msaaSize;
}
- (void) setRender3DTextureDeposterize:(BOOL)state
{
gpuEvent->ApplyRender3DSettingsLock();
@ -1608,14 +1744,13 @@ CVReturn MacDisplayLinkCallback(CVDisplayLinkRef displayLink,
bool OSXOpenGLRendererInit()
{
static bool isContextAlreadyCreated = false;
if (!isContextAlreadyCreated)
bool isContextCreated = (OSXOpenGLRendererContext != NULL);
if (!isContextCreated)
{
isContextAlreadyCreated = CreateOpenGLRenderer();
isContextCreated = CreateOpenGLRenderer();
}
return true;
return isContextCreated;
}
bool OSXOpenGLRendererBegin()

View File

@ -115,8 +115,12 @@ typedef struct
@property (copy) NSURL *firmwareImageURL;
@property (copy) NSURL *slot1R4URL;
@property (assign) NSString *firmwareMACAddressSelectionString;
@property (readonly) pthread_rwlock_t *rwlockCoreExecute;
- (void) generateFirmwareMACAddress;
- (BOOL) isSlot1Ejected;
- (void) slot1Eject;

View File

@ -88,6 +88,7 @@ volatile bool execute = true;
@dynamic arm9ImageURL;
@dynamic arm7ImageURL;
@dynamic firmwareImageURL;
@dynamic firmwareMACAddressSelectionString;
@dynamic slot1R4URL;
@dynamic rwlockCoreExecute;
@ -129,7 +130,6 @@ volatile bool execute = true;
threadParam.cdsCore = self;
wifiHandler->SetUniqueMACValue((uint32_t)[[NSProcessInfo processInfo] processIdentifier]);
wifiHandler->SetEmulationLevel(WifiEmulationLevel_Off);
pthread_rwlock_init(&threadParam.rwlockOutputList, NULL);
@ -716,11 +716,40 @@ volatile bool execute = true;
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
}
- (void) setFirmwareMACAddressSelectionString:(NSString *)theString
{
// Do nothing. This is here for KVO-compliance only.
}
- (NSString *) firmwareMACAddressSelectionString
{
// TODO: Also handle the case of returning the correct MAC address of external firmware.
//return [NSString stringWithFormat:@"Firmware %@", [[self cdsFirmware] MACAddressString]];
return @"Firmware 00:09:BF:FF:FF:FF";
}
- (pthread_rwlock_t *) rwlockCoreExecute
{
return &threadParam.rwlockCoreExecute;
}
- (void) generateFirmwareMACAddress
{
const uint32_t macValue = (uint32_t)random() & 0x00FFFFFF;
uint8_t newMACAddress[6];
newMACAddress[0] = 0x00;
newMACAddress[1] = 0x09;
newMACAddress[2] = 0xBF;
newMACAddress[3] = (macValue >> 0) & 0x000000FF;
newMACAddress[4] = (macValue >> 8) & 0x000000FF;
newMACAddress[5] = (macValue >> 16) & 0x000000FF;
//[[self cdsFirmware] setMACAddress:newMACAddress];
[self setFirmwareMACAddressSelectionString:NULL];
}
- (BOOL) isSlot1Ejected
{
const BOOL isEjected = (nds.cardEjected) ? YES : NO;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 2013-2017 DeSmuME Team
Copyright (C) 2013-2018 DeSmuME Team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -77,6 +77,8 @@ class AudioSampleBlockGenerator;
NSTextField *ndsErrorStatusTextField;
NSView *exportRomSavePanelAccessoryView;
NSPopUpButton *openglMSAAPopUpButton;
BOOL isSaveStateEdited;
BOOL isWorking;
@ -155,6 +157,8 @@ class AudioSampleBlockGenerator;
@property (readonly) IBOutlet NSTextField *ndsErrorStatusTextField;
@property (readonly) IBOutlet NSView *exportRomSavePanelAccessoryView;
@property (readonly) IBOutlet NSPopUpButton *openglMSAAPopUpButton;
@property (readonly) NSImage *iconExecute;
@property (readonly) NSImage *iconPause;
@property (readonly) NSImage *iconSpeedNormal;
@ -237,6 +241,7 @@ class AudioSampleBlockGenerator;
- (IBAction) chooseSlot1R4Directory:(id)sender;
- (IBAction) slot1Eject:(id)sender;
- (IBAction) simulateEmulationCrash:(id)sender;
- (IBAction) generateFirmwareMACAddress:(id)sender;
- (IBAction) writeDefaults3DRenderingSettings:(id)sender;
- (IBAction) writeDefaultsEmulationSettings:(id)sender;
@ -301,6 +306,7 @@ class AudioSampleBlockGenerator;
- (void) updateAllWindowTitles;
- (void) updateDisplayPanelTitles;
- (void) appInit;
- (void) fillOpenGLMSAAMenu;
- (void) readUserDefaults;
- (void) writeUserDefaults;
- (void) restoreDisplayWindowStates;

View File

@ -71,6 +71,8 @@
@synthesize ndsErrorStatusTextField;
@synthesize exportRomSavePanelAccessoryView;
@synthesize openglMSAAPopUpButton;
@synthesize iconExecute;
@synthesize iconPause;
@synthesize iconSpeedNormal;
@ -235,6 +237,7 @@
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
[cdsCore setCdsFirmware:theFirmware];
[cdsCore setFirmwareMACAddressSelectionString:NULL];
[firmwarePanelController setContent:theFirmware];
[cdsFirmware release];
@ -927,6 +930,12 @@
[cdsCore setMasterExecute:NO];
}
- (IBAction) generateFirmwareMACAddress:(id)sender
{
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
[cdsCore generateFirmwareMACAddress];
}
- (IBAction) writeDefaults3DRenderingSettings:(id)sender
{
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
@ -941,7 +950,7 @@
[[NSUserDefaults standardUserDefaults] setBool:[[cdsCore cdsGPU] render3DTextures] forKey:@"Render3D_Textures"];
[[NSUserDefaults standardUserDefaults] setInteger:[[cdsCore cdsGPU] render3DThreads] forKey:@"Render3D_Threads"];
[[NSUserDefaults standardUserDefaults] setBool:[[cdsCore cdsGPU] render3DLineHack] forKey:@"Render3D_LineHack"];
[[NSUserDefaults standardUserDefaults] setBool:[[cdsCore cdsGPU] render3DMultisample] forKey:@"Render3D_Multisample"];
[[NSUserDefaults standardUserDefaults] setInteger:[[cdsCore cdsGPU] render3DMultisampleSize] forKey:@"Render3D_MultisampleSize"];
[[NSUserDefaults standardUserDefaults] setInteger:[[cdsCore cdsGPU] render3DTextureScalingFactor] forKey:@"Render3D_TextureScalingFactor"];
[[NSUserDefaults standardUserDefaults] setBool:[[cdsCore cdsGPU] render3DTextureDeposterize] forKey:@"Render3D_TextureDeposterize"];
[[NSUserDefaults standardUserDefaults] setBool:[[cdsCore cdsGPU] render3DTextureSmoothing] forKey:@"Render3D_TextureSmoothing"];
@ -955,7 +964,7 @@
- (IBAction) writeDefaultsEmulationSettings:(id)sender
{
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
NSDictionary *firmwareDict = [(CocoaDSFirmware *)[firmwarePanelController content] dataDictionary];
CocoaDSFirmware *writeFirmware = (CocoaDSFirmware *)[firmwarePanelController content];
// Force end of editing of any text fields.
[[(NSControl *)sender window] makeFirstResponder:nil];
@ -973,11 +982,11 @@
[[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagEmulateEnsata] forKey:@"Emulation_EmulateEnsata"];
[[NSUserDefaults standardUserDefaults] setBool:[cdsCore emuFlagDebugConsole] forKey:@"Emulation_UseDebugConsole"];
[[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Nickname"] forKey:@"FirmwareConfig_Nickname"];
[[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Message"] forKey:@"FirmwareConfig_Message"];
[[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"FavoriteColor"] forKey:@"FirmwareConfig_FavoriteColor"];
[[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Birthday"] forKey:@"FirmwareConfig_Birthday"];
[[NSUserDefaults standardUserDefaults] setObject:[firmwareDict valueForKey:@"Language"] forKey:@"FirmwareConfig_Language"];
[[NSUserDefaults standardUserDefaults] setObject:[writeFirmware nickname] forKey:@"FirmwareConfig_Nickname"];
[[NSUserDefaults standardUserDefaults] setObject:[writeFirmware message] forKey:@"FirmwareConfig_Message"];
[[NSUserDefaults standardUserDefaults] setInteger:[writeFirmware favoriteColor] forKey:@"FirmwareConfig_FavoriteColor"];
[[NSUserDefaults standardUserDefaults] setObject:[writeFirmware birthday] forKey:@"FirmwareConfig_Birthday"];
[[NSUserDefaults standardUserDefaults] setInteger:[writeFirmware language] forKey:@"FirmwareConfig_Language"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@ -2220,6 +2229,38 @@
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
[screenshotCaptureToolDelegate setSharedData:[[cdsCore cdsGPU] sharedData]];
[avCaptureToolDelegate setSharedData:[[cdsCore cdsGPU] sharedData]];
[self fillOpenGLMSAAMenu];
}
- (void) fillOpenGLMSAAMenu
{
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
NSUInteger maxSamples = [[cdsCore cdsGPU] openglDeviceMaxMultisamples];
size_t itemCount = 0;
while (maxSamples > 1)
{
itemCount++;
maxSamples >>= 1;
}
if (itemCount <= 0)
{
return;
}
int itemValue = 2;
for (size_t i = 0; i < itemCount; i++, itemValue<<=1)
{
NSString *itemTitle = [NSString stringWithFormat:@"%d", itemValue];
[openglMSAAPopUpButton addItemWithTitle:itemTitle];
NSMenuItem *menuItem = [openglMSAAPopUpButton itemAtIndex:i+1];
[menuItem setTag:itemValue];
}
[openglMSAAPopUpButton selectItemAtIndex:0];
}
- (void) readUserDefaults
@ -2260,7 +2301,7 @@
[[cdsCore cdsGPU] setRender3DFog:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_Fog"]];
[[cdsCore cdsGPU] setRender3DTextures:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_Textures"]];
[[cdsCore cdsGPU] setRender3DLineHack:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_LineHack"]];
[[cdsCore cdsGPU] setRender3DMultisample:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_Multisample"]];
[[cdsCore cdsGPU] setRender3DMultisampleSize:[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_MultisampleSize"]];
[[cdsCore cdsGPU] setRender3DTextureScalingFactor:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_TextureScalingFactor"]];
[[cdsCore cdsGPU] setRender3DTextureDeposterize:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_TextureDeposterize"]];
[[cdsCore cdsGPU] setRender3DTextureSmoothing:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_TextureSmoothing"]];

View File

@ -0,0 +1,68 @@
/*
Copyright (C) 2018 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#import <Cocoa/Cocoa.h>
class ClientExecutionControl;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
@interface WifiSettingsPanelDelegate : NSObject <NSWindowDelegate>
#else
@interface WifiSettingsPanelDelegate : NSObject
#endif
{
ClientExecutionControl *execControl;
uint32_t _myMACAddressValue;
NSString *_libpcapDeviceSelectionName;
NSInteger addressSelection;
NSPopUpButton *bridgeDevicePopUpButton;
NSString *firmwareMACAddressString;
NSString *myMACAddress1String;
NSString *myMACAddress2String;
NSString *myMACAddress3String;
NSString *myMACAddress4String;
NSString *currentSessionMACAddressString;
}
@property (assign) ClientExecutionControl *execControl;
@property (assign) NSInteger wifiEmulationMode;
@property (assign) NSInteger addressSelection;
@property (assign) NSInteger bridgeDeviceSelection;
@property (assign) NSString *firmwareMACAddressString;
@property (assign) NSString *myMACAddress1String;
@property (assign) NSString *myMACAddress2String;
@property (assign) NSString *myMACAddress3String;
@property (assign) NSString *myMACAddress4String;
@property (assign) NSString *currentSessionMACAddressString;
@property (readonly) IBOutlet NSPopUpButton *bridgeDevicePopUpButton;
- (void) updateMyMACAddressStringsWithValue:(uint32_t)value;
- (void) updateFirmwareMACAddressStringWithValue:(uint32_t)value;
- (void) fillLibpcapDeviceMenu;
- (void) generateRandomMyMACAddressSet;
- (IBAction) generateNewAddresses:(id)sender;
- (IBAction) writeDefaultsWifiSettings:(id)sender;
- (void) readUserDefaults;
@end

View File

@ -0,0 +1,279 @@
/*
Copyright (C) 2018 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string>
#include <vector>
#import "WifiSettingsPanel.h"
#include "../ClientExecutionControl.h"
#include "../../../wifi.h"
#undef BOOL
@implementation WifiSettingsPanelDelegate
@synthesize execControl;
@dynamic wifiEmulationMode;
@dynamic addressSelection;
@dynamic bridgeDeviceSelection;
@synthesize bridgeDevicePopUpButton;
@synthesize firmwareMACAddressString;
@synthesize myMACAddress1String;
@synthesize myMACAddress2String;
@synthesize myMACAddress3String;
@synthesize myMACAddress4String;
@synthesize currentSessionMACAddressString;
- (id)init
{
self = [super init];
if(self == nil)
{
return self;
}
execControl = NULL;
_myMACAddressValue = 0x00503412;
const uint8_t myMAC4 = (_myMACAddressValue >> 0) & 0x000000FF;
const uint8_t myMAC5 = (_myMACAddressValue >> 8) & 0x000000FF;
const uint8_t myMAC6 = (_myMACAddressValue >> 16) & 0x000000F0;
firmwareMACAddressString = @"Firmware 00:09:BF:FF:FF:FF";
currentSessionMACAddressString = @"00:09:BF:FF:FF:FF";
myMACAddress1String = [NSString stringWithFormat:@"My Address #1 00:09:BF:%02X:%02X:%02X", myMAC4, myMAC5, myMAC6 + 1];
myMACAddress2String = [NSString stringWithFormat:@"My Address #2 00:09:BF:%02X:%02X:%02X", myMAC4, myMAC5, myMAC6 + 2];
myMACAddress3String = [NSString stringWithFormat:@"My Address #3 00:09:BF:%02X:%02X:%02X", myMAC4, myMAC5, myMAC6 + 3];
myMACAddress4String = [NSString stringWithFormat:@"My Address #4 00:09:BF:%02X:%02X:%02X", myMAC4, myMAC5, myMAC6 + 4];
addressSelection = 0;
_libpcapDeviceSelectionName = @"";
return self;
}
- (void)dealloc
{
[super dealloc];
}
- (void) setWifiEmulationMode:(NSInteger)theMode
{
execControl->SetWifiEmulationMode((int)theMode);
}
- (NSInteger) wifiEmulationMode
{
if (execControl == NULL)
{
return WifiEmulationLevel_Off;
}
return (NSInteger)execControl->GetWifiEmulationMode();
}
- (void) setAddressSelection:(NSInteger)theSelection
{
if (theSelection == 0)
{
wifiHandler->SetFirmwareMACMode(FirmwareMACMode_ReadFromFirmware);
}
else if ( (theSelection >= 1) && (theSelection <= 4) )
{
const uint8_t myMAC4 = (_myMACAddressValue >> 0) & 0x000000FF;
const uint8_t myMAC5 = (_myMACAddressValue >> 8) & 0x000000FF;
const uint8_t myMAC6 = (_myMACAddressValue >> 16) & 0x000000F0;
wifiHandler->SetUserMACValues(myMAC4, myMAC5, myMAC6 + theSelection);
wifiHandler->SetFirmwareMACMode(FirmwareMACMode_Manual);
}
addressSelection = theSelection;
}
- (NSInteger) addressSelection
{
return addressSelection;
}
- (void) setBridgeDeviceSelection:(NSInteger)theSelection
{
_libpcapDeviceSelectionName = [bridgeDevicePopUpButton itemTitleAtIndex:theSelection];
execControl->SetWifiBridgeDeviceIndex((int)theSelection);
}
- (NSInteger) bridgeDeviceSelection
{
if (execControl == NULL)
{
return 0;
}
return execControl->GetWifiBridgeDeviceIndex();
}
- (void) updateMyMACAddressStringsWithValue:(uint32_t)value
{
const uint8_t myMAC4 = (value >> 0) & 0x000000FF;
const uint8_t myMAC5 = (value >> 8) & 0x000000FF;
const uint8_t myMAC6 = (value >> 16) & 0x000000F0;
[self setMyMACAddress1String:[NSString stringWithFormat:@"My Address #1 00:09:BF:%02X:%02X:%02X", myMAC4, myMAC5, myMAC6 + 1]];
[self setMyMACAddress2String:[NSString stringWithFormat:@"My Address #2 00:09:BF:%02X:%02X:%02X", myMAC4, myMAC5, myMAC6 + 2]];
[self setMyMACAddress3String:[NSString stringWithFormat:@"My Address #3 00:09:BF:%02X:%02X:%02X", myMAC4, myMAC5, myMAC6 + 3]];
[self setMyMACAddress4String:[NSString stringWithFormat:@"My Address #4 00:09:BF:%02X:%02X:%02X", myMAC4, myMAC5, myMAC6 + 4]];
}
- (void) updateFirmwareMACAddressStringWithValue:(uint32_t)value
{
const uint8_t fwMAC4 = (value >> 0) & 0x000000FF;
const uint8_t fwMAC5 = (value >> 8) & 0x000000FF;
const uint8_t fwMAC6 = (value >> 16) & 0x000000FF;
[self setFirmwareMACAddressString:[NSString stringWithFormat:@"Firmware 00:09:BF:%02X:%02X:%02X", fwMAC4, fwMAC5, fwMAC6]];
}
- (void) fillLibpcapDeviceMenu
{
std::vector<std::string> deviceList;
int deviceCount = wifiHandler->GetBridgeDeviceList(&deviceList);
if (deviceCount <= 0)
{
return;
}
[bridgeDevicePopUpButton removeAllItems];
for (int i = 0; i < deviceCount; i++)
{
NSString *itemTitle = [NSString stringWithCString:deviceList[i].c_str() encoding:NSUTF8StringEncoding];
[bridgeDevicePopUpButton addItemWithTitle:itemTitle];
NSMenuItem *menuItem = [bridgeDevicePopUpButton itemAtIndex:i];
[menuItem setTag:i];
}
if (deviceCount > 0)
{
[self setAddressSelection:0];
}
}
- (void) generateRandomMyMACAddressSet
{
_myMACAddressValue = (uint32_t)random() & 0x00FFFFFF;
[self updateMyMACAddressStringsWithValue:_myMACAddressValue];
const NSInteger currentAddressSelection = [self addressSelection];
if (currentAddressSelection != 0)
{
[self setAddressSelection:currentAddressSelection];
}
}
- (IBAction) generateNewAddresses:(id)sender
{
[self generateRandomMyMACAddressSet];
}
- (IBAction) writeDefaultsWifiSettings:(id)sender
{
[[NSUserDefaults standardUserDefaults] setInteger:[self wifiEmulationMode] forKey:@"Wifi_EmulationMode"];
[[NSUserDefaults standardUserDefaults] setInteger:[self addressSelection] forKey:@"Wifi_AddressSelection"];
[[NSUserDefaults standardUserDefaults] setInteger:[self bridgeDeviceSelection] forKey:@"Wifi_BridgeDeviceSelectionIndex"];
[[NSUserDefaults standardUserDefaults] setObject:_libpcapDeviceSelectionName forKey:@"Wifi_BridgeDeviceSelectionName"];
[[NSUserDefaults standardUserDefaults] setInteger:_myMACAddressValue forKey:@"Wifi_MyMACAddress"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (void) readUserDefaults
{
BOOL needUserDefaultSynchronize = NO;
// Set the user's MAC address set.
// This needs to happen first since the other properties will have a dependency on this.
uint32_t userDefaultMACAddressValue = 0;
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"Wifi_MyMACAddress"] != nil)
{
userDefaultMACAddressValue = (uint32_t)[[NSUserDefaults standardUserDefaults] integerForKey:@"Wifi_MyMACAddress"];
userDefaultMACAddressValue &= 0x00FFFFFF;
}
if (userDefaultMACAddressValue == 0)
{
// Generate a new random MAC address set if one does not exist.
do
{
userDefaultMACAddressValue = (uint32_t)random() & 0x00FFFFFF;
} while (userDefaultMACAddressValue == 0);
[[NSUserDefaults standardUserDefaults] setInteger:userDefaultMACAddressValue forKey:@"Wifi_MyMACAddress"];
needUserDefaultSynchronize = YES;
}
_myMACAddressValue = userDefaultMACAddressValue;
[self updateMyMACAddressStringsWithValue:_myMACAddressValue];
// Set the bridge device selection.
NSInteger userDefaultDeviceIndex = [[NSUserDefaults standardUserDefaults] integerForKey:@"Wifi_BridgeDeviceSelectionIndex"];
NSString *userDefaultDeviceName = [[NSUserDefaults standardUserDefaults] stringForKey:@"Wifi_BridgeDeviceSelectionName"];
NSString *selectedName = [bridgeDevicePopUpButton itemTitleAtIndex:userDefaultDeviceIndex];
// Check to see if the selected device name matches what we've got in user defaults.
// If the user's hardware configuration hasn't changed in between app runs, then we
// should get a match. But if we don't get a match, then we can't be sure if the
// user's hardware configuration is the same. In the case of a mismatch, just revert
// to using en0.
if ( (userDefaultDeviceName == nil) || [userDefaultDeviceName isEqualToString:@""] || ![userDefaultDeviceName isEqualToString:selectedName])
{
userDefaultDeviceIndex = [bridgeDevicePopUpButton indexOfItemWithTitle:@"en0"];
// en0 SHOULD be found, as all Macs since ye olden times have come equipped with
// at least one Ethernet port. If we can't find a device with name "en0", then as
// a last resort, just pick the first device in the list.
if (userDefaultDeviceIndex == -1)
{
userDefaultDeviceIndex = 0;
}
userDefaultDeviceName = [bridgeDevicePopUpButton itemTitleAtIndex:userDefaultDeviceIndex];
[[NSUserDefaults standardUserDefaults] setInteger:userDefaultDeviceIndex forKey:@"Wifi_BridgeDeviceSelectionIndex"];
[[NSUserDefaults standardUserDefaults] setObject:userDefaultDeviceName forKey:@"Wifi_BridgeDeviceSelectionName"];
needUserDefaultSynchronize = YES;
}
[self setBridgeDeviceSelection:userDefaultDeviceIndex];
// Set the remaining user defaults.
[self setWifiEmulationMode:[[NSUserDefaults standardUserDefaults] integerForKey:@"Wifi_EmulationMode"]];
[self setAddressSelection:[[NSUserDefaults standardUserDefaults] integerForKey:@"Wifi_AddressSelection"]];
// If we wrote to user defaults beforehand, then synchronize the write as the final operation here.
if (needUserDefaultSynchronize)
{
[[NSUserDefaults standardUserDefaults] synchronize];
}
}
@end

View File

@ -1,6 +1,6 @@
/*
Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2014 DeSmuME Team
Copyright (C) 2012-2018 DeSmuME Team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -74,6 +74,8 @@ class OGLImage;
NSMenuItem *displayRotationMenuCustomItem;
NSTextField *displayRotationField;
NSPopUpButton *openglMSAAPopUpButton;
NSImage *iconVolumeFull;
NSImage *iconVolumeTwoThird;
NSImage *iconVolumeOneThird;
@ -110,6 +112,8 @@ class OGLImage;
@property (readonly) IBOutlet NSTextField *displayRotationField;
@property (readonly) IBOutlet NSPopUpButton *spuSyncMethodMenu;
@property (readonly) IBOutlet NSPopUpButton *openglMSAAPopUpButton;
@property (readonly) IBOutlet DisplayPreviewView *previewView;
@property (readonly) NSMutableDictionary *bindings;
@ -146,6 +150,7 @@ class OGLImage;
- (void) didEndFirmwareConfigSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
- (void) switchContentView:(NSView *)theView;
- (void) markUnsupportedOpenGLMSAAMenuItems;
- (void) setupUserDefaults;
@end

View File

@ -1,6 +1,6 @@
/*
Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2017 DeSmuME Team
Copyright (C) 2012-2018 DeSmuME Team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -20,6 +20,7 @@
#import "EmuControllerDelegate.h"
#import "cocoa_core.h"
#import "cocoa_GPU.h"
#import "cocoa_cheat.h"
#import "cocoa_globals.h"
#import "cocoa_input.h"
@ -303,6 +304,8 @@
@synthesize displayRotationField;
@synthesize spuSyncMethodMenu;
@synthesize openglMSAAPopUpButton;
@synthesize previewView;
@synthesize bindings;
@ -900,6 +903,34 @@
[tempView release];
}
- (void) markUnsupportedOpenGLMSAAMenuItems
{
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
NSUInteger maxSamples = [[cdsCore cdsGPU] openglDeviceMaxMultisamples];
size_t itemCount = [openglMSAAPopUpButton numberOfItems];
BOOL needAddUnsupportedSeparator = YES;
for (size_t i = 0; i < itemCount; i++)
{
NSMenuItem *menuItem = [openglMSAAPopUpButton itemAtIndex:i];
if ([menuItem tag] > maxSamples)
{
if (needAddUnsupportedSeparator)
{
NSMenuItem *newSeparatorItem = [NSMenuItem separatorItem];
[newSeparatorItem setTag:-1];
[[openglMSAAPopUpButton menu] insertItem:newSeparatorItem atIndex:i];
needAddUnsupportedSeparator = NO;
itemCount++;
continue;
}
[menuItem setTitle:[NSString stringWithFormat:@"%@ (unsupported on this GPU)", [menuItem title]]];
}
}
}
- (void) setupUserDefaults
{
// Update input preferences.

View File

@ -133,7 +133,7 @@
case CORE3DLIST_OPENGL:
render3DEngineDetails = [NSString stringWithFormat:@"%@ (MSAA=%@, SmoothTextures=%@)",
[[cdsCore cdsGPU] render3DRenderingEngineString],
[[cdsCore cdsGPU] render3DMultisample] ? @"YES" : @"NO",
([[cdsCore cdsGPU] render3DMultisampleSize] == 0) ? @"Off" : [NSString stringWithFormat:@"%ld", (unsigned long)[[cdsCore cdsGPU] render3DMultisampleSize]],
[[cdsCore cdsGPU] render3DTextureSmoothing] ? @"YES" : @"NO"];
break;