Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make hotkeys for togglign IR, AR, efb copies and fog settings configu…
…rable.
  • Loading branch information
RachelBryk committed Jul 30, 2013
1 parent 4987f89 commit a33b1fc
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 46 deletions.
5 changes: 4 additions & 1 deletion Source/Core/Core/Src/ConfigManager.cpp
Expand Up @@ -67,7 +67,10 @@ static const struct {
{ "Wiimote4Connect", 347 /* WXK_F8 */, 1 /* wxMOD_ALT */ },
{ "BalanceBoardConnect",348 /* WXK_F9 */, 1 /* wxMOD_ALT */ },
#endif

{ "ToggleIR", 0, 0 /* wxMOD_NONE */ },
{ "ToggleAspectRatio", 0, 0 /* wxMOD_NONE */ },
{ "ToggleEFBCopies", 0, 0 /* wxMOD_NONE */ },
{ "ToggleFog", 0, 0 /* wxMOD_NONE */ },
{ "LoadStateSlot1", 340 /* WXK_F1 */, 0 /* wxMOD_NONE */ },
{ "LoadStateSlot2", 341 /* WXK_F2 */, 0 /* wxMOD_NONE */ },
{ "LoadStateSlot3", 342 /* WXK_F3 */, 0 /* wxMOD_NONE */ },
Expand Down
5 changes: 5 additions & 0 deletions Source/Core/Core/Src/CoreParameter.h
Expand Up @@ -34,6 +34,11 @@ enum Hotkey
HK_WIIMOTE4_CONNECT,
HK_BALANCEBOARD_CONNECT,

HK_INTERNAL_RES,
HK_ASPECT_RATIO,
HK_EFB_COPIES,
HK_FOG,

HK_LOAD_STATE_SLOT_1,
HK_LOAD_STATE_SLOT_2,
HK_LOAD_STATE_SLOT_3,
Expand Down
69 changes: 32 additions & 37 deletions Source/Core/DolphinWX/Src/Frame.cpp
Expand Up @@ -846,6 +846,38 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
WiimoteId = 3;
else if (IsHotkey(event, HK_BALANCEBOARD_CONNECT))
WiimoteId = 4;
if (IsHotkey(event, HK_INTERNAL_RES))
{
OSDChoice = 1;
// Toggle native resolution
if (++g_Config.iEFBScale > SCALE_4X)
g_Config.iEFBScale = SCALE_AUTO;
}
else if (IsHotkey(event, HK_ASPECT_RATIO))
{
OSDChoice = 2;
// Toggle aspect ratio
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
}
else if (IsHotkey(event, HK_EFB_COPIES))
{
OSDChoice = 3;
// Toggle EFB copy
if (!g_Config.bEFBCopyEnable || g_Config.bCopyEFBToTexture)
{
g_Config.bEFBCopyEnable ^= true;
g_Config.bCopyEFBToTexture = false;
}
else
{
g_Config.bCopyEFBToTexture = !g_Config.bCopyEFBToTexture;
}
}
else if (IsHotkey(event, HK_FOG))
{
OSDChoice = 4;
g_Config.bDisableFog = !g_Config.bDisableFog;
}
else
{
unsigned int i = NUM_HOTKEYS;
Expand Down Expand Up @@ -891,43 +923,6 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
ConnectWiimote(WiimoteId, connect);
}

if (g_Config.bOSDHotKey && event.GetModifiers() == wxMOD_NONE)
{
switch (event.GetKeyCode())
{
case '3':
OSDChoice = 1;
// Toggle native resolution
g_Config.iEFBScale = g_Config.iEFBScale + 1;
if (g_Config.iEFBScale > 7) g_Config.iEFBScale = 0;
break;
case '4':
OSDChoice = 2;
// Toggle aspect ratio
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
break;
case '5':
OSDChoice = 3;
// Toggle EFB copy
if (!g_Config.bEFBCopyEnable || g_Config.bCopyEFBToTexture)
{
g_Config.bEFBCopyEnable ^= true;
g_Config.bCopyEFBToTexture = false;
}
else
{
g_Config.bCopyEFBToTexture = !g_Config.bCopyEFBToTexture;
}
break;
case '6':
OSDChoice = 4;
g_Config.bDisableFog = !g_Config.bDisableFog;
break;
default:
break;
}
}

if (g_Config.bFreeLook && event.GetModifiers() == wxMOD_SHIFT)
{
static float debugSpeed = 1.0f;
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/DolphinWX/Src/FrameTools.cpp
Expand Up @@ -1581,7 +1581,11 @@ void CFrame::UpdateGUI()

// Update Menu Accelerators
for (unsigned int i = 0; i < NUM_HOTKEYS; i++)
{
if (GetCmdForHotkey(i) == -1)
continue;
GetMenuBar()->FindItem(GetCmdForHotkey(i))->SetItemLabel(GetMenuLabel(i));
}

GetMenuBar()->FindItem(IDM_LOADSTATE)->Enable(Initialized);
GetMenuBar()->FindItem(IDM_SAVESTATE)->Enable(Initialized);
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/DolphinWX/Src/HotkeyDlg.cpp
Expand Up @@ -186,6 +186,10 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls(void)
_("Connect Wiimote 3"),
_("Connect Wiimote 4"),
_("Connect Balance Board"),
_("Toggle IR"),
_("Toggle Aspect Ratio"),
_("Toggle EFB Copies"),
_("Toggle Fog"),

_("Load State Slot 1"),
_("Load State Slot 2"),
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/DolphinWX/Src/VideoConfigDiag.cpp
Expand Up @@ -121,7 +121,6 @@ wxString crop_desc = wxTRANSLATE("Crop the picture from 4:3 to 5:4 or from 16:9
wxString opencl_desc = wxTRANSLATE("[EXPERIMENTAL]\nAims to speed up emulation by offloading texture decoding to the GPU using the OpenCL framework.\nHowever, right now it's known to cause texture defects in various games. Also it's slower than regular CPU texture decoding in most cases.\n\nIf unsure, leave this unchecked.");
wxString dlc_desc = wxTRANSLATE("[EXPERIMENTAL]\nSpeeds up emulation a bit by caching display lists.\nPossibly causes issues though.\n\nIf unsure, leave this unchecked.");
wxString omp_desc = wxTRANSLATE("Use multiple threads to decode textures.\nMight result in a speedup (especially on CPUs with more than two cores).\n\nIf unsure, leave this unchecked.");
wxString hotkeys_desc = wxTRANSLATE("Allows toggling certain options via the hotkeys 3 (Internal Resolution), 4 (Aspect Ratio), 5 (Copy EFB) and 6 (Fog) within the emulation window.\n\nIf unsure, leave this unchecked.");
wxString ppshader_desc = wxTRANSLATE("Apply a post-processing effect after finishing a frame.\n\nIf unsure, select (off).");
wxString cache_efb_copies_desc = wxTRANSLATE("Slightly speeds up EFB to RAM copies by sacrificing emulation accuracy.\nSometimes also increases visual quality.\nIf you're experiencing any issues, try raising texture cache accuracy or disable this option.\n\nIf unsure, leave this unchecked.");
wxString shader_errors_desc = wxTRANSLATE("Usually if shader compilation fails, an error message is displayed.\nHowever, one may skip the popups to allow interruption free gameplay by checking this option.\n\nIf unsure, leave this unchecked.");
Expand Down Expand Up @@ -559,7 +558,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con

szr_misc->Add(CreateCheckBox(page_advanced, _("Show Input Display"), wxGetTranslation(show_input_display_desc), vconfig.bShowInputDisplay));
szr_misc->Add(CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), vconfig.bCrop));
szr_misc->Add(CreateCheckBox(page_advanced, _("Enable Hotkeys"), wxGetTranslation(hotkeys_desc), vconfig.bOSDHotKey));

// Progressive Scan
{
Expand Down
3 changes: 0 additions & 3 deletions Source/Core/VideoCommon/Src/RenderBase.cpp
Expand Up @@ -254,9 +254,6 @@ void Renderer::SetScreenshot(const char *filename)
// Create On-Screen-Messages
void Renderer::DrawDebugText()
{
if (!g_Config.bOSDHotKey)
return;

// OSD Menu messages
if (OSDChoice > 0)
{
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/VideoCommon/Src/VideoConfig.cpp
Expand Up @@ -92,7 +92,6 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true);
iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false);
iniFile.Get("Hacks", "EFBCopyEnable", &bEFBCopyEnable, true);
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0);
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, true);
iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
iniFile.Get("Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable, false);
Expand Down Expand Up @@ -248,7 +247,6 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable);
iniFile.Set("Hacks", "DlistCachingEnable", bDlistCachingEnable);
iniFile.Set("Hacks", "EFBCopyEnable", bEFBCopyEnable);
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey);
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture);
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
iniFile.Set("Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable);
Expand Down
1 change: 0 additions & 1 deletion Source/Core/VideoCommon/Src/VideoConfig.h
Expand Up @@ -112,7 +112,6 @@ struct VideoConfig
bool bEFBCopyEnable;
bool bEFBCopyCacheEnable;
bool bEFBEmulateFormatChanges;
bool bOSDHotKey;
bool bCopyEFBToTexture;
bool bCopyEFBScaled;
int iSafeTextureCache_ColorSamples;
Expand Down

0 comments on commit a33b1fc

Please sign in to comment.