GUI: Fixed a double keydown event in the main frame, the double click in the video window (didn't know about CS_DBLCLKS)
OpenGL: Fixed the live resolution setting git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4211 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
49e849dc94
commit
a3345ea942
|
@ -194,10 +194,9 @@ wxAuiToolBar *CCodeWindow::GetToolBar()
|
|||
|
||||
void CCodeWindow::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
if ((event.GetKeyCode() == WXK_SPACE) && Parent->IsActive())
|
||||
SingleCPUStep();
|
||||
else
|
||||
event.Skip();
|
||||
|
||||
if ((event.GetKeyCode() == WXK_SPACE) && Parent->IsActive()) SingleCPUStep();
|
||||
}
|
||||
|
||||
void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
||||
|
|
|
@ -141,14 +141,16 @@ int abc = 0;
|
|||
{
|
||||
switch (nMsg)
|
||||
{
|
||||
//case WM_LBUTTONDOWN:
|
||||
//case WM_LBUTTONUP:
|
||||
//case WM_MOUSEMOVE:
|
||||
// break;
|
||||
/*
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_MOUSEMOVE:
|
||||
break;
|
||||
case WM_LBUTTONDBLCLK:
|
||||
break;
|
||||
*/
|
||||
|
||||
// This doesn't work, strange
|
||||
//case WM_LBUTTONDBLCLK:
|
||||
//PanicAlert("Double click");
|
||||
//case WM_KEYDOWN:
|
||||
// break;
|
||||
|
||||
case WM_USER:
|
||||
|
@ -469,7 +471,7 @@ CFrame::CFrame(wxFrame* parent,
|
|||
wxAuiManagerEventHandler(CFrame::OnManagerResize),
|
||||
(wxObject*)0, this);
|
||||
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_LEFT_DOWN,
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_LEFT_DCLICK,
|
||||
wxMouseEventHandler(CFrame::OnDoubleClick),
|
||||
(wxObject*)0, this);
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_MOTION,
|
||||
|
@ -646,38 +648,19 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
|
|||
|
||||
void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
// Don't block other events
|
||||
// In this case event.Skip() cause a double posting to this function
|
||||
if (! (Core::GetState() == Core::CORE_RUN && bRenderToMain && event.GetEventObject() == this))
|
||||
event.Skip();
|
||||
|
||||
// Escape key turn off fullscreen then Stop emulation in windowed mode
|
||||
if (event.GetKeyCode() == WXK_ESCAPE)
|
||||
// Toggle fullscreen
|
||||
if (event.GetKeyCode() == WXK_ESCAPE || (event.GetKeyCode() == WXK_RETURN && event.GetModifiers() == wxMOD_ALT))
|
||||
{
|
||||
// Temporary solution to double esc keydown. When the OpenGL plugin is running all esc keydowns are duplicated
|
||||
// I'm guessing it's coming from the OpenGL plugin but I couldn't find the source of it so I added this until
|
||||
// the source of the problem surfaces.
|
||||
static double Time = 0;
|
||||
if (Common::Timer::GetDoubleTime()-1 < Time) return;
|
||||
Time = Common::Timer::GetDoubleTime();
|
||||
|
||||
DoFullscreen(!IsFullScreen());
|
||||
if (IsFullScreen())
|
||||
{
|
||||
#ifdef _WIN32
|
||||
MSWSetCursor(true);
|
||||
#endif
|
||||
}
|
||||
//UpdateGUI();
|
||||
}
|
||||
if (event.GetKeyCode() == WXK_RETURN && event.GetModifiers() == wxMOD_ALT)
|
||||
{
|
||||
// For some reasons, wxWidget doesn't proccess the Alt+Enter event there on windows.
|
||||
// But still, pressing Alt+Enter make it Fullscreen, So this is for other OS... :P
|
||||
DoFullscreen(!IsFullScreen());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
if(event.GetKeyCode() == 'M', '3', '4', '5', '6') // Send this to the video plugin WndProc
|
||||
{
|
||||
PostMessage((HWND)Core::GetWindowHandle(), WM_KEYDOWN, event.GetKeyCode(), 0);
|
||||
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, OPENGL_WM_USER_KEYDOWN, event.GetKeyCode());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -696,13 +679,14 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
|||
|
||||
void CFrame::OnKeyUp(wxKeyEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 0); // 0 = Up
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// ---------------
|
||||
// Detect double click. Kind of, for some reason we have to manually create the double click for now.
|
||||
// Detect double click
|
||||
|
||||
void CFrame::OnDoubleClick(wxMouseEvent& event)
|
||||
{
|
||||
|
@ -713,38 +697,9 @@ void CFrame::OnDoubleClick(wxMouseEvent& event)
|
|||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) return;
|
||||
|
||||
// Only detect double clicks in the rendering window, and only use this when a game is running
|
||||
if(Core::GetState() == Core::CORE_UNINITIALIZED || event.GetId() != IDM_MPANEL) return;
|
||||
if (! (Core::GetState() == Core::CORE_RUN && bRenderToMain && event.GetEventObject() == m_Panel)) return;
|
||||
|
||||
// For first click just save the time
|
||||
if(m_fLastClickTime == 0) { m_fLastClickTime = Common::Timer::GetDoubleTime(); return; }
|
||||
|
||||
// -------------------------------------------
|
||||
/* Manually detect double clicks since both wxEVT_LEFT_DCLICK and WM_LBUTTONDBLCLK stops
|
||||
working after the child window is created by the plugin */
|
||||
// ----------------------
|
||||
double TmpTime = Common::Timer::GetDoubleTime();
|
||||
int Elapsed = (TmpTime - m_fLastClickTime) * 1000;
|
||||
|
||||
// Get the double click time, if avaliable
|
||||
int DoubleClickTime;
|
||||
#ifdef _WIN32
|
||||
DoubleClickTime = GetDoubleClickTime();
|
||||
#else
|
||||
DoubleClickTime = 500; // The default in Windows
|
||||
#endif
|
||||
|
||||
m_fLastClickTime = TmpTime; // Save the click time
|
||||
|
||||
if (Elapsed < DoubleClickTime)
|
||||
{
|
||||
DoFullscreen(!IsFullScreen());
|
||||
#ifdef _WIN32
|
||||
MSWSetCursor(true); // Show the cursor again, in case it was hidden
|
||||
#endif
|
||||
m_fLastClickTime -= 10; // Don't treat repeated clicks as double clicks
|
||||
}
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
|
||||
|
@ -842,10 +797,10 @@ wxAuiNotebook* CFrame::CreateEmptyNotebook()
|
|||
}
|
||||
|
||||
|
||||
void CFrame::DoFullscreen(bool _F)
|
||||
void CFrame::DoFullscreen(bool bF)
|
||||
{
|
||||
ShowFullScreen(_F);
|
||||
if (_F)
|
||||
ShowFullScreen(bF);
|
||||
if (bF)
|
||||
{
|
||||
// Save the current mode before going to fullscreen
|
||||
AuiCurrent = m_Mgr->SavePerspective();
|
||||
|
@ -856,6 +811,14 @@ void CFrame::DoFullscreen(bool _F)
|
|||
// Restore saved perspective
|
||||
m_Mgr->LoadPerspective(AuiCurrent, true);
|
||||
}
|
||||
|
||||
// Show the cursor again, in case it was hidden
|
||||
if (IsFullScreen())
|
||||
{
|
||||
#ifdef _WIN32
|
||||
MSWSetCursor(true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Debugging, show loose windows
|
||||
|
|
|
@ -599,16 +599,13 @@ void CFrame::OnBootDrive(wxCommandEvent& event)
|
|||
// Refresh the file list and browse for a favorites directory
|
||||
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
if (m_GameListCtrl)
|
||||
{
|
||||
m_GameListCtrl->Update();
|
||||
}
|
||||
if (m_GameListCtrl) m_GameListCtrl->Update();
|
||||
}
|
||||
|
||||
|
||||
void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
m_GameListCtrl->BrowseForDirectory();
|
||||
if (m_GameListCtrl) m_GameListCtrl->BrowseForDirectory();
|
||||
}
|
||||
|
||||
// Create screenshot
|
||||
|
@ -764,8 +761,7 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event))
|
|||
// the entire screen (when we render to the main window).
|
||||
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
DoFullscreen(true);
|
||||
UpdateGUI();
|
||||
DoFullscreen(!IsFullScreen());
|
||||
}
|
||||
|
||||
void CFrame::OnToggleDualCore(wxCommandEvent& WXUNUSED (event))
|
||||
|
@ -995,10 +991,7 @@ void CFrame::GameListChanged(wxCommandEvent& event)
|
|||
break;
|
||||
}
|
||||
|
||||
if (m_GameListCtrl)
|
||||
{
|
||||
m_GameListCtrl->Update();
|
||||
}
|
||||
if (m_GameListCtrl) m_GameListCtrl->Update();
|
||||
}
|
||||
|
||||
// Enable and disable the toolbar
|
||||
|
|
|
@ -26,6 +26,7 @@ enum PLUGIN_COMM
|
|||
// Begin at 10 in case there is already messages with wParam = 0, 1, 2 and so on
|
||||
OPENGL_WM_USER_STOP = 10,
|
||||
OPENGL_WM_USER_CREATE,
|
||||
OPENGL_WM_USER_KEYDOWN,
|
||||
NJOY_RELOAD, // Reload nJoy if DirectInput has failed
|
||||
WIIMOTE_RECONNECT, // Reconnect the Wiimote if it has disconnected
|
||||
INPUT_FRAME_COUNTER, // Wind back the frame counter for rerecording
|
||||
|
|
|
@ -42,7 +42,7 @@ void Config::Load()
|
|||
|
||||
iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware
|
||||
iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
|
||||
iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, false);
|
||||
iniFile.Get("Hardware", "RenderToMainframe", &RenderToMainframe, false);
|
||||
iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true);
|
||||
iniFile.Get("Settings", "2xResolution", &b2xResolution, false);
|
||||
iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false);
|
||||
|
@ -136,7 +136,7 @@ void Config::Save()
|
|||
iniFile.Set("Hardware", "FullscreenRes", iFSResolution);
|
||||
iniFile.Set("Hardware", "Fullscreen", bFullscreen);
|
||||
iniFile.Set("Hardware", "VSync", bVSync);
|
||||
iniFile.Set("Hardware", "RenderToMainframe", renderToMainframe);
|
||||
iniFile.Set("Hardware", "RenderToMainframe", RenderToMainframe);
|
||||
iniFile.Set("Settings", "StretchToFit", bNativeResolution);
|
||||
iniFile.Set("Settings", "2xResolution", b2xResolution);
|
||||
iniFile.Set("Settings", "KeepAR_4_3", bKeepAR43);
|
||||
|
|
|
@ -52,7 +52,7 @@ struct Config
|
|||
// General
|
||||
bool bFullscreen;
|
||||
bool bHideCursor;
|
||||
bool renderToMainframe;
|
||||
bool RenderToMainframe;
|
||||
bool bVSync;
|
||||
|
||||
// Resolution control
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "TextureConverter.h"
|
||||
#include "XFB.h"
|
||||
#include "Render.h"
|
||||
|
||||
extern bool s_bHaveFramebufferBlit; // comes from Render.cpp
|
||||
|
||||
|
@ -264,10 +265,10 @@ GLuint FramebufferManager::GetEFBDepthTexture(const EFBRectangle& sourceRc) cons
|
|||
TargetRectangle FramebufferManager::ConvertEFBRectangle(const EFBRectangle& rc) const
|
||||
{
|
||||
TargetRectangle result;
|
||||
result.left = rc.left * m_targetWidth / EFB_WIDTH;
|
||||
result.top = m_targetHeight - (rc.top * m_targetHeight / EFB_HEIGHT);
|
||||
result.right = rc.right * m_targetWidth / EFB_WIDTH;
|
||||
result.bottom = m_targetHeight - (rc.bottom * m_targetHeight / EFB_HEIGHT);
|
||||
result.left = rc.left * Renderer::GetTargetWidth() / EFB_WIDTH;
|
||||
result.top = Renderer::GetTargetHeight() - (rc.top * Renderer::GetTargetHeight() / EFB_HEIGHT);
|
||||
result.right = rc.right * Renderer::GetTargetWidth() / EFB_WIDTH;
|
||||
result.bottom = Renderer::GetTargetHeight() - (rc.bottom * Renderer::GetTargetHeight() / EFB_HEIGHT);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -317,8 +318,8 @@ void FramebufferManager::copyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight
|
|||
it->xfbWidth = fbWidth;
|
||||
it->xfbHeight = fbHeight;
|
||||
|
||||
it->xfbSource.texWidth = m_targetWidth;
|
||||
it->xfbSource.texHeight = m_targetHeight;
|
||||
it->xfbSource.texWidth = Renderer::GetTargetWidth();
|
||||
it->xfbSource.texHeight = Renderer::GetTargetHeight();
|
||||
it->xfbSource.sourceRc = ConvertEFBRectangle(sourceRc);
|
||||
|
||||
xfbTexture = it->xfbSource.texture;
|
||||
|
|
|
@ -199,7 +199,7 @@ 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 ||
|
||||
if (!g_Config.RenderToMainframe ||
|
||||
g_VideoInitialize.pWindowHandle == NULL) {
|
||||
GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle,
|
||||
-1, _("Dolphin"), wxPoint(50,50), size);
|
||||
|
@ -233,7 +233,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||
// ----------------------
|
||||
|
||||
// Create a separate window
|
||||
if (!g_Config.renderToMainframe || g_VideoInitialize.pWindowHandle == NULL)
|
||||
if (!g_Config.RenderToMainframe || g_VideoInitialize.pWindowHandle == NULL)
|
||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, _T("Please wait..."));
|
||||
// Create a child window
|
||||
else
|
||||
|
@ -282,7 +282,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||
ChangeDisplaySettings(NULL, 0);
|
||||
}
|
||||
|
||||
if (g_Config.bFullscreen && !g_Config.renderToMainframe)
|
||||
if (g_Config.bFullscreen && !g_Config.RenderToMainframe)
|
||||
{
|
||||
// Hide the cursor
|
||||
ShowCursor(FALSE);
|
||||
|
|
|
@ -177,7 +177,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
|
|||
// General Display Settings
|
||||
sbBasic = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Basic Display Settings"));
|
||||
m_RenderToMainWindow = new wxCheckBox(m_PageGeneral, ID_RENDERTOMAINWINDOW, wxT("Render to main window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_RenderToMainWindow->SetValue(g_Config.renderToMainframe);
|
||||
m_RenderToMainWindow->SetValue(g_Config.RenderToMainframe);
|
||||
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);
|
||||
m_WidescreenHack = new wxCheckBox(m_PageGeneral, ID_WIDESCREEN_HACK, wxT("Wide Screen Hack"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
@ -582,7 +582,7 @@ void GFXConfigDialogOGL::GeneralSettingsChanged(wxCommandEvent& event)
|
|||
g_Config.bFullscreen = m_Fullscreen->IsChecked();
|
||||
break;
|
||||
case ID_RENDERTOMAINWINDOW:
|
||||
g_Config.renderToMainframe = m_RenderToMainWindow->IsChecked();
|
||||
g_Config.RenderToMainframe = m_RenderToMainWindow->IsChecked();
|
||||
g_Config.bFullscreen = false;
|
||||
break;
|
||||
case ID_NATIVERESOLUTION:
|
||||
|
@ -772,8 +772,8 @@ void GFXConfigDialogOGL::UpdateGUI()
|
|||
m_AutoScale->Enable(!g_Config.bUseXFB);
|
||||
|
||||
// These options are for the separate rendering window
|
||||
m_Fullscreen->Enable(!g_Config.renderToMainframe);
|
||||
if (g_Config.renderToMainframe) m_Fullscreen->SetValue(false);
|
||||
m_Fullscreen->Enable(!g_Config.RenderToMainframe);
|
||||
if (g_Config.RenderToMainframe) m_Fullscreen->SetValue(false);
|
||||
|
||||
// Disable the internal resolution option if it's set to native
|
||||
m_WindowResolutionCB->Enable(!(g_Config.bNativeResolution || g_Config.b2xResolution));
|
||||
|
|
|
@ -86,6 +86,7 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
|||
extern bool gShowDebugger;
|
||||
int OSDChoice = 0, OSDTime = 0, OSDInternalW = 0, OSDInternalH = 0;
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// OSD Menu
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
|
@ -100,8 +101,8 @@ void OSDMenu(WPARAM wParam)
|
|||
// Toggle native resolution
|
||||
if (!(g_Config.bNativeResolution || g_Config.b2xResolution))
|
||||
g_Config.bNativeResolution = true;
|
||||
else if (g_Config.bNativeResolution && g_Config.bAllow2xResolution)
|
||||
{ g_Config.bNativeResolution = false; g_Config.b2xResolution = true; }
|
||||
else if (g_Config.bNativeResolution)
|
||||
{ g_Config.bNativeResolution = false; if (g_Config.bAllow2xResolution) {g_Config.b2xResolution = true;} }
|
||||
else
|
||||
g_Config.b2xResolution = false;
|
||||
break;
|
||||
|
@ -139,7 +140,7 @@ namespace EmuWindow
|
|||
{
|
||||
|
||||
HWND m_hWnd = NULL; // The new window that is created here
|
||||
HWND m_hParent = NULL;
|
||||
HWND m_hParent = NULL; // The main wxFrame
|
||||
HWND m_hMain = NULL; // The main CPanel
|
||||
|
||||
HINSTANCE m_hInstance = NULL;
|
||||
|
@ -165,12 +166,10 @@ HWND GetWnd()
|
|||
{
|
||||
return m_hWnd;
|
||||
}
|
||||
|
||||
HWND GetParentWnd()
|
||||
{
|
||||
return m_hParent;
|
||||
}
|
||||
|
||||
HWND GetChildParentWnd()
|
||||
{
|
||||
return m_hMain;
|
||||
|
@ -235,6 +234,37 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// KeyDown events
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void OnKeyDown(WPARAM wParam)
|
||||
{
|
||||
switch (LOWORD( wParam ))
|
||||
{
|
||||
case VK_ESCAPE:
|
||||
if (g_Config.bFullscreen && !g_Config.RenderToMainframe)
|
||||
{
|
||||
// Pressing Esc switch to Windowed in Fullscreen mode
|
||||
ToggleFullscreen(m_hWnd);
|
||||
return;
|
||||
}
|
||||
else if (!g_Config.RenderToMainframe)
|
||||
{
|
||||
// And stops the emulation when already in Windowed mode
|
||||
PostMessage(m_hMain, WM_USER, OPENGL_WM_USER_STOP, 0);
|
||||
}
|
||||
break;
|
||||
case '3': // OSD keys
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
OSDMenu(wParam);
|
||||
break;
|
||||
}
|
||||
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HDC hdc;
|
||||
|
@ -255,7 +285,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||
{
|
||||
case VK_RETURN:
|
||||
// Pressing Alt+Enter switch FullScreen/Windowed
|
||||
if (m_hParent == NULL && !g_Config.renderToMainframe)
|
||||
if (m_hParent == NULL && !g_Config.RenderToMainframe)
|
||||
{
|
||||
ToggleFullscreen(hWnd);
|
||||
return 0;
|
||||
|
@ -265,29 +295,16 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
switch( LOWORD( wParam ))
|
||||
{
|
||||
case VK_ESCAPE:
|
||||
if (g_Config.bFullscreen)
|
||||
{
|
||||
// Pressing Esc switch to Windowed in Fullscreen mode
|
||||
ToggleFullscreen(hWnd);
|
||||
return 0;
|
||||
}
|
||||
else if (!g_Config.renderToMainframe)
|
||||
{
|
||||
// And stops the emulation when already in Windowed mode
|
||||
PostMessage(m_hMain, WM_USER, OPENGL_WM_USER_STOP, 0);
|
||||
}
|
||||
// Don't process this as a child window to avoid double events
|
||||
if (!g_Config.RenderToMainframe) OnKeyDown(wParam);
|
||||
break;
|
||||
case '3': // OSD keys
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
OSDMenu(wParam);
|
||||
break;
|
||||
}
|
||||
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
|
||||
|
||||
/* Post thes mouse events to the main window, it's nessesary becase in difference to the
|
||||
keyboard inputs these events only appear here, not in the parent window or any other WndProc()*/
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
PostMessage(GetChildParentWnd(), iMsg, wParam, lParam);
|
||||
break;
|
||||
|
||||
/* The reason we pick up the WM_MOUSEMOVE is to be able to change this option
|
||||
|
@ -309,23 +326,14 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||
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
|
||||
WM_USER cases we would start making wParam or lParam cases */
|
||||
if (wParam == 10)
|
||||
if (wParam == OPENGL_WM_USER_STOP)
|
||||
{
|
||||
if (lParam)
|
||||
SetCursor(hCursor);
|
||||
else
|
||||
SetCursor(hCursorBlank);
|
||||
}
|
||||
break;
|
||||
|
||||
/* Post thes mouse events to the main window, it's nessesary becase in difference to the
|
||||
keyboard inputs these events only appear here, not in the main WndProc() */
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
PostMessage(GetParentWnd(), iMsg, wParam, lParam);
|
||||
if (wParam == OPENGL_WM_USER_KEYDOWN) OnKeyDown(lParam);
|
||||
break;
|
||||
|
||||
// This is called when we close the window when we render to a separate window
|
||||
|
@ -364,7 +372,7 @@ 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;
|
||||
wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
||||
wndClass.lpfnWndProc = WndProc;
|
||||
wndClass.cbClsExtra = 0;
|
||||
wndClass.cbWndExtra = 0;
|
||||
|
|
|
@ -99,7 +99,6 @@ static int s_MSAACoverageSamples = 0;
|
|||
bool s_bHaveFramebufferBlit = false; // export to FramebufferManager.cpp
|
||||
static bool s_bHaveCoverageMSAA = false;
|
||||
static u32 s_blendMode;
|
||||
static bool s_bNativeResolution = false;
|
||||
|
||||
static volatile bool s_bScreenshot = false;
|
||||
static Common::Thread *scrshotThread = 0;
|
||||
|
@ -183,7 +182,6 @@ bool Renderer::Init()
|
|||
bool bSuccess = true;
|
||||
s_blendMode = 0;
|
||||
s_MSAACoverageSamples = 0;
|
||||
s_bNativeResolution = g_Config.bNativeResolution;
|
||||
switch (g_Config.iMultisampleMode)
|
||||
{
|
||||
case MULTISAMPLE_OFF: s_MSAASamples = 1; break;
|
||||
|
@ -304,16 +302,14 @@ bool Renderer::Init()
|
|||
{
|
||||
// The size of the framebuffer targets should really NOT be the size of the OpenGL viewport.
|
||||
// The EFB is larger than 640x480 - in fact, it's 640x528, give or take a couple of lines.
|
||||
// So the below is wrong.
|
||||
// This should really be grabbed from config rather than from OpenGL.
|
||||
s_targetwidth = (640 >= W) ? 640 : W;
|
||||
s_targetwidth = (EFB_WIDTH >= W) ? EFB_WIDTH : W;
|
||||
s_targetheight = (480 >= H) ? 480 : H;
|
||||
|
||||
// Compensate height of render target for scaling, so that we get something close to the correct number of
|
||||
// vertical pixels.
|
||||
// Adjust all heights with this ratio, the resulting height will be the same as H or EFB_HEIGHT. I.e.
|
||||
// 768 (-1) for 1024x768 etc.
|
||||
s_targetheight *= 528.0 / 480.0;
|
||||
|
||||
// Ensure a minimum target size so that the native res target always fits.
|
||||
// Ensure a minimum target size so that the native res target always fits
|
||||
if (s_targetwidth < EFB_WIDTH) s_targetwidth = EFB_WIDTH;
|
||||
if (s_targetheight < EFB_HEIGHT) s_targetheight = EFB_HEIGHT;
|
||||
}
|
||||
|
@ -327,6 +323,10 @@ bool Renderer::Init()
|
|||
// Initialize the FramebufferManager
|
||||
g_framebufferManager.Init(s_targetwidth, s_targetheight, s_MSAASamples, s_MSAACoverageSamples);
|
||||
|
||||
// Save the custom resolution
|
||||
s_targetwidth = (int)OpenGL_GetBackbufferWidth();
|
||||
s_targetheight = (int)OpenGL_GetBackbufferHeight();
|
||||
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
|
||||
if (GL_REPORT_ERROR() != GL_NO_ERROR)
|
||||
|
@ -435,12 +435,14 @@ void Renderer::Shutdown(void)
|
|||
// Return the rendering window width and height
|
||||
int Renderer::GetTargetWidth()
|
||||
{
|
||||
return s_targetwidth;
|
||||
return (g_Config.bNativeResolution || g_Config.b2xResolution) ?
|
||||
(g_Config.bNativeResolution ? EFB_WIDTH : EFB_WIDTH * 2) : s_targetwidth;
|
||||
}
|
||||
|
||||
int Renderer::GetTargetHeight()
|
||||
{
|
||||
return s_targetheight;
|
||||
return (g_Config.bNativeResolution || g_Config.b2xResolution) ?
|
||||
(g_Config.bNativeResolution ? EFB_HEIGHT : EFB_HEIGHT * 2) : s_targetheight;
|
||||
}
|
||||
|
||||
float Renderer::GetTargetScaleX()
|
||||
|
@ -1018,9 +1020,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
|
|||
// Place messages on the picture, then copy it to the screen
|
||||
SwapBuffers();
|
||||
|
||||
// Why save this as s_bNativeResolution if we updated it every frame?
|
||||
s_bNativeResolution = g_Config.bNativeResolution;
|
||||
|
||||
RestoreAPIState();
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
|
Loading…
Reference in New Issue