Shortcuts: Added VS Service button
This commit is contained in:
parent
aa14eb5981
commit
c7023d7635
5 changed files with 33 additions and 21 deletions
|
@ -219,6 +219,7 @@ struct EmulatorKeyMappings
|
||||||
|
|
||||||
uint32_t InsertCoin1;
|
uint32_t InsertCoin1;
|
||||||
uint32_t InsertCoin2;
|
uint32_t InsertCoin2;
|
||||||
|
uint32_t VsServiceButton;
|
||||||
|
|
||||||
uint32_t TakeScreenshot;
|
uint32_t TakeScreenshot;
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,25 +36,41 @@ bool ShortcutKeyHandler::DetectKeyPress(uint32_t keyCode)
|
||||||
return false;
|
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)
|
void ShortcutKeyHandler::CheckMappedKeys(EmulatorKeyMappings mappings)
|
||||||
{
|
{
|
||||||
if(ControlManager::IsKeyPressed(mappings.FastForward)) {
|
if(DetectKeyPress(mappings.FastForward)) {
|
||||||
_turboEnabled = true;
|
EmulationSettings::SetFlags(EmulationFlags::Turbo);
|
||||||
|
} else if(DetectKeyRelease(mappings.FastForward)) {
|
||||||
|
EmulationSettings::ClearFlags(EmulationFlags::Turbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DetectKeyPress(mappings.TakeScreenshot)) {
|
if(DetectKeyPress(mappings.TakeScreenshot)) {
|
||||||
VideoDecoder::GetInstance()->TakeScreenshot();
|
VideoDecoder::GetInstance()->TakeScreenshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DetectKeyPress(mappings.InsertCoin1)) {
|
if(VsControlManager::GetInstance()) {
|
||||||
if(VsControlManager::GetInstance()) {
|
VsControlManager* manager = VsControlManager::GetInstance();
|
||||||
VsControlManager::GetInstance()->InsertCoin(0);
|
if(DetectKeyPress(mappings.InsertCoin1)) {
|
||||||
|
manager->InsertCoin(0);
|
||||||
}
|
}
|
||||||
}
|
if(DetectKeyPress(mappings.InsertCoin2)) {
|
||||||
|
manager->InsertCoin(1);
|
||||||
if(DetectKeyPress(mappings.InsertCoin2)) {
|
}
|
||||||
if(VsControlManager::GetInstance()) {
|
if(DetectKeyPress(mappings.VsServiceButton)) {
|
||||||
VsControlManager::GetInstance()->InsertCoin(1);
|
manager->SetServiceButtonState(true);
|
||||||
|
}
|
||||||
|
if(DetectKeyRelease(mappings.VsServiceButton)) {
|
||||||
|
manager->SetServiceButtonState(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,15 +116,7 @@ void ShortcutKeyHandler::ProcessKeys(EmulatorKeyMappingSet mappings)
|
||||||
ControlManager::RefreshKeyState();
|
ControlManager::RefreshKeyState();
|
||||||
|
|
||||||
_keysDown.clear();
|
_keysDown.clear();
|
||||||
|
|
||||||
_turboEnabled = false;
|
|
||||||
CheckMappedKeys(mappings.KeySet1);
|
CheckMappedKeys(mappings.KeySet1);
|
||||||
CheckMappedKeys(mappings.KeySet2);
|
CheckMappedKeys(mappings.KeySet2);
|
||||||
if(_turboEnabled) {
|
|
||||||
EmulationSettings::SetFlags(EmulationFlags::Turbo);
|
|
||||||
} else {
|
|
||||||
EmulationSettings::ClearFlags(EmulationFlags::Turbo);
|
|
||||||
}
|
|
||||||
|
|
||||||
_prevKeysDown = _keysDown;
|
_prevKeysDown = _keysDown;
|
||||||
}
|
}
|
|
@ -12,11 +12,12 @@ private:
|
||||||
|
|
||||||
std::unordered_set<uint32_t> _keysDown;
|
std::unordered_set<uint32_t> _keysDown;
|
||||||
std::unordered_set<uint32_t> _prevKeysDown;
|
std::unordered_set<uint32_t> _prevKeysDown;
|
||||||
bool _turboEnabled;
|
|
||||||
|
|
||||||
void CheckMappedKeys(EmulatorKeyMappings mappings);
|
void CheckMappedKeys(EmulatorKeyMappings mappings);
|
||||||
void ProcessKeys(EmulatorKeyMappingSet mappings);
|
void ProcessKeys(EmulatorKeyMappingSet mappings);
|
||||||
|
|
||||||
bool DetectKeyPress(uint32_t keyCode);
|
bool DetectKeyPress(uint32_t keyCode);
|
||||||
|
bool DetectKeyRelease(uint32_t keyCode);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShortcutKeyHandler();
|
ShortcutKeyHandler();
|
||||||
|
|
|
@ -521,6 +521,7 @@
|
||||||
<Message ID="EmulatorShortcutMappings_InsertNextDisk">FDS - Insérer le disque suivant</Message>
|
<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_InsertCoin1">VS - Insérer une pièce (1)</Message>
|
||||||
<Message ID="EmulatorShortcutMappings_InsertCoin2">VS - Insérer une pièce (2)</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_MoveToNextStateSlot">Position de sauvegarde suivante</Message>
|
||||||
<Message ID="EmulatorShortcutMappings_MoveToPreviousStateSlot">Position de sauvegarde précédente</Message>
|
<Message ID="EmulatorShortcutMappings_MoveToPreviousStateSlot">Position de sauvegarde précédente</Message>
|
||||||
<Message ID="EmulatorShortcutMappings_SaveState">Sauvegarder l'état à la position courante</Message>
|
<Message ID="EmulatorShortcutMappings_SaveState">Sauvegarder l'état à la position courante</Message>
|
||||||
|
|
|
@ -500,9 +500,10 @@
|
||||||
<Message ID="EmulatorShortcutMappings_Reset">リセット</Message>
|
<Message ID="EmulatorShortcutMappings_Reset">リセット</Message>
|
||||||
<Message ID="EmulatorShortcutMappings_TakeScreenshot">スクリーンショットを撮る</Message>
|
<Message ID="EmulatorShortcutMappings_TakeScreenshot">スクリーンショットを撮る</Message>
|
||||||
<Message ID="EmulatorShortcutMappings_SwitchDiskSide">FDS - A面B面切り替え</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_InsertCoin1">VS - インサートコイン 1</Message>
|
||||||
<Message ID="EmulatorShortcutMappings_InsertCoin2">VS - インサートコイン 2</Message>
|
<Message ID="EmulatorShortcutMappings_InsertCoin2">VS - インサートコイン 2</Message>
|
||||||
|
<Message ID="EmulatorShortcutMappings_VsServiceButton">VS - サービスボタン</Message>
|
||||||
<Message ID="EmulatorShortcutMappings_MoveToNextStateSlot">次のクイックセーブスロットを選ぶ</Message>
|
<Message ID="EmulatorShortcutMappings_MoveToNextStateSlot">次のクイックセーブスロットを選ぶ</Message>
|
||||||
<Message ID="EmulatorShortcutMappings_MoveToPreviousStateSlot">前のクイックセーブスロットを選ぶ</Message>
|
<Message ID="EmulatorShortcutMappings_MoveToPreviousStateSlot">前のクイックセーブスロットを選ぶ</Message>
|
||||||
<Message ID="EmulatorShortcutMappings_SaveState">選択中スロットにクイックセーブ</Message>
|
<Message ID="EmulatorShortcutMappings_SaveState">選択中スロットにクイックセーブ</Message>
|
||||||
|
|
Loading…
Add table
Reference in a new issue