mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Big restructuring of how the video plugin works. In linux and windows you shouldn't see a change in the functionality; however, there are changes in how render to main or not, and fullscreen modes, and such are handled. Input is largely restructured for the video plugin. It is now handled by the host. Keys for pausing and changing fullscreen are configurable. More will probably be later. This is probably classified as highly experimental.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5336 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -77,7 +77,7 @@ u32 OpenGL_GetBackbufferHeight()
|
||||
void OpenGL_SetWindowText(const char *text)
|
||||
{
|
||||
#if defined(USE_WX) && USE_WX
|
||||
GLWin.frame->SetTitle(wxString::FromAscii(text));
|
||||
// GLWin.frame->SetTitle(wxString::FromAscii(text));
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
cocoaGLSetTitle(GLWin.cocoaWin, text);
|
||||
#elif defined(_WIN32)
|
||||
@ -120,143 +120,105 @@ void UpdateFPSDisplay(const char *text)
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
THREAD_RETURN XEventThread(void *pArg);
|
||||
|
||||
void X11_EWMH_Fullscreen(int action)
|
||||
{
|
||||
_assert_(action == _NET_WM_STATE_REMOVE || action == _NET_WM_STATE_ADD
|
||||
|| action == _NET_WM_STATE_TOGGLE);
|
||||
|
||||
// Init X event structure for _NET_WM_STATE_FULLSCREEN client message
|
||||
XEvent event;
|
||||
event.xclient.type = ClientMessage;
|
||||
event.xclient.message_type = XInternAtom(GLWin.dpy, "_NET_WM_STATE", False);
|
||||
event.xclient.window = GLWin.win;
|
||||
event.xclient.format = 32;
|
||||
event.xclient.data.l[0] = action;
|
||||
event.xclient.data.l[1] = XInternAtom(GLWin.dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
||||
|
||||
// Send the event
|
||||
if (!XSendEvent(GLWin.dpy, DefaultRootWindow(GLWin.dpy), False,
|
||||
SubstructureRedirectMask | SubstructureNotifyMask, &event))
|
||||
ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode.\n");
|
||||
}
|
||||
|
||||
void CreateXWindow (void)
|
||||
{
|
||||
Atom wmProtocols[3];
|
||||
Window parent;
|
||||
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
wxMutexGuiEnter();
|
||||
#endif
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
if (GLWin.fs && !GLWin.renderToMain)
|
||||
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, RootWindow(GLWin.dpy, GLWin.screen),
|
||||
GLWin.fullSize, GLWin.screenRotation, CurrentTime);
|
||||
#endif
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
if (GLWin.renderToMain)
|
||||
{
|
||||
GLWin.panel->GetSize((int *)&GLWin.width, (int *)&GLWin.height);
|
||||
GLWin.panel->GetPosition(&GLWin.x, &GLWin.y);
|
||||
parent = GDK_WINDOW_XID(GTK_WIDGET(GLWin.panel->GetHandle())->window);
|
||||
GLWin.panel->SetFocus();
|
||||
// Get the resolution setings for fullscreen mode
|
||||
int fullWidth, fullHeight;
|
||||
sscanf(g_Config.cFSResolution, "%dx%d", &fullWidth, &fullHeight);
|
||||
|
||||
int vidModeMajorVersion, vidModeMinorVersion;
|
||||
XRRScreenSize *sizes;
|
||||
int numSizes;
|
||||
|
||||
XRRQueryVersion(GLWin.dpy, &vidModeMajorVersion, &vidModeMinorVersion);
|
||||
NOTICE_LOG(VIDEO, "XRRExtension-Version %d.%d", vidModeMajorVersion, vidModeMinorVersion);
|
||||
|
||||
GLWin.screenConfig = XRRGetScreenInfo(GLWin.dpy, GLWin.parent);
|
||||
|
||||
/* save desktop resolution */
|
||||
GLWin.deskSize = XRRConfigCurrentConfiguration(GLWin.screenConfig, &GLWin.screenRotation);
|
||||
/* Set the desktop resolution as the default */
|
||||
GLWin.fullSize = GLWin.deskSize;
|
||||
|
||||
/* Find the index of the fullscreen resolution from config */
|
||||
sizes = XRRConfigSizes(GLWin.screenConfig, &numSizes);
|
||||
if (numSizes > 0 && sizes != NULL) {
|
||||
for (int i = 0; i < numSizes; i++) {
|
||||
if ((sizes[i].width == fullWidth) && (sizes[i].height == fullHeight)) {
|
||||
GLWin.fullSize = i;
|
||||
}
|
||||
}
|
||||
NOTICE_LOG(VIDEO, "Fullscreen Resolution %dx%d", sizes[GLWin.fullSize].width, sizes[GLWin.fullSize].height);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
GLWin.x = 0;
|
||||
GLWin.y = 0;
|
||||
GLWin.width = GLWin.winWidth;
|
||||
GLWin.height = GLWin.winHeight;
|
||||
parent = RootWindow(GLWin.dpy, GLWin.vi->screen);
|
||||
else {
|
||||
ERROR_LOG(VIDEO, "Failed to obtain fullscreen sizes.\n"
|
||||
"Using current desktop resolution for fullscreen.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
Atom wmProtocols[1];
|
||||
|
||||
g_VideoInitialize.pRequestWindowSize(GLWin.x, GLWin.y, (int&)GLWin.width, (int&)GLWin.height);
|
||||
|
||||
// Control window size and picture scaling
|
||||
s_backbuffer_width = GLWin.width;
|
||||
s_backbuffer_height = GLWin.height;
|
||||
|
||||
// create the window
|
||||
GLWin.win = XCreateWindow(GLWin.dpy, parent,
|
||||
// Setup window attributes
|
||||
GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
|
||||
GLWin.parent, GLWin.vi->visual, AllocNone);
|
||||
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
StructureNotifyMask | ResizeRedirectMask;
|
||||
GLWin.attr.background_pixel = BlackPixel(GLWin.dpy, GLWin.screen);
|
||||
GLWin.attr.border_pixel = 0;
|
||||
|
||||
// Create the window
|
||||
GLWin.win = XCreateWindow(GLWin.dpy, GLWin.parent,
|
||||
GLWin.x, GLWin.y, GLWin.width, GLWin.height, 0, GLWin.vi->depth, InputOutput, GLWin.vi->visual,
|
||||
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
|
||||
wmProtocols[0] = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True);
|
||||
wmProtocols[1] = XInternAtom(GLWin.dpy, "_NET_WM_STATE", False);
|
||||
wmProtocols[2] = XInternAtom(GLWin.dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
||||
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 3);
|
||||
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 1);
|
||||
XSetStandardProperties(GLWin.dpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
|
||||
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask );
|
||||
XMapRaised(GLWin.dpy, GLWin.win);
|
||||
XSync(GLWin.dpy, True);
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
wxMutexGuiLeave();
|
||||
#endif
|
||||
|
||||
if (g_Config.bHideCursor)
|
||||
{
|
||||
// make a blank cursor
|
||||
Pixmap Blank;
|
||||
XColor DummyColor;
|
||||
char ZeroData[1] = {0};
|
||||
Blank = XCreateBitmapFromData (GLWin.dpy, GLWin.win, ZeroData, 1, 1);
|
||||
GLWin.blankCursor = XCreatePixmapCursor(GLWin.dpy, Blank, Blank, &DummyColor, &DummyColor, 0, 0);
|
||||
XFreePixmap (GLWin.dpy, Blank);
|
||||
}
|
||||
|
||||
GLWin.xEventThread = new Common::Thread(XEventThread, NULL);
|
||||
}
|
||||
|
||||
void DestroyXWindow(void)
|
||||
void ToggleDisplayMode (bool bFullscreen)
|
||||
{
|
||||
if( GLWin.ctx )
|
||||
{
|
||||
if( !glXMakeCurrent(GLWin.dpy, None, NULL))
|
||||
{
|
||||
printf("Could not release drawing context.\n");
|
||||
}
|
||||
}
|
||||
/* switch back to original desktop resolution if we were in fullscreen */
|
||||
if( GLWin.fs )
|
||||
{
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, RootWindow(GLWin.dpy, GLWin.screen),
|
||||
GLWin.deskSize, GLWin.screenRotation, CurrentTime);
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
if (!GLWin.renderToMain)
|
||||
#endif
|
||||
X11_EWMH_Fullscreen(_NET_WM_STATE_REMOVE);
|
||||
#endif
|
||||
}
|
||||
XUndefineCursor(GLWin.dpy, GLWin.win);
|
||||
XUnmapWindow(GLWin.dpy, GLWin.win);
|
||||
GLWin.win = 0;
|
||||
}
|
||||
|
||||
void ToggleFullscreenMode (void)
|
||||
{
|
||||
GLWin.fs = !GLWin.fs;
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
if (GLWin.fs)
|
||||
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, RootWindow(GLWin.dpy, GLWin.screen),
|
||||
if (bFullscreen)
|
||||
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, GLWin.parent,
|
||||
GLWin.fullSize, GLWin.screenRotation, CurrentTime);
|
||||
else
|
||||
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, RootWindow(GLWin.dpy, GLWin.screen),
|
||||
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, GLWin.parent,
|
||||
GLWin.deskSize, GLWin.screenRotation, CurrentTime);
|
||||
#endif
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
if (!GLWin.renderToMain)
|
||||
}
|
||||
|
||||
void DestroyXWindow(void)
|
||||
{
|
||||
/* switch back to original desktop resolution if we were in fullscreen */
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
ToggleDisplayMode(False);
|
||||
#endif
|
||||
XUnmapWindow(GLWin.dpy, GLWin.win);
|
||||
GLWin.win = 0;
|
||||
XFreeColormap(GLWin.dpy, GLWin.attr.colormap);
|
||||
if (GLWin.xEventThread)
|
||||
GLWin.xEventThread->WaitForDeath();
|
||||
GLWin.xEventThread = NULL;
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
XRRFreeScreenConfigInfo(GLWin.screenConfig);
|
||||
#endif
|
||||
{
|
||||
X11_EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
|
||||
XRaiseWindow(GLWin.dpy, GLWin.win);
|
||||
XSetInputFocus(GLWin.dpy, GLWin.win, RevertToPointerRoot, CurrentTime);
|
||||
}
|
||||
XSync(GLWin.dpy, False);
|
||||
}
|
||||
|
||||
THREAD_RETURN XEventThread(void *pArg)
|
||||
{
|
||||
bool bPaused = False;
|
||||
while (GLWin.win)
|
||||
{
|
||||
XEvent event;
|
||||
@ -268,31 +230,17 @@ THREAD_RETURN XEventThread(void *pArg)
|
||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
switch (key)
|
||||
{
|
||||
case XK_F1: case XK_F2: case XK_F3: case XK_F4: case XK_F5: case XK_F6:
|
||||
case XK_F7: case XK_F8: case XK_F9: case XK_F11: case XK_F12:
|
||||
g_VideoInitialize.pKeyPress(key - 0xff4e,
|
||||
event.xkey.state & ShiftMask,
|
||||
event.xkey.state & ControlMask);
|
||||
break;
|
||||
case XK_Escape:
|
||||
if (GLWin.fs && !bPaused)
|
||||
{
|
||||
printf("toggling fullscreen\n");
|
||||
ToggleFullscreenMode();
|
||||
}
|
||||
g_VideoInitialize.pKeyPress(0x1c, False, False);
|
||||
break;
|
||||
case XK_Return:
|
||||
if (event.xkey.state & Mod1Mask)
|
||||
ToggleFullscreenMode();
|
||||
break;
|
||||
case XK_3:
|
||||
OSDChoice = 1;
|
||||
// Toggle native resolution
|
||||
if (!(g_Config.bNativeResolution || g_Config.b2xResolution))
|
||||
g_Config.bNativeResolution = true;
|
||||
else if (g_Config.bNativeResolution && Renderer::AllowCustom())
|
||||
{ g_Config.bNativeResolution = false; if (Renderer::Allow2x()) {g_Config.b2xResolution = true;} }
|
||||
{
|
||||
g_Config.bNativeResolution = false;
|
||||
if (Renderer::Allow2x())
|
||||
g_Config.b2xResolution = true;
|
||||
}
|
||||
else if (Renderer::AllowCustom())
|
||||
g_Config.b2xResolution = false;
|
||||
break;
|
||||
@ -326,64 +274,22 @@ THREAD_RETURN XEventThread(void *pArg)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FocusIn:
|
||||
if (g_Config.bHideCursor && !bPaused && !GLWin.renderToMain)
|
||||
XDefineCursor(GLWin.dpy, GLWin.win, GLWin.blankCursor);
|
||||
break;
|
||||
case FocusOut:
|
||||
if (g_Config.bHideCursor && !bPaused && !GLWin.renderToMain)
|
||||
XUndefineCursor(GLWin.dpy, GLWin.win);
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
Window winDummy;
|
||||
unsigned int borderDummy;
|
||||
unsigned int borderDummy, depthDummy;
|
||||
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
|
||||
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
|
||||
&GLWin.width, &GLWin.height, &borderDummy, &depthDummy);
|
||||
s_backbuffer_width = GLWin.width;
|
||||
s_backbuffer_height = GLWin.height;
|
||||
// Save windowed mode size for return from fullscreen
|
||||
if (!GLWin.fs)
|
||||
{
|
||||
GLWin.winWidth = GLWin.width;
|
||||
GLWin.winHeight = GLWin.height;
|
||||
}
|
||||
break;
|
||||
case ClientMessage:
|
||||
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", False))
|
||||
g_VideoInitialize.pKeyPress(0x1b, False, False);
|
||||
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "TOGGLE_FULLSCREEN", False))
|
||||
ToggleFullscreenMode();
|
||||
if (g_Config.bHideCursor &&
|
||||
(ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "PAUSE", False))
|
||||
{
|
||||
bPaused = True;
|
||||
XUndefineCursor(GLWin.dpy, GLWin.win);
|
||||
}
|
||||
if (g_Config.bHideCursor &&
|
||||
(ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "RESUME", False))
|
||||
{
|
||||
bPaused = False;
|
||||
XDefineCursor(GLWin.dpy, GLWin.win, GLWin.blankCursor);
|
||||
}
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
if (GLWin.renderToMain &&
|
||||
(ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "RESIZE", False))
|
||||
{
|
||||
GLWin.panel->GetSize((int *)&GLWin.width, (int *)&GLWin.height);
|
||||
GLWin.panel->GetPosition(&GLWin.x, &GLWin.y);
|
||||
XMoveResizeWindow(GLWin.dpy, GLWin.win, GLWin.x, GLWin.y, GLWin.width, GLWin.height);
|
||||
}
|
||||
if (GLWin.renderToMain &&
|
||||
(ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "FOCUSIN", False))
|
||||
{
|
||||
GLWin.panel->SetFocus();
|
||||
if (g_Config.bHideCursor)
|
||||
XDefineCursor(GLWin.dpy, GLWin.win, GLWin.blankCursor);
|
||||
}
|
||||
if (GLWin.renderToMain && g_Config.bHideCursor &&
|
||||
(ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "FOCUSOUT", False))
|
||||
XUndefineCursor(GLWin.dpy, GLWin.win);
|
||||
#endif
|
||||
g_VideoInitialize.pCoreMessage(WM_USER_STOP);
|
||||
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "TOGGLE_DISPLAYMODE", False))
|
||||
ToggleDisplayMode(event.xclient.data.l[1]);
|
||||
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "RESIZE", False))
|
||||
XMoveResizeWindow(GLWin.dpy, GLWin.win, event.xclient.data.l[1],
|
||||
event.xclient.data.l[2], event.xclient.data.l[3], event.xclient.data.l[4]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -399,33 +305,9 @@ THREAD_RETURN XEventThread(void *pArg)
|
||||
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
|
||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight)
|
||||
{
|
||||
#if !defined(HAVE_X11) || !HAVE_X11
|
||||
// Check for fullscreen mode
|
||||
int _twidth, _theight;
|
||||
if (g_Config.bFullscreen)
|
||||
{
|
||||
if (strlen(g_Config.cFSResolution) > 1)
|
||||
{
|
||||
sscanf(g_Config.cFSResolution, "%dx%d", &_twidth, &_theight);
|
||||
}
|
||||
else // No full screen reso set, fall back to default reso
|
||||
{
|
||||
_twidth = _iwidth;
|
||||
_theight = _iheight;
|
||||
}
|
||||
}
|
||||
else // Going Windowed
|
||||
{
|
||||
if (strlen(g_Config.cInternalRes) > 1)
|
||||
{
|
||||
sscanf(g_Config.cInternalRes, "%dx%d", &_twidth, &_theight);
|
||||
}
|
||||
else // No Window resolution set, fall back to default
|
||||
{
|
||||
_twidth = _iwidth;
|
||||
_theight = _iheight;
|
||||
}
|
||||
}
|
||||
#if (!defined(HAVE_X11) || !HAVE_X11)
|
||||
int _tx, _ty, _twidth, _theight;
|
||||
g_VideoInitialize.pRequestWindowSize(_tx, _ty, _twidth, _theight);
|
||||
|
||||
// Control window size and picture scaling
|
||||
s_backbuffer_width = _twidth;
|
||||
@ -439,19 +321,12 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
|
||||
|
||||
wxSize size(_iwidth, _iheight);
|
||||
if (!g_Config.RenderToMainframe ||
|
||||
g_VideoInitialize.pWindowHandle == NULL) {
|
||||
GLWin.frame = new wxFrame((wxWindow *)NULL,
|
||||
-1, _("Dolphin"), wxPoint(50,50), size);
|
||||
} else {
|
||||
GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle,
|
||||
-1, _("Dolphin"), wxPoint(50,50), size);
|
||||
}
|
||||
|
||||
GLWin.glCanvas = new wxGLCanvas(GLWin.frame, wxID_ANY, args,
|
||||
GLWin.panel = (wxPanel *)g_VideoInitialize.pWindowHandle;
|
||||
|
||||
GLWin.glCanvas = new wxGLCanvas(GLWin.panel, wxID_ANY, args,
|
||||
wxPoint(0,0), size, wxSUNKEN_BORDER);
|
||||
GLWin.glCtxt = new wxGLContext(GLWin.glCanvas);
|
||||
GLWin.frame->Show(TRUE);
|
||||
GLWin.glCanvas->Show(TRUE);
|
||||
|
||||
GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
||||
@ -470,36 +345,6 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
return false;
|
||||
}
|
||||
|
||||
if (g_Config.bFullscreen)
|
||||
{
|
||||
DEVMODE dmScreenSettings;
|
||||
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
|
||||
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
|
||||
dmScreenSettings.dmPelsWidth = s_backbuffer_width;
|
||||
dmScreenSettings.dmPelsHeight = s_backbuffer_height;
|
||||
dmScreenSettings.dmBitsPerPel = 32;
|
||||
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
|
||||
|
||||
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
|
||||
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
|
||||
{
|
||||
if (MessageBox(NULL, _T("The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?"), _T("NeHe GL"),MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
|
||||
EmuWindow::ToggleFullscreen(EmuWindow::GetWnd());
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// SetWindowPos to the upper-left corner of the screen
|
||||
SetWindowPos(EmuWindow::GetWnd(), HWND_TOP, 0, 0, _twidth, _theight, SWP_NOREPOSITION | SWP_NOZORDER);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Change to default resolution
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
}
|
||||
|
||||
// Show the window
|
||||
EmuWindow::Show();
|
||||
|
||||
@ -547,7 +392,6 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
int glxMajorVersion, glxMinorVersion;
|
||||
int vidModeMajorVersion, vidModeMinorVersion;
|
||||
|
||||
// attributes for a single buffered visual in RGBA format with at least
|
||||
// 8 bits per color and a 24 bit depth buffer
|
||||
@ -568,110 +412,35 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
|
||||
|
||||
GLWin.dpy = XOpenDisplay(0);
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
GLWin.panel = (wxPanel *)g_VideoInitialize.pPanel;
|
||||
#endif
|
||||
GLWin.parent = (Window)g_VideoInitialize.pWindowHandle;
|
||||
g_VideoInitialize.pWindowHandle = (Display *)GLWin.dpy;
|
||||
GLWin.screen = DefaultScreen(GLWin.dpy);
|
||||
if (GLWin.parent == 0)
|
||||
GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
|
||||
XkbSetDetectableAutoRepeat(GLWin.dpy, True, NULL);
|
||||
|
||||
// Fullscreen option.
|
||||
GLWin.fs = g_Config.bFullscreen; //Set to setting in Options
|
||||
// Render to main option.
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
GLWin.renderToMain = g_Config.RenderToMainframe;
|
||||
#else
|
||||
GLWin.renderToMain = False;
|
||||
#endif
|
||||
glXQueryVersion(GLWin.dpy, &glxMajorVersion, &glxMinorVersion);
|
||||
NOTICE_LOG(VIDEO, "glX-Version %d.%d", glxMajorVersion, glxMinorVersion);
|
||||
|
||||
/* get an appropriate visual */
|
||||
GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDbl);
|
||||
if (GLWin.vi == NULL) {
|
||||
GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListSgl);
|
||||
GLWin.doubleBuffered = False;
|
||||
ERROR_LOG(VIDEO, "Only Singlebuffered Visual!");
|
||||
}
|
||||
else {
|
||||
GLWin.doubleBuffered = True;
|
||||
else
|
||||
NOTICE_LOG(VIDEO, "Got Doublebuffered Visual!");
|
||||
}
|
||||
|
||||
glXQueryVersion(GLWin.dpy, &glxMajorVersion, &glxMinorVersion);
|
||||
NOTICE_LOG(VIDEO, "glX-Version %d.%d", glxMajorVersion, glxMinorVersion);
|
||||
// Create a GLX context.
|
||||
GLWin.ctx = glXCreateContext(GLWin.dpy, GLWin.vi, 0, GL_TRUE);
|
||||
if(!GLWin.ctx)
|
||||
if (!GLWin.ctx)
|
||||
{
|
||||
PanicAlert("Couldn't Create GLX context.Quit");
|
||||
exit(0); // TODO: Don't bring down entire Emu
|
||||
}
|
||||
// Create a color map and set the event masks
|
||||
GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
|
||||
RootWindow(GLWin.dpy, GLWin.vi->screen), GLWin.vi->visual, AllocNone);
|
||||
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
StructureNotifyMask | ResizeRedirectMask;
|
||||
GLWin.attr.background_pixel = BlackPixel(GLWin.dpy, GLWin.screen);
|
||||
GLWin.attr.border_pixel = 0;
|
||||
XkbSetDetectableAutoRepeat(GLWin.dpy, True, NULL);
|
||||
|
||||
// Get the resolution setings for both fullscreen and windowed modes
|
||||
if (strlen(g_Config.cFSResolution) > 1)
|
||||
sscanf(g_Config.cFSResolution, "%dx%d", &GLWin.fullWidth, &GLWin.fullHeight);
|
||||
else // No full screen reso set, fall back to desktop resolution
|
||||
{
|
||||
GLWin.fullWidth = DisplayWidth(GLWin.dpy, GLWin.screen);
|
||||
GLWin.fullHeight = DisplayHeight(GLWin.dpy, GLWin.screen);
|
||||
}
|
||||
if (strlen(g_Config.cInternalRes) > 1)
|
||||
sscanf(g_Config.cInternalRes, "%dx%d", &GLWin.winWidth, &GLWin.winHeight);
|
||||
else // No Window resolution set, fall back to default
|
||||
{
|
||||
GLWin.winWidth = _iwidth;
|
||||
GLWin.winHeight = _iheight;
|
||||
}
|
||||
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
XRRQueryVersion(GLWin.dpy, &vidModeMajorVersion, &vidModeMinorVersion);
|
||||
XRRScreenSize *sizes;
|
||||
int numSizes;
|
||||
|
||||
NOTICE_LOG(VIDEO, "XRRExtension-Version %d.%d", vidModeMajorVersion, vidModeMinorVersion);
|
||||
|
||||
GLWin.screenConfig = XRRGetScreenInfo(GLWin.dpy, RootWindow(GLWin.dpy, GLWin.screen));
|
||||
|
||||
/* save desktop resolution */
|
||||
GLWin.deskSize = XRRConfigCurrentConfiguration(GLWin.screenConfig, &GLWin.screenRotation);
|
||||
/* Set the desktop resolution as the default */
|
||||
GLWin.fullSize = -1;
|
||||
|
||||
/* Find the index of the fullscreen resolution from config */
|
||||
sizes = XRRConfigSizes(GLWin.screenConfig, &numSizes);
|
||||
if (numSizes > 0 && sizes != NULL) {
|
||||
for (int i = 0; i < numSizes; i++) {
|
||||
if ((sizes[i].width == GLWin.fullWidth) && (sizes[i].height == GLWin.fullHeight)) {
|
||||
GLWin.fullSize = i;
|
||||
}
|
||||
}
|
||||
NOTICE_LOG(VIDEO, "Fullscreen Resolution %dx%d", sizes[GLWin.fullSize].width, sizes[GLWin.fullSize].height);
|
||||
}
|
||||
else {
|
||||
ERROR_LOG(VIDEO, "Failed to obtain fullscreen sizes.\n"
|
||||
"Using current desktop resolution for fullscreen.\n");
|
||||
GLWin.fullWidth = DisplayWidth(GLWin.dpy, GLWin.screen);
|
||||
GLWin.fullHeight = DisplayHeight(GLWin.dpy, GLWin.screen);
|
||||
}
|
||||
#else
|
||||
GLWin.fullWidth = DisplayWidth(GLWin.dpy, GLWin.screen);
|
||||
GLWin.fullHeight = DisplayHeight(GLWin.dpy, GLWin.screen);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
if (GLWin.renderToMain)
|
||||
g_VideoInitialize.pKeyPress(0, False, False);
|
||||
#endif
|
||||
|
||||
CreateXWindow();
|
||||
g_VideoInitialize.pXWindow = (Window *) &GLWin.win;
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
@ -680,35 +449,12 @@ bool OpenGL_Initialize()
|
||||
{
|
||||
bool success = OpenGL_MakeCurrent();
|
||||
if (!success)
|
||||
{
|
||||
{
|
||||
PanicAlert("Can't Activate The GL Rendering Context.");
|
||||
return false;
|
||||
}
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
NOTICE_LOG(VIDEO, "GLWin Depth %d", GLWin.depth)
|
||||
if (glXIsDirect(GLWin.dpy, GLWin.ctx)) {
|
||||
NOTICE_LOG(VIDEO, "detected direct rendering");
|
||||
} else {
|
||||
ERROR_LOG(VIDEO, "no Direct Rendering possible!");
|
||||
}
|
||||
|
||||
if (GLWin.fs)
|
||||
{
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
if (GLWin.renderToMain)
|
||||
{
|
||||
GLWin.fs = False;
|
||||
g_VideoInitialize.pKeyPress(0x1d, False, False);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
X11_EWMH_Fullscreen(_NET_WM_STATE_ADD);
|
||||
}
|
||||
|
||||
// Hide the cursor now
|
||||
if (g_Config.bHideCursor)
|
||||
XDefineCursor (GLWin.dpy, GLWin.win, GLWin.blankCursor);
|
||||
#endif
|
||||
// Notify the core that the window is current
|
||||
g_VideoInitialize.pCoreMessage(WM_USER_CREATE);
|
||||
return success;
|
||||
|
||||
}
|
||||
@ -782,12 +528,12 @@ void OpenGL_Shutdown()
|
||||
{
|
||||
#if defined(USE_WX) && USE_WX
|
||||
delete GLWin.glCanvas;
|
||||
delete GLWin.frame;
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
cocoaGLDeleteWindow(GLWin.cocoaWin);
|
||||
cocoaGLDelete(GLWin.cocoaCtx);
|
||||
|
||||
#elif defined(_WIN32)
|
||||
EmuWindow::ToggleDisplayMode(false);
|
||||
if (hRC) // Do We Have A Rendering Context?
|
||||
{
|
||||
if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts?
|
||||
@ -810,21 +556,14 @@ void OpenGL_Shutdown()
|
||||
ERROR_LOG(VIDEO, "Release Device Context Failed.");
|
||||
hDC = NULL; // Set DC To NULL
|
||||
}
|
||||
EmuWindow::Close();
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
DestroyXWindow();
|
||||
if (GLWin.xEventThread)
|
||||
GLWin.xEventThread->WaitForDeath();
|
||||
GLWin.xEventThread = NULL;
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
if (GLWin.fullSize >= 0)
|
||||
XRRFreeScreenConfigInfo(GLWin.screenConfig);
|
||||
#endif
|
||||
if (g_Config.bHideCursor)
|
||||
XFreeCursor(GLWin.dpy, GLWin.blankCursor);
|
||||
if (GLWin.ctx && !glXMakeCurrent(GLWin.dpy, None, NULL))
|
||||
NOTICE_LOG(VIDEO, "Could not release drawing context.");
|
||||
if (GLWin.ctx)
|
||||
{
|
||||
glXDestroyContext(GLWin.dpy, GLWin.ctx);
|
||||
XFreeColormap(GLWin.dpy, GLWin.attr.colormap);
|
||||
XCloseDisplay(GLWin.dpy);
|
||||
GLWin.ctx = NULL;
|
||||
}
|
||||
|
@ -41,23 +41,12 @@
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
#include <GL/glxew.h>
|
||||
#include <X11/XKBlib.h>
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 // Needed for render to main
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "Thread.h"
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#endif // XRANDR
|
||||
// EWMH state actions, see
|
||||
// http://freedesktop.org/wiki/Specifications/wm-spec?action=show&redirect=Standards%2Fwm-spec
|
||||
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
|
||||
#define _NET_WM_STATE_ADD 1 /* add/set property */
|
||||
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
|
||||
|
||||
#elif defined(USE_SDL) && USE_SDL
|
||||
#include <GL/glew.h>
|
||||
@ -95,20 +84,12 @@ typedef struct {
|
||||
NSOpenGLContext *cocoaCtx;
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
Window win;
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
wxPanel *panel;
|
||||
#endif
|
||||
Window parent;
|
||||
Display *dpy;
|
||||
XVisualInfo *vi;
|
||||
GLXContext ctx;
|
||||
Cursor blankCursor;
|
||||
XSetWindowAttributes attr;
|
||||
Bool fs;
|
||||
Bool doubleBuffered;
|
||||
int fullWidth, fullHeight;
|
||||
int winWidth, winHeight;
|
||||
Common::Thread *xEventThread;
|
||||
Bool renderToMain;
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
XRRScreenConfiguration *screenConfig;
|
||||
Rotation screenRotation;
|
||||
@ -117,12 +98,11 @@ typedef struct {
|
||||
#endif // X11
|
||||
#if defined(USE_WX) && USE_WX
|
||||
wxGLCanvas *glCanvas;
|
||||
wxFrame *frame;
|
||||
wxPanel *panel;
|
||||
wxGLContext *glCtxt;
|
||||
#endif
|
||||
int x, y;
|
||||
unsigned int width, height;
|
||||
unsigned int depth;
|
||||
} GLWindow;
|
||||
|
||||
extern GLWindow GLWin;
|
||||
|
@ -36,11 +36,8 @@ BEGIN_EVENT_TABLE(GFXConfigDialogOGL,wxDialog)
|
||||
EVT_CLOSE(GFXConfigDialogOGL::OnClose)
|
||||
EVT_BUTTON(wxID_CLOSE, GFXConfigDialogOGL::CloseClick)
|
||||
EVT_BUTTON(wxID_ABOUT, GFXConfigDialogOGL::AboutClick)
|
||||
EVT_CHECKBOX(ID_FULLSCREEN, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_VSYNC, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_RENDERTOMAINWINDOW, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHOICE(ID_WINDOWRESOLUTIONCB, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHOICE(ID_WINDOWFSRESOLUTIONCB, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHOICE(ID_FULLSCREENRESOLUTION, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHOICE(ID_MAXANISOTROPY, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHOICE(ID_MSAAMODECB, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_NATIVERESOLUTION, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
@ -52,9 +49,6 @@ BEGIN_EVENT_TABLE(GFXConfigDialogOGL,wxDialog)
|
||||
EVT_CHECKBOX(ID_WIDESCREENHACK, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHOICE(ID_ASPECT, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_CROP, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
#ifndef _WIN32
|
||||
EVT_CHECKBOX(ID_HIDECURSOR, GFXConfigDialogOGL::GeneralSettingsChanged)
|
||||
#endif
|
||||
EVT_CHECKBOX(ID_WIREFRAME, GFXConfigDialogOGL::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_SHOWFPS, GFXConfigDialogOGL::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_STATISTICS, GFXConfigDialogOGL::AdvancedSettingsChanged)
|
||||
@ -138,11 +132,6 @@ void GFXConfigDialogOGL::AddFSReso(const char *reso)
|
||||
arrayStringFor_FullscreenCB.Add(wxString::FromAscii(reso));
|
||||
}
|
||||
|
||||
void GFXConfigDialogOGL::AddWindowReso(const char *reso)
|
||||
{
|
||||
arrayStringFor_WindowResolutionCB.Add(wxString::FromAscii(reso));
|
||||
}
|
||||
|
||||
// This one could be used to reload shaders while dolphin is running...
|
||||
void GFXConfigDialogOGL::LoadShaders()
|
||||
{
|
||||
@ -172,8 +161,6 @@ void GFXConfigDialogOGL::InitializeGUILists()
|
||||
// Resolutions
|
||||
if (arrayStringFor_FullscreenCB.empty())
|
||||
AddFSReso("<No resolutions found>");
|
||||
if (arrayStringFor_WindowResolutionCB.empty())
|
||||
AddWindowReso("<No resolutions found>");
|
||||
|
||||
// Keep Aspect Ratio
|
||||
arrayStringFor_AspectRatio.Add(wxT("Auto Aspect (recommended)"));
|
||||
@ -213,22 +200,14 @@ void GFXConfigDialogOGL::InitializeGUIValues()
|
||||
// General Display Settings
|
||||
m_NativeResolution->SetValue(g_Config.bNativeResolution);
|
||||
m_2xResolution->SetValue(g_Config.b2xResolution);
|
||||
m_Fullscreen->SetValue(g_Config.bFullscreen);
|
||||
|
||||
int num = 0;
|
||||
num = m_WindowResolutionCB->FindString(wxString::FromAscii(g_Config.cInternalRes));
|
||||
m_WindowResolutionCB->SetSelection(num);
|
||||
|
||||
num = m_WindowFSResolutionCB->FindString(wxString::FromAscii(g_Config.cFSResolution));
|
||||
m_WindowFSResolutionCB->SetSelection(num);
|
||||
#ifndef _WIN32
|
||||
m_HideCursor->SetValue(g_Config.bHideCursor);
|
||||
#endif
|
||||
m_KeepAR->SetSelection(g_Config.iAspectRatio);
|
||||
m_Crop->SetValue(g_Config.bCrop);
|
||||
|
||||
// Advanced Display Settings
|
||||
m_RenderToMainWindow->SetValue(g_Config.RenderToMainframe);
|
||||
m_OSDHotKey->SetValue(g_Config.bOSDHotKey);
|
||||
m_VSync->SetValue(g_Config.bVSync);
|
||||
m_UseXFB->SetValue(g_Config.bUseXFB);
|
||||
@ -288,10 +267,6 @@ void GFXConfigDialogOGL::InitializeGUIValues()
|
||||
void GFXConfigDialogOGL::InitializeGUITooltips()
|
||||
{
|
||||
// Tool tips
|
||||
m_Fullscreen->SetToolTip(
|
||||
wxT("Start the separate window in fullscreen mode.")
|
||||
wxT(" Press Alt+Enter to switch between Fullscreen and Windowed mode.")
|
||||
wxT("\n\nApplies instanty during gameplay: <Yes>"));
|
||||
m_NativeResolution->SetToolTip(
|
||||
wxT("This will use the game's native resolution and stretch it to fill the")
|
||||
wxT("\nwindow instead of changing the internal display resolution. It")
|
||||
@ -309,12 +284,9 @@ void GFXConfigDialogOGL::InitializeGUITooltips()
|
||||
wxT("\nis of the 5:4 format if you have selected the 4:3 aspect ratio. It will assume")
|
||||
wxT("\nthat your screen is of the 16:10 format if you have selected the 16:9 aspect ratio.")
|
||||
wxT("\n\nApplies instanty during gameplay: <Yes>"));
|
||||
m_WindowResolutionCB->SetToolTip(
|
||||
wxT("Select internal resolution for the separate rendering window for windowed mode")
|
||||
wxT("\n\nApplies instanty during gameplay: <No>"));
|
||||
m_WindowFSResolutionCB->SetToolTip(
|
||||
wxT("Select internal resolution for the separate rendering window for fullscreen mode")
|
||||
wxT("\n\nApplies instanty during gameplay: <No>"));
|
||||
wxT("Select resolution for fullscreen mode")
|
||||
wxT("\n\nApplies instantly during gameplay: <No>"));
|
||||
m_MSAAModeCB->SetToolTip(wxT(
|
||||
"Applies instanty during gameplay: <No>"));
|
||||
m_OSDHotKey->SetToolTip(
|
||||
@ -393,17 +365,11 @@ void GFXConfigDialogOGL::CreateGUIControls()
|
||||
|
||||
// General Display Settings
|
||||
sbBasic = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Basic Display Settings"));
|
||||
wxStaticText *IRText = new wxStaticText(m_PageGeneral, ID_IRTEXT, wxT("Resolution:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
wxStaticText *IRText = new wxStaticText(m_PageGeneral, wxID_ANY, wxT("Resolution:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_NativeResolution = new wxCheckBox(m_PageGeneral, ID_NATIVERESOLUTION, wxT("Native"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_2xResolution = new wxCheckBox(m_PageGeneral, ID_2X_RESOLUTION, wxT("2x"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
wxStaticText *RText = new wxStaticText(m_PageGeneral, ID_RTEXT, wxT("Custom resolution:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
wxStaticText *WMText = new wxStaticText(m_PageGeneral, ID_WMTEXT, wxT("Windowed:"), wxDefaultPosition, wxDefaultSize , 0 );
|
||||
m_Fullscreen = new wxCheckBox(m_PageGeneral, ID_FULLSCREEN, wxT("Fullscreen:"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_WindowResolutionCB = new wxChoice(m_PageGeneral, ID_WINDOWRESOLUTIONCB, wxDefaultPosition, wxDefaultSize, arrayStringFor_WindowResolutionCB, 0, wxDefaultValidator, arrayStringFor_WindowResolutionCB[0]);
|
||||
m_WindowFSResolutionCB = new wxChoice(m_PageGeneral, ID_WINDOWFSRESOLUTIONCB, wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenCB, 0, wxDefaultValidator, arrayStringFor_FullscreenCB[0]);
|
||||
#ifndef _WIN32
|
||||
m_HideCursor = new wxCheckBox(m_PageGeneral, ID_HIDECURSOR, wxT("Hide mouse cursor"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
#endif
|
||||
wxStaticText *RText = new wxStaticText(m_PageGeneral, wxID_ANY, wxT("Fullscreen Display Resolution:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_WindowFSResolutionCB = new wxChoice(m_PageGeneral, ID_FULLSCREENRESOLUTION, wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenCB, 0, wxDefaultValidator, arrayStringFor_FullscreenCB[0]);
|
||||
// Aspect ratio / positioning controls
|
||||
wxStaticText *KeepARText = new wxStaticText(m_PageGeneral, wxID_ANY, wxT("Keep aspect ratio:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_KeepAR = new wxChoice(m_PageGeneral, ID_ASPECT, wxDefaultPosition, wxDefaultSize, arrayStringFor_AspectRatio);
|
||||
@ -411,7 +377,6 @@ void GFXConfigDialogOGL::CreateGUIControls()
|
||||
|
||||
// Advanced Display Settings
|
||||
sbBasicAdvanced = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Advanced Display Settings"));
|
||||
m_RenderToMainWindow = new wxCheckBox(m_PageGeneral, ID_RENDERTOMAINWINDOW, wxT("Render to Main window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_OSDHotKey = new wxCheckBox(m_PageGeneral, ID_OSDHOTKEY, wxT("Enable Hotkeys"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
#if !defined(_WIN32) && (!defined(HAVE_X11) || !HAVE_X11)
|
||||
// JPeterson set the hot key to be Win32-specific
|
||||
@ -445,32 +410,23 @@ void GFXConfigDialogOGL::CreateGUIControls()
|
||||
sBasic->Add(m_2xResolution, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
|
||||
sBasic->Add(RText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
sBasic->Add(WMText, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
sBasic->Add(m_WindowResolutionCB, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL, 5);
|
||||
sBasic->Add(m_Fullscreen, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
sBasic->Add(m_WindowFSResolutionCB, wxGBPosition(2, 2), wxGBSpan(1, 1), wxALL, 5);
|
||||
sBasic->Add(m_WindowFSResolutionCB, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL, 5);
|
||||
|
||||
sBasic->Add(KeepARText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
sBasic->Add(m_KeepAR, wxGBPosition(3, 1), wxGBSpan(1, 1), wxALL, 5);
|
||||
sBasic->Add(m_Crop, wxGBPosition(3, 2), wxGBSpan(1, 1), wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||
|
||||
// This option is configured from the main Dolphin.exe settings for _WIN32
|
||||
#ifndef _WIN32
|
||||
sBasic->Add(m_HideCursor, wxGBPosition(5, 0), wxGBSpan(1, 4), wxALL, 5);
|
||||
#endif
|
||||
sBasic->Add(KeepARText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
sBasic->Add(m_KeepAR, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL, 5);
|
||||
sBasic->Add(m_Crop, wxGBPosition(2, 2), wxGBSpan(1, 1), wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||
|
||||
sbBasic->Add(sBasic);
|
||||
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
|
||||
|
||||
sBasicAdvanced = new wxGridBagSizer(0, 0);
|
||||
|
||||
sBasicAdvanced->Add(m_RenderToMainWindow, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_OSDHotKey, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_VSync, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_UseXFB, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_UseRealXFB, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_AutoScale, wxGBPosition(5, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_WidescreenHack, wxGBPosition(6, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_OSDHotKey, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_VSync, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_UseXFB, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_UseRealXFB, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_AutoScale, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sBasicAdvanced->Add(m_WidescreenHack, wxGBPosition(5, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
|
||||
sbBasicAdvanced->Add(sBasicAdvanced);
|
||||
sGeneral->Add(sbBasicAdvanced, 0, wxEXPAND|wxALL, 5);
|
||||
@ -638,13 +594,6 @@ void GFXConfigDialogOGL::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case ID_FULLSCREEN:
|
||||
g_Config.bFullscreen = m_Fullscreen->IsChecked();
|
||||
break;
|
||||
case ID_RENDERTOMAINWINDOW:
|
||||
g_Config.RenderToMainframe = m_RenderToMainWindow->IsChecked();
|
||||
g_Config.bFullscreen = false;
|
||||
break;
|
||||
case ID_NATIVERESOLUTION:
|
||||
g_Config.bNativeResolution = m_NativeResolution->IsChecked();
|
||||
// Don't allow 1x and 2x at the same time
|
||||
@ -679,15 +628,7 @@ void GFXConfigDialogOGL::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
case ID_FORCEFILTERING:
|
||||
g_Config.bForceFiltering = m_ForceFiltering->IsChecked();
|
||||
break;
|
||||
#ifndef _WIN32
|
||||
case ID_HIDECURSOR:
|
||||
g_Config.bHideCursor = m_HideCursor->IsChecked();
|
||||
break;
|
||||
#endif
|
||||
case ID_WINDOWRESOLUTIONCB:
|
||||
strcpy(g_Config.cInternalRes, m_WindowResolutionCB->GetStringSelection().mb_str() );
|
||||
break;
|
||||
case ID_WINDOWFSRESOLUTIONCB:
|
||||
case ID_FULLSCREENRESOLUTION:
|
||||
strcpy(g_Config.cFSResolution, m_WindowFSResolutionCB->GetStringSelection().mb_str() );
|
||||
break;
|
||||
case ID_MAXANISOTROPY:
|
||||
@ -839,23 +780,12 @@ void GFXConfigDialogOGL::UpdateGUI()
|
||||
m_AutoScale->Enable(!g_Config.bUseRealXFB);
|
||||
m_UseXFB->Enable(!g_Config.bUseRealXFB);
|
||||
|
||||
// These options are for the separate rendering window
|
||||
#if !defined(HAVE_GTK2) || !HAVE_GTK2 || !defined(wxGTK)
|
||||
m_Fullscreen->Enable(!g_Config.RenderToMainframe);
|
||||
if (g_Config.RenderToMainframe) m_Fullscreen->SetValue(false);
|
||||
#endif
|
||||
|
||||
// Resolution settings
|
||||
//disable native/2x choice when real xfb is on. native simply looks best, as ector noted above.
|
||||
//besides, it would look odd if one disabled native, and it came back on again.
|
||||
m_NativeResolution->Enable(!g_Config.bUseRealXFB);
|
||||
m_2xResolution->Enable(!g_Config.bUseRealXFB && (!g_Config.bRunning || Renderer::Allow2x()));
|
||||
m_WindowResolutionCB->Enable(!g_Config.bRunning);
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
m_WindowFSResolutionCB->Enable(!g_Config.bRunning);
|
||||
#else
|
||||
m_WindowFSResolutionCB->Enable(!g_Config.bRunning && !g_Config.RenderToMainframe);
|
||||
#endif
|
||||
|
||||
// Disable the Copy to options when EFBCopy is disabled
|
||||
m_Radio_CopyEFBToRAM->Enable(!(g_Config.bEFBCopyDisable));
|
||||
|
@ -65,7 +65,6 @@ class GFXConfigDialogOGL : public wxDialog
|
||||
void CloseClick(wxCommandEvent& event);
|
||||
|
||||
void AddFSReso(const char *reso);
|
||||
void AddWindowReso(const char *reso);
|
||||
void CreateGUIControls();
|
||||
void GameIniLoad();
|
||||
|
||||
@ -95,9 +94,7 @@ class GFXConfigDialogOGL : public wxDialog
|
||||
wxNotebook *m_Notebook;
|
||||
wxPanel *m_PageGeneral;
|
||||
wxPanel *m_PageAdvanced;
|
||||
wxCheckBox *m_Fullscreen;
|
||||
wxCheckBox *m_VSync;
|
||||
wxCheckBox *m_RenderToMainWindow;
|
||||
wxCheckBox *m_NativeResolution, *m_2xResolution;
|
||||
wxCheckBox *m_WidescreenHack;
|
||||
wxCheckBox *m_ForceFiltering;
|
||||
@ -105,10 +102,6 @@ class GFXConfigDialogOGL : public wxDialog
|
||||
wxCheckBox *m_UseXFB;
|
||||
wxCheckBox *m_UseRealXFB;
|
||||
wxCheckBox *m_AutoScale;
|
||||
#ifndef _WIN32
|
||||
wxCheckBox *m_HideCursor;
|
||||
#endif
|
||||
wxChoice *m_WindowResolutionCB;
|
||||
wxChoice *m_WindowFSResolutionCB;
|
||||
wxChoice *m_MaxAnisotropyCB;
|
||||
wxChoice *m_MSAAModeCB, *m_PhackvalueCB, *m_PostShaderCB, *m_KeepAR;
|
||||
@ -144,7 +137,6 @@ class GFXConfigDialogOGL : public wxDialog
|
||||
wxSlider *m_SliderWidth, *m_SliderHeight, *m_SliderLeft, *m_SliderTop;
|
||||
wxCheckBox *m_ScreenSize;
|
||||
|
||||
wxArrayString arrayStringFor_WindowResolutionCB;
|
||||
wxArrayString arrayStringFor_FullscreenCB;
|
||||
wxArrayString arrayStringFor_AspectRatio;
|
||||
wxArrayString arrayStringFor_MaxAnisotropyCB;
|
||||
@ -158,9 +150,7 @@ class GFXConfigDialogOGL : public wxDialog
|
||||
ID_PAGEGENERAL,
|
||||
ID_PAGEADVANCED,
|
||||
|
||||
ID_FULLSCREEN,
|
||||
ID_VSYNC,
|
||||
ID_RENDERTOMAINWINDOW,
|
||||
ID_NATIVERESOLUTION, ID_2X_RESOLUTION,
|
||||
ID_ASPECT,
|
||||
ID_CROP,
|
||||
@ -169,16 +159,7 @@ class GFXConfigDialogOGL : public wxDialog
|
||||
ID_AUTOSCALE,
|
||||
ID_WIDESCREENHACK,
|
||||
|
||||
ID_HIDECURSOR,
|
||||
ID_FSTEXT,
|
||||
ID_FULLSCREENCB,
|
||||
ID_WMTEXT,
|
||||
ID_WM2TEXT,
|
||||
ID_FMTEXT,
|
||||
ID_IRTEXT,
|
||||
ID_RTEXT,
|
||||
ID_WINDOWRESOLUTIONCB,
|
||||
ID_WINDOWFSRESOLUTIONCB,
|
||||
ID_FULLSCREENRESOLUTION,
|
||||
ID_FORCEFILTERING,
|
||||
ID_MAXANISOTROPY,
|
||||
ID_MAXANISOTROPYTEXT,
|
||||
|
@ -137,27 +137,12 @@ namespace EmuWindow
|
||||
|
||||
HWND m_hWnd = NULL; // The new window that is created here
|
||||
HWND m_hParent = NULL;
|
||||
HWND m_hMain = NULL; // The main CPanel
|
||||
|
||||
HINSTANCE m_hInstance = NULL;
|
||||
WNDCLASSEX wndClass;
|
||||
const TCHAR m_szClassName[] = _T("DolphinEmuWnd");
|
||||
int g_winstyle;
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/* Invisible cursor option. In the lack of a predefined IDC_BLANK we make
|
||||
an empty transparent cursor */
|
||||
// ------------------
|
||||
HCURSOR hCursor = NULL, hCursorBlank = NULL;
|
||||
void CreateCursors(HINSTANCE hInstance)
|
||||
{
|
||||
BYTE ANDmaskCursor[] = { 0xff };
|
||||
BYTE XORmaskCursor[] = { 0x00 };
|
||||
hCursorBlank = CreateCursor(hInstance, 0,0, 1,1, ANDmaskCursor,XORmaskCursor);
|
||||
|
||||
hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
}
|
||||
|
||||
HWND GetWnd()
|
||||
{
|
||||
return m_hWnd;
|
||||
@ -233,18 +218,6 @@ void OnKeyDown(WPARAM wParam)
|
||||
{
|
||||
switch (LOWORD( wParam ))
|
||||
{
|
||||
case VK_ESCAPE:
|
||||
if (!g_Config.RenderToMainframe)
|
||||
{
|
||||
if (g_Config.bFullscreen)
|
||||
{
|
||||
// Pressing Esc switches to Windowed mode from Fullscreen mode
|
||||
ToggleFullscreen(m_hWnd);
|
||||
}
|
||||
// then pauses the emulation if already Windowed
|
||||
SendMessage(m_hMain, WM_USER, WM_USER_PAUSE, 0);
|
||||
}
|
||||
break;
|
||||
case '3': // OSD keys
|
||||
case '4':
|
||||
case '5':
|
||||
@ -254,10 +227,29 @@ void OnKeyDown(WPARAM wParam)
|
||||
OSDMenu(wParam);
|
||||
break;
|
||||
}
|
||||
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
void ToggleDisplayMode (int bFullscreen)
|
||||
{
|
||||
if (bFullscreen)
|
||||
{
|
||||
DEVMODE dmScreenSettings;
|
||||
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
|
||||
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
|
||||
sscanf(g_Config.cFSResolution, "%dx%d", &dmScreenSettings.dmPelsWidth, &dmScreenSettings.dmPelsHeight);
|
||||
dmScreenSettings.dmBitsPerPel = 32;
|
||||
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
|
||||
|
||||
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
|
||||
ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Change to default resolution
|
||||
ChangeDisplaySettings(NULL, CDS_FULLSCREEN);
|
||||
}
|
||||
}
|
||||
|
||||
// Should really take a look at the mouse stuff in here - some of it is weird.
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
@ -267,10 +259,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
switch (iMsg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
PostMessage(m_hMain, WM_USER, WM_USER_CREATE, g_Config.RenderToMainframe);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
HDC hdc;
|
||||
@ -280,29 +268,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SYSKEYDOWN:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case VK_RETURN:
|
||||
// Pressing Alt+Enter switch FullScreen/Windowed
|
||||
if (m_hParent == NULL && !g_Config.RenderToMainframe)
|
||||
{
|
||||
ToggleFullscreen(hWnd);
|
||||
}
|
||||
break;
|
||||
case VK_F5: case VK_F6: case VK_F7: case VK_F8:
|
||||
PostMessage(m_hMain, WM_SYSKEYDOWN, wParam, lParam);
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, iMsg, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
// Don't process this as a child window to avoid double events
|
||||
if (!g_Config.RenderToMainframe)
|
||||
OnKeyDown(wParam);
|
||||
|
||||
break;
|
||||
|
||||
/* Post these mouse events to the main window, it's nessesary becase in difference to the
|
||||
@ -313,53 +279,26 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
PostMessage(GetParentWnd(), iMsg, wParam, lParam);
|
||||
break;
|
||||
|
||||
/* The reason we pick up the WM_MOUSEMOVE is to be able to change this option
|
||||
during gameplay. The alternative is to load one of the cursors when the plugin
|
||||
is loaded and go with that. This should only produce a minimal performance hit
|
||||
because SetCursor is not supposed to actually change the cursor if it's the
|
||||
same as the one before. */
|
||||
case WM_MOUSEMOVE:
|
||||
/* Check rendering mode; child or parent. Then post the mouse moves to the main window
|
||||
it's nessesary for both the child window and separate rendering window because
|
||||
moves over the rendering window do not reach the main program then. */
|
||||
if (GetParentWnd() == NULL) { // Separate rendering window
|
||||
PostMessage(m_hMain, iMsg, wParam, -1);
|
||||
SetCursor(hCursor);
|
||||
}
|
||||
else
|
||||
PostMessage(GetParentWnd(), iMsg, wParam, lParam);
|
||||
break;
|
||||
|
||||
/* To support the separate window rendering we get the message back here. So we basically
|
||||
only let it pass through Dolphin > Frame.cpp to determine if it should be on or off
|
||||
and coordinate it with the other settings if nessesary */
|
||||
case WM_USER:
|
||||
if (wParam == WM_USER_STOP)
|
||||
SetCursor((lParam) ? hCursor : hCursorBlank);
|
||||
else if (wParam == WM_USER_KEYDOWN)
|
||||
if (wParam == WM_USER_KEYDOWN)
|
||||
{
|
||||
OnKeyDown(lParam);
|
||||
FreeLookInput(wParam, lParam);
|
||||
}
|
||||
else if (wParam == TOGGLE_FULLSCREEN)
|
||||
{
|
||||
if(!g_Config.RenderToMainframe)
|
||||
ToggleFullscreen(m_hWnd);
|
||||
}
|
||||
else if (wParam == WIIMOTE_DISCONNECT)
|
||||
{
|
||||
PostMessage(m_hMain, WM_USER, wParam, lParam);
|
||||
PostMessage(m_hParent, WM_USER, wParam, lParam);
|
||||
}
|
||||
else if (wParam == TOGGLE_DISPLAYMODE)
|
||||
ToggleDisplayMode(lParam);
|
||||
break;
|
||||
|
||||
// This is called when we close the window when we render to a separate window
|
||||
case WM_CLOSE:
|
||||
case WM_CLOSE:
|
||||
if (m_hParent == NULL)
|
||||
{
|
||||
// Take it out of fullscreen and stop the game
|
||||
if( g_Config.bFullscreen )
|
||||
ToggleFullscreen(m_hParent);
|
||||
PostMessage(m_hMain, WM_USER, WM_USER_STOP, 0);
|
||||
// Stop the game
|
||||
PostMessage(m_hParent, WM_USER, WM_USER_STOP, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -378,6 +317,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
return DefWindowProc(hWnd, iMsg, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
case WM_SETCURSOR:
|
||||
PostMessage(m_hParent, WM_USER, WM_USER_SETCURSOR, 0);
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, iMsg, wParam, lParam);
|
||||
}
|
||||
@ -390,14 +333,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const TCHAR *title)
|
||||
{
|
||||
wndClass.cbSize = sizeof( wndClass );
|
||||
wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
||||
wndClass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wndClass.lpfnWndProc = WndProc;
|
||||
wndClass.cbClsExtra = 0;
|
||||
wndClass.cbWndExtra = 0;
|
||||
wndClass.hInstance = hInstance;
|
||||
wndClass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
|
||||
// To interfer less with SetCursor() later we set this to NULL
|
||||
//wndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
|
||||
wndClass.hCursor = NULL;
|
||||
wndClass.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
|
||||
wndClass.lpszMenuName = NULL;
|
||||
@ -407,112 +348,21 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
||||
m_hInstance = hInstance;
|
||||
RegisterClassEx( &wndClass );
|
||||
|
||||
CreateCursors(m_hInstance);
|
||||
|
||||
// Create child window
|
||||
if (g_Config.RenderToMainframe)
|
||||
{
|
||||
m_hParent = m_hMain = parent;
|
||||
m_hParent = parent;
|
||||
|
||||
m_hWnd = CreateWindow(m_szClassName, title, WS_CHILD,
|
||||
0, 0, width, height, parent, NULL, hInstance, NULL);
|
||||
}
|
||||
// Create new separate window
|
||||
else
|
||||
{
|
||||
// Don't forget to make it NULL, or a broken window will be created in case we
|
||||
// render to main, stop, then render to separate window, as the GUI will still
|
||||
// think we're rendering to main because m_hParent will still contain the old HWND
|
||||
m_hParent = NULL;
|
||||
m_hMain = parent;
|
||||
|
||||
DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW;
|
||||
RECT rc = {0, 0, width, height};
|
||||
AdjustWindowRect(&rc, style, false);
|
||||
RECT rcdesktop;
|
||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||
|
||||
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||
|
||||
m_hWnd = CreateWindow(m_szClassName, title, style,
|
||||
X, Y, rc.right-rc.left, rc.bottom-rc.top,
|
||||
NULL, NULL, hInstance, NULL);
|
||||
}
|
||||
m_hWnd = CreateWindow(m_szClassName, title, WS_CHILD,
|
||||
0, 0, width, height, parent, NULL, hInstance, NULL);
|
||||
|
||||
return m_hWnd;
|
||||
}
|
||||
|
||||
void ToggleFullscreen(HWND hParent, bool bForceFull)
|
||||
{
|
||||
if (m_hParent == NULL)
|
||||
{
|
||||
int w_fs = 640, h_fs = 480;
|
||||
if (!g_Config.bFullscreen || bForceFull)
|
||||
{
|
||||
if (strlen(g_Config.cFSResolution) > 1)
|
||||
sscanf(g_Config.cFSResolution, "%dx%d", &w_fs, &h_fs);
|
||||
|
||||
// Get into fullscreen
|
||||
DEVMODE dmScreenSettings;
|
||||
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
|
||||
// Desktop -> FullScreen
|
||||
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
|
||||
dmScreenSettings.dmPelsWidth = w_fs;
|
||||
dmScreenSettings.dmPelsHeight = h_fs;
|
||||
dmScreenSettings.dmFields = DM_PELSWIDTH|DM_PELSHEIGHT;
|
||||
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
|
||||
return;
|
||||
|
||||
// Set new window style -> PopUp
|
||||
SetWindowLongPtr(hParent, GWL_STYLE, WS_POPUP);
|
||||
|
||||
// SetWindowPos to the upper-left corner of the screen
|
||||
SetWindowPos(hParent, HWND_TOP, 0, 0, w_fs, h_fs, SWP_NOREPOSITION);
|
||||
|
||||
ShowCursor(FALSE);
|
||||
g_Config.bFullscreen = true;
|
||||
|
||||
// Eventually show the window!
|
||||
EmuWindow::Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen(g_Config.cInternalRes) > 1)
|
||||
sscanf(g_Config.cInternalRes, "%dx%d", &w_fs, &h_fs);
|
||||
|
||||
// FullScreen -> Desktop
|
||||
ChangeDisplaySettings(NULL, CDS_FULLSCREEN);
|
||||
|
||||
DWORD style = WS_OVERLAPPEDWINDOW;
|
||||
RECT rc = {0, 0, w_fs, h_fs};
|
||||
AdjustWindowRect(&rc, style, false);
|
||||
RECT rcdesktop;
|
||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||
|
||||
// SetWindowPos to the center of the screen
|
||||
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||
SetWindowPos(hParent, NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
|
||||
|
||||
// Set new window style FS -> Windowed
|
||||
SetWindowLongPtr(hParent, GWL_STYLE, style);
|
||||
|
||||
// Re-Enable the cursor
|
||||
ShowCursor(TRUE);
|
||||
g_Config.bFullscreen = false;
|
||||
|
||||
// Eventually show the window!
|
||||
EmuWindow::Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ShowWindow(m_hWnd, SW_SHOW);
|
||||
BringWindowToTop(m_hWnd);
|
||||
UpdateWindow(m_hWnd);
|
||||
SetFocus(m_hParent);
|
||||
|
||||
// gShowDebugger from main.cpp is forgotten between the Dolphin-Debugger is opened and a game is
|
||||
// started so we have to use an ini file setting here
|
||||
@ -527,14 +377,15 @@ void Show()
|
||||
|
||||
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title)
|
||||
{
|
||||
int width=640, height=480;
|
||||
sscanf( g_Config.bFullscreen ? g_Config.cFSResolution : g_Config.cInternalRes, "%dx%d", &width, &height );
|
||||
int x=0, y=0, width=640, height=480;
|
||||
g_VideoInitialize.pRequestWindowSize(x, y, width, height);
|
||||
return OpenWindow(hParent, hInstance, width, height, title);
|
||||
}
|
||||
|
||||
void Close()
|
||||
{
|
||||
DestroyWindow(m_hWnd);
|
||||
if (m_hParent == NULL)
|
||||
DestroyWindow(m_hWnd);
|
||||
UnregisterClass(m_szClassName, m_hInstance);
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,8 @@ namespace EmuWindow
|
||||
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
|
||||
void Show();
|
||||
void Close();
|
||||
void ToggleFullscreen(HWND hParent, bool bForceFull = false);
|
||||
void SetSize(int displayWidth, int displayHeight);
|
||||
void ToggleDisplayMode (int bFullscreen);
|
||||
}
|
||||
|
||||
#endif // _WIN32_H_
|
||||
|
@ -82,8 +82,6 @@ CGprofile g_cgfProf;
|
||||
|
||||
RasterFont* s_pfont = NULL;
|
||||
|
||||
static bool s_bFullscreen = false;
|
||||
|
||||
static bool s_bLastFrameDumped = false;
|
||||
#ifdef _WIN32
|
||||
static bool s_bAVIDumping = false;
|
||||
@ -241,8 +239,6 @@ bool Renderer::Init()
|
||||
(const char*)glGetString(GL_RENDERER),
|
||||
(const char*)glGetString(GL_VERSION)).c_str(), 5000);
|
||||
|
||||
s_bFullscreen = g_ActiveConfig.bFullscreen;
|
||||
|
||||
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs);
|
||||
if (numvertexattribs < 11) {
|
||||
ERROR_LOG(VIDEO, "*********\nGPU: OGL ERROR: Number of attributes %d not enough\nGPU: *********Does your video card support OpenGL 2.x?", numvertexattribs);
|
||||
@ -847,7 +843,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
|
||||
// care of disabling it in that case. It returns false in case of no post processing.
|
||||
bool applyShader = PostProcessing::ApplyShader();
|
||||
|
||||
const XFBSource* xfbSource;
|
||||
const XFBSource* xfbSource = NULL;
|
||||
|
||||
// draw each xfb source
|
||||
for (u32 i = 0; i < xfbCount; ++i)
|
||||
@ -1227,7 +1223,8 @@ void Renderer::DrawDebugText()
|
||||
std::vector<std::string> T0;
|
||||
|
||||
int W, H;
|
||||
sscanf(g_ActiveConfig.cInternalRes, "%dx%d", &W, &H);
|
||||
W = OpenGL_GetBackbufferWidth();
|
||||
H = OpenGL_GetBackbufferHeight();
|
||||
|
||||
std::string OSDM1 =
|
||||
g_ActiveConfig.bNativeResolution || g_ActiveConfig.b2xResolution ?
|
||||
|
@ -98,16 +98,11 @@ if sys.platform == 'win32':
|
||||
env['base_dir'] + '/Externals/Cg/'
|
||||
]
|
||||
gfxenv['CPPPATH'] += libs
|
||||
|
||||
|
||||
# check for Xrandr
|
||||
gfxenv['HAVE_XRANDR'] = gfxenv['HAVE_X11'] and conf.CheckPKG('xrandr')
|
||||
|
||||
conf.Define('HAVE_XRANDR', gfxenv['HAVE_XRANDR'])
|
||||
|
||||
# check for libgtk2.0
|
||||
gfxenv['HAVE_GTK2'] = gfxenv['HAVE_WX'] and conf.CheckPKG('gtk+-2.0')
|
||||
conf.Define('HAVE_GTK2', gfxenv['HAVE_GTK2'])
|
||||
conf.Define('HAVE_XRANDR', gfxenv['HAVE_XRANDR'])
|
||||
|
||||
conf.Finish()
|
||||
|
||||
|
@ -167,7 +167,7 @@ void DllDebugger(HWND _hParent, bool Show)
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void Win32AddResolutions()
|
||||
void AddResolutions()
|
||||
{
|
||||
// Search for avaliable resolutions
|
||||
|
||||
@ -201,13 +201,12 @@ void Win32AddResolutions()
|
||||
resos.push_back(strBuffer);
|
||||
i++;
|
||||
m_ConfigFrame->AddFSReso(szBuffer);
|
||||
m_ConfigFrame->AddWindowReso(szBuffer);
|
||||
}
|
||||
ZeroMemory(&dmi, sizeof(dmi));
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
void X11AddResolutions() {
|
||||
void AddResolutions() {
|
||||
// Don't modify GLWin.dpy here.
|
||||
// If the emulator is running that is bad.
|
||||
Display *dpy;
|
||||
@ -229,15 +228,12 @@ void X11AddResolutions() {
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
m_ConfigFrame->AddFSReso(temp);
|
||||
//Add same to window resolutions, since
|
||||
//they should be nearly all that's needed
|
||||
m_ConfigFrame->AddWindowReso(temp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
void CocoaAddResolutions() {
|
||||
void AddResolutions() {
|
||||
|
||||
CFArrayRef modes;
|
||||
CFRange range;
|
||||
@ -269,7 +265,6 @@ void CocoaAddResolutions() {
|
||||
sprintf(temp,"%dx%d", modeWidth, modeHeight);
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
m_ConfigFrame->AddFSReso(temp);
|
||||
m_ConfigFrame->AddWindowReso(temp);//Add same to Window ones, since they should be nearly all that's needed
|
||||
#endif
|
||||
px = modeWidth;
|
||||
py = modeHeight;
|
||||
@ -288,13 +283,7 @@ void DllConfig(HWND _hParent)
|
||||
wxWindow *frame = GetParentedWxWindow(_hParent);
|
||||
m_ConfigFrame = new GFXConfigDialogOGL(frame);
|
||||
|
||||
#if defined(_WIN32)
|
||||
Win32AddResolutions();
|
||||
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
X11AddResolutions();
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
CocoaAddResolutions();
|
||||
#endif
|
||||
AddResolutions();
|
||||
|
||||
// Prevent user to show more than 1 config window at same time
|
||||
#ifdef _WIN32
|
||||
|
Reference in New Issue
Block a user