[Project64] Try to fix key assignments

This commit is contained in:
zilmar 2017-04-29 15:55:30 +10:00
parent 40e6919c61
commit 0ed144f39d
9 changed files with 280 additions and 200 deletions

View File

@ -61,9 +61,9 @@ const char * SystemEventName(SystemEvent event)
}
CSystemEvents::CSystemEvents(CN64System * System, CPlugins * Plugins) :
m_System(System),
m_Plugins(Plugins),
m_bDoSomething(false)
m_System(System),
m_Plugins(Plugins),
m_bDoSomething(false)
{
}

View File

@ -98,7 +98,7 @@ CN64System::CN64System(CPlugins * Plugins, bool SavesReadOnly, bool SyncSystem)
m_Recomp = new CRecompiler(m_MMU_VM, m_Reg, m_EndEmulation);
}
}
WriteTrace(TraceN64System, TraceDebug, "Done");
}

View File

@ -37,7 +37,7 @@
CSettings * g_Settings = NULL;
CSettings::CSettings() :
m_NextAutoSettingId(0x200000)
m_NextAutoSettingId(0x200000)
{
}

View File

@ -6,9 +6,9 @@
#include <commdlg.h>
CMainMenu::CMainMenu(CMainGui * hMainWindow) :
CBaseMenu(),
m_ResetAccelerators(true),
m_Gui(hMainWindow)
CBaseMenu(),
m_ResetAccelerators(true),
m_Gui(hMainWindow)
{
ResetMenu();
@ -681,10 +681,10 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
bool RomLoaded = g_Settings->LoadStringVal(Game_GameName).length() > 0;
bool RomList = UISettingsLoadBool(RomBrowser_Enabled) && !CPURunning;
CMenuShortCutKey::ACCESS_MODE AccessLevel = CMenuShortCutKey::GAME_NOT_RUNNING;
CMenuShortCutKey::RUNNING_STATE RunningState = CMenuShortCutKey::RUNNING_STATE_NOT_RUNNING;
if (g_Settings->LoadBool(GameRunning_CPU_Running))
{
AccessLevel = UISettingsLoadBool(UserInterface_InFullScreen) ? CMenuShortCutKey::GAME_RUNNING_FULLSCREEN : CMenuShortCutKey::GAME_RUNNING_WINDOW;
RunningState = UISettingsLoadBool(UserInterface_InFullScreen) ? CMenuShortCutKey::RUNNING_STATE_FULLSCREEN : CMenuShortCutKey::RUNNING_STATE_WINDOWED;
}
//Get the system information to make the menu
@ -739,19 +739,19 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
/* File Menu
****************/
MenuItemList FileMenu;
Item.Reset(ID_FILE_OPEN_ROM, MENU_OPEN, m_ShortCuts.ShortCutString(ID_FILE_OPEN_ROM, AccessLevel));
Item.Reset(ID_FILE_OPEN_ROM, MENU_OPEN, m_ShortCuts.ShortCutString(ID_FILE_OPEN_ROM, RunningState));
FileMenu.push_back(Item);
if (!inBasicMode)
{
Item.Reset(ID_FILE_ROM_INFO, MENU_ROM_INFO, m_ShortCuts.ShortCutString(ID_FILE_ROM_INFO, AccessLevel));
Item.Reset(ID_FILE_ROM_INFO, MENU_ROM_INFO, m_ShortCuts.ShortCutString(ID_FILE_ROM_INFO, RunningState));
Item.SetItemEnabled(RomLoaded);
FileMenu.push_back(Item);
FileMenu.push_back(MENU_ITEM(SPLITER));
Item.Reset(ID_FILE_STARTEMULATION, MENU_START, m_ShortCuts.ShortCutString(ID_FILE_STARTEMULATION, AccessLevel));
Item.Reset(ID_FILE_STARTEMULATION, MENU_START, m_ShortCuts.ShortCutString(ID_FILE_STARTEMULATION, RunningState));
Item.SetItemEnabled(RomLoaded && !CPURunning);
FileMenu.push_back(Item);
}
Item.Reset(ID_FILE_ENDEMULATION, MENU_END, m_ShortCuts.ShortCutString(ID_FILE_ENDEMULATION, AccessLevel));
Item.Reset(ID_FILE_ENDEMULATION, MENU_END, m_ShortCuts.ShortCutString(ID_FILE_ENDEMULATION, RunningState));
Item.SetItemEnabled(CPURunning);
FileMenu.push_back(Item);
FileMenu.push_back(MENU_ITEM(SPLITER));
@ -760,9 +760,9 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
if (RomList)
{
FileMenu.push_back(MENU_ITEM(SPLITER));
Item.Reset(ID_FILE_ROMDIRECTORY, MENU_CHOOSE_ROM, m_ShortCuts.ShortCutString(ID_FILE_ROMDIRECTORY, AccessLevel));
Item.Reset(ID_FILE_ROMDIRECTORY, MENU_CHOOSE_ROM, m_ShortCuts.ShortCutString(ID_FILE_ROMDIRECTORY, RunningState));
FileMenu.push_back(Item);
Item.Reset(ID_FILE_REFRESHROMLIST, MENU_REFRESH, m_ShortCuts.ShortCutString(ID_FILE_REFRESHROMLIST, AccessLevel));
Item.Reset(ID_FILE_REFRESHROMLIST, MENU_REFRESH, m_ShortCuts.ShortCutString(ID_FILE_REFRESHROMLIST, RunningState));
FileMenu.push_back(Item);
}
@ -796,44 +796,44 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
}
}
FileMenu.push_back(MENU_ITEM(SPLITER));
FileMenu.push_back(MENU_ITEM(ID_FILE_EXIT, MENU_EXIT, m_ShortCuts.ShortCutString(ID_FILE_EXIT, AccessLevel)));
FileMenu.push_back(MENU_ITEM(ID_FILE_EXIT, MENU_EXIT, m_ShortCuts.ShortCutString(ID_FILE_EXIT, RunningState)));
/* Current Save
****************/
MenuItemList CurrentSaveMenu;
DWORD _CurrentSaveState = g_Settings->LoadDword(Game_CurrentSaveState);
Item.Reset(ID_CURRENT_SAVE_DEFAULT, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_DEFAULT, AccessLevel), NULL, GetSaveSlotString(0));
Item.Reset(ID_CURRENT_SAVE_DEFAULT, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_DEFAULT, RunningState), NULL, GetSaveSlotString(0));
if (_CurrentSaveState == 0) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
CurrentSaveMenu.push_back(MENU_ITEM(SPLITER));
Item.Reset(ID_CURRENT_SAVE_1, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_1, AccessLevel), NULL, GetSaveSlotString(1));
Item.Reset(ID_CURRENT_SAVE_1, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_1, RunningState), NULL, GetSaveSlotString(1));
if (_CurrentSaveState == 1) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
Item.Reset(ID_CURRENT_SAVE_2, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_2, AccessLevel), NULL, GetSaveSlotString(2));
Item.Reset(ID_CURRENT_SAVE_2, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_2, RunningState), NULL, GetSaveSlotString(2));
if (_CurrentSaveState == 2) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
Item.Reset(ID_CURRENT_SAVE_3, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_3, AccessLevel), NULL, GetSaveSlotString(3));
Item.Reset(ID_CURRENT_SAVE_3, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_3, RunningState), NULL, GetSaveSlotString(3));
if (_CurrentSaveState == 3) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
Item.Reset(ID_CURRENT_SAVE_4, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_4, AccessLevel), NULL, GetSaveSlotString(4));
Item.Reset(ID_CURRENT_SAVE_4, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_4, RunningState), NULL, GetSaveSlotString(4));
if (_CurrentSaveState == 4) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
Item.Reset(ID_CURRENT_SAVE_5, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_5, AccessLevel), NULL, GetSaveSlotString(5));
Item.Reset(ID_CURRENT_SAVE_5, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_5, RunningState), NULL, GetSaveSlotString(5));
if (_CurrentSaveState == 5) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
Item.Reset(ID_CURRENT_SAVE_6, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_6, AccessLevel), NULL, GetSaveSlotString(6));
Item.Reset(ID_CURRENT_SAVE_6, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_6, RunningState), NULL, GetSaveSlotString(6));
if (_CurrentSaveState == 6) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
Item.Reset(ID_CURRENT_SAVE_7, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_7, AccessLevel), NULL, GetSaveSlotString(7));
Item.Reset(ID_CURRENT_SAVE_7, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_7, RunningState), NULL, GetSaveSlotString(7));
if (_CurrentSaveState == 7) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
Item.Reset(ID_CURRENT_SAVE_8, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_8, AccessLevel), NULL, GetSaveSlotString(8));
Item.Reset(ID_CURRENT_SAVE_8, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_8, RunningState), NULL, GetSaveSlotString(8));
if (_CurrentSaveState == 8) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
Item.Reset(ID_CURRENT_SAVE_9, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_9, AccessLevel), NULL, GetSaveSlotString(9));
Item.Reset(ID_CURRENT_SAVE_9, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_9, RunningState), NULL, GetSaveSlotString(9));
if (_CurrentSaveState == 9) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
Item.Reset(ID_CURRENT_SAVE_10, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_10, AccessLevel), NULL, GetSaveSlotString(10));
Item.Reset(ID_CURRENT_SAVE_10, EMPTY_STRING, m_ShortCuts.ShortCutString(ID_CURRENT_SAVE_10, RunningState), NULL, GetSaveSlotString(10));
if (_CurrentSaveState == 10) { Item.SetItemTicked(true); }
CurrentSaveMenu.push_back(Item);
@ -843,55 +843,55 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
MenuItemList ResetMenu;
if (inBasicMode)
{
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_SOFT, MENU_RESET, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_SOFT, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_SOFT, MENU_RESET, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_SOFT, RunningState)));
}
else
{
ResetMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_SOFT, MENU_RESET_SOFT, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_SOFT, AccessLevel)));
ResetMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_HARD, MENU_RESET_HARD, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_HARD, AccessLevel)));
ResetMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_SOFT, MENU_RESET_SOFT, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_SOFT, RunningState)));
ResetMenu.push_back(MENU_ITEM(ID_SYSTEM_RESET_HARD, MENU_RESET_HARD, m_ShortCuts.ShortCutString(ID_SYSTEM_RESET_HARD, RunningState)));
SystemMenu.push_back(MENU_ITEM(SUB_MENU, MENU_RESET, EMPTY_STDSTR, &ResetMenu));
}
if (g_Settings->LoadBool(GameRunning_CPU_Paused))
{
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_PAUSE, MENU_RESUME, m_ShortCuts.ShortCutString(ID_SYSTEM_PAUSE, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_PAUSE, MENU_RESUME, m_ShortCuts.ShortCutString(ID_SYSTEM_PAUSE, RunningState)));
}
else
{
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_PAUSE, MENU_PAUSE, m_ShortCuts.ShortCutString(ID_SYSTEM_PAUSE, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_PAUSE, MENU_PAUSE, m_ShortCuts.ShortCutString(ID_SYSTEM_PAUSE, RunningState)));
}
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_BITMAP, MENU_BITMAP, m_ShortCuts.ShortCutString(ID_SYSTEM_BITMAP, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_BITMAP, MENU_BITMAP, m_ShortCuts.ShortCutString(ID_SYSTEM_BITMAP, RunningState)));
SystemMenu.push_back(MENU_ITEM(SPLITER));
if (!inBasicMode)
{
Item.Reset(ID_SYSTEM_LIMITFPS, MENU_LIMIT_FPS, m_ShortCuts.ShortCutString(ID_SYSTEM_LIMITFPS, AccessLevel));
Item.Reset(ID_SYSTEM_LIMITFPS, MENU_LIMIT_FPS, m_ShortCuts.ShortCutString(ID_SYSTEM_LIMITFPS, RunningState));
if (g_Settings->LoadBool(GameRunning_LimitFPS)) { Item.SetItemTicked(true); }
SystemMenu.push_back(Item);
SystemMenu.push_back(MENU_ITEM(SPLITER));
}
Item.Reset(ID_SYSTEM_SWAPDISK, MENU_SWAPDISK, m_ShortCuts.ShortCutString(ID_SYSTEM_SWAPDISK, AccessLevel));
Item.Reset(ID_SYSTEM_SWAPDISK, MENU_SWAPDISK, m_ShortCuts.ShortCutString(ID_SYSTEM_SWAPDISK, RunningState));
if (g_Disk == NULL) { Item.SetItemEnabled(false); }
SystemMenu.push_back(Item);
SystemMenu.push_back(MENU_ITEM(SPLITER));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVE, MENU_SAVE, m_ShortCuts.ShortCutString(ID_SYSTEM_SAVE, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVE, MENU_SAVE, m_ShortCuts.ShortCutString(ID_SYSTEM_SAVE, RunningState)));
if (!inBasicMode)
{
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVEAS, MENU_SAVE_AS, m_ShortCuts.ShortCutString(ID_SYSTEM_SAVEAS, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_SAVEAS, MENU_SAVE_AS, m_ShortCuts.ShortCutString(ID_SYSTEM_SAVEAS, RunningState)));
}
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_RESTORE, MENU_RESTORE, m_ShortCuts.ShortCutString(ID_SYSTEM_RESTORE, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_RESTORE, MENU_RESTORE, m_ShortCuts.ShortCutString(ID_SYSTEM_RESTORE, RunningState)));
if (!inBasicMode)
{
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_LOAD, MENU_LOAD, m_ShortCuts.ShortCutString(ID_SYSTEM_LOAD, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_LOAD, MENU_LOAD, m_ShortCuts.ShortCutString(ID_SYSTEM_LOAD, RunningState)));
}
SystemMenu.push_back(MENU_ITEM(SPLITER));
SystemMenu.push_back(MENU_ITEM(SUB_MENU, MENU_CURRENT_SAVE, EMPTY_STDSTR, &CurrentSaveMenu));
SystemMenu.push_back(MENU_ITEM(SPLITER));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_CHEAT, MENU_CHEAT, m_ShortCuts.ShortCutString(ID_SYSTEM_CHEAT, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_GSBUTTON, MENU_GS_BUTTON, m_ShortCuts.ShortCutString(ID_SYSTEM_GSBUTTON, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_CHEAT, MENU_CHEAT, m_ShortCuts.ShortCutString(ID_SYSTEM_CHEAT, RunningState)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_GSBUTTON, MENU_GS_BUTTON, m_ShortCuts.ShortCutString(ID_SYSTEM_GSBUTTON, RunningState)));
/* Option Menu
****************/
MenuItemList OptionMenu;
Item.Reset(ID_OPTIONS_FULLSCREEN, MENU_FULL_SCREEN, m_ShortCuts.ShortCutString(ID_OPTIONS_FULLSCREEN, AccessLevel));
Item.Reset(ID_OPTIONS_FULLSCREEN, MENU_FULL_SCREEN, m_ShortCuts.ShortCutString(ID_OPTIONS_FULLSCREEN, RunningState));
Item.SetItemEnabled(CPURunning);
if (g_Plugins && g_Plugins->Gfx() && g_Plugins->Gfx()->ChangeWindow == NULL)
{
@ -900,20 +900,20 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
OptionMenu.push_back(Item);
if (!inBasicMode)
{
Item.Reset(ID_OPTIONS_ALWAYSONTOP, MENU_ON_TOP, m_ShortCuts.ShortCutString(ID_OPTIONS_ALWAYSONTOP, AccessLevel));
Item.Reset(ID_OPTIONS_ALWAYSONTOP, MENU_ON_TOP, m_ShortCuts.ShortCutString(ID_OPTIONS_ALWAYSONTOP, RunningState));
if (UISettingsLoadDword(UserInterface_AlwaysOnTop)) { Item.SetItemTicked(true); }
Item.SetItemEnabled(CPURunning);
OptionMenu.push_back(Item);
}
OptionMenu.push_back(MENU_ITEM(SPLITER));
Item.Reset(ID_OPTIONS_CONFIG_GFX, MENU_CONFG_GFX, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_GFX, AccessLevel));
Item.Reset(ID_OPTIONS_CONFIG_GFX, MENU_CONFG_GFX, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_GFX, RunningState));
if (g_Plugins && g_Plugins->Gfx() == NULL || g_Plugins->Gfx()->DllConfig == NULL)
{
Item.SetItemEnabled(false);
}
OptionMenu.push_back(Item);
Item.Reset(ID_OPTIONS_CONFIG_AUDIO, MENU_CONFG_AUDIO, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_AUDIO, AccessLevel));
Item.Reset(ID_OPTIONS_CONFIG_AUDIO, MENU_CONFG_AUDIO, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_AUDIO, RunningState));
if (g_Plugins->Audio() == NULL || g_Plugins->Audio()->DllConfig == NULL)
{
Item.SetItemEnabled(false);
@ -921,14 +921,14 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
OptionMenu.push_back(Item);
if (!inBasicMode)
{
Item.Reset(ID_OPTIONS_CONFIG_RSP, MENU_CONFG_RSP, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_RSP, AccessLevel));
Item.Reset(ID_OPTIONS_CONFIG_RSP, MENU_CONFG_RSP, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_RSP, RunningState));
if (g_Plugins->RSP() == NULL || g_Plugins->RSP()->DllConfig == NULL)
{
Item.SetItemEnabled(false);
}
OptionMenu.push_back(Item);
}
Item.Reset(ID_OPTIONS_CONFIG_CONT, MENU_CONFG_CTRL, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_CONT, AccessLevel));
Item.Reset(ID_OPTIONS_CONFIG_CONT, MENU_CONFG_CTRL, m_ShortCuts.ShortCutString(ID_OPTIONS_CONFIG_CONT, RunningState));
if (g_Plugins && g_Plugins->Control() == NULL || g_Plugins->Control()->DllConfig == NULL)
{
Item.SetItemEnabled(false);
@ -938,11 +938,11 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
OptionMenu.push_back(MENU_ITEM(SPLITER));
if (!inBasicMode)
{
Item.Reset(ID_OPTIONS_CPU_USAGE, MENU_SHOW_CPU, m_ShortCuts.ShortCutString(ID_OPTIONS_CPU_USAGE, AccessLevel));
Item.Reset(ID_OPTIONS_CPU_USAGE, MENU_SHOW_CPU, m_ShortCuts.ShortCutString(ID_OPTIONS_CPU_USAGE, RunningState));
if (g_Settings->LoadDword(UserInterface_ShowCPUPer)) { Item.SetItemTicked(true); }
OptionMenu.push_back(Item);
}
OptionMenu.push_back(MENU_ITEM(ID_OPTIONS_SETTINGS, MENU_SETTINGS, m_ShortCuts.ShortCutString(ID_OPTIONS_SETTINGS, AccessLevel)));
OptionMenu.push_back(MENU_ITEM(ID_OPTIONS_SETTINGS, MENU_SETTINGS, m_ShortCuts.ShortCutString(ID_OPTIONS_SETTINGS, RunningState)));
/* Profile Menu
****************/
@ -1254,7 +1254,8 @@ void CMainMenu::RebuildAccelerators(void)
HACCEL m_OldAccelTable = (HACCEL)m_AccelTable;
m_AccelTable = m_ShortCuts.GetAcceleratorTable();
if (m_OldAccelTable) {
if (m_OldAccelTable)
{
DestroyAcceleratorTable(m_OldAccelTable);
}
WriteTrace(TraceUserInterface, TraceDebug, "Done");

View File

@ -186,8 +186,8 @@ CMenuShortCutKey::CMenuShortCutKey(WORD key, bool bCtrl, bool bAlt, bool bShift,
}
}
if (m_bShift) { m_ShortCutName.Format("Shift+%s", m_ShortCutName.c_str()); }
if (m_bCtrl) { m_ShortCutName.Format("Ctrl+%s", m_ShortCutName.c_str()); }
if (m_bAlt) { m_ShortCutName.Format("Alt+%s", m_ShortCutName.c_str()); }
if (m_bCtrl) { m_ShortCutName.Format("Ctrl+%s", m_ShortCutName.c_str()); }
if (m_bAlt) { m_ShortCutName.Format("Alt+%s", m_ShortCutName.c_str()); }
}
VIRTUAL_KEY * CMenuShortCutKey::VirtualKeyList(int &Size)
@ -196,16 +196,53 @@ VIRTUAL_KEY * CMenuShortCutKey::VirtualKeyList(int &Size)
return (VIRTUAL_KEY *)m_VirtualKeyList;
}
bool CMenuShortCutKey::Same(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode) const
CMenuShortCutKey::RUNNING_STATE CMenuShortCutKey::RunningState(void)
{
if (key != m_key) { return false; }
if (g_Settings->LoadBool(GameRunning_CPU_Running))
{
return UISettingsLoadBool(UserInterface_InFullScreen) ? CMenuShortCutKey::RUNNING_STATE_FULLSCREEN : CMenuShortCutKey::RUNNING_STATE_WINDOWED;
}
return RUNNING_STATE_NOT_RUNNING;
}
bool CMenuShortCutKey::Match(WORD key, bool bCtrl, bool bAlt, bool bShift, RUNNING_STATE RunningState) const
{
if (key != m_key) { return false; }
if (bShift != m_bShift) { return false; }
if (bCtrl != m_bCtrl) { return false; }
if (bAlt != m_bAlt) { return false; }
if ((m_AccessMode & AccessMode) != AccessMode) { return false; }
if (bCtrl != m_bCtrl) { return false; }
if (bAlt != m_bAlt) { return false; }
if (!Active(RunningState)) { return false; }
return true;
}
bool CMenuShortCutKey::Active(RUNNING_STATE RunningState) const
{
switch (RunningState)
{
case CMenuShortCutKey::RUNNING_STATE_NOT_RUNNING:
if (m_AccessMode == CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING ||
m_AccessMode == CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN ||
m_AccessMode == CMenuShortCutKey::ACCESS_ANYTIME)
{
return true;
}
break;
case CMenuShortCutKey::RUNNING_STATE_WINDOWED:
if (m_AccessMode == CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW ||
m_AccessMode == CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN ||
m_AccessMode == CMenuShortCutKey::ACCESS_GAME_RUNNING ||
m_AccessMode == CMenuShortCutKey::ACCESS_ANYTIME)
{
return true;
}
break;
case CMenuShortCutKey::RUNNING_STATE_FULLSCREEN:
default:
g_Notify->BreakPoint(__FILE__, __LINE__);
}
return false;
}
CShortCutItem::CShortCutItem(LanguageStringID Section, LanguageStringID Title, ACCESS_MODE Access)
{
Reset(Section, Title, Access);
@ -213,9 +250,9 @@ CShortCutItem::CShortCutItem(LanguageStringID Section, LanguageStringID Title, A
void CShortCutItem::Reset(LanguageStringID Section, LanguageStringID Title, ACCESS_MODE Access)
{
this->m_Section = Section;
this->m_Title = Title;
this->m_Access = Access;
m_Section = Section;
m_Title = Title;
m_Access = Access;
}
void CShortCutItem::AddShortCut(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded, bool bInactive)
@ -242,6 +279,41 @@ void CShortCutItem::RemoveItem(CMenuShortCutKey * ShortCut)
}
}
bool CShortCutItem::Avaliable(CMenuShortCutKey::RUNNING_STATE RunningState)
{
switch (RunningState)
{
case CMenuShortCutKey::RUNNING_STATE_NOT_RUNNING:
if (m_Access == CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING ||
m_Access == CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN ||
m_Access == CMenuShortCutKey::ACCESS_ANYTIME)
{
return true;
}
break;
case CMenuShortCutKey::RUNNING_STATE_WINDOWED:
if (m_Access == CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW ||
m_Access == CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN ||
m_Access == CMenuShortCutKey::ACCESS_GAME_RUNNING ||
m_Access == CMenuShortCutKey::ACCESS_ANYTIME)
{
return true;
}
break;
case CMenuShortCutKey::RUNNING_STATE_FULLSCREEN:
if (m_Access == CMenuShortCutKey::ACCESS_GAME_RUNNING_FULLSCREEN ||
m_Access == CMenuShortCutKey::ACCESS_GAME_RUNNING ||
m_Access == CMenuShortCutKey::ACCESS_ANYTIME)
{
return true;
}
break;
default:
g_Notify->BreakPoint(__FILE__, __LINE__);
}
return false;
}
CShortCuts::CShortCuts()
{
Load();
@ -251,7 +323,7 @@ CShortCuts::~CShortCuts()
{
}
std::wstring CShortCuts::ShortCutString(int MenuID, CMenuShortCutKey::ACCESS_MODE AccessLevel)
std::wstring CShortCuts::ShortCutString(int MenuID, CMenuShortCutKey::RUNNING_STATE RunningState)
{
CGuard CS(m_CS);
@ -261,12 +333,7 @@ std::wstring CShortCuts::ShortCutString(int MenuID, CMenuShortCutKey::ACCESS_MOD
const SHORTCUT_KEY_LIST & ShortCutList = MenuItem->second.GetAccelItems();
for (SHORTCUT_KEY_LIST::const_iterator item = ShortCutList.begin(); item != ShortCutList.end(); item++)
{
ACCESS_MODE ItemMode = item->AccessMode();
if ((ItemMode & AccessLevel) != AccessLevel)
{
continue;
}
if (item->Inactive())
if (!item->Active(RunningState) || item->Inactive())
{
continue;
}
@ -275,7 +342,7 @@ std::wstring CShortCuts::ShortCutString(int MenuID, CMenuShortCutKey::ACCESS_MOD
return L"";
}
LanguageStringID CShortCuts::GetMenuItemName(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE Access)
LanguageStringID CShortCuts::GetMenuItemName(WORD key, bool bCtrl, bool bAlt, bool bShift, RUNNING_STATE RunningState)
{
CGuard CS(m_CS);
@ -285,7 +352,8 @@ LanguageStringID CShortCuts::GetMenuItemName(WORD key, bool bCtrl, bool bAlt, bo
for (SHORTCUT_KEY_LIST::const_iterator AccelItem = short_cut.GetAccelItems().begin(); AccelItem != short_cut.GetAccelItems().end(); AccelItem++)
{
if (!AccelItem->Same(key, bCtrl, bAlt, bShift, Access)) { continue; }
if (AccelItem->Inactive()) { continue; }
if (!AccelItem->Match(key, bCtrl, bAlt, bShift, RunningState)) { continue; }
return short_cut.Title();
}
}
@ -303,96 +371,96 @@ void CShortCuts::Load(bool InitialValues)
m_ShortCuts.clear();
AddShortCut(ID_FILE_OPEN_ROM, STR_SHORTCUT_FILEMENU, MENU_OPEN, CMenuShortCutKey::NOT_IN_FULLSCREEN);
AddShortCut(ID_FILE_ROM_INFO, STR_SHORTCUT_FILEMENU, MENU_ROM_INFO, CMenuShortCutKey::NOT_IN_FULLSCREEN);
AddShortCut(ID_FILE_STARTEMULATION, STR_SHORTCUT_FILEMENU, MENU_START, CMenuShortCutKey::NOT_IN_FULLSCREEN);
AddShortCut(ID_FILE_ENDEMULATION, STR_SHORTCUT_FILEMENU, MENU_END, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_FILE_ROMDIRECTORY, STR_SHORTCUT_FILEMENU, MENU_CHOOSE_ROM, CMenuShortCutKey::GAME_NOT_RUNNING);
AddShortCut(ID_FILE_REFRESHROMLIST, STR_SHORTCUT_FILEMENU, MENU_REFRESH, CMenuShortCutKey::GAME_NOT_RUNNING);
AddShortCut(ID_FILE_EXIT, STR_SHORTCUT_FILEMENU, MENU_EXIT, CMenuShortCutKey::ANYTIME);
AddShortCut(ID_FILE_OPEN_ROM, STR_SHORTCUT_FILEMENU, MENU_OPEN, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_FILE_ROM_INFO, STR_SHORTCUT_FILEMENU, MENU_ROM_INFO, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_FILE_STARTEMULATION, STR_SHORTCUT_FILEMENU, MENU_START, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_FILE_ENDEMULATION, STR_SHORTCUT_FILEMENU, MENU_END, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_FILE_ROMDIRECTORY, STR_SHORTCUT_FILEMENU, MENU_CHOOSE_ROM, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
AddShortCut(ID_FILE_REFRESHROMLIST, STR_SHORTCUT_FILEMENU, MENU_REFRESH, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
AddShortCut(ID_FILE_EXIT, STR_SHORTCUT_FILEMENU, MENU_EXIT, CMenuShortCutKey::ACCESS_ANYTIME);
AddShortCut(ID_SYSTEM_RESET_SOFT, STR_SHORTCUT_SYSTEMMENU, MENU_RESET_SOFT, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_SYSTEM_RESET_HARD, STR_SHORTCUT_SYSTEMMENU, MENU_RESET_HARD, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_SYSTEM_PAUSE, STR_SHORTCUT_SYSTEMMENU, MENU_PAUSE, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_SYSTEM_BITMAP, STR_SHORTCUT_SYSTEMMENU, MENU_BITMAP, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_SYSTEM_LIMITFPS, STR_SHORTCUT_SYSTEMMENU, MENU_LIMIT_FPS, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_SYSTEM_SWAPDISK, STR_SHORTCUT_SYSTEMMENU, MENU_SWAPDISK, CMenuShortCutKey::GAME_RUNNING_WINDOW);
AddShortCut(ID_SYSTEM_SAVE, STR_SHORTCUT_SYSTEMMENU, MENU_SAVE, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_SYSTEM_SAVEAS, STR_SHORTCUT_SYSTEMMENU, MENU_SAVE_AS, CMenuShortCutKey::GAME_RUNNING_WINDOW);
AddShortCut(ID_SYSTEM_RESTORE, STR_SHORTCUT_SYSTEMMENU, MENU_RESTORE, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_SYSTEM_LOAD, STR_SHORTCUT_SYSTEMMENU, MENU_LOAD, CMenuShortCutKey::GAME_RUNNING_WINDOW);
AddShortCut(ID_SYSTEM_CHEAT, STR_SHORTCUT_SYSTEMMENU, MENU_CHEAT, CMenuShortCutKey::NOT_IN_FULLSCREEN);
AddShortCut(ID_SYSTEM_GSBUTTON, STR_SHORTCUT_SYSTEMMENU, MENU_GS_BUTTON, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_SYSTEM_RESET_SOFT, STR_SHORTCUT_SYSTEMMENU, MENU_RESET_SOFT, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_SYSTEM_RESET_HARD, STR_SHORTCUT_SYSTEMMENU, MENU_RESET_HARD, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_SYSTEM_PAUSE, STR_SHORTCUT_SYSTEMMENU, MENU_PAUSE, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_SYSTEM_BITMAP, STR_SHORTCUT_SYSTEMMENU, MENU_BITMAP, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_SYSTEM_LIMITFPS, STR_SHORTCUT_SYSTEMMENU, MENU_LIMIT_FPS, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_SYSTEM_SWAPDISK, STR_SHORTCUT_SYSTEMMENU, MENU_SWAPDISK, CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW);
AddShortCut(ID_SYSTEM_SAVE, STR_SHORTCUT_SYSTEMMENU, MENU_SAVE, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_SYSTEM_SAVEAS, STR_SHORTCUT_SYSTEMMENU, MENU_SAVE_AS, CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW);
AddShortCut(ID_SYSTEM_RESTORE, STR_SHORTCUT_SYSTEMMENU, MENU_RESTORE, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_SYSTEM_LOAD, STR_SHORTCUT_SYSTEMMENU, MENU_LOAD, CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW);
AddShortCut(ID_SYSTEM_CHEAT, STR_SHORTCUT_SYSTEMMENU, MENU_CHEAT, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_SYSTEM_GSBUTTON, STR_SHORTCUT_SYSTEMMENU, MENU_GS_BUTTON, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_OPTIONS_DISPLAY_FR, STR_SHORTCUT_OPTIONS, OPTION_DISPLAY_FR, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_OPTIONS_CHANGE_FR, STR_SHORTCUT_OPTIONS, OPTION_CHANGE_FR, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_OPTIONS_INCREASE_SPEED, STR_SHORTCUT_OPTIONS, STR_INSREASE_SPEED, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_OPTIONS_DECREASE_SPEED, STR_SHORTCUT_OPTIONS, STR_DECREASE_SPEED, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_OPTIONS_DISPLAY_FR, STR_SHORTCUT_OPTIONS, OPTION_DISPLAY_FR, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_OPTIONS_CHANGE_FR, STR_SHORTCUT_OPTIONS, OPTION_CHANGE_FR, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_OPTIONS_INCREASE_SPEED, STR_SHORTCUT_OPTIONS, STR_INSREASE_SPEED, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_OPTIONS_DECREASE_SPEED, STR_SHORTCUT_OPTIONS, STR_DECREASE_SPEED, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_DEFAULT, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_DEFAULT, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_1, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_1, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_2, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_2, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_3, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_3, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_4, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_4, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_5, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_5, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_6, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_6, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_7, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_7, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_8, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_8, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_9, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_9, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_10, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_10, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_DEFAULT, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_DEFAULT, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_1, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_1, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_2, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_2, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_3, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_3, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_4, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_4, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_5, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_5, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_6, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_6, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_7, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_7, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_8, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_8, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_9, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_9, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_CURRENT_SAVE_10, STR_SHORTCUT_SAVESLOT, SAVE_SLOT_10, CMenuShortCutKey::ACCESS_GAME_RUNNING);
//Option Menu
AddShortCut(ID_OPTIONS_FULLSCREEN, STR_SHORTCUT_OPTIONS, MENU_FULL_SCREEN, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_OPTIONS_ALWAYSONTOP, STR_SHORTCUT_OPTIONS, MENU_ON_TOP, CMenuShortCutKey::NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_CONFIG_GFX, STR_SHORTCUT_OPTIONS, MENU_CONFG_GFX, CMenuShortCutKey::NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_CONFIG_AUDIO, STR_SHORTCUT_OPTIONS, MENU_CONFG_AUDIO, CMenuShortCutKey::NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_CONFIG_CONT, STR_SHORTCUT_OPTIONS, MENU_CONFG_CTRL, CMenuShortCutKey::NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_CONFIG_RSP, STR_SHORTCUT_OPTIONS, MENU_CONFG_RSP, CMenuShortCutKey::NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_CPU_USAGE, STR_SHORTCUT_OPTIONS, MENU_SHOW_CPU, CMenuShortCutKey::GAME_RUNNING);
AddShortCut(ID_OPTIONS_SETTINGS, STR_SHORTCUT_OPTIONS, MENU_SETTINGS, CMenuShortCutKey::NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_FULLSCREEN, STR_SHORTCUT_OPTIONS, MENU_FULL_SCREEN, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_OPTIONS_ALWAYSONTOP, STR_SHORTCUT_OPTIONS, MENU_ON_TOP, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_CONFIG_GFX, STR_SHORTCUT_OPTIONS, MENU_CONFG_GFX, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_CONFIG_AUDIO, STR_SHORTCUT_OPTIONS, MENU_CONFG_AUDIO, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_CONFIG_CONT, STR_SHORTCUT_OPTIONS, MENU_CONFG_CTRL, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_CONFIG_RSP, STR_SHORTCUT_OPTIONS, MENU_CONFG_RSP, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
AddShortCut(ID_OPTIONS_CPU_USAGE, STR_SHORTCUT_OPTIONS, MENU_SHOW_CPU, CMenuShortCutKey::ACCESS_GAME_RUNNING);
AddShortCut(ID_OPTIONS_SETTINGS, STR_SHORTCUT_OPTIONS, MENU_SETTINGS, CMenuShortCutKey::ACCESS_NOT_IN_FULLSCREEN);
CPath ShortCutFile = UISettingsLoadStringVal(SupportFile_ShortCuts);
if (!ShortCutFile.Exists() || InitialValues)
{
m_ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O', TRUE, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O', TRUE, false, false, CMenuShortCutKey::GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_STARTEMULATION)->second.AddShortCut(VK_F11, false, false, false, CMenuShortCutKey::GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_ENDEMULATION)->second.AddShortCut(VK_F12, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_FILE_REFRESHROMLIST)->second.AddShortCut(VK_F5, false, false, false, CMenuShortCutKey::GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_EXIT)->second.AddShortCut(VK_F4, false, true, false, CMenuShortCutKey::GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_EXIT)->second.AddShortCut(VK_F4, false, true, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_DEFAULT)->second.AddShortCut(0xC0, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_1)->second.AddShortCut('1', false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_2)->second.AddShortCut('2', false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_3)->second.AddShortCut('3', false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_4)->second.AddShortCut('4', false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_5)->second.AddShortCut('5', false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_6)->second.AddShortCut('6', false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_7)->second.AddShortCut('7', false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_8)->second.AddShortCut('8', false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_9)->second.AddShortCut('9', false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_10)->second.AddShortCut('0', false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_OPTIONS_FULLSCREEN)->second.AddShortCut(VK_RETURN, false, true, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_OPTIONS_FULLSCREEN)->second.AddShortCut(VK_ESCAPE, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_OPTIONS_ALWAYSONTOP)->second.AddShortCut('A', true, false, false, CMenuShortCutKey::GAME_NOT_RUNNING);
m_ShortCuts.find(ID_OPTIONS_ALWAYSONTOP)->second.AddShortCut('A', true, false, false, CMenuShortCutKey::GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_OPTIONS_SETTINGS)->second.AddShortCut('T', true, false, false, CMenuShortCutKey::GAME_NOT_RUNNING);
m_ShortCuts.find(ID_OPTIONS_SETTINGS)->second.AddShortCut('T', true, false, false, CMenuShortCutKey::GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_SYSTEM_RESET_SOFT)->second.AddShortCut(VK_F1, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_RESET_HARD)->second.AddShortCut(VK_F1, false, false, true, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_PAUSE)->second.AddShortCut(VK_F2, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_PAUSE)->second.AddShortCut(VK_PAUSE, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_BITMAP)->second.AddShortCut(VK_F3, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_LIMITFPS)->second.AddShortCut(VK_F4, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_SWAPDISK)->second.AddShortCut('D', true, false, false, CMenuShortCutKey::GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_SYSTEM_SAVE)->second.AddShortCut(VK_F5, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_RESTORE)->second.AddShortCut(VK_F7, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_LOAD)->second.AddShortCut('L', true, false, false, CMenuShortCutKey::GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_SYSTEM_SAVEAS)->second.AddShortCut('S', true, false, false, CMenuShortCutKey::GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_SYSTEM_CHEAT)->second.AddShortCut('C', true, false, false, CMenuShortCutKey::GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_SYSTEM_GSBUTTON)->second.AddShortCut(VK_F9, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_OPTIONS_INCREASE_SPEED)->second.AddShortCut(VK_OEM_PLUS, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_OPTIONS_DECREASE_SPEED)->second.AddShortCut(VK_OEM_MINUS, false, false, false, CMenuShortCutKey::GAME_RUNNING);
m_ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O', TRUE, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O', TRUE, false, false, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_STARTEMULATION)->second.AddShortCut(VK_F11, false, false, false, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_ENDEMULATION)->second.AddShortCut(VK_F12, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_FILE_REFRESHROMLIST)->second.AddShortCut(VK_F5, false, false, false, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_EXIT)->second.AddShortCut(VK_F4, false, true, false, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
m_ShortCuts.find(ID_FILE_EXIT)->second.AddShortCut(VK_F4, false, true, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_DEFAULT)->second.AddShortCut(0xC0, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_1)->second.AddShortCut('1', false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_2)->second.AddShortCut('2', false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_3)->second.AddShortCut('3', false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_4)->second.AddShortCut('4', false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_5)->second.AddShortCut('5', false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_6)->second.AddShortCut('6', false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_7)->second.AddShortCut('7', false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_8)->second.AddShortCut('8', false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_9)->second.AddShortCut('9', false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_CURRENT_SAVE_10)->second.AddShortCut('0', false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_OPTIONS_FULLSCREEN)->second.AddShortCut(VK_RETURN, false, true, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_OPTIONS_FULLSCREEN)->second.AddShortCut(VK_ESCAPE, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_OPTIONS_ALWAYSONTOP)->second.AddShortCut('A', true, false, false, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
m_ShortCuts.find(ID_OPTIONS_ALWAYSONTOP)->second.AddShortCut('A', true, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_OPTIONS_SETTINGS)->second.AddShortCut('T', true, false, false, CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING);
m_ShortCuts.find(ID_OPTIONS_SETTINGS)->second.AddShortCut('T', true, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_SYSTEM_RESET_SOFT)->second.AddShortCut(VK_F1, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_RESET_HARD)->second.AddShortCut(VK_F1, false, false, true, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_PAUSE)->second.AddShortCut(VK_F2, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_PAUSE)->second.AddShortCut(VK_PAUSE, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_BITMAP)->second.AddShortCut(VK_F3, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_LIMITFPS)->second.AddShortCut(VK_F4, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_SWAPDISK)->second.AddShortCut('D', true, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_SYSTEM_SAVE)->second.AddShortCut(VK_F5, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_RESTORE)->second.AddShortCut(VK_F7, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_SYSTEM_LOAD)->second.AddShortCut('L', true, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_SYSTEM_SAVEAS)->second.AddShortCut('S', true, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_SYSTEM_CHEAT)->second.AddShortCut('C', true, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING_WINDOW);
m_ShortCuts.find(ID_SYSTEM_GSBUTTON)->second.AddShortCut(VK_F9, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_OPTIONS_INCREASE_SPEED)->second.AddShortCut(VK_OEM_PLUS, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
m_ShortCuts.find(ID_OPTIONS_DECREASE_SPEED)->second.AddShortCut(VK_OEM_MINUS, false, false, false, CMenuShortCutKey::ACCESS_GAME_RUNNING);
}
else
{
@ -454,21 +522,14 @@ HACCEL CShortCuts::GetAcceleratorTable(void)
CGuard CS(m_CS);
//Generate a ACCEL list
CMenuShortCutKey::ACCESS_MODE AccessLevel = CMenuShortCutKey::GAME_NOT_RUNNING;
if (g_Settings->LoadBool(GameRunning_CPU_Running))
{
AccessLevel = UISettingsLoadBool(UserInterface_InFullScreen) ? CMenuShortCutKey::GAME_RUNNING_FULLSCREEN : CMenuShortCutKey::GAME_RUNNING_WINDOW;
}
int size = 0, MaxSize = m_ShortCuts.size() * 5;
ACCEL * AccelList = new ACCEL[MaxSize];
CMenuShortCutKey::RUNNING_STATE RunningState = CMenuShortCutKey::RunningState();
for (MSC_MAP::iterator Item = m_ShortCuts.begin(); Item != m_ShortCuts.end(); Item++)
{
CShortCutItem & short_cut = Item->second;
CMenuShortCutKey::ACCESS_MODE ItemMode = short_cut.AccessMode();
if ((ItemMode & AccessLevel) != AccessLevel)
if (!short_cut.Avaliable(RunningState))
{
continue;
}
@ -481,7 +542,7 @@ HACCEL CShortCuts::GetAcceleratorTable(void)
{
continue;
}
if ((Key.AccessMode() & AccessLevel) != AccessLevel)
if (!Key.Active(RunningState))
{
continue;
}
@ -489,8 +550,8 @@ HACCEL CShortCuts::GetAcceleratorTable(void)
AccelList[size].cmd = (WORD)Item->first;
AccelList[size].key = Key.Key();
AccelList[size].fVirt = FVIRTKEY;
if (Key.Alt()) { AccelList[size].fVirt |= FALT; }
if (Key.Ctrl()) { AccelList[size].fVirt |= FCONTROL; }
if (Key.Alt()) { AccelList[size].fVirt |= FALT; }
if (Key.Ctrl()) { AccelList[size].fVirt |= FCONTROL; }
if (Key.Shift()) { AccelList[size].fVirt |= FSHIFT; }
size += 1;
}

View File

@ -20,15 +20,22 @@ struct VIRTUAL_KEY
class CMenuShortCutKey
{
public:
enum RUNNING_STATE
{
RUNNING_STATE_NOT_RUNNING = 1,
RUNNING_STATE_WINDOWED = 2,
RUNNING_STATE_FULLSCREEN = 3,
};
enum ACCESS_MODE
{
NONE = 0,
GAME_NOT_RUNNING = 1,
GAME_RUNNING_WINDOW = 2,
NOT_IN_FULLSCREEN = 3,
GAME_RUNNING_FULLSCREEN = 4,
GAME_RUNNING = 6,
ANYTIME = 7,
ACCESS_NONE = 0,
ACCESS_GAME_NOT_RUNNING = 1,
ACCESS_GAME_RUNNING_WINDOW = 2,
ACCESS_NOT_IN_FULLSCREEN = 3,
ACCESS_GAME_RUNNING_FULLSCREEN = 4,
ACCESS_GAME_RUNNING = 6,
ACCESS_ANYTIME = 7,
};
private:
@ -46,9 +53,11 @@ private:
public:
CMenuShortCutKey(void);
CMenuShortCutKey(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded, bool bInactive);
bool Same(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode) const;
bool Match(WORD key, bool bCtrl, bool bAlt, bool bShift, RUNNING_STATE RunningState) const;
bool Active(RUNNING_STATE RunningState) const;
static VIRTUAL_KEY * VirtualKeyList(int &Size);
static RUNNING_STATE RunningState(void);
inline stdstr Name(void) const { return m_ShortCutName; }
inline WORD Key(void) const { return m_key; }
@ -69,6 +78,7 @@ public:
private:
typedef CMenuShortCutKey::ACCESS_MODE ACCESS_MODE;
typedef CMenuShortCutKey::RUNNING_STATE RUNNING_STATE;
ACCESS_MODE m_Access;
LanguageStringID m_Section;
@ -80,11 +90,12 @@ public:
void Reset(LanguageStringID Section, LanguageStringID Title, ACCESS_MODE Access);
void AddShortCut(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded = false, bool bInactive = false);
void RemoveItem(CMenuShortCutKey * ShortCut);
bool Avaliable(RUNNING_STATE RunningState);
inline const SHORTCUT_KEY_LIST & GetAccelItems(void) const { return m_AccelList; }
inline const SHORTCUT_KEY_LIST & GetAccelItems(void) const { return m_AccelList; }
inline LanguageStringID Section(void) const { return m_Section; }
inline LanguageStringID Title(void) const { return m_Title; }
inline ACCESS_MODE AccessMode(void) const { return m_Access; }
inline ACCESS_MODE AccessMode(void) const { return m_Access; }
};
typedef std::map<int, CShortCutItem> MSC_MAP;
@ -92,7 +103,8 @@ typedef std::map<int, CShortCutItem> MSC_MAP;
class CShortCuts
{
typedef CShortCutItem::SHORTCUT_KEY_LIST SHORTCUT_KEY_LIST;
typedef CMenuShortCutKey::ACCESS_MODE ACCESS_MODE;
typedef CMenuShortCutKey::ACCESS_MODE ACCESS_MODE;
typedef CMenuShortCutKey::RUNNING_STATE RUNNING_STATE;
typedef LanguageStringID LangStr;
MSC_MAP m_ShortCuts;
@ -104,10 +116,10 @@ public:
CShortCuts(void);
~CShortCuts(void);
std::wstring ShortCutString(int MenuID, ACCESS_MODE AccessLevel);
LangStr GetMenuItemName(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE Access);
HACCEL GetAcceleratorTable(void);
MSC_MAP & GetShortCuts(void) { return m_ShortCuts; }
std::wstring ShortCutString(int MenuID, RUNNING_STATE RunningState);
LangStr GetMenuItemName(WORD key, bool bCtrl, bool bAlt, bool bShift, RUNNING_STATE RunningState);
HACCEL GetAcceleratorTable(void);
MSC_MAP & GetShortCuts(void) { return m_ShortCuts; }
void Load(bool InitialValues = false);
void Save(void);

View File

@ -37,9 +37,9 @@ COptionsShortCutsPage::COptionsShortCutsPage(HWND hParent, const RECT & rcDispay
m_MenuItems.ModifyStyle(0, TVS_SHOWSELALWAYS);
m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_1).c_str()), CMenuShortCutKey::GAME_NOT_RUNNING);
m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_3).c_str()), CMenuShortCutKey::GAME_RUNNING_WINDOW);
m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_4).c_str()), CMenuShortCutKey::GAME_RUNNING_FULLSCREEN);
m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_1).c_str()), CMenuShortCutKey::RUNNING_STATE_NOT_RUNNING);
m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_3).c_str()), CMenuShortCutKey::RUNNING_STATE_WINDOWED);
m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_4).c_str()), CMenuShortCutKey::RUNNING_STATE_FULLSCREEN);
m_CpuState.SetCurSel(0);
int VirtualKeyListSize;
@ -74,18 +74,18 @@ void COptionsShortCutsPage::CheckResetEnable(void)
void COptionsShortCutsPage::OnCpuStateChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
RUNNING_STATE RunningState = (RUNNING_STATE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
MSC_MAP & ShortCuts = m_ShortCuts.GetShortCuts();
m_MenuItems.DeleteAllItems();
for (MSC_MAP::iterator Item = ShortCuts.begin(); Item != ShortCuts.end(); Item++)
{
ACCESS_MODE ItemMode = Item->second.AccessMode();
if ((ItemMode & AccessLevel) != AccessLevel)
if (!Item->second.Avaliable(RunningState))
{
continue;
}
//find Parent
HTREEITEM hParent = m_MenuItems.GetChildItem(TVI_ROOT);
while (hParent)
@ -185,7 +185,7 @@ void COptionsShortCutsPage::OnAssignClicked(UINT /*Code*/, int /*id*/, HWND /*ct
bool bAlt = (SendDlgItemMessage(IDC_ALT, BM_GETCHECK, 0, 0) == BST_CHECKED);
bool bShift = (SendDlgItemMessage(IDC_SHIFT, BM_GETCHECK, 0, 0) == BST_CHECKED);
ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
RUNNING_STATE RunningState = (RUNNING_STATE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
HTREEITEM hSelectedItem = m_MenuItems.GetSelectedItem();
if (hSelectedItem == NULL)
@ -201,14 +201,21 @@ void COptionsShortCutsPage::OnAssignClicked(UINT /*Code*/, int /*id*/, HWND /*ct
}
CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hSelectedItem);
LanguageStringID strid = m_ShortCuts.GetMenuItemName(key, bCtrl, bAlt, bShift, AccessLevel);
LanguageStringID strid = m_ShortCuts.GetMenuItemName(key, bCtrl, bAlt, bShift, RunningState);
if (strid != EMPTY_STRING)
{
g_Notify->DisplayError(GS(MSG_MENUITEM_ASSIGNED));
return;
}
ShortCut->AddShortCut(key, bCtrl, bAlt, bShift, AccessLevel, true, false);
CMenuShortCutKey::ACCESS_MODE AccessMode = CMenuShortCutKey::ACCESS_NONE;
switch (RunningState)
{
case CMenuShortCutKey::RUNNING_STATE_NOT_RUNNING: AccessMode = CMenuShortCutKey::ACCESS_GAME_NOT_RUNNING; break;
case CMenuShortCutKey::RUNNING_STATE_WINDOWED: AccessMode = CMenuShortCutKey::ACCESS_GAME_RUNNING; break;
case CMenuShortCutKey::RUNNING_STATE_FULLSCREEN: AccessMode = CMenuShortCutKey::ACCESS_GAME_RUNNING_FULLSCREEN; break;
}
ShortCut->AddShortCut(key, bCtrl, bAlt, bShift, AccessMode, true, false);
m_MenuItems.SetItemState(hSelectedItem, TVIS_BOLD, TVIS_BOLD);
m_MenuItems.SetItemState(hParent, TVIS_BOLD, TVIS_BOLD);
m_EnableReset = true;
@ -227,9 +234,9 @@ void COptionsShortCutsPage::OnShortCutChanged(UINT /*Code*/, int /*id*/, HWND /*
bool bAlt = (SendDlgItemMessage(IDC_ALT, BM_GETCHECK, 0, 0) == BST_CHECKED);
bool bShift = (SendDlgItemMessage(IDC_SHIFT, BM_GETCHECK, 0, 0) == BST_CHECKED);
ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
RUNNING_STATE RunningState = (RUNNING_STATE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
stdstr str = GS(m_ShortCuts.GetMenuItemName(key, bCtrl, bAlt, bShift, AccessLevel));
stdstr str = GS(m_ShortCuts.GetMenuItemName(key, bCtrl, bAlt, bShift, RunningState));
if (str.length() > 0)
{
str.resize(std::remove(str.begin(), str.end(), '&') - str.begin());
@ -255,7 +262,7 @@ void COptionsShortCutsPage::RefreshShortCutOptions(HTREEITEM hItem)
return;
}
ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
RUNNING_STATE RunningState = (RUNNING_STATE)m_CpuState.GetItemData(m_CpuState.GetCurSel());
CShortCutItem * ShortCut = (CShortCutItem *)m_MenuItems.GetItemData(hItem);
m_CurrentKeys.ResetContent();
@ -263,16 +270,11 @@ void COptionsShortCutsPage::RefreshShortCutOptions(HTREEITEM hItem)
const SHORTCUT_KEY_LIST & ShortCutList = ShortCut->GetAccelItems();
for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item++)
{
if (ShortCut_item->Inactive())
if (ShortCut_item->Inactive() || !ShortCut_item->Active(RunningState))
{
continue;
}
ACCESS_MODE ItemMode = ShortCut_item->AccessMode();
if ((ItemMode & AccessLevel) != AccessLevel)
{
continue;
}
stdstr Name = ShortCut_item->Name();
m_CurrentKeys.SetItemData(m_CurrentKeys.AddString(Name.c_str()), (DWORD_PTR)&*ShortCut_item);
}

View File

@ -14,8 +14,8 @@ class COptionsShortCutsPage :
public CSettingsPageImpl<COptionsShortCutsPage>,
public CSettingsPage
{
typedef CMenuShortCutKey::ACCESS_MODE ACCESS_MODE;
typedef CShortCutItem::SHORTCUT_KEY_LIST SHORTCUT_KEY_LIST;
typedef CMenuShortCutKey::RUNNING_STATE RUNNING_STATE;
typedef CShortCutItem::SHORTCUT_KEY_LIST SHORTCUT_KEY_LIST;
BEGIN_MSG_MAP_EX(COptionsShortCutsPage)
COMMAND_HANDLER_EX(IDC_C_CPU_STATE,LBN_SELCHANGE,OnCpuStateChanged);

View File

@ -1,5 +1,9 @@
Android Release 9:
- Add ability to change screen res
- Fix multiple pause/resume
- minor bug fixes
Windows 2.4
- Build with v2015
- Build with v2015
- fixed fpu issue - Indiana Jones (#76)
- Fix bug in key assignment (#1309)