summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorsl1nk3.s <sl1nk3.s@gmail.com>2009-04-03 20:12:59 +0000
committersl1nk3.s <sl1nk3.s@gmail.com>2009-04-03 20:12:59 +0000
commitefb0a112013a09c0b255d696dbdfce06d9eb5938 (patch)
tree037942a2e1ab7eaf0c48ddfe2c5968bd2bfeef58 /Source
parente1c3d1bfd4fa246d32125ed3e05290fbd08d3178 (diff)
Fixed various OGL fullscreen issues, screen shaking, esc key not working, misplaced fullscreen window.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2858 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/ARCodeAddEdit.h2
-rw-r--r--Source/Plugins/Plugin_DSP_HLE/Src/HLEMixer.cpp17
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp13
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp3
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp76
6 files changed, 89 insertions, 24 deletions
diff --git a/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp b/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp
index aa84dfda7d..16e7c67b93 100644
--- a/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp
+++ b/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/Source/Core/DolphinWX/Src/ARCodeAddEdit.h b/Source/Core/DolphinWX/Src/ARCodeAddEdit.h
index 394684fa87..eaef8ffa07 100644
--- a/Source/Core/DolphinWX/Src/ARCodeAddEdit.h
+++ b/Source/Core/DolphinWX/Src/ARCodeAddEdit.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2003-2008 Dolphin Project.
+// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/HLEMixer.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/HLEMixer.cpp
index e3efae0465..c48fcaa27a 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/HLEMixer.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/HLEMixer.cpp
@@ -1,3 +1,20 @@
+// Copyright (C) 2003-2009 Dolphin Project.
+
+// This program 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, version 2.0.
+
+// This program 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 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
#include "Config.h" // Local
#include "Globals.h"
#include "DSPHandler.h"
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
index 51b263f37b..4c0771744e 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
@@ -283,15 +283,18 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
dwStyle = WS_OVERLAPPEDWINDOW;
}
- RECT rc;
- rc.left = 0; rc.top = 0;
- rc.right = s_backbuffer_width; rc.bottom = s_backbuffer_height;
+ RECT rc = {0, 0, s_backbuffer_width, s_backbuffer_height};
AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle);
+
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
- // EmuWindow::GetWnd() is either the new child window or the new separate window
- SetWindowPos(EmuWindow::GetWnd(), NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
+ // EmuWindow::GetWnd() is either the new child window or the new separate window
+ if (g_Config.bFullscreen)
+ // We put the window at the upper left corner of the screen, so x = y = 0
+ SetWindowPos(EmuWindow::GetWnd(), NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
+ else
+ SetWindowPos(EmuWindow::GetWnd(), NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be
{
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp
index 65983966d1..e8d09058fd 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp
@@ -448,6 +448,7 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
break;
case ID_RENDERTOMAINWINDOW:
g_Config.renderToMainframe = m_RenderToMainWindow->IsChecked();
+ g_Config.bFullscreen = false;
break;
case ID_NATIVERESOLUTION:
g_Config.bNativeResolution = m_NativeResolution->IsChecked();
@@ -605,6 +606,8 @@ void ConfigDialog::UpdateGUI()
// These options are for the separate rendering window
m_Fullscreen->Enable(!g_Config.renderToMainframe);
+ if (g_Config.renderToMainframe)
+ m_Fullscreen->SetValue(false);
m_FullscreenCB->Enable(!g_Config.renderToMainframe);
m_WindowResolutionCB->Enable(!g_Config.renderToMainframe);
}
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp
index d6a5c832b9..47e758be4c 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp
@@ -156,27 +156,69 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
case WM_KEYDOWN:
switch( LOWORD( wParam ))
{
- case VK_ESCAPE: // Pressing Esc Stop or Maximize
- //DestroyWindow(hWnd);
- //PostQuitMessage(0);
-
- /* The fullscreen option for Windows users is not very user friendly. With this the user
- can only get out of the fullscreen mode by pressing Esc or Alt + F4. Esc also stops
- the emulation. Todo: But currently it hangs, so I have disabled the shutdown. */
- //if (m_hParent == NULL) ExitProcess(0);
+ case VK_ESCAPE:
+ // Pressing Esc switch FullScreen/Windowed
if (m_hParent == NULL)
- {
+ {
+ int w_fs = 640, h_fs = 480;
if (g_Config.bFullscreen)
{
- //PostMessage(m_hMain, WM_USER, OPENGL_WM_USER_STOP, 0); // Stop
+ // Get out of fullscreen
+ g_Config.bFullscreen = false;
+
+ if (strlen(g_Config.iWindowedRes) > 1)
+ sscanf(g_Config.iWindowedRes, "%dx%d", &w_fs, &h_fs);
+
+ // FullScreen - > Desktop
+ ChangeDisplaySettings(NULL, 0);
+
+ // Set new window style FS -> Windowed
+ SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
+
+ // Re-Enable the cursor
+ ShowCursor(TRUE);
+
+ RECT rcdesktop;
+ RECT rc = {0, 0, w_fs, h_fs};
+ 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;
+ // SetWindowPos to the center of the screen
+ SetWindowPos(hWnd, NULL, X, Y, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
+
+ // Eventually show the window!
+ EmuWindow::Show();
}
else
{
- // Toggle maximize and restore
- if (IsZoomed(hWnd))
- ShowWindow(hWnd, SW_RESTORE);
- else
- ShowWindow(hWnd, SW_MAXIMIZE);
+ // Get into fullscreen
+ g_Config.bFullscreen = true;
+ DEVMODE dmScreenSettings;
+ memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
+
+ if (strlen(g_Config.iFSResolution) > 1)
+ sscanf(g_Config.iFSResolution, "%dx%d", &w_fs, &h_fs);
+
+ // Desktop -> FullScreen
+ dmScreenSettings.dmSize = sizeof(dmScreenSettings);
+ dmScreenSettings.dmPelsWidth = w_fs;
+ dmScreenSettings.dmPelsHeight = h_fs;
+ dmScreenSettings.dmBitsPerPel = 32;
+ dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
+ if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
+ return 0;
+ // Set new window style -> PopUp
+ SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
+
+ // Disable the cursor
+ ShowCursor(FALSE);
+
+ // SetWindowPos to the upper-left corner of the screen
+ SetWindowPos(hWnd, NULL, 0, 0, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
+
+ // Eventually show the window!
+ EmuWindow::Show();
}
return 0;
}
@@ -210,7 +252,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
break;
/* To support the separate window rendering we get the message back here. So we basically
- only let it pass through DolphinWX > Frame.cpp to determine if it should be on or off
+ 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:
/* I set wParam to 10 just in case there are other WM_USER events. If we want more
@@ -372,7 +414,7 @@ void SetSize(int width, int height)
rc.right = rc.left + w;
rc.top = (1024 - h)/2;
rc.bottom = rc.top + h;
- ::MoveWindow(m_hWnd, rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top, TRUE);
+ MoveWindow(m_hWnd, rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top, TRUE);
}
} // EmuWindow