OpenGL: Added OSD menu from 3, 4, 5 keys

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3369 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-06-08 02:48:38 +00:00
parent 97691461ca
commit 6691469164
5 changed files with 115 additions and 23 deletions

View File

@ -515,7 +515,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
ShowFullScreen(!IsFullScreen()); ShowFullScreen(!IsFullScreen());
} }
#ifdef _WIN32 #ifdef _WIN32
if(event.GetKeyCode() == 'E','M') // 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_KEYDOWN, event.GetKeyCode(), 0);
event.Skip(); // Don't block the E key event.Skip(); // Don't block the E key

View File

@ -209,6 +209,13 @@ void ConfigDialog::CreateGUIControls()
m_MSAAModeCB->Append(wxT("16xQ CSAA")); m_MSAAModeCB->Append(wxT("16xQ CSAA"));
m_MSAAModeCB->SetSelection(g_Config.iMultisampleMode); m_MSAAModeCB->SetSelection(g_Config.iMultisampleMode);
m_EFBCopyDisableHotKey = new wxCheckBox(m_PageGeneral, ID_EFBCOPYDISABLEHOTKEY, wxT("OSD Hotkeys"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
#ifndef _WIN32
// JPeterson set the hot key to be Win32-specific
m_EFBCopyDisableHotKey->Enable(false);
#endif
m_EFBCopyDisableHotKey->SetValue(g_Config.bEFBCopyDisableHotKey);
// Tool tips // Tool tips
m_Fullscreen->SetToolTip(wxT( m_Fullscreen->SetToolTip(wxT(
"This will create a Fullscreen window using the chosen Fullscreen resolution." "This will create a Fullscreen window using the chosen Fullscreen resolution."
@ -231,6 +238,8 @@ void ConfigDialog::CreateGUIControls()
"\n\nApplies instanty during gameplay: No")); "\n\nApplies instanty during gameplay: No"));
m_MSAAModeCB->SetToolTip(wxT( m_MSAAModeCB->SetToolTip(wxT(
"Applies instanty during gameplay: No")); "Applies instanty during gameplay: No"));
m_EFBCopyDisableHotKey->SetToolTip(wxT(
"Enable OSD hotkeys '3', '4', '5', etc."));
// Enhancements // Enhancements
sbEnhancements = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Enhancements")); sbEnhancements = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Enhancements"));
@ -269,10 +278,11 @@ void ConfigDialog::CreateGUIControls()
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5); sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
sBasicAdvanced = new wxGridBagSizer(0, 0); sBasicAdvanced = new wxGridBagSizer(0, 0);
sBasicAdvanced->Add(m_VSync, wxGBPosition(0, 0), wxGBSpan(1, 3), wxALL, 5); sBasicAdvanced->Add(m_EFBCopyDisableHotKey, wxGBPosition(0, 0), wxGBSpan(1, 3), wxALL, 5);
sBasicAdvanced->Add(m_UseXFB, wxGBPosition(1, 0), wxGBSpan(1, 3), wxALL, 5); sBasicAdvanced->Add(m_VSync, wxGBPosition(1, 0), wxGBSpan(1, 3), wxALL, 5);
sBasicAdvanced->Add(m_RenderToMainWindow, wxGBPosition(2, 0), wxGBSpan(1, 3), wxALL, 5); sBasicAdvanced->Add(m_UseXFB, wxGBPosition(2, 0), wxGBSpan(1, 3), wxALL, 5);
sBasicAdvanced->Add(m_AutoScale, wxGBPosition(3, 0), wxGBSpan(1, 3), wxALL, 5); sBasicAdvanced->Add(m_RenderToMainWindow, wxGBPosition(3, 0), wxGBSpan(1, 3), wxALL, 5);
sBasicAdvanced->Add(m_AutoScale, wxGBPosition(4, 0), wxGBSpan(1, 3), wxALL, 5);
sbBasicAdvanced->Add(sBasicAdvanced); sbBasicAdvanced->Add(sBasicAdvanced);
sGeneral->Add(sbBasicAdvanced, 0, wxEXPAND|wxALL, 5); sGeneral->Add(sbBasicAdvanced, 0, wxEXPAND|wxALL, 5);
@ -338,14 +348,6 @@ void ConfigDialog::CreateGUIControls()
m_Radio_CopyEFBToGL->SetToolTip(wxT("[This option will apply immediately and does not require a restart to take effect.]")); m_Radio_CopyEFBToGL->SetToolTip(wxT("[This option will apply immediately and does not require a restart to take effect.]"));
g_Config.bCopyEFBToRAM ? m_Radio_CopyEFBToRAM->SetValue(true) : m_Radio_CopyEFBToGL->SetValue(true); g_Config.bCopyEFBToRAM ? m_Radio_CopyEFBToRAM->SetValue(true) : m_Radio_CopyEFBToGL->SetValue(true);
m_EFBCopyDisableHotKey = new wxCheckBox(m_PageAdvanced, ID_EFBCOPYDISABLEHOTKEY, wxT("With hotkey E"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_EFBCopyDisableHotKey->SetToolTip(wxT("Use the E key to turn this option on and off"));
#ifndef _WIN32
// JPeterson set the hot key to be Win32-specific
m_EFBCopyDisableHotKey->Enable(false);
#endif
m_EFBCopyDisableHotKey->SetValue(g_Config.bEFBCopyDisableHotKey);
// Utility // Utility
sbUtilities = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Utilities")); sbUtilities = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Utilities"));
m_DumpTextures = new wxCheckBox(m_PageAdvanced, ID_DUMPTEXTURES, wxT("Dump textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_DumpTextures = new wxCheckBox(m_PageAdvanced, ID_DUMPTEXTURES, wxT("Dump textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -425,7 +427,6 @@ void ConfigDialog::CreateGUIControls()
wxStaticBoxSizer *sSBox = new wxStaticBoxSizer(m_StaticBox_EFB, wxVERTICAL); wxStaticBoxSizer *sSBox = new wxStaticBoxSizer(m_StaticBox_EFB, wxVERTICAL);
wxBoxSizer *sStrip1 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *sStrip1 = new wxBoxSizer(wxHORIZONTAL);
sStrip1->Add(m_CheckBox_DisableCopyEFB, 0, wxALL|wxEXPAND, 5); sStrip1->Add(m_CheckBox_DisableCopyEFB, 0, wxALL|wxEXPAND, 5);
sStrip1->Add(m_EFBCopyDisableHotKey, 0, wxALL|wxEXPAND, 5);
sSBox->Add(sStrip1, 0, wxALL|wxEXPAND, 0); sSBox->Add(sStrip1, 0, wxALL|wxEXPAND, 0);
sSBox->Add(m_Radio_CopyEFBToRAM, 0, wxALL|wxEXPAND, 5); sSBox->Add(m_Radio_CopyEFBToRAM, 0, wxALL|wxEXPAND, 5);
sSBox->Add(m_Radio_CopyEFBToGL, 0, wxALL|wxEXPAND, 5); sSBox->Add(m_Radio_CopyEFBToGL, 0, wxALL|wxEXPAND, 5);

View File

@ -94,8 +94,50 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
void DoDllDebugger(); void DoDllDebugger();
extern bool gShowDebugger; extern bool gShowDebugger;
int OSDChoice = 0, OSDTime = 0, OSDInternalW = 0, OSDInternalH = 0;
// ---------------------- // ---------------------------------------------------------------------
// OSD Menu
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
// Let's begin with 3 since 1 and 2 are default Wii keys
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
void OSDMenu(WPARAM wParam)
{
switch( LOWORD( wParam ))
{
case '3':
OSDChoice = 1;
// Toggle native resolution
g_Config.bNativeResolution = !g_Config.bNativeResolution;
break;
case '4':
OSDChoice = 2;
// Toggle aspect ratio
if (!(g_Config.bKeepAR43 || g_Config.bKeepAR169))
{ g_Config.bKeepAR43 = true; g_Config.bCrop = false; }
else if (g_Config.bKeepAR43 && !g_Config.bCrop)
g_Config.bCrop = true;
else if (g_Config.bKeepAR43)
{ g_Config.bKeepAR43 = false; g_Config.bCrop = false; g_Config.bKeepAR169 = true; }
else if (g_Config.bKeepAR169 && !g_Config.bCrop)
g_Config.bCrop = true;
else
{ g_Config.bKeepAR43 = false; g_Config.bKeepAR169 = false; g_Config.bCrop = false; }
break;
case '5':
OSDChoice = 3;
// Toggle EFB copy
g_Config.bEFBCopyDisable = !g_Config.bEFBCopyDisable;
break;
case '6':
//OSDChoice = 4;
break;
}
}
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// The rendering window // The rendering window
// ---------------------- // ----------------------
namespace EmuWindow namespace EmuWindow
@ -110,7 +152,7 @@ WNDCLASSEX wndClass;
const TCHAR m_szClassName[] = "DolphinEmuWnd"; const TCHAR m_szClassName[] = "DolphinEmuWnd";
int g_winstyle; int g_winstyle;
// ------------------------------------------ // ---------------------------------------------------------------------
/* Invisible cursor option. In the lack of a predefined IDC_BLANK we make /* Invisible cursor option. In the lack of a predefined IDC_BLANK we make
an empty transparent cursor */ an empty transparent cursor */
// ------------------ // ------------------
@ -243,13 +285,11 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
PostMessage(m_hMain, WM_USER, OPENGL_WM_USER_STOP, 0); PostMessage(m_hMain, WM_USER, OPENGL_WM_USER_STOP, 0);
} }
break; break;
case 'E': // EFB hotkey case '3': // OSD keys
if (g_Config.bEFBCopyDisableHotKey) case '4':
{ case '5':
g_Config.bEFBCopyDisable = !g_Config.bEFBCopyDisable; case '6':
OSD::AddMessage(StringFromFormat("Copy EFB was turned %s", OSDMenu(wParam);
g_Config.bEFBCopyDisable ? "off" : "on").c_str(), 5000);
}
break; break;
} }
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0); g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);

View File

@ -885,6 +885,9 @@ void Renderer::Swap(const TRectangle& rc)
v_max = (float)GetTargetHeight(); v_max = (float)GetTargetHeight();
} }
// Tell the OSD Menu about the current internal resolution
OSDInternalW = rc.right; OSDInternalH = rc.bottom;
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Apply AA // Apply AA
// ¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯
@ -1287,6 +1290,53 @@ void Renderer::DrawDebugText()
// Render a shadow, and then the text. // Render a shadow, and then the text.
Renderer::RenderText(debugtext_buffer, 21, 21, 0xDD000000); Renderer::RenderText(debugtext_buffer, 21, 21, 0xDD000000);
Renderer::RenderText(debugtext_buffer, 20, 20, 0xFF00FFFF); Renderer::RenderText(debugtext_buffer, 20, 20, 0xFF00FFFF);
// OSD Menu messages
if (OSDChoice > 0 && g_Config.bEFBCopyDisableHotKey)
{
OSDTime = timeGetTime() + 3000;
OSDChoice = -OSDChoice;
}
if (OSDTime > timeGetTime() && g_Config.bEFBCopyDisableHotKey)
{
std::string T1 = "";
std::string T2 = "";
int W, H;
sscanf(g_Config.iInternalRes, "%dx%d", &W, &H);
std::string OSDM1 =
g_Config.bNativeResolution ? StringFromFormat("%i x %i (native)", OSDInternalW, OSDInternalH)
: StringFromFormat("%i x %i", W, H);
std::string OSDM21 =
!(g_Config.bKeepAR43 || g_Config.bKeepAR169) ? "-": (g_Config.bKeepAR43 ? "4:3" : "16:9");
std::string OSDM22 =
g_Config.bCrop ? " (crop)" : "";
std::string OSDM31 =
g_Config.bCopyEFBToRAM ? "RAM" : "Texture";
std::string OSDM32 =
g_Config.bEFBCopyDisable ? "Yes" : "No";
// If there is more text than this we will have a collission
if (g_Config.bShowFPS)
{ T1 += "\n\n"; T2 += "\n\n"; }
// The latest changed setting in yellow
T1 += (OSDChoice == -1) ? StringFromFormat("3: Internal Resolution: %s\n", OSDM1.c_str()) : "\n";
T1 += (OSDChoice == -2) ? StringFromFormat("4: Lock Aspect Ratio: %s%s\n", OSDM21.c_str(), OSDM22.c_str()) : "\n";
T1 += (OSDChoice == -3) ? StringFromFormat("5: Copy Embedded Framebuffer to %s: %s\n", OSDM31.c_str(), OSDM32.c_str()) : "\n";
// The other settings in cyan
T2 += !(OSDChoice == -1) ? StringFromFormat("3: Internal Resolution: %s\n", OSDM1.c_str()) : "\n";
T2 += !(OSDChoice == -2) ? StringFromFormat("4: Lock Aspect Ratio: %s\n", OSDM21.c_str(), OSDM22.c_str()) : "\n";
T2 += !(OSDChoice == -3) ? StringFromFormat("5: Copy Embedded Framebuffer to %s: %s\n", OSDM31.c_str(), OSDM32.c_str()) : "\n";
// Render a shadow, and then the text
Renderer::RenderText(T1.c_str(), 21, 21, 0xDD000000);
Renderer::RenderText(T1.c_str(), 20, 20, 0xFFffff00);
Renderer::RenderText(T2.c_str(), 21, 21, 0xDD000000);
Renderer::RenderText(T2.c_str(), 20, 20, 0xFF00FFFF);
}
} }
void Renderer::RenderText(const char* pstr, int left, int top, u32 color) void Renderer::RenderText(const char* pstr, int left, int top, u32 color)
{ {

View File

@ -38,6 +38,7 @@ extern CGcontext g_cgcontext;
extern CGprofile g_cgvProf, g_cgfProf; extern CGprofile g_cgvProf, g_cgfProf;
extern int frameCount; extern int frameCount;
extern int OSDChoice, OSDTime, OSDInternalW, OSDInternalH;
class Renderer class Renderer
{ {