Allow changing the fullscreen resolution on OS X.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7011 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
0e91e5b238
commit
e0e4a3ae02
|
@ -8,6 +8,7 @@ def createVersion(env, target, source):
|
|||
from SconsTests import utils
|
||||
utils.GenerateRevFile(env['flavor'], source[0].path, target[0].path)
|
||||
|
||||
Execute(Delete('svnrev.h'))
|
||||
env.Command('svnrev.h', 'svnrev_template.h',
|
||||
[Delete('${TARGET.srcpath}'), createVersion])
|
||||
|
||||
|
|
|
@ -1377,43 +1377,33 @@ void CConfigMain::AddResolutions()
|
|||
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
main_frame->m_XRRConfig->AddResolutions(arrayStringFor_FullscreenResolution);
|
||||
#elif defined(__APPLE__)
|
||||
CFDictionaryRef mode;
|
||||
CFArrayRef array;
|
||||
CFIndex n, i;
|
||||
int w, h;
|
||||
std::vector<std::string> resos;
|
||||
|
||||
array = CGDisplayAvailableModes(CGMainDisplayID());
|
||||
n = CFArrayGetCount(array);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
CFArrayRef modes = CGDisplayAvailableModes(CGMainDisplayID());
|
||||
for (CFIndex i = 0; i < CFArrayGetCount(modes); i++)
|
||||
{
|
||||
mode = (CFDictionaryRef)CFArrayGetValueAtIndex(array, i);
|
||||
|
||||
CFNumberRef anWidth = (CFNumberRef)CFDictionaryGetValue(mode,
|
||||
kCGDisplayWidth);
|
||||
if (NULL == anWidth ||
|
||||
!CFNumberGetValue(anWidth, kCFNumberIntType, &w))
|
||||
std::stringstream res;
|
||||
CFDictionaryRef mode;
|
||||
CFNumberRef ref;
|
||||
int w, h, d;
|
||||
|
||||
mode = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, i);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayWidth);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &w);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayHeight);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &h);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode,
|
||||
kCGDisplayBitsPerPixel);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &d);
|
||||
|
||||
if (CFDictionaryContainsKey(mode, kCGDisplayModeIsInterlaced))
|
||||
continue;
|
||||
if (CFDictionaryContainsKey(mode, kCGDisplayModeIsStretched))
|
||||
continue;
|
||||
if (d != 32)
|
||||
continue;
|
||||
|
||||
CFNumberRef anHeight =
|
||||
(CFNumberRef)CFDictionaryGetValue(mode,
|
||||
kCGDisplayHeight);
|
||||
if (NULL == anHeight ||
|
||||
!CFNumberGetValue(anHeight, kCFNumberIntType, &h))
|
||||
continue;
|
||||
|
||||
char res[32];
|
||||
sprintf(res,"%dx%d", w, h);
|
||||
std::string strRes(res);
|
||||
res << w << "x" << h;
|
||||
|
||||
// Only add unique resolutions
|
||||
if (std::find(resos.begin(), resos.end(), strRes) ==
|
||||
resos.end())
|
||||
{
|
||||
resos.push_back(strRes);
|
||||
arrayStringFor_FullscreenResolution.Add(strRes);
|
||||
}
|
||||
arrayStringFor_FullscreenResolution.Add(res.str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -37,6 +37,10 @@ Core::GetWindowHandle().
|
|||
#include "Timer.h"
|
||||
#include "VideoBackendBase.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
#include "Globals.h" // Local
|
||||
#include "Frame.h"
|
||||
#include "ConfigMain.h"
|
||||
|
@ -768,6 +772,34 @@ void CFrame::ToggleDisplayMode(bool bFullscreen)
|
|||
}
|
||||
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
m_XRRConfig->ToggleDisplayMode(bFullscreen);
|
||||
#elif defined __APPLE__
|
||||
CFArrayRef modes = CGDisplayAvailableModes(CGMainDisplayID());
|
||||
for (CFIndex i = 0; i < CFArrayGetCount(modes); i++)
|
||||
{
|
||||
CFDictionaryRef mode;
|
||||
CFNumberRef ref;
|
||||
int x, y, w, h, d;
|
||||
|
||||
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.\
|
||||
strFullscreenResolution.c_str(), "%dx%d", &x, &y);
|
||||
|
||||
mode = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, i);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayWidth);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &w);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayHeight);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &h);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode,
|
||||
kCGDisplayBitsPerPixel);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &d);
|
||||
|
||||
if (w != x || h != y || d != 32)
|
||||
continue;;
|
||||
|
||||
if (bFullscreen)
|
||||
CGDisplaySwitchToMode(CGMainDisplayID(), mode);
|
||||
else
|
||||
CGRestorePermanentDisplayConfiguration();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,8 @@ import sys
|
|||
from SconsTests import utils
|
||||
|
||||
files = ['BootManager.cpp']
|
||||
|
||||
ldflags = [ ]
|
||||
|
||||
libs = [ ]
|
||||
ldflags = []
|
||||
libs = []
|
||||
|
||||
if not env['HAVE_WX']:
|
||||
files += ['MainNoGUI.cpp']
|
||||
|
@ -51,11 +49,11 @@ else:
|
|||
|
||||
libs += ['debwx', 'debugger_ui_util', 'dolphinwx']
|
||||
|
||||
libs += ['core', 'discio', 'plugin_videoogl'] # 'plugin_videosoftware'
|
||||
libs += ['core', 'common', 'discio', 'plugin_videoogl'] # 'plugin_videosoftware'
|
||||
if env['HAVE_WX']:
|
||||
libs += ['videouicommon']
|
||||
libs += ['audiocommon', 'common', 'inputcommon', 'videocommon']
|
||||
libs += ['GLEW', 'SOIL', 'bdisasm', 'lua', 'lzo2', 'sfml-network', 'z']
|
||||
libs += ['audiocommon', 'inputcommon', 'videocommon']
|
||||
libs += ['GLEW', 'SOIL', 'bdisasm', 'lua', 'lzo2', 'sfml-network', 'z']
|
||||
|
||||
if sys.platform == 'win32':
|
||||
files += [ "stdafx.cpp" ]
|
||||
|
@ -71,7 +69,6 @@ elif sys.platform == 'darwin':
|
|||
libs += [ 'iconv' ]
|
||||
exe += 'NoGUI'
|
||||
|
||||
|
||||
env.Install('#' + env['prefix'] + '/Dolphin.app/Contents/' +
|
||||
'Frameworks/Cg.framework', source = [
|
||||
'#Externals/Cg/Cg.framework/Cg',
|
||||
|
|
Loading…
Reference in New Issue