mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-27 08:15:33 +01:00
osx buildfix, add resolutions to ogl dialog
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5363 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
ba89d91872
commit
0dc924efef
@ -95,6 +95,10 @@ GFXDebuggerOGL *m_DebuggerFrame = NULL;
|
|||||||
|
|
||||||
#include "VideoState.h"
|
#include "VideoState.h"
|
||||||
|
|
||||||
|
#if defined(HAVE_COCOA) && HAVE_COCOA
|
||||||
|
#include <Cocoa/Cocoa.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
SVideoInitialize g_VideoInitialize;
|
SVideoInitialize g_VideoInitialize;
|
||||||
PLUGIN_GLOBALS* globals = NULL;
|
PLUGIN_GLOBALS* globals = NULL;
|
||||||
|
|
||||||
@ -166,47 +170,34 @@ void DllDebugger(HWND _hParent, bool Show)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
// Search for avaliable resolutions
|
||||||
void AddResolutions()
|
void AddResolutions()
|
||||||
{
|
{
|
||||||
// Search for avaliable resolutions
|
#ifdef _WIN32
|
||||||
|
|
||||||
DWORD iModeNum = 0;
|
DWORD iModeNum = 0;
|
||||||
DEVMODE dmi;
|
DEVMODE dmi;
|
||||||
ZeroMemory(&dmi, sizeof(dmi));
|
ZeroMemory(&dmi, sizeof(dmi));
|
||||||
dmi.dmSize = sizeof(dmi);
|
dmi.dmSize = sizeof(dmi);
|
||||||
std::vector<std::string> resos;
|
std::vector<std::string> resos;
|
||||||
resos.reserve(20);
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
|
while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
|
||||||
{
|
{
|
||||||
char szBuffer[100];
|
char res[100];
|
||||||
sprintf(szBuffer, "%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
|
sprintf(res, "%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
|
||||||
std::string strBuffer(szBuffer);
|
std::string strRes(res);
|
||||||
// Create a check loop to check every pointer of resolutions to see if
|
// Only add unique resolutions
|
||||||
// the res is added or not
|
if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
|
||||||
int b = 0;
|
|
||||||
bool resFound = false;
|
|
||||||
while (b < i && !resFound)
|
|
||||||
{
|
{
|
||||||
// Is the res already added?
|
resos.push_back(strRes);
|
||||||
resFound = (resos[b] == strBuffer);
|
m_ConfigFrame->AddFSReso(res);
|
||||||
b++;
|
|
||||||
}
|
|
||||||
// Add the resolution
|
|
||||||
if (!resFound && i < 100) // don't want to overflow resos array. not
|
|
||||||
// likely to happen, but you never know.
|
|
||||||
{
|
|
||||||
resos.push_back(strBuffer);
|
|
||||||
i++;
|
|
||||||
m_ConfigFrame->AddFSReso(szBuffer);
|
|
||||||
}
|
}
|
||||||
ZeroMemory(&dmi, sizeof(dmi));
|
ZeroMemory(&dmi, sizeof(dmi));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XRANDR) && HAVE_XRANDR
|
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XRANDR) \
|
||||||
void AddResolutions() {
|
&& HAVE_XRANDR && defined(HAVE_WX) && HAVE_WX
|
||||||
|
|
||||||
// Don't modify GLWin.dpy here.
|
// Don't modify GLWin.dpy here.
|
||||||
// If the emulator is running that is bad.
|
// If the emulator is running that is bad.
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
@ -225,53 +216,41 @@ void AddResolutions() {
|
|||||||
{
|
{
|
||||||
char temp[32];
|
char temp[32];
|
||||||
sprintf(temp,"%dx%d", sizes[i].width, sizes[i].height);
|
sprintf(temp,"%dx%d", sizes[i].width, sizes[i].height);
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
|
||||||
m_ConfigFrame->AddFSReso(temp);
|
m_ConfigFrame->AddFSReso(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(HAVE_COCOA) && HAVE_COCOA && defined(HAVE_WX) && HAVE_WX
|
||||||
|
|
||||||
|
CGDisplayModeRef mode;
|
||||||
|
CFArrayRef array;
|
||||||
|
CFIndex n, i;
|
||||||
|
int w, h;
|
||||||
|
std::vector<std::string> resos;
|
||||||
|
|
||||||
|
array = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), NULL);
|
||||||
|
n = CFArrayGetCount(array);
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(array, i);
|
||||||
|
w = CGDisplayModeGetWidth(mode);
|
||||||
|
h = CGDisplayModeGetHeight(mode);
|
||||||
|
|
||||||
|
char res[32];
|
||||||
|
sprintf(res,"%dx%d", w, h);
|
||||||
|
std::string strRes(res);
|
||||||
|
// Only add unique resolutions
|
||||||
|
if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
|
||||||
|
{
|
||||||
|
resos.push_back(strRes);
|
||||||
|
m_ConfigFrame->AddFSReso(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CFRelease(array);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
|
||||||
void AddResolutions() {
|
|
||||||
|
|
||||||
CFArrayRef modes;
|
|
||||||
CFRange range;
|
|
||||||
CFDictionaryRef modesDict;
|
|
||||||
CFNumberRef modeValue;
|
|
||||||
|
|
||||||
int modeWidth;
|
|
||||||
int modeHeight;
|
|
||||||
int modeBpp;
|
|
||||||
int modeIndex;
|
|
||||||
int px = 0, py = 0;
|
|
||||||
|
|
||||||
modes = CGDisplayAvailableModes(CGMainDisplayID());
|
|
||||||
|
|
||||||
range.location = 0;
|
|
||||||
range.length = CFArrayGetCount(modes);
|
|
||||||
|
|
||||||
for (modeIndex=0; modeIndex<range.length; modeIndex++) {
|
|
||||||
modesDict = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, modeIndex);
|
|
||||||
modeValue = (CFNumberRef) CFDictionaryGetValue(modesDict, kCGDisplayWidth);
|
|
||||||
CFNumberGetValue(modeValue, kCFNumberLongType, &modeWidth);
|
|
||||||
modeValue = (CFNumberRef) CFDictionaryGetValue(modesDict, kCGDisplayHeight);
|
|
||||||
CFNumberGetValue(modeValue, kCFNumberLongType, &modeHeight);
|
|
||||||
modeValue = (CFNumberRef) CFDictionaryGetValue(modesDict, kCGDisplayBitsPerPixel);
|
|
||||||
CFNumberGetValue(modeValue, kCFNumberLongType, &modeBpp);
|
|
||||||
|
|
||||||
if (px != modeWidth && py != modeHeight) {
|
|
||||||
char temp[32];
|
|
||||||
sprintf(temp,"%dx%d", modeWidth, modeHeight);
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
|
||||||
m_ConfigFrame->AddFSReso(temp);
|
|
||||||
#endif
|
|
||||||
px = modeWidth;
|
|
||||||
py = modeHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DllConfig(HWND _hParent)
|
void DllConfig(HWND _hParent)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user