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)
|
void CCodeWindow::OnKeyDown(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
if ((event.GetKeyCode() == WXK_SPACE) && Parent->IsActive())
|
event.Skip();
|
||||||
SingleCPUStep();
|
|
||||||
else
|
if ((event.GetKeyCode() == WXK_SPACE) && Parent->IsActive()) SingleCPUStep();
|
||||||
event.Skip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
|
|
||||||
//CFrame is the main parent window. Inside CFrame there is an m_Panel that is the parent for
|
// CFrame is the main parent window. Inside CFrame there is an m_Panel that is the parent for
|
||||||
//the rendering window (when we render to the main window). In Windows the rendering window is
|
// the rendering window (when we render to the main window). In Windows the rendering window is
|
||||||
//created by giving CreateWindow() m_Panel->GetHandle() as parent window and creating a new
|
// created by giving CreateWindow() m_Panel->GetHandle() as parent window and creating a new
|
||||||
//child window to m_Panel. The new child window handle that is returned by CreateWindow() can
|
// child window to m_Panel. The new child window handle that is returned by CreateWindow() can
|
||||||
//be accessed from Core::GetWindowHandle().
|
// be accessed from Core::GetWindowHandle().
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
// Includes
|
// Includes
|
||||||
|
@ -72,7 +72,7 @@ extern "C" {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//---------------
|
// ---------------
|
||||||
// Windows functions. Setting the cursor with wxSetCursor() did not work in this instance.
|
// Windows functions. Setting the cursor with wxSetCursor() did not work in this instance.
|
||||||
// Probably because it's somehow reset from the WndProc() in the child window
|
// Probably because it's somehow reset from the WndProc() in the child window
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -103,8 +103,8 @@ HWND MSWGetParent_(HWND Parent)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------
|
// ---------------
|
||||||
//The CPanel class to receive MSWWindowProc messages from the video plugin.
|
// The CPanel class to receive MSWWindowProc messages from the video plugin.
|
||||||
|
|
||||||
extern CFrame* main_frame;
|
extern CFrame* main_frame;
|
||||||
|
|
||||||
|
@ -141,15 +141,17 @@ int abc = 0;
|
||||||
{
|
{
|
||||||
switch (nMsg)
|
switch (nMsg)
|
||||||
{
|
{
|
||||||
//case WM_LBUTTONDOWN:
|
/*
|
||||||
//case WM_LBUTTONUP:
|
case WM_LBUTTONDOWN:
|
||||||
//case WM_MOUSEMOVE:
|
case WM_LBUTTONUP:
|
||||||
// break;
|
case WM_MOUSEMOVE:
|
||||||
|
break;
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
|
||||||
// This doesn't work, strange
|
//case WM_KEYDOWN:
|
||||||
//case WM_LBUTTONDBLCLK:
|
// break;
|
||||||
//PanicAlert("Double click");
|
|
||||||
//break;
|
|
||||||
|
|
||||||
case WM_USER:
|
case WM_USER:
|
||||||
switch(wParam)
|
switch(wParam)
|
||||||
|
@ -469,7 +471,7 @@ CFrame::CFrame(wxFrame* parent,
|
||||||
wxAuiManagerEventHandler(CFrame::OnManagerResize),
|
wxAuiManagerEventHandler(CFrame::OnManagerResize),
|
||||||
(wxObject*)0, this);
|
(wxObject*)0, this);
|
||||||
|
|
||||||
wxTheApp->Connect(wxID_ANY, wxEVT_LEFT_DOWN,
|
wxTheApp->Connect(wxID_ANY, wxEVT_LEFT_DCLICK,
|
||||||
wxMouseEventHandler(CFrame::OnDoubleClick),
|
wxMouseEventHandler(CFrame::OnDoubleClick),
|
||||||
(wxObject*)0, this);
|
(wxObject*)0, this);
|
||||||
wxTheApp->Connect(wxID_ANY, wxEVT_MOTION,
|
wxTheApp->Connect(wxID_ANY, wxEVT_MOTION,
|
||||||
|
@ -646,38 +648,19 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
|
||||||
|
|
||||||
void CFrame::OnKeyDown(wxKeyEvent& event)
|
void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
// Don't block other events
|
// In this case event.Skip() cause a double posting to this function
|
||||||
event.Skip();
|
if (! (Core::GetState() == Core::CORE_RUN && bRenderToMain && event.GetEventObject() == this))
|
||||||
|
event.Skip();
|
||||||
|
|
||||||
// Escape key turn off fullscreen then Stop emulation in windowed mode
|
// Toggle fullscreen
|
||||||
if (event.GetKeyCode() == WXK_ESCAPE)
|
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());
|
DoFullscreen(!IsFullScreen());
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if(event.GetKeyCode() == 'M', '3', '4', '5', '6') // Send this to the video plugin WndProc
|
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
|
#endif
|
||||||
|
|
||||||
|
@ -696,13 +679,14 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
|
|
||||||
void CFrame::OnKeyUp(wxKeyEvent& event)
|
void CFrame::OnKeyUp(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
|
event.Skip();
|
||||||
|
|
||||||
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||||
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 0); // 0 = Up
|
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)
|
void CFrame::OnDoubleClick(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
|
@ -713,38 +697,9 @@ void CFrame::OnDoubleClick(wxMouseEvent& event)
|
||||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) return;
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) return;
|
||||||
|
|
||||||
// Only detect double clicks in the rendering window, and only use this when a game is running
|
// 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
|
DoFullscreen(!IsFullScreen());
|
||||||
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);
|
ShowFullScreen(bF);
|
||||||
if (_F)
|
if (bF)
|
||||||
{
|
{
|
||||||
// Save the current mode before going to fullscreen
|
// Save the current mode before going to fullscreen
|
||||||
AuiCurrent = m_Mgr->SavePerspective();
|
AuiCurrent = m_Mgr->SavePerspective();
|
||||||
|
@ -856,6 +811,14 @@ void CFrame::DoFullscreen(bool _F)
|
||||||
// Restore saved perspective
|
// Restore saved perspective
|
||||||
m_Mgr->LoadPerspective(AuiCurrent, true);
|
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
|
// Debugging, show loose windows
|
||||||
|
|
|
@ -599,16 +599,13 @@ void CFrame::OnBootDrive(wxCommandEvent& event)
|
||||||
// Refresh the file list and browse for a favorites directory
|
// Refresh the file list and browse for a favorites directory
|
||||||
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
|
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
if (m_GameListCtrl)
|
if (m_GameListCtrl) m_GameListCtrl->Update();
|
||||||
{
|
|
||||||
m_GameListCtrl->Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
|
void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
m_GameListCtrl->BrowseForDirectory();
|
if (m_GameListCtrl) m_GameListCtrl->BrowseForDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create screenshot
|
// Create screenshot
|
||||||
|
@ -764,8 +761,7 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event))
|
||||||
// the entire screen (when we render to the main window).
|
// the entire screen (when we render to the main window).
|
||||||
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event))
|
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
DoFullscreen(true);
|
DoFullscreen(!IsFullScreen());
|
||||||
UpdateGUI();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnToggleDualCore(wxCommandEvent& WXUNUSED (event))
|
void CFrame::OnToggleDualCore(wxCommandEvent& WXUNUSED (event))
|
||||||
|
@ -995,10 +991,7 @@ void CFrame::GameListChanged(wxCommandEvent& event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_GameListCtrl)
|
if (m_GameListCtrl) m_GameListCtrl->Update();
|
||||||
{
|
|
||||||
m_GameListCtrl->Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable and disable the toolbar
|
// 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
|
// 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_STOP = 10,
|
||||||
OPENGL_WM_USER_CREATE,
|
OPENGL_WM_USER_CREATE,
|
||||||
|
OPENGL_WM_USER_KEYDOWN,
|
||||||
NJOY_RELOAD, // Reload nJoy if DirectInput has failed
|
NJOY_RELOAD, // Reload nJoy if DirectInput has failed
|
||||||
WIIMOTE_RECONNECT, // Reconnect the Wiimote if it has disconnected
|
WIIMOTE_RECONNECT, // Reconnect the Wiimote if it has disconnected
|
||||||
INPUT_FRAME_COUNTER, // Wind back the frame counter for rerecording
|
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", "Fullscreen", &bFullscreen, 0); // Hardware
|
||||||
iniFile.Get("Hardware", "VSync", &bVSync, 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", "StretchToFit", &bNativeResolution, true);
|
||||||
iniFile.Get("Settings", "2xResolution", &b2xResolution, false);
|
iniFile.Get("Settings", "2xResolution", &b2xResolution, false);
|
||||||
iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false);
|
iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false);
|
||||||
|
@ -136,7 +136,7 @@ void Config::Save()
|
||||||
iniFile.Set("Hardware", "FullscreenRes", iFSResolution);
|
iniFile.Set("Hardware", "FullscreenRes", iFSResolution);
|
||||||
iniFile.Set("Hardware", "Fullscreen", bFullscreen);
|
iniFile.Set("Hardware", "Fullscreen", bFullscreen);
|
||||||
iniFile.Set("Hardware", "VSync", bVSync);
|
iniFile.Set("Hardware", "VSync", bVSync);
|
||||||
iniFile.Set("Hardware", "RenderToMainframe", renderToMainframe);
|
iniFile.Set("Hardware", "RenderToMainframe", RenderToMainframe);
|
||||||
iniFile.Set("Settings", "StretchToFit", bNativeResolution);
|
iniFile.Set("Settings", "StretchToFit", bNativeResolution);
|
||||||
iniFile.Set("Settings", "2xResolution", b2xResolution);
|
iniFile.Set("Settings", "2xResolution", b2xResolution);
|
||||||
iniFile.Set("Settings", "KeepAR_4_3", bKeepAR43);
|
iniFile.Set("Settings", "KeepAR_4_3", bKeepAR43);
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct Config
|
||||||
// General
|
// General
|
||||||
bool bFullscreen;
|
bool bFullscreen;
|
||||||
bool bHideCursor;
|
bool bHideCursor;
|
||||||
bool renderToMainframe;
|
bool RenderToMainframe;
|
||||||
bool bVSync;
|
bool bVSync;
|
||||||
|
|
||||||
// Resolution control
|
// Resolution control
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "TextureConverter.h"
|
#include "TextureConverter.h"
|
||||||
#include "XFB.h"
|
#include "XFB.h"
|
||||||
|
#include "Render.h"
|
||||||
|
|
||||||
extern bool s_bHaveFramebufferBlit; // comes from Render.cpp
|
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 FramebufferManager::ConvertEFBRectangle(const EFBRectangle& rc) const
|
||||||
{
|
{
|
||||||
TargetRectangle result;
|
TargetRectangle result;
|
||||||
result.left = rc.left * m_targetWidth / EFB_WIDTH;
|
result.left = rc.left * Renderer::GetTargetWidth() / EFB_WIDTH;
|
||||||
result.top = m_targetHeight - (rc.top * m_targetHeight / EFB_HEIGHT);
|
result.top = Renderer::GetTargetHeight() - (rc.top * Renderer::GetTargetHeight() / EFB_HEIGHT);
|
||||||
result.right = rc.right * m_targetWidth / EFB_WIDTH;
|
result.right = rc.right * Renderer::GetTargetWidth() / EFB_WIDTH;
|
||||||
result.bottom = m_targetHeight - (rc.bottom * m_targetHeight / EFB_HEIGHT);
|
result.bottom = Renderer::GetTargetHeight() - (rc.bottom * Renderer::GetTargetHeight() / EFB_HEIGHT);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,8 +318,8 @@ void FramebufferManager::copyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight
|
||||||
it->xfbWidth = fbWidth;
|
it->xfbWidth = fbWidth;
|
||||||
it->xfbHeight = fbHeight;
|
it->xfbHeight = fbHeight;
|
||||||
|
|
||||||
it->xfbSource.texWidth = m_targetWidth;
|
it->xfbSource.texWidth = Renderer::GetTargetWidth();
|
||||||
it->xfbSource.texHeight = m_targetHeight;
|
it->xfbSource.texHeight = Renderer::GetTargetHeight();
|
||||||
it->xfbSource.sourceRc = ConvertEFBRectangle(sourceRc);
|
it->xfbSource.sourceRc = ConvertEFBRectangle(sourceRc);
|
||||||
|
|
||||||
xfbTexture = it->xfbSource.texture;
|
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};
|
int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
|
||||||
|
|
||||||
wxSize size(_iwidth, _iheight);
|
wxSize size(_iwidth, _iheight);
|
||||||
if (!g_Config.renderToMainframe ||
|
if (!g_Config.RenderToMainframe ||
|
||||||
g_VideoInitialize.pWindowHandle == NULL) {
|
g_VideoInitialize.pWindowHandle == NULL) {
|
||||||
GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle,
|
GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle,
|
||||||
-1, _("Dolphin"), wxPoint(50,50), size);
|
-1, _("Dolphin"), wxPoint(50,50), size);
|
||||||
|
@ -233,7 +233,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||||
// ----------------------
|
// ----------------------
|
||||||
|
|
||||||
// Create a separate window
|
// 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..."));
|
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, _T("Please wait..."));
|
||||||
// Create a child window
|
// Create a child window
|
||||||
else
|
else
|
||||||
|
@ -282,7 +282,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||||
ChangeDisplaySettings(NULL, 0);
|
ChangeDisplaySettings(NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Config.bFullscreen && !g_Config.renderToMainframe)
|
if (g_Config.bFullscreen && !g_Config.RenderToMainframe)
|
||||||
{
|
{
|
||||||
// Hide the cursor
|
// Hide the cursor
|
||||||
ShowCursor(FALSE);
|
ShowCursor(FALSE);
|
||||||
|
|
|
@ -177,7 +177,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
|
||||||
// General Display Settings
|
// General Display Settings
|
||||||
sbBasic = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Basic 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 = 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_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_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);
|
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();
|
g_Config.bFullscreen = m_Fullscreen->IsChecked();
|
||||||
break;
|
break;
|
||||||
case ID_RENDERTOMAINWINDOW:
|
case ID_RENDERTOMAINWINDOW:
|
||||||
g_Config.renderToMainframe = m_RenderToMainWindow->IsChecked();
|
g_Config.RenderToMainframe = m_RenderToMainWindow->IsChecked();
|
||||||
g_Config.bFullscreen = false;
|
g_Config.bFullscreen = false;
|
||||||
break;
|
break;
|
||||||
case ID_NATIVERESOLUTION:
|
case ID_NATIVERESOLUTION:
|
||||||
|
@ -772,8 +772,8 @@ void GFXConfigDialogOGL::UpdateGUI()
|
||||||
m_AutoScale->Enable(!g_Config.bUseXFB);
|
m_AutoScale->Enable(!g_Config.bUseXFB);
|
||||||
|
|
||||||
// These options are for the separate rendering window
|
// These options are for the separate rendering window
|
||||||
m_Fullscreen->Enable(!g_Config.renderToMainframe);
|
m_Fullscreen->Enable(!g_Config.RenderToMainframe);
|
||||||
if (g_Config.renderToMainframe) m_Fullscreen->SetValue(false);
|
if (g_Config.RenderToMainframe) m_Fullscreen->SetValue(false);
|
||||||
|
|
||||||
// Disable the internal resolution option if it's set to native
|
// Disable the internal resolution option if it's set to native
|
||||||
m_WindowResolutionCB->Enable(!(g_Config.bNativeResolution || g_Config.b2xResolution));
|
m_WindowResolutionCB->Enable(!(g_Config.bNativeResolution || g_Config.b2xResolution));
|
||||||
|
|
|
@ -86,6 +86,7 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||||
extern bool gShowDebugger;
|
extern bool gShowDebugger;
|
||||||
int OSDChoice = 0, OSDTime = 0, OSDInternalW = 0, OSDInternalH = 0;
|
int OSDChoice = 0, OSDTime = 0, OSDInternalW = 0, OSDInternalH = 0;
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// OSD Menu
|
// OSD Menu
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
|
@ -100,8 +101,8 @@ void OSDMenu(WPARAM wParam)
|
||||||
// Toggle native resolution
|
// Toggle native resolution
|
||||||
if (!(g_Config.bNativeResolution || g_Config.b2xResolution))
|
if (!(g_Config.bNativeResolution || g_Config.b2xResolution))
|
||||||
g_Config.bNativeResolution = true;
|
g_Config.bNativeResolution = true;
|
||||||
else if (g_Config.bNativeResolution && g_Config.bAllow2xResolution)
|
else if (g_Config.bNativeResolution)
|
||||||
{ g_Config.bNativeResolution = false; g_Config.b2xResolution = true; }
|
{ g_Config.bNativeResolution = false; if (g_Config.bAllow2xResolution) {g_Config.b2xResolution = true;} }
|
||||||
else
|
else
|
||||||
g_Config.b2xResolution = false;
|
g_Config.b2xResolution = false;
|
||||||
break;
|
break;
|
||||||
|
@ -139,7 +140,7 @@ namespace EmuWindow
|
||||||
{
|
{
|
||||||
|
|
||||||
HWND m_hWnd = NULL; // The new window that is created here
|
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
|
HWND m_hMain = NULL; // The main CPanel
|
||||||
|
|
||||||
HINSTANCE m_hInstance = NULL;
|
HINSTANCE m_hInstance = NULL;
|
||||||
|
@ -165,12 +166,10 @@ HWND GetWnd()
|
||||||
{
|
{
|
||||||
return m_hWnd;
|
return m_hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND GetParentWnd()
|
HWND GetParentWnd()
|
||||||
{
|
{
|
||||||
return m_hParent;
|
return m_hParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND GetChildParentWnd()
|
HWND GetChildParentWnd()
|
||||||
{
|
{
|
||||||
return m_hMain;
|
return m_hMain;
|
||||||
|
@ -235,7 +234,38 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
// ---------------------------------------------------------------------
|
||||||
|
// 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;
|
HDC hdc;
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
|
@ -255,7 +285,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
case VK_RETURN:
|
case VK_RETURN:
|
||||||
// Pressing Alt+Enter switch FullScreen/Windowed
|
// Pressing Alt+Enter switch FullScreen/Windowed
|
||||||
if (m_hParent == NULL && !g_Config.renderToMainframe)
|
if (m_hParent == NULL && !g_Config.RenderToMainframe)
|
||||||
{
|
{
|
||||||
ToggleFullscreen(hWnd);
|
ToggleFullscreen(hWnd);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -265,31 +295,18 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
switch( LOWORD( wParam ))
|
// Don't process this as a child window to avoid double events
|
||||||
{
|
if (!g_Config.RenderToMainframe) OnKeyDown(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);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
break;
|
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 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
|
/* 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
|
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
|
is loaded and go with that. This should only produce a minimal performance hit
|
||||||
|
@ -309,25 +326,16 @@ 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
|
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 */
|
and coordinate it with the other settings if nessesary */
|
||||||
case WM_USER:
|
case WM_USER:
|
||||||
/* I set wParam to 10 just in case there are other WM_USER events. If we want more
|
if (wParam == OPENGL_WM_USER_STOP)
|
||||||
WM_USER cases we would start making wParam or lParam cases */
|
|
||||||
if (wParam == 10)
|
|
||||||
{
|
{
|
||||||
if (lParam)
|
if (lParam)
|
||||||
SetCursor(hCursor);
|
SetCursor(hCursor);
|
||||||
else
|
else
|
||||||
SetCursor(hCursorBlank);
|
SetCursor(hCursorBlank);
|
||||||
}
|
}
|
||||||
|
if (wParam == OPENGL_WM_USER_KEYDOWN) OnKeyDown(lParam);
|
||||||
break;
|
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);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// This is called when we close the window when we render to a separate window
|
// 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)
|
if (m_hParent == NULL)
|
||||||
|
@ -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)
|
HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const TCHAR *title)
|
||||||
{
|
{
|
||||||
wndClass.cbSize = sizeof( wndClass );
|
wndClass.cbSize = sizeof( wndClass );
|
||||||
wndClass.style = CS_HREDRAW | CS_VREDRAW;
|
wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
||||||
wndClass.lpfnWndProc = WndProc;
|
wndClass.lpfnWndProc = WndProc;
|
||||||
wndClass.cbClsExtra = 0;
|
wndClass.cbClsExtra = 0;
|
||||||
wndClass.cbWndExtra = 0;
|
wndClass.cbWndExtra = 0;
|
||||||
|
|
|
@ -99,7 +99,6 @@ static int s_MSAACoverageSamples = 0;
|
||||||
bool s_bHaveFramebufferBlit = false; // export to FramebufferManager.cpp
|
bool s_bHaveFramebufferBlit = false; // export to FramebufferManager.cpp
|
||||||
static bool s_bHaveCoverageMSAA = false;
|
static bool s_bHaveCoverageMSAA = false;
|
||||||
static u32 s_blendMode;
|
static u32 s_blendMode;
|
||||||
static bool s_bNativeResolution = false;
|
|
||||||
|
|
||||||
static volatile bool s_bScreenshot = false;
|
static volatile bool s_bScreenshot = false;
|
||||||
static Common::Thread *scrshotThread = 0;
|
static Common::Thread *scrshotThread = 0;
|
||||||
|
@ -183,7 +182,6 @@ bool Renderer::Init()
|
||||||
bool bSuccess = true;
|
bool bSuccess = true;
|
||||||
s_blendMode = 0;
|
s_blendMode = 0;
|
||||||
s_MSAACoverageSamples = 0;
|
s_MSAACoverageSamples = 0;
|
||||||
s_bNativeResolution = g_Config.bNativeResolution;
|
|
||||||
switch (g_Config.iMultisampleMode)
|
switch (g_Config.iMultisampleMode)
|
||||||
{
|
{
|
||||||
case MULTISAMPLE_OFF: s_MSAASamples = 1; break;
|
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 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.
|
// The EFB is larger than 640x480 - in fact, it's 640x528, give or take a couple of lines.
|
||||||
// So the below is wrong.
|
s_targetwidth = (EFB_WIDTH >= W) ? EFB_WIDTH : W;
|
||||||
// This should really be grabbed from config rather than from OpenGL.
|
|
||||||
s_targetwidth = (640 >= W) ? 640 : W;
|
|
||||||
s_targetheight = (480 >= H) ? 480 : H;
|
s_targetheight = (480 >= H) ? 480 : H;
|
||||||
|
|
||||||
// Compensate height of render target for scaling, so that we get something close to the correct number of
|
// Adjust all heights with this ratio, the resulting height will be the same as H or EFB_HEIGHT. I.e.
|
||||||
// vertical pixels.
|
// 768 (-1) for 1024x768 etc.
|
||||||
s_targetheight *= 528.0 / 480.0;
|
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_targetwidth < EFB_WIDTH) s_targetwidth = EFB_WIDTH;
|
||||||
if (s_targetheight < EFB_HEIGHT) s_targetheight = EFB_HEIGHT;
|
if (s_targetheight < EFB_HEIGHT) s_targetheight = EFB_HEIGHT;
|
||||||
}
|
}
|
||||||
|
@ -327,6 +323,10 @@ bool Renderer::Init()
|
||||||
// Initialize the FramebufferManager
|
// Initialize the FramebufferManager
|
||||||
g_framebufferManager.Init(s_targetwidth, s_targetheight, s_MSAASamples, s_MSAACoverageSamples);
|
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);
|
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||||
|
|
||||||
if (GL_REPORT_ERROR() != GL_NO_ERROR)
|
if (GL_REPORT_ERROR() != GL_NO_ERROR)
|
||||||
|
@ -435,12 +435,14 @@ void Renderer::Shutdown(void)
|
||||||
// Return the rendering window width and height
|
// Return the rendering window width and height
|
||||||
int Renderer::GetTargetWidth()
|
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()
|
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()
|
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
|
// Place messages on the picture, then copy it to the screen
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
|
||||||
// Why save this as s_bNativeResolution if we updated it every frame?
|
|
||||||
s_bNativeResolution = g_Config.bNativeResolution;
|
|
||||||
|
|
||||||
RestoreAPIState();
|
RestoreAPIState();
|
||||||
|
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
Loading…
Reference in New Issue