Shortcuts: Added VS Service button

This commit is contained in:
Souryo 2016-09-03 10:49:54 -04:00
parent aa14eb5981
commit c7023d7635
5 changed files with 33 additions and 21 deletions

View file

@ -219,6 +219,7 @@ struct EmulatorKeyMappings
uint32_t InsertCoin1;
uint32_t InsertCoin2;
uint32_t VsServiceButton;
uint32_t TakeScreenshot;
};

View file

@ -36,25 +36,41 @@ bool ShortcutKeyHandler::DetectKeyPress(uint32_t keyCode)
return false;
}
bool ShortcutKeyHandler::DetectKeyRelease(uint32_t keyCode)
{
if(!ControlManager::IsKeyPressed(keyCode)) {
if(_prevKeysDown.find(keyCode) != _prevKeysDown.end()) {
return true;
}
}
return false;
}
void ShortcutKeyHandler::CheckMappedKeys(EmulatorKeyMappings mappings)
{
if(ControlManager::IsKeyPressed(mappings.FastForward)) {
_turboEnabled = true;
if(DetectKeyPress(mappings.FastForward)) {
EmulationSettings::SetFlags(EmulationFlags::Turbo);
} else if(DetectKeyRelease(mappings.FastForward)) {
EmulationSettings::ClearFlags(EmulationFlags::Turbo);
}
if(DetectKeyPress(mappings.TakeScreenshot)) {
VideoDecoder::GetInstance()->TakeScreenshot();
}
if(DetectKeyPress(mappings.InsertCoin1)) {
if(VsControlManager::GetInstance()) {
VsControlManager::GetInstance()->InsertCoin(0);
if(VsControlManager::GetInstance()) {
VsControlManager* manager = VsControlManager::GetInstance();
if(DetectKeyPress(mappings.InsertCoin1)) {
manager->InsertCoin(0);
}
}
if(DetectKeyPress(mappings.InsertCoin2)) {
if(VsControlManager::GetInstance()) {
VsControlManager::GetInstance()->InsertCoin(1);
if(DetectKeyPress(mappings.InsertCoin2)) {
manager->InsertCoin(1);
}
if(DetectKeyPress(mappings.VsServiceButton)) {
manager->SetServiceButtonState(true);
}
if(DetectKeyRelease(mappings.VsServiceButton)) {
manager->SetServiceButtonState(false);
}
}
@ -100,15 +116,7 @@ void ShortcutKeyHandler::ProcessKeys(EmulatorKeyMappingSet mappings)
ControlManager::RefreshKeyState();
_keysDown.clear();
_turboEnabled = false;
CheckMappedKeys(mappings.KeySet1);
CheckMappedKeys(mappings.KeySet2);
if(_turboEnabled) {
EmulationSettings::SetFlags(EmulationFlags::Turbo);
} else {
EmulationSettings::ClearFlags(EmulationFlags::Turbo);
}
_prevKeysDown = _keysDown;
}

View file

@ -12,11 +12,12 @@ private:
std::unordered_set<uint32_t> _keysDown;
std::unordered_set<uint32_t> _prevKeysDown;
bool _turboEnabled;
void CheckMappedKeys(EmulatorKeyMappings mappings);
void ProcessKeys(EmulatorKeyMappingSet mappings);
bool DetectKeyPress(uint32_t keyCode);
bool DetectKeyRelease(uint32_t keyCode);
public:
ShortcutKeyHandler();

View file

@ -521,6 +521,7 @@
<Message ID="EmulatorShortcutMappings_InsertNextDisk">FDS - Insérer le disque suivant</Message>
<Message ID="EmulatorShortcutMappings_InsertCoin1">VS - Insérer une pièce (1)</Message>
<Message ID="EmulatorShortcutMappings_InsertCoin2">VS - Insérer une pièce (2)</Message>
<Message ID="EmulatorShortcutMappings_VsServiceButton">VS - Bouton de service</Message>
<Message ID="EmulatorShortcutMappings_MoveToNextStateSlot">Position de sauvegarde suivante</Message>
<Message ID="EmulatorShortcutMappings_MoveToPreviousStateSlot">Position de sauvegarde précédente</Message>
<Message ID="EmulatorShortcutMappings_SaveState">Sauvegarder l'état à la position courante</Message>

View file

@ -500,9 +500,10 @@
<Message ID="EmulatorShortcutMappings_Reset">リセット</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">スクリーンショットを撮る</Message>
<Message ID="EmulatorShortcutMappings_SwitchDiskSide">FDS - A面B面切り替え</Message>
<Message ID="EmulatorShortcutMappings_InsertNextDisk">FDS - 次のディスクを入れる</Message>
<Message ID="EmulatorShortcutMappings_InsertNextDisk">FDS - 次のディスクを入れる</Message>
<Message ID="EmulatorShortcutMappings_InsertCoin1">VS - インサートコイン 1</Message>
<Message ID="EmulatorShortcutMappings_InsertCoin2">VS - インサートコイン 2</Message>
<Message ID="EmulatorShortcutMappings_VsServiceButton">VS - サービスボタン</Message>
<Message ID="EmulatorShortcutMappings_MoveToNextStateSlot">次のクイックセーブスロットを選ぶ</Message>
<Message ID="EmulatorShortcutMappings_MoveToPreviousStateSlot">前のクイックセーブスロットを選ぶ</Message>
<Message ID="EmulatorShortcutMappings_SaveState">選択中スロットにクイックセーブ</Message>