UI: Allow all UI shortcuts to be customized (and support for multi-key shortcuts)

This commit is contained in:
Souryo 2017-09-08 10:38:41 -04:00
parent 0f1915e478
commit a4d06f683a
37 changed files with 1469 additions and 643 deletions

View file

@ -24,7 +24,6 @@
#include "NsfPpu.h"
#include "SoundMixer.h"
#include "NsfMapper.h"
#include "ShortcutKeyHandler.h"
#include "MovieManager.h"
#include "RewindManager.h"
#include "SaveStateManager.h"
@ -337,7 +336,6 @@ void Console::Run()
double targetTime;
uint32_t lastFrameNumber = -1;
ShortcutKeyHandler shortcutKeyHandler;
_autoSaveManager.reset(new AutoSaveManager());
_runLock.Acquire();

View file

@ -53,12 +53,12 @@ bool ControlManager::IsMouseButtonPressed(MouseButton button)
return false;
}
uint32_t ControlManager::GetPressedKey()
vector<uint32_t> ControlManager::GetPressedKeys()
{
if(_keyManager != nullptr) {
return _keyManager->GetPressedKey();
return _keyManager->GetPressedKeys();
}
return 0;
return vector<uint32_t>();
}
string ControlManager::GetKeyName(uint32_t keyCode)

View file

@ -59,7 +59,7 @@ class ControlManager : public Snapshotable, public IMemoryHandler
static void RefreshKeyState();
static bool IsKeyPressed(uint32_t keyCode);
static bool IsMouseButtonPressed(MouseButton button);
static uint32_t GetPressedKey();
static vector<uint32_t> GetPressedKeys();
static string GetKeyName(uint32_t keyCode);
static uint32_t GetKeyCode(string keyName);

View file

@ -56,7 +56,8 @@ bool EmulationSettings::_nsfDisableApuIrqs = true;
uint32_t EmulationSettings::_autoSaveDelay = 5;
bool EmulationSettings::_autoSaveNotify = false;
EmulatorKeyMappingSet EmulationSettings::_emulatorKeys;
SimpleLock EmulationSettings::_shortcutLock;
std::unordered_map<int, KeyCombination> EmulationSettings::_emulatorKeys[2];
RamPowerOnState EmulationSettings::_ramPowerOnState = RamPowerOnState::AllZeros;

View file

@ -272,45 +272,88 @@ struct KeyMappingSet
uint32_t TurboSpeed;
};
struct EmulatorKeyMappings
enum class EmulatorShortcut
{
uint32_t FastForward;
uint32_t Rewind;
uint32_t RewindTenSecs;
uint32_t RewindOneMin;
FastForward,
Rewind,
RewindTenSecs,
RewindOneMin,
uint32_t Pause;
uint32_t Reset;
uint32_t PowerCycle;
uint32_t PowerOff;
uint32_t Exit;
MoveToNextStateSlot,
MoveToPreviousStateSlot,
SaveState,
LoadState,
uint32_t MoveToNextStateSlot;
uint32_t MoveToPreviousStateSlot;
uint32_t SaveState;
uint32_t LoadState;
InsertNextDisk,
VsServiceButton,
uint32_t SwitchDiskSide;
uint32_t InsertNextDisk;
ToggleCheats,
ToggleAudio,
uint32_t InsertCoin1;
uint32_t InsertCoin2;
uint32_t VsServiceButton;
RunSingleFrame,
uint32_t TakeScreenshot;
uint32_t IncreaseSpeed;
uint32_t DecreaseSpeed;
// Everything below this is handled UI-side
SwitchDiskSide,
EjectDisk,
uint32_t ToggleCheats;
uint32_t ToggleAudio;
InsertCoin1,
InsertCoin2,
uint32_t RunSingleFrame;
TakeScreenshot,
IncreaseSpeed,
DecreaseSpeed,
MaxSpeed,
Pause,
Reset,
PowerCycle,
PowerOff,
Exit,
SetScale1x,
SetScale2x,
SetScale3x,
SetScale4x,
SetScale5x,
SetScale6x,
ToggleFullscreen,
ToggleFps,
LoadRandomGame,
SaveStateSlot1,
SaveStateSlot2,
SaveStateSlot3,
SaveStateSlot4,
SaveStateSlot5,
SaveStateSlot6,
SaveStateSlot7,
SaveStateToFile,
LoadStateSlot1,
LoadStateSlot2,
LoadStateSlot3,
LoadStateSlot4,
LoadStateSlot5,
LoadStateSlot6,
LoadStateSlot7,
LoadStateSlot8,
LoadStateFromFile,
OpenFile,
OpenDebugger,
OpenAssembler,
OpenPpuViewer,
OpenMemoryTools,
OpenScriptWindow,
OpenTraceLogger
};
struct EmulatorKeyMappingSet
struct KeyCombination
{
EmulatorKeyMappings KeySet1 = {};
EmulatorKeyMappings KeySet2 = {};
uint32_t Key1;
uint32_t Key2;
uint32_t Key3;
};
enum class Language
@ -442,10 +485,11 @@ private:
static uint32_t _autoSaveDelay;
static bool _autoSaveNotify;
static EmulatorKeyMappingSet _emulatorKeys;
static std::unordered_map<int, KeyCombination> _emulatorKeys[2];
static RamPowerOnState _ramPowerOnState;
static SimpleLock _shortcutLock;
static SimpleLock _lock;
public:
@ -1008,14 +1052,27 @@ public:
return _controllerKeys[port];
}
static void SetEmulatorKeys(EmulatorKeyMappingSet keyMappings)
static void ClearShortcutKeys()
{
_emulatorKeys = keyMappings;
auto lock = _shortcutLock.AcquireSafe();
_emulatorKeys[0].clear();
_emulatorKeys[1].clear();
}
static EmulatorKeyMappingSet GetEmulatorKeys()
static void SetShortcutKey(EmulatorShortcut shortcut, KeyCombination keyCombination, int keySetIndex)
{
return _emulatorKeys;
auto lock = _shortcutLock.AcquireSafe();
_emulatorKeys[keySetIndex][(int)shortcut] = keyCombination;
}
static KeyCombination GetShortcutKey(EmulatorShortcut shortcut, int keySetIndex)
{
auto lock = _shortcutLock.AcquireSafe();
auto result = _emulatorKeys[keySetIndex].find((int)shortcut);
if(result != _emulatorKeys[keySetIndex].end()) {
return result->second;
}
return {};
}
static bool NeedControllerUpdate()

View file

@ -18,10 +18,11 @@ public:
virtual void UpdateDevices() = 0;
virtual bool IsMouseButtonPressed(MouseButton button) = 0;
virtual bool IsKeyPressed(uint32_t keyCode) = 0;
virtual uint32_t GetPressedKey() = 0;
virtual vector<uint32_t> GetPressedKeys() = 0;
virtual string GetKeyName(uint32_t keyCode) = 0;
virtual uint32_t GetKeyCode(string keyName) = 0;
virtual void SetKeyState(uint16_t scanCode, bool state) = 0;
virtual void ResetKeyState() = 0;
virtual void SetDisabled(bool disabled) = 0;
};

View file

@ -20,11 +20,8 @@ enum class ConsoleNotificationType
ConfigChanged = 14,
DisconnectedFromServer = 15,
PpuViewerDisplayFrame = 16,
RequestExit = 17,
ToggleCheats = 18,
ToggleAudio = 19,
RequestReset = 20,
RequestPowerCycle = 21,
ExecuteShortcut = 17,
};
class INotificationListener

View file

@ -10,10 +10,11 @@
ShortcutKeyHandler::ShortcutKeyHandler()
{
_keySetIndex = 0;
_stopThread = false;
_thread = std::thread([=]() {
while(!_stopThread) {
ProcessKeys(EmulationSettings::GetEmulatorKeys());
ProcessKeys();
std::this_thread::sleep_for(std::chrono::duration<int, std::milli>(50));
}
});
@ -25,134 +26,108 @@ ShortcutKeyHandler::~ShortcutKeyHandler()
_thread.join();
}
bool ShortcutKeyHandler::DetectKeyPress(uint32_t keyCode)
bool ShortcutKeyHandler::IsKeyPressed(EmulatorShortcut shortcut)
{
if(ControlManager::IsKeyPressed(keyCode)) {
_keysDown.emplace(keyCode);
KeyCombination comb = EmulationSettings::GetShortcutKey(shortcut, _keySetIndex);
if(_prevKeysDown.find(keyCode) == _prevKeysDown.end()) {
int keyCount = (comb.Key1 ? 1 : 0) + (comb.Key2 ? 1 : 0) + (comb.Key3 ? 1 : 0);
if(keyCount == 0) {
return false;
}
if(_pressedKeys.size() != keyCount) {
//Only allow shortcuts that use as many keys as the number of keys pressed
//e.g: Needed to prevent Shift-F1 from triggering a shortcut for F1
return false;
}
return ControlManager::IsKeyPressed(comb.Key1) &&
(comb.Key2 == 0 || ControlManager::IsKeyPressed(comb.Key2)) &&
(comb.Key3 == 0 || ControlManager::IsKeyPressed(comb.Key3));
}
bool ShortcutKeyHandler::DetectKeyPress(EmulatorShortcut shortcut)
{
if(IsKeyPressed(shortcut)) {
_keysDown[_keySetIndex].emplace(shortcut);
if(_prevKeysDown[_keySetIndex].find(shortcut) == _prevKeysDown[_keySetIndex].end()) {
return true;
}
}
return false;
}
bool ShortcutKeyHandler::DetectKeyRelease(uint32_t keyCode)
bool ShortcutKeyHandler::DetectKeyRelease(EmulatorShortcut shortcut)
{
if(!ControlManager::IsKeyPressed(keyCode)) {
if(_prevKeysDown.find(keyCode) != _prevKeysDown.end()) {
if(!IsKeyPressed(shortcut)) {
if(_prevKeysDown[_keySetIndex].find(shortcut) != _prevKeysDown[_keySetIndex].end()) {
return true;
}
}
return false;
}
void ShortcutKeyHandler::CheckMappedKeys(EmulatorKeyMappings mappings)
void ShortcutKeyHandler::CheckMappedKeys()
{
bool isNetplayClient = GameClient::Connected();
bool isMovieActive = MovieManager::Playing() || MovieManager::Recording();
bool needConfirm = EmulationSettings::CheckFlag(ConfirmExitResetPower);
if(DetectKeyPress(mappings.FastForward)) {
//Let the UI handle these shortcuts
for(uint64_t i = (uint64_t)EmulatorShortcut::SwitchDiskSide; i <= (uint64_t)EmulatorShortcut::OpenTraceLogger; i++) {
if(DetectKeyPress((EmulatorShortcut)i)) {
void* param = (void*)i;
MessageManager::SendNotification(ConsoleNotificationType::ExecuteShortcut, param);
}
}
if(DetectKeyPress(EmulatorShortcut::FastForward)) {
EmulationSettings::SetFlags(EmulationFlags::Turbo);
} else if(DetectKeyRelease(mappings.FastForward)) {
} else if(DetectKeyRelease(EmulatorShortcut::FastForward)) {
EmulationSettings::ClearFlags(EmulationFlags::Turbo);
}
if(DetectKeyPress(mappings.IncreaseSpeed)) {
EmulationSettings::IncreaseEmulationSpeed();
}
if(DetectKeyPress(mappings.DecreaseSpeed)) {
EmulationSettings::DecreaseEmulationSpeed();
}
if(DetectKeyPress(mappings.TakeScreenshot)) {
VideoDecoder::GetInstance()->TakeScreenshot();
}
if(VsControlManager::GetInstance() && !isNetplayClient && !isMovieActive) {
VsControlManager* manager = VsControlManager::GetInstance();
if(DetectKeyPress(mappings.InsertCoin1)) {
manager->InsertCoin(0);
}
if(DetectKeyPress(mappings.InsertCoin2)) {
manager->InsertCoin(1);
}
if(DetectKeyPress(mappings.VsServiceButton)) {
if(DetectKeyPress(EmulatorShortcut::VsServiceButton)) {
manager->SetServiceButtonState(true);
}
if(DetectKeyRelease(mappings.VsServiceButton)) {
if(DetectKeyRelease(EmulatorShortcut::VsServiceButton)) {
manager->SetServiceButtonState(false);
}
}
if(DetectKeyPress(mappings.SwitchDiskSide) && !isNetplayClient && !isMovieActive) {
FDS::SwitchDiskSide();
}
if(DetectKeyPress(mappings.InsertNextDisk) && !isNetplayClient && !isMovieActive) {
if(DetectKeyPress(EmulatorShortcut::InsertNextDisk) && !isNetplayClient && !isMovieActive) {
FDS::InsertNextDisk();
}
if(DetectKeyPress(mappings.MoveToNextStateSlot)) {
if(DetectKeyPress(EmulatorShortcut::MoveToNextStateSlot)) {
SaveStateManager::MoveToNextSlot();
}
if(DetectKeyPress(mappings.MoveToPreviousStateSlot)) {
if(DetectKeyPress(EmulatorShortcut::MoveToPreviousStateSlot)) {
SaveStateManager::MoveToPreviousSlot();
}
if(DetectKeyPress(mappings.SaveState)) {
if(DetectKeyPress(EmulatorShortcut::SaveState)) {
SaveStateManager::SaveState();
}
if(DetectKeyPress(mappings.LoadState) && !isNetplayClient) {
if(DetectKeyPress(EmulatorShortcut::LoadState) && !isNetplayClient) {
SaveStateManager::LoadState();
}
if(!isNetplayClient && !isMovieActive) {
if(DetectKeyPress(mappings.Reset)) {
if(needConfirm) {
MessageManager::SendNotification(ConsoleNotificationType::RequestReset);
} else {
Console::Reset(true);
}
}
if(DetectKeyPress(mappings.PowerCycle)) {
if(needConfirm) {
MessageManager::SendNotification(ConsoleNotificationType::RequestPowerCycle);
} else {
Console::Reset(false);
}
}
if(DetectKeyPress(EmulatorShortcut::ToggleCheats) && !isNetplayClient && !isMovieActive) {
MessageManager::SendNotification(ConsoleNotificationType::ExecuteShortcut, (void*)EmulatorShortcut::ToggleCheats);
}
if(DetectKeyPress(mappings.PowerOff)) {
Console::GetInstance()->Stop();
if(DetectKeyPress(EmulatorShortcut::ToggleAudio)) {
MessageManager::SendNotification(ConsoleNotificationType::ExecuteShortcut, (void*)EmulatorShortcut::ToggleAudio);
}
if(DetectKeyPress(mappings.Exit)) {
MessageManager::SendNotification(ConsoleNotificationType::RequestExit);
}
if(DetectKeyPress(mappings.Pause) && !isNetplayClient) {
if(EmulationSettings::CheckFlag(EmulationFlags::Paused)) {
EmulationSettings::ClearFlags(EmulationFlags::Paused);
} else {
EmulationSettings::SetFlags(EmulationFlags::Paused);
}
}
if(DetectKeyPress(mappings.ToggleCheats) && !isNetplayClient && !isMovieActive) {
MessageManager::SendNotification(ConsoleNotificationType::ToggleCheats);
}
if(DetectKeyPress(mappings.ToggleAudio)) {
MessageManager::SendNotification(ConsoleNotificationType::ToggleAudio);
}
if(ControlManager::IsKeyPressed(mappings.RunSingleFrame)) {
if(IsKeyPressed(EmulatorShortcut::RunSingleFrame)) {
if(EmulationSettings::CheckFlag(EmulationFlags::Paused)) {
EmulationSettings::ClearFlags(EmulationFlags::Paused);
Console::Pause();
@ -165,24 +140,29 @@ void ShortcutKeyHandler::CheckMappedKeys(EmulatorKeyMappings mappings)
}
if(!isNetplayClient && !isMovieActive && !EmulationSettings::CheckFlag(NsfPlayerEnabled)) {
if(DetectKeyPress(mappings.Rewind)) {
if(DetectKeyPress(EmulatorShortcut::Rewind)) {
RewindManager::StartRewinding();
} else if(DetectKeyRelease(mappings.Rewind)) {
} else if(DetectKeyRelease(EmulatorShortcut::Rewind)) {
RewindManager::StopRewinding();
} else if(DetectKeyPress(mappings.RewindTenSecs)) {
} else if(DetectKeyPress(EmulatorShortcut::RewindTenSecs)) {
RewindManager::RewindSeconds(10);
} else if(DetectKeyPress(mappings.RewindOneMin)) {
} else if(DetectKeyPress(EmulatorShortcut::RewindOneMin)) {
RewindManager::RewindSeconds(60);
}
}
}
void ShortcutKeyHandler::ProcessKeys(EmulatorKeyMappingSet mappings)
void ShortcutKeyHandler::ProcessKeys()
{
auto lock = _lock.AcquireSafe();
ControlManager::RefreshKeyState();
_keysDown.clear();
CheckMappedKeys(mappings.KeySet1);
CheckMappedKeys(mappings.KeySet2);
_prevKeysDown = _keysDown;
_pressedKeys = ControlManager::GetPressedKeys();
for(int i = 0; i < 2; i++) {
_keysDown[i].clear();
_keySetIndex = i;
CheckMappedKeys();
_prevKeysDown[i] = _keysDown[i];
}
}

View file

@ -2,6 +2,7 @@
#include "stdafx.h"
#include <thread>
#include <unordered_set>
#include "../Utilities/SimpleLock.h"
#include "EmulationSettings.h"
class ShortcutKeyHandler
@ -9,17 +10,24 @@ class ShortcutKeyHandler
private:
std::thread _thread;
atomic<bool> _stopThread;
SimpleLock _lock;
std::unordered_set<uint32_t> _keysDown;
std::unordered_set<uint32_t> _prevKeysDown;
int _keySetIndex;
vector<uint32_t> _pressedKeys;
void CheckMappedKeys(EmulatorKeyMappings mappings);
void ProcessKeys(EmulatorKeyMappingSet mappings);
std::unordered_set<EmulatorShortcut> _keysDown[2];
std::unordered_set<EmulatorShortcut> _prevKeysDown[2];
bool DetectKeyPress(uint32_t keyCode);
bool DetectKeyRelease(uint32_t keyCode);
void CheckMappedKeys();
bool IsKeyPressed(EmulatorShortcut key);
bool DetectKeyPress(EmulatorShortcut key);
bool DetectKeyRelease(EmulatorShortcut key);
public:
ShortcutKeyHandler();
~ShortcutKeyHandler();
void ProcessKeys();
};

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Mesen.GUI.Forms;
namespace Mesen.GUI.Config
@ -48,8 +49,9 @@ namespace Mesen.GUI.Config
public bool CloudSaveIntegration = false;
public DateTime CloudLastSync = DateTime.MinValue;
public EmulatorKeyMappings? EmulatorKeySet1;
public EmulatorKeyMappings? EmulatorKeySet2;
public bool DefaultsInitialized = false;
public List<ShortcutKeyInfo> ShortcutKeys1;
public List<ShortcutKeyInfo> ShortcutKeys2;
public bool DisableGameDatabase = false;
public bool DisableOsd = false;
@ -87,19 +89,63 @@ namespace Mesen.GUI.Config
public void InitializeDefaults()
{
if(EmulatorKeySet1 == null) {
EmulatorKeySet1 = new EmulatorKeyMappings() {
FastForward = InteropEmu.GetKeyCode("Tab"),
Rewind = InteropEmu.GetKeyCode("Backspace")
};
}
if(!DefaultsInitialized) {
ShortcutKeys1 = new List<ShortcutKeyInfo>();
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.FastForward, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Tab") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Rewind, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Backspace") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.IncreaseSpeed, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("+") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.DecreaseSpeed, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("-") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.MaxSpeed, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F9") }));
if(EmulatorKeySet2 == null) {
EmulatorKeySet2 = new EmulatorKeyMappings() {
FastForward = InteropEmu.GetKeyCode("Pad1 R2"),
Rewind = InteropEmu.GetKeyCode("Pad1 L2")
};
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.ToggleFps, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F10") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.ToggleFullscreen, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F11") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.TakeScreenshot, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F12") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadRandomGame, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("Ins") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Reset, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("R") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.PowerCycle, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("T") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Pause, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Esc") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale1x, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Alt"), Key2 = InteropEmu.GetKeyCode("1") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale2x, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Alt"), Key2 = InteropEmu.GetKeyCode("2") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale3x, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Alt"), Key2 = InteropEmu.GetKeyCode("3") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale4x, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Alt"), Key2 = InteropEmu.GetKeyCode("4") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale5x, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Alt"), Key2 = InteropEmu.GetKeyCode("5") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale6x, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Alt"), Key2 = InteropEmu.GetKeyCode("6") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.OpenAssembler, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("A") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.OpenDebugger, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("D") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.OpenMemoryTools, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("M") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.OpenPpuViewer, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("P") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.OpenScriptWindow, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("J") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.OpenTraceLogger, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("N") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.OpenFile, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("O") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot1, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Shift"), Key2 = InteropEmu.GetKeyCode("F1") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot2, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Shift"), Key2 = InteropEmu.GetKeyCode("F2") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot3, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Shift"), Key2 = InteropEmu.GetKeyCode("F3") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot4, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Shift"), Key2 = InteropEmu.GetKeyCode("F4") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot5, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Shift"), Key2 = InteropEmu.GetKeyCode("F5") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot6, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Shift"), Key2 = InteropEmu.GetKeyCode("F6") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot7, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Shift"), Key2 = InteropEmu.GetKeyCode("F7") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateToFile, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("S") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot1, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F1") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot2, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F2") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot3, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F3") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot4, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F4") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot5, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F5") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot6, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F6") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot7, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F7") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot8, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F8") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateFromFile, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("L") }));
ShortcutKeys2 = new List<ShortcutKeyInfo>();
ShortcutKeys2.Add(new ShortcutKeyInfo(EmulatorShortcut.FastForward, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Pad1 R2") }));
ShortcutKeys2.Add(new ShortcutKeyInfo(EmulatorShortcut.Rewind, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Pad1 L2") }));
}
DefaultsInitialized = true;
}
static public void ApplyConfig()
@ -141,11 +187,32 @@ namespace Mesen.GUI.Config
InteropEmu.SetFlag(EmulationFlags.NsfShuffle, preferenceInfo.NsfShuffle);
InteropEmu.SetAutoSaveOptions(preferenceInfo.AutoSave ? (uint)preferenceInfo.AutoSaveDelay : 0, preferenceInfo.AutoSaveNotify);
InteropEmu.SetEmulatorKeys(new EmulatorKeyMappingSet() { KeySet1 = preferenceInfo.EmulatorKeySet1.Value, KeySet2 = preferenceInfo.EmulatorKeySet2.Value });
InteropEmu.ClearShortcutKeys();
foreach(ShortcutKeyInfo shortcutInfo in preferenceInfo.ShortcutKeys1) {
InteropEmu.SetShortcutKey(shortcutInfo.Shortcut, shortcutInfo.KeyCombination, 0);
}
foreach(ShortcutKeyInfo shortcutInfo in preferenceInfo.ShortcutKeys2) {
InteropEmu.SetShortcutKey(shortcutInfo.Shortcut, shortcutInfo.KeyCombination, 1);
}
InteropEmu.SetRewindBufferSize(preferenceInfo.RewindBufferSize);
InteropEmu.SetFolderOverrides(ConfigManager.SaveFolder, ConfigManager.SaveStateFolder, ConfigManager.ScreenshotFolder);
}
}
public class ShortcutKeyInfo
{
public EmulatorShortcut Shortcut;
public KeyCombination KeyCombination;
public ShortcutKeyInfo() { }
public ShortcutKeyInfo(EmulatorShortcut key, KeyCombination keyCombination)
{
Shortcut = key;
KeyCombination = keyCombination;
}
}
}

View file

@ -228,9 +228,9 @@ namespace Mesen.GUI.Controls
private void tmrInput_Tick(object sender, EventArgs e)
{
//Use player 1's controls to navigate the recent game selection screen
if(!InteropEmu.IsRunning()) {
uint keyCode = InteropEmu.GetPressedKey();
if(Application.OpenForms.Count > 0 && Application.OpenForms[0].ContainsFocus && !InteropEmu.IsRunning()) {
List<uint> keyCodes = InteropEmu.GetPressedKeys();
uint keyCode = keyCodes.Count > 0 ? keyCodes[0] : 0;
if(keyCode > 0) {
if(!_waitForRelease) {
foreach(KeyMappings mapping in ConfigManager.Config.InputInfo.Controllers[0].Keys) {

View file

@ -373,10 +373,13 @@
<Control ID="chkFdsAutoLoadDisk">Insereix automàticament la cara A del disc 1 al carregar un joc de la FDS</Control>
<Control ID="chkFdsFastForwardOnLoad">Activa l'avanç ràpid automàticament en jocs de la FDS mentre el disc o la BIOS es carreguen</Control>
<Control ID="chkFdsAutoInsertDisk">Canvia automàticament de disc en jocs de la FDS</Control>
<Control ID="tpgShortcuts">Dreceres</Control>
<Control ID="lblShortcutWarning">Warning: Your current configuration contains conflicting key bindings. If this is not intentional, please review and correct your key bindings.</Control>
<Control ID="colAction">Acció</Control>
<Control ID="colBinding1">Drecera #1</Control>
<Control ID="colBinding2">Drecera #2</Control>
<Control ID="tpgSaveData">Còpies de seguretat</Control>
<Control ID="grpAutomaticSaves">Desat de partida automàtic</Control>
<Control ID="chkAutoSave">Desa automàticament cada</Control>
@ -680,6 +683,42 @@
<Message ID="EmulatorShortcutMappings_ToggleCheats">Activa/Desactiva els trucs</Message>
<Message ID="EmulatorShortcutMappings_ToggleAudio">Activa/Desactiva el so</Message>
<Message ID="EmulatorShortcutMappings_RunSingleFrame">Avança un sol fotograma</Message>
<Message ID="EmulatorShortcutMappings_EjectDisk">FDS - Eject Disk</Message>
<Message ID="EmulatorShortcutMappings_SetScale1x">Set Scale 1x</Message>
<Message ID="EmulatorShortcutMappings_SetScale2x">Set Scale 2x</Message>
<Message ID="EmulatorShortcutMappings_SetScale3x">Set Scale 3x</Message>
<Message ID="EmulatorShortcutMappings_SetScale4x">Set Scale 4x</Message>
<Message ID="EmulatorShortcutMappings_SetScale5x">Set Scale 5x</Message>
<Message ID="EmulatorShortcutMappings_SetScale6x">Set Scale 6x</Message>
<Message ID="EmulatorShortcutMappings_ToggleFullscreen">Toggle Fullscreen Mode</Message>
<Message ID="EmulatorShortcutMappings_ToggleFps">Toggle FPS Counter</Message>
<Message ID="EmulatorShortcutMappings_MaxSpeed">Toggle Maximum Speed</Message>
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Load Random Game</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Save State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot2">Save State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot3">Save State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot4">Save State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot5">Save State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot6">Save State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot7">Save State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_SaveStateToFile">Save State to File</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot1">Load State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot2">Load State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot3">Load State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot4">Load State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot5">Load State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot6">Load State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot7">Load State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot8">Load State - Slot 8</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Load State from File</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Open File</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Open Debugger</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Open Assembler</Message>
<Message ID="EmulatorShortcutMappings_OpenPpuViewer">Open Ppu Viewer</Message>
<Message ID="EmulatorShortcutMappings_OpenMemoryTools">Open Memory Tools</Message>
<Message ID="EmulatorShortcutMappings_OpenScriptWindow">Open Script Window</Message>
<Message ID="EmulatorShortcutMappings_OpenTraceLogger">Open Trace Logger</Message>
</Messages>
<Enums>
<Enum ID="ControllerType">

View file

@ -105,6 +105,42 @@
<Message ID="EmulatorShortcutMappings_ToggleCheats">Enable/Disable Cheat Codes</Message>
<Message ID="EmulatorShortcutMappings_ToggleAudio">Enable/Disable Audio</Message>
<Message ID="EmulatorShortcutMappings_RunSingleFrame">Run Single Frame</Message>
<Message ID="EmulatorShortcutMappings_EjectDisk">FDS - Eject Disk</Message>
<Message ID="EmulatorShortcutMappings_SetScale1x">Set Scale 1x</Message>
<Message ID="EmulatorShortcutMappings_SetScale2x">Set Scale 2x</Message>
<Message ID="EmulatorShortcutMappings_SetScale3x">Set Scale 3x</Message>
<Message ID="EmulatorShortcutMappings_SetScale4x">Set Scale 4x</Message>
<Message ID="EmulatorShortcutMappings_SetScale5x">Set Scale 5x</Message>
<Message ID="EmulatorShortcutMappings_SetScale6x">Set Scale 6x</Message>
<Message ID="EmulatorShortcutMappings_ToggleFullscreen">Toggle Fullscreen Mode</Message>
<Message ID="EmulatorShortcutMappings_ToggleFps">Toggle FPS Counter</Message>
<Message ID="EmulatorShortcutMappings_MaxSpeed">Toggle Maximum Speed</Message>
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Load Random Game</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Save State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot2">Save State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot3">Save State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot4">Save State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot5">Save State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot6">Save State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot7">Save State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_SaveStateToFile">Save State to File</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot1">Load State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot2">Load State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot3">Load State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot4">Load State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot5">Load State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot6">Load State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot7">Load State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot8">Load State - Slot 8</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Load State from File</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Open File</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Open Debugger</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Open Assembler</Message>
<Message ID="EmulatorShortcutMappings_OpenPpuViewer">Open Ppu Viewer</Message>
<Message ID="EmulatorShortcutMappings_OpenMemoryTools">Open Memory Tools</Message>
<Message ID="EmulatorShortcutMappings_OpenScriptWindow">Open Script Window</Message>
<Message ID="EmulatorShortcutMappings_OpenTraceLogger">Open Trace Logger</Message>
</Messages>
<Enums>
<Enum ID="ControllerType">

View file

@ -388,10 +388,13 @@
<Control ID="chkFdsAutoLoadDisk">Insertar la cara A del disco 1 al cargar un juego FDS</Control>
<Control ID="chkFdsFastForwardOnLoad">Aumentar la velocidad de la emulación de juegos de carga FDS</Control>
<Control ID="chkFdsAutoInsertDisk">Cambiar los discos automáticamente para juegos FDS</Control>
<Control ID="tpgShortcuts">Atajos</Control>
<Control ID="lblShortcutWarning">Warning: Your current configuration contains conflicting key bindings. If this is not intentional, please review and correct your key bindings.</Control>
<Control ID="colAction">Acción</Control>
<Control ID="colBinding1">Atajo #1</Control>
<Control ID="colBinding2">Atajo #2</Control>
<Control ID="tpgSaveData">Copias de seguridad</Control>
<Control ID="grpAutomaticSaves">Guardado de estado automático</Control>
<Control ID="chkAutoSave">Crear una copia de seguridad de cada estado</Control>
@ -714,6 +717,42 @@
<Message ID="EmulatorShortcutMappings_ToggleCheats">Habilitar/Deshabilitar códigos de trucos</Message>
<Message ID="EmulatorShortcutMappings_ToggleAudio">Habilitar/Deshabilitar sonido</Message>
<Message ID="EmulatorShortcutMappings_RunSingleFrame">Ejecutar un sólo fotograma</Message>
<Message ID="EmulatorShortcutMappings_EjectDisk">FDS - Eject Disk</Message>
<Message ID="EmulatorShortcutMappings_SetScale1x">Set Scale 1x</Message>
<Message ID="EmulatorShortcutMappings_SetScale2x">Set Scale 2x</Message>
<Message ID="EmulatorShortcutMappings_SetScale3x">Set Scale 3x</Message>
<Message ID="EmulatorShortcutMappings_SetScale4x">Set Scale 4x</Message>
<Message ID="EmulatorShortcutMappings_SetScale5x">Set Scale 5x</Message>
<Message ID="EmulatorShortcutMappings_SetScale6x">Set Scale 6x</Message>
<Message ID="EmulatorShortcutMappings_ToggleFullscreen">Toggle Fullscreen Mode</Message>
<Message ID="EmulatorShortcutMappings_ToggleFps">Toggle FPS Counter</Message>
<Message ID="EmulatorShortcutMappings_MaxSpeed">Toggle Maximum Speed</Message>
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Load Random Game</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Save State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot2">Save State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot3">Save State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot4">Save State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot5">Save State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot6">Save State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot7">Save State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_SaveStateToFile">Save State to File</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot1">Load State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot2">Load State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot3">Load State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot4">Load State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot5">Load State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot6">Load State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot7">Load State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot8">Load State - Slot 8</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Load State from File</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Open File</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Open Debugger</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Open Assembler</Message>
<Message ID="EmulatorShortcutMappings_OpenPpuViewer">Open Ppu Viewer</Message>
<Message ID="EmulatorShortcutMappings_OpenMemoryTools">Open Memory Tools</Message>
<Message ID="EmulatorShortcutMappings_OpenScriptWindow">Open Script Window</Message>
<Message ID="EmulatorShortcutMappings_OpenTraceLogger">Open Trace Logger</Message>
</Messages>
<Enums>
<Enum ID="ControllerType">

View file

@ -200,7 +200,7 @@
<Control ID="lblDisplayPosition">Position d'affichage :</Control>
<Control ID="chkDisplayInputHorizontally">Afficher horizontalement</Control>
<Control ID="lblKeyBinding">Attention: Votre configuration actuel contient des conflicts - certaines touches sur votre clavier ou manetter sont mappées à plusieurs boutons sur la console. Veuillez réviser votre configuration et la corriger au besoin.</Control>
<Control ID="lblKeyBinding">Attention: Votre configuration actuelle contient des conflicts - certaines touches sur votre clavier ou manette sont mappées à plusieurs boutons sur la console. Veuillez réviser votre configuration et la corriger au besoin.</Control>
</Form>
<Form ID="frmControllerConfig" Title="Configuration de la manette">
<Control ID="lblTurboSpeed">Vitesse du mode turbo:</Control>
@ -400,6 +400,7 @@
<Control ID="lblRewindMinutes">minutes (Utilise ≈1MB/min)</Control>
<Control ID="tpgShortcuts">Raccourcis</Control>
<Control ID="lblShortcutWarning">Attention: Votre configuration actuelle contient des conflicts. Veuillez réviser votre configuration et la corriger au besoin.</Control>
<Control ID="colAction">Action</Control>
<Control ID="colBinding1">Raccourci #1</Control>
<Control ID="colBinding2">Raccourci #2</Control>
@ -729,6 +730,42 @@
<Message ID="EmulatorShortcutMappings_ToggleCheats">Activer/Désactiver tous les codes</Message>
<Message ID="EmulatorShortcutMappings_ToggleAudio">Activer/Désactiver l'audio</Message>
<Message ID="EmulatorShortcutMappings_RunSingleFrame">Avancer d'une seule image</Message>
<Message ID="EmulatorShortcutMappings_EjectDisk">FDS - Éjecter le disque</Message>
<Message ID="EmulatorShortcutMappings_SetScale1x">Taille de l'image 1x</Message>
<Message ID="EmulatorShortcutMappings_SetScale2x">Taille de l'image 2x</Message>
<Message ID="EmulatorShortcutMappings_SetScale3x">Taille de l'image 3x</Message>
<Message ID="EmulatorShortcutMappings_SetScale4x">Taille de l'image 4x</Message>
<Message ID="EmulatorShortcutMappings_SetScale5x">Taille de l'image 5x</Message>
<Message ID="EmulatorShortcutMappings_SetScale6x">Taille de l'image 6x</Message>
<Message ID="EmulatorShortcutMappings_ToggleFullscreen">Activer/Désactiver le mode plein écran</Message>
<Message ID="EmulatorShortcutMappings_ToggleFps">Activer/Désactiver le compteur FPS</Message>
<Message ID="EmulatorShortcutMappings_MaxSpeed">Activer/Désactiver la vitesse maximale</Message>
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Ouvrir un jeu aléatoire</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Sauvegarde d'état - Position 1</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot2">Sauvegarde d'état - Position 2</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot3">Sauvegarde d'état - Position 3</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot4">Sauvegarde d'état - Position 4</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot5">Sauvegarde d'état - Position 5</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot6">Sauvegarde d'état - Position 6</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot7">Sauvegarde d'état - Position 7</Message>
<Message ID="EmulatorShortcutMappings_SaveStateToFile">Sauvergarde l'état dans un fichier</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot1">Chargement d'état - Position 1</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot2">Chargement d'état - Position 2</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot3">Chargement d'état - Position 3</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot4">Chargement d'état - Position 4</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot5">Chargement d'état - Position 5</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot6">Chargement d'état - Position 6</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot7">Chargement d'état - Position 7</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot8">Chargement d'état - Position 8</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Charger l'état à partir d'un fichier</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Ouvrir un fichier</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Ouvrir le débogueur</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Ouvrir l'assembleur</Message>
<Message ID="EmulatorShortcutMappings_OpenPpuViewer">Ouvrir le visualiseur du PPU</Message>
<Message ID="EmulatorShortcutMappings_OpenMemoryTools">Ouvrir les outils mémoire</Message>
<Message ID="EmulatorShortcutMappings_OpenScriptWindow">Ouvrir une fenêtre de script</Message>
<Message ID="EmulatorShortcutMappings_OpenTraceLogger">Ouvrir l'enregistreur de trace</Message>
</Messages>
<Enums>
<Enum ID="ControllerType">

View file

@ -35,6 +35,8 @@
<Control ID="mnuScale2x">2倍</Control>
<Control ID="mnuScale3x">3倍</Control>
<Control ID="mnuScale4x">4倍</Control>
<Control ID="mnuScale5x">5倍</Control>
<Control ID="mnuScale6x">6倍</Control>
<Control ID="mnuScaleCustom">カスタム</Control>
<Control ID="mnuFullscreen">全画面表示</Control>
<Control ID="mnuVideoFilter">画面エフェクト</Control>
@ -399,6 +401,7 @@
<Control ID="lblRewindMinutes">分をキープする (メモリの使用量分に約MB)</Control>
<Control ID="tpgShortcuts"> ショートカットキー </Control>
<Control ID="lblShortcutWarning">注意: 使っている設定の中には同じマッピングが何回もあります。 間違いでこの設定にした場合は、設定を確認して直してください。</Control>
<Control ID="colAction">機能</Control>
<Control ID="colBinding1">ショートカットキー1</Control>
<Control ID="colBinding2">ショートカットキー2</Control>
@ -712,6 +715,42 @@
<Message ID="EmulatorShortcutMappings_ToggleCheats">チートコードを無効・有効にする</Message>
<Message ID="EmulatorShortcutMappings_ToggleAudio">音声を無効・有効にする</Message>
<Message ID="EmulatorShortcutMappings_RunSingleFrame">次のフレームを表す</Message>
<Message ID="EmulatorShortcutMappings_EjectDisk">FDS - ディスクを取り出す</Message>
<Message ID="EmulatorShortcutMappings_SetScale1x">映像サイズ 1倍</Message>
<Message ID="EmulatorShortcutMappings_SetScale2x">映像サイズ 2倍</Message>
<Message ID="EmulatorShortcutMappings_SetScale3x">映像サイズ 3倍</Message>
<Message ID="EmulatorShortcutMappings_SetScale4x">映像サイズ 4倍</Message>
<Message ID="EmulatorShortcutMappings_SetScale5x">映像サイズ 5倍</Message>
<Message ID="EmulatorShortcutMappings_SetScale6x">映像サイズ 6倍</Message>
<Message ID="EmulatorShortcutMappings_ToggleFullscreen">全画面表示</Message>
<Message ID="EmulatorShortcutMappings_ToggleFps">フレームレート表示</Message>
<Message ID="EmulatorShortcutMappings_MaxSpeed">最高速度を無効・有効にする</Message>
<Message ID="EmulatorShortcutMappings_LoadRandomGame">ランダムゲームを開く</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">クイックセーブスロット1に保存する</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot2">クイックセーブスロット2に保存する</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot3">クイックセーブスロット3に保存する</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot4">クイックセーブスロット4に保存する</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot5">クイックセーブスロット5に保存する</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot6">クイックセーブスロット6に保存する</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot7">クイックセーブスロット7に保存する</Message>
<Message ID="EmulatorShortcutMappings_SaveStateToFile">クイックセーブデータをファイルに保存する</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot1">クイックセーブスロット1からロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot2">クイックセーブスロット2からロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot3">クイックセーブスロット3からロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot4">クイックセーブスロット4からロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot5">クイックセーブスロット5からロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot6">クイックセーブスロット6からロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot7">クイックセーブスロット7からロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot8">クイックセーブスロット8からロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">クイックセーブデータをファイルからロードする</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">ファイルを開く</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">デバッガを開く</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">アセンブラを開く</Message>
<Message ID="EmulatorShortcutMappings_OpenPpuViewer">PPUビューアーを開く</Message>
<Message ID="EmulatorShortcutMappings_OpenMemoryTools">メモリツールを開く</Message>
<Message ID="EmulatorShortcutMappings_OpenScriptWindow">スクリプトウインドウを開く</Message>
<Message ID="EmulatorShortcutMappings_OpenTraceLogger">トレースロガーを開く</Message>
</Messages>
<Enums>
<Enum ID="ControllerType">

View file

@ -388,10 +388,13 @@
<Control ID="chkFdsAutoLoadDisk">Inserir a parte A do disco 1 ao carregar um jogo FDS</Control>
<Control ID="chkFdsFastForwardOnLoad">Aumentar a velocidade da emulação de jogos ao carregar no FDS</Control>
<Control ID="chkFdsAutoInsertDisk">Trocar automaticamente disquetes para os jogos do FDS</Control>
<Control ID="tpgShortcuts">Atalhos</Control>
<Control ID="lblShortcutWarning">Warning: Your current configuration contains conflicting key bindings. If this is not intentional, please review and correct your key bindings.</Control>
<Control ID="colAction">Ação</Control>
<Control ID="colBinding1">Atalho #1</Control>
<Control ID="colBinding2">Atalho #2</Control>
<Control ID="tpgSaveData">Cópias de segurança</Control>
<Control ID="grpAutomaticSaves">Salvar estado automático</Control>
<Control ID="chkAutoSave">Salvar estado do jogo automaticamente a cada</Control>
@ -714,6 +717,42 @@
<Message ID="EmulatorShortcutMappings_ToggleCheats">Habilitar/Desabilitar códigos de cheat</Message>
<Message ID="EmulatorShortcutMappings_ToggleAudio">Habilitar/Desabilitar áudio</Message>
<Message ID="EmulatorShortcutMappings_RunSingleFrame">Executar um só quadro</Message>
<Message ID="EmulatorShortcutMappings_EjectDisk">FDS - Eject Disk</Message>
<Message ID="EmulatorShortcutMappings_SetScale1x">Set Scale 1x</Message>
<Message ID="EmulatorShortcutMappings_SetScale2x">Set Scale 2x</Message>
<Message ID="EmulatorShortcutMappings_SetScale3x">Set Scale 3x</Message>
<Message ID="EmulatorShortcutMappings_SetScale4x">Set Scale 4x</Message>
<Message ID="EmulatorShortcutMappings_SetScale5x">Set Scale 5x</Message>
<Message ID="EmulatorShortcutMappings_SetScale6x">Set Scale 6x</Message>
<Message ID="EmulatorShortcutMappings_ToggleFullscreen">Toggle Fullscreen Mode</Message>
<Message ID="EmulatorShortcutMappings_ToggleFps">Toggle FPS Counter</Message>
<Message ID="EmulatorShortcutMappings_MaxSpeed">Toggle Maximum Speed</Message>
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Load Random Game</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Save State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot2">Save State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot3">Save State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot4">Save State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot5">Save State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot6">Save State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot7">Save State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_SaveStateToFile">Save State to File</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot1">Load State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot2">Load State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot3">Load State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot4">Load State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot5">Load State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot6">Load State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot7">Load State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot8">Load State - Slot 8</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Load State from File</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Open File</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Open Debugger</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Open Assembler</Message>
<Message ID="EmulatorShortcutMappings_OpenPpuViewer">Open Ppu Viewer</Message>
<Message ID="EmulatorShortcutMappings_OpenMemoryTools">Open Memory Tools</Message>
<Message ID="EmulatorShortcutMappings_OpenScriptWindow">Open Script Window</Message>
<Message ID="EmulatorShortcutMappings_OpenTraceLogger">Open Trace Logger</Message>
</Messages>
<Enums>
<Enum ID="ControllerType">

View file

@ -399,6 +399,7 @@
<Control ID="lblRewindMinutes">minutes (Memory Usage ≈1MB/min)</Control>
<Control ID="tpgShortcuts">Горячие клавиши</Control>
<Control ID="lblShortcutWarning">Warning: Your current configuration contains conflicting key bindings. If this is not intentional, please review and correct your key bindings.</Control>
<Control ID="colAction">Действие</Control>
<Control ID="colBinding1">Вариант #1</Control>
<Control ID="colBinding2">Вариант #2</Control>
@ -719,6 +720,42 @@
<Message ID="EmulatorShortcutMappings_ToggleCheats">Enable/Disable Cheat Codes</Message>
<Message ID="EmulatorShortcutMappings_ToggleAudio">Enable/Disable Audio</Message>
<Message ID="EmulatorShortcutMappings_RunSingleFrame">Run Single Frame</Message>
<Message ID="EmulatorShortcutMappings_EjectDisk">FDS - Eject Disk</Message>
<Message ID="EmulatorShortcutMappings_SetScale1x">Set Scale 1x</Message>
<Message ID="EmulatorShortcutMappings_SetScale2x">Set Scale 2x</Message>
<Message ID="EmulatorShortcutMappings_SetScale3x">Set Scale 3x</Message>
<Message ID="EmulatorShortcutMappings_SetScale4x">Set Scale 4x</Message>
<Message ID="EmulatorShortcutMappings_SetScale5x">Set Scale 5x</Message>
<Message ID="EmulatorShortcutMappings_SetScale6x">Set Scale 6x</Message>
<Message ID="EmulatorShortcutMappings_ToggleFullscreen">Toggle Fullscreen Mode</Message>
<Message ID="EmulatorShortcutMappings_ToggleFps">Toggle FPS Counter</Message>
<Message ID="EmulatorShortcutMappings_MaxSpeed">Toggle Maximum Speed</Message>
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Load Random Game</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Save State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot2">Save State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot3">Save State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot4">Save State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot5">Save State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot6">Save State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot7">Save State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_SaveStateToFile">Save State to File</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot1">Load State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot2">Load State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot3">Load State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot4">Load State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot5">Load State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot6">Load State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot7">Load State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot8">Load State - Slot 8</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Load State from File</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Open File</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Open Debugger</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Open Assembler</Message>
<Message ID="EmulatorShortcutMappings_OpenPpuViewer">Open Ppu Viewer</Message>
<Message ID="EmulatorShortcutMappings_OpenMemoryTools">Open Memory Tools</Message>
<Message ID="EmulatorShortcutMappings_OpenScriptWindow">Open Script Window</Message>
<Message ID="EmulatorShortcutMappings_OpenTraceLogger">Open Trace Logger</Message>
</Messages>
<Enums>
<Enum ID="ControllerType">

View file

@ -399,6 +399,7 @@
<Control ID="lblRewindMinutes">хвилин (Використання Пам'яті ≈1 МБ/хв)</Control>
<Control ID="tpgShortcuts">Гарячі клавіші</Control>
<Control ID="lblShortcutWarning">Warning: Your current configuration contains conflicting key bindings. If this is not intentional, please review and correct your key bindings.</Control>
<Control ID="colAction">Дія</Control>
<Control ID="colBinding1">Варiант #1</Control>
<Control ID="colBinding2">Варiант #2</Control>
@ -719,6 +720,42 @@
<Message ID="EmulatorShortcutMappings_ToggleCheats">Включити/Виключити Чит Коди</Message>
<Message ID="EmulatorShortcutMappings_ToggleAudio">Увімкнути/Вимкнути звук</Message>
<Message ID="EmulatorShortcutMappings_RunSingleFrame">Запуск Одного Кадру</Message>
<Message ID="EmulatorShortcutMappings_EjectDisk">FDS - Eject Disk</Message>
<Message ID="EmulatorShortcutMappings_SetScale1x">Set Scale 1x</Message>
<Message ID="EmulatorShortcutMappings_SetScale2x">Set Scale 2x</Message>
<Message ID="EmulatorShortcutMappings_SetScale3x">Set Scale 3x</Message>
<Message ID="EmulatorShortcutMappings_SetScale4x">Set Scale 4x</Message>
<Message ID="EmulatorShortcutMappings_SetScale5x">Set Scale 5x</Message>
<Message ID="EmulatorShortcutMappings_SetScale6x">Set Scale 6x</Message>
<Message ID="EmulatorShortcutMappings_ToggleFullscreen">Toggle Fullscreen Mode</Message>
<Message ID="EmulatorShortcutMappings_ToggleFps">Toggle FPS Counter</Message>
<Message ID="EmulatorShortcutMappings_MaxSpeed">Toggle Maximum Speed</Message>
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Load Random Game</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Save State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot2">Save State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot3">Save State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot4">Save State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot5">Save State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot6">Save State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_SaveStateSlot7">Save State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_SaveStateToFile">Save State to File</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot1">Load State - Slot 1</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot2">Load State - Slot 2</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot3">Load State - Slot 3</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot4">Load State - Slot 4</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot5">Load State - Slot 5</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot6">Load State - Slot 6</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot7">Load State - Slot 7</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlot8">Load State - Slot 8</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Load State from File</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Open File</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Open Debugger</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Open Assembler</Message>
<Message ID="EmulatorShortcutMappings_OpenPpuViewer">Open Ppu Viewer</Message>
<Message ID="EmulatorShortcutMappings_OpenMemoryTools">Open Memory Tools</Message>
<Message ID="EmulatorShortcutMappings_OpenScriptWindow">Open Script Window</Message>
<Message ID="EmulatorShortcutMappings_OpenTraceLogger">Open Trace Logger</Message>
</Messages>
<Enums>
<Enum ID="ControllerType">

View file

@ -31,7 +31,16 @@
this.colAction = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colBinding1 = new System.Windows.Forms.DataGridViewButtonColumn();
this.colBinding2 = new System.Windows.Forms.DataGridViewButtonColumn();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.pnlConflictWarning = new System.Windows.Forms.Panel();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.picWarning = new System.Windows.Forms.PictureBox();
this.lblShortcutWarning = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.gridShortcuts)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.pnlConflictWarning.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picWarning)).BeginInit();
this.SuspendLayout();
//
// gridShortcuts
@ -47,14 +56,16 @@
this.colBinding1,
this.colBinding2});
this.gridShortcuts.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridShortcuts.Location = new System.Drawing.Point(0, 0);
this.gridShortcuts.Location = new System.Drawing.Point(0, 32);
this.gridShortcuts.Margin = new System.Windows.Forms.Padding(0);
this.gridShortcuts.MultiSelect = false;
this.gridShortcuts.Name = "gridShortcuts";
this.gridShortcuts.RowHeadersVisible = false;
this.gridShortcuts.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.gridShortcuts.Size = new System.Drawing.Size(448, 248);
this.gridShortcuts.Size = new System.Drawing.Size(448, 216);
this.gridShortcuts.TabIndex = 2;
this.gridShortcuts.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.gridShortcuts_CellContentClick);
this.gridShortcuts.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.gridShortcuts_CellMouseDown);
//
// colAction
//
@ -78,15 +89,85 @@
this.colBinding2.Name = "colBinding2";
this.colBinding2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.colBinding2.Width = 110;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.pnlConflictWarning, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.gridShortcuts, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(448, 248);
this.tableLayoutPanel1.TabIndex = 3;
//
// pnlConflictWarning
//
this.pnlConflictWarning.BackColor = System.Drawing.Color.WhiteSmoke;
this.pnlConflictWarning.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnlConflictWarning.Controls.Add(this.tableLayoutPanel2);
this.pnlConflictWarning.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlConflictWarning.Location = new System.Drawing.Point(0, 0);
this.pnlConflictWarning.Margin = new System.Windows.Forms.Padding(0, 0, 0, 2);
this.pnlConflictWarning.Name = "pnlConflictWarning";
this.pnlConflictWarning.Size = new System.Drawing.Size(448, 30);
this.pnlConflictWarning.TabIndex = 20;
this.pnlConflictWarning.Visible = false;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 2;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Controls.Add(this.picWarning, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.lblShortcutWarning, 1, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(446, 28);
this.tableLayoutPanel2.TabIndex = 0;
//
// picWarning
//
this.picWarning.Anchor = System.Windows.Forms.AnchorStyles.None;
this.picWarning.Image = global::Mesen.GUI.Properties.Resources.Warning;
this.picWarning.Location = new System.Drawing.Point(3, 6);
this.picWarning.Name = "picWarning";
this.picWarning.Size = new System.Drawing.Size(16, 16);
this.picWarning.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.picWarning.TabIndex = 0;
this.picWarning.TabStop = false;
//
// lblShortcutWarning
//
this.lblShortcutWarning.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblShortcutWarning.Location = new System.Drawing.Point(25, 0);
this.lblShortcutWarning.Name = "lblShortcutWarning";
this.lblShortcutWarning.Size = new System.Drawing.Size(418, 28);
this.lblShortcutWarning.TabIndex = 1;
this.lblShortcutWarning.Text = "Warning: Your current configuration contains conflicting key bindings. If this is" +
" not intentional, please review and correct your key bindings.";
//
// ctrlEmulatorShortcuts
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.gridShortcuts);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "ctrlEmulatorShortcuts";
this.Size = new System.Drawing.Size(448, 248);
((System.ComponentModel.ISupportInitialize)(this.gridShortcuts)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.pnlConflictWarning.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picWarning)).EndInit();
this.ResumeLayout(false);
}
@ -96,5 +177,10 @@
private System.Windows.Forms.DataGridViewTextBoxColumn colAction;
private System.Windows.Forms.DataGridViewButtonColumn colBinding1;
private System.Windows.Forms.DataGridViewButtonColumn colBinding2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Panel pnlConflictWarning;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.PictureBox picWarning;
private System.Windows.Forms.Label lblShortcutWarning;
}
}

View file

@ -4,6 +4,7 @@ using System.Windows.Forms;
using Mesen.GUI.Config;
using System.Reflection;
using Mesen.GUI.Controls;
using System.Collections.Generic;
namespace Mesen.GUI.Forms.Config
{
@ -20,36 +21,150 @@ namespace Mesen.GUI.Forms.Config
private void InitializeGrid()
{
FieldInfo[] fields = typeof(EmulatorKeyMappings).GetFields();
foreach(FieldInfo fieldInfo in fields) {
int index = gridShortcuts.Rows.Add();
gridShortcuts.Rows[index].Cells[0].Tag = fieldInfo;
gridShortcuts.Rows[index].Cells[0].Value = ResourceHelper.GetMessage("EmulatorShortcutMappings_" + fieldInfo.Name);
EmulatorShortcut[] displayOrder = new EmulatorShortcut[] {
EmulatorShortcut.FastForward,
EmulatorShortcut.Rewind,
EmulatorShortcut.RewindTenSecs,
EmulatorShortcut.RewindOneMin,
UInt32 keyCode = (UInt32)fieldInfo.GetValue(ConfigManager.Config.PreferenceInfo.EmulatorKeySet1);
gridShortcuts.Rows[index].Cells[1].Value = InteropEmu.GetKeyName(keyCode);
gridShortcuts.Rows[index].Cells[1].Tag = keyCode;
EmulatorShortcut.Pause,
EmulatorShortcut.Reset,
EmulatorShortcut.PowerCycle,
EmulatorShortcut.PowerOff,
EmulatorShortcut.Exit,
keyCode = (UInt32)fieldInfo.GetValue(ConfigManager.Config.PreferenceInfo.EmulatorKeySet2);
gridShortcuts.Rows[index].Cells[2].Value = InteropEmu.GetKeyName(keyCode);
gridShortcuts.Rows[index].Cells[2].Tag = keyCode;
EmulatorShortcut.InsertNextDisk,
EmulatorShortcut.SwitchDiskSide,
EmulatorShortcut.EjectDisk,
EmulatorShortcut.InsertCoin1,
EmulatorShortcut.InsertCoin2,
EmulatorShortcut.VsServiceButton,
EmulatorShortcut.TakeScreenshot,
EmulatorShortcut.LoadRandomGame,
EmulatorShortcut.RunSingleFrame,
EmulatorShortcut.SetScale1x,
EmulatorShortcut.SetScale2x,
EmulatorShortcut.SetScale3x,
EmulatorShortcut.SetScale4x,
EmulatorShortcut.SetScale5x,
EmulatorShortcut.SetScale6x,
EmulatorShortcut.ToggleFullscreen,
EmulatorShortcut.ToggleFps,
EmulatorShortcut.ToggleCheats,
EmulatorShortcut.ToggleAudio,
EmulatorShortcut.MaxSpeed,
EmulatorShortcut.IncreaseSpeed,
EmulatorShortcut.DecreaseSpeed,
EmulatorShortcut.OpenFile,
EmulatorShortcut.OpenDebugger,
EmulatorShortcut.OpenAssembler,
EmulatorShortcut.OpenPpuViewer,
EmulatorShortcut.OpenMemoryTools,
EmulatorShortcut.OpenScriptWindow,
EmulatorShortcut.OpenTraceLogger,
EmulatorShortcut.MoveToNextStateSlot,
EmulatorShortcut.MoveToPreviousStateSlot,
EmulatorShortcut.SaveState,
EmulatorShortcut.LoadState,
EmulatorShortcut.SaveStateSlot1,
EmulatorShortcut.SaveStateSlot2,
EmulatorShortcut.SaveStateSlot3,
EmulatorShortcut.SaveStateSlot4,
EmulatorShortcut.SaveStateSlot5,
EmulatorShortcut.SaveStateSlot6,
EmulatorShortcut.SaveStateSlot7,
EmulatorShortcut.SaveStateToFile,
EmulatorShortcut.LoadStateSlot1,
EmulatorShortcut.LoadStateSlot2,
EmulatorShortcut.LoadStateSlot3,
EmulatorShortcut.LoadStateSlot4,
EmulatorShortcut.LoadStateSlot5,
EmulatorShortcut.LoadStateSlot6,
EmulatorShortcut.LoadStateSlot7,
EmulatorShortcut.LoadStateSlot8,
EmulatorShortcut.LoadStateFromFile,
};
HashSet<string> keyCombinations = new HashSet<string>();
foreach(EmulatorShortcut shortcut in displayOrder) {
int i = gridShortcuts.Rows.Add();
gridShortcuts.Rows[i].Cells[0].Tag = shortcut;
gridShortcuts.Rows[i].Cells[0].Value = ResourceHelper.GetMessage("EmulatorShortcutMappings_" + shortcut.ToString());
int keyIndex = ConfigManager.Config.PreferenceInfo.ShortcutKeys1.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
if(keyIndex >= 0) {
KeyCombination keyComb = ConfigManager.Config.PreferenceInfo.ShortcutKeys1[keyIndex].KeyCombination;
keyCombinations.Add(keyComb.ToString());
gridShortcuts.Rows[i].Cells[1].Value = keyComb.ToString();
gridShortcuts.Rows[i].Cells[1].Tag = keyComb;
}
keyIndex = ConfigManager.Config.PreferenceInfo.ShortcutKeys2.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
if(keyIndex >= 0) {
KeyCombination keyComb = ConfigManager.Config.PreferenceInfo.ShortcutKeys2[keyIndex].KeyCombination;
keyCombinations.Add(keyComb.ToString());
gridShortcuts.Rows[i].Cells[2].Value = keyComb.ToString();
gridShortcuts.Rows[i].Cells[2].Tag = keyComb;
}
}
CheckConflicts();
}
private void CheckConflicts()
{
HashSet<string> keyCombinations = new HashSet<string>();
for(int i = gridShortcuts.Rows.Count - 1; i >= 0; i--) {
EmulatorShortcut shortcut = (EmulatorShortcut)gridShortcuts.Rows[i].Cells[0].Tag;
for(int j = 1; j <= 2; j++) {
if(gridShortcuts.Rows[i].Cells[j].Tag != null) {
KeyCombination keyComb = (KeyCombination)gridShortcuts.Rows[i].Cells[j].Tag;
if(!keyComb.IsEmpty && !keyCombinations.Add(keyComb.ToString())) {
pnlConflictWarning.Visible = true;
return;
}
}
}
}
pnlConflictWarning.Visible = false;
}
public void UpdateConfig()
{
//Need to box the structs into objects for SetValue to work properly
object keySet1 = new EmulatorKeyMappings();
object keySet2 = new EmulatorKeyMappings();
var keySet1 = new List<ShortcutKeyInfo>();
var keySet2 = new List<ShortcutKeyInfo>();
for(int i = gridShortcuts.Rows.Count - 1; i >= 0; i--) {
FieldInfo field = (FieldInfo)gridShortcuts.Rows[i].Cells[0].Tag;
field.SetValue(keySet1, gridShortcuts.Rows[i].Cells[1].Tag);
field.SetValue(keySet2, gridShortcuts.Rows[i].Cells[2].Tag);
EmulatorShortcut shortcut = (EmulatorShortcut)gridShortcuts.Rows[i].Cells[0].Tag;
if(gridShortcuts.Rows[i].Cells[1].Tag != null) {
KeyCombination keyComb = (KeyCombination)gridShortcuts.Rows[i].Cells[1].Tag;
if(!keyComb.IsEmpty) {
keySet1.Add(new ShortcutKeyInfo(shortcut, keyComb));
}
}
if(gridShortcuts.Rows[i].Cells[2].Tag != null) {
KeyCombination keyComb = (KeyCombination)gridShortcuts.Rows[i].Cells[2].Tag;
if(!keyComb.IsEmpty) {
keySet2.Add(new ShortcutKeyInfo(shortcut, keyComb));
}
}
}
ConfigManager.Config.PreferenceInfo.EmulatorKeySet1 = (EmulatorKeyMappings)keySet1;
ConfigManager.Config.PreferenceInfo.EmulatorKeySet2 = (EmulatorKeyMappings)keySet2;
ConfigManager.Config.PreferenceInfo.ShortcutKeys1 = keySet1;
ConfigManager.Config.PreferenceInfo.ShortcutKeys2 = keySet2;
}
private void gridShortcuts_CellContentClick(object sender, DataGridViewCellEventArgs e)
@ -57,10 +172,26 @@ namespace Mesen.GUI.Forms.Config
if(gridShortcuts.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) {
DataGridViewButtonCell button = gridShortcuts.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewButtonCell;
if(button != null) {
frmGetKey frm = new frmGetKey();
using(frmGetKey frm = new frmGetKey(false)) {
frm.ShowDialog();
button.Value = frm.BindedKeyName;
button.Tag = frm.BindedKeyCode;
button.Value = frm.ShortcutKey.ToString();
button.Tag = frm.ShortcutKey;
CheckConflicts();
}
}
}
}
private void gridShortcuts_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
//Right-click on buttons to clear mappings
if(e.Button == MouseButtons.Right && gridShortcuts.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) {
DataGridViewButtonCell button = gridShortcuts.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewButtonCell;
if(button != null) {
button.Value = "";
button.Tag = new KeyCombination();
CheckConflicts();
}
}
}

View file

@ -126,11 +126,11 @@ namespace Mesen.GUI.Forms.Config
private void btnMapping_Click(object sender, EventArgs e)
{
frmGetKey frm = new frmGetKey();
using(frmGetKey frm = new frmGetKey(true)) {
frm.ShowDialog();
((Button)sender).Text = frm.BindedKeyName;
((Button)sender).Tag = frm.BindedKeyCode;
((Button)sender).Text = frm.ShortcutKey.ToString();
((Button)sender).Tag = frm.ShortcutKey.Key1;
}
this.OnChange?.Invoke(this, null);
}

View file

@ -29,6 +29,7 @@
{
this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lblCurrentKeys = new System.Windows.Forms.Label();
this.lblSetKeyMessage = new System.Windows.Forms.Label();
this.tmrCheckKey = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
@ -37,18 +38,28 @@
// groupBox1
//
this.groupBox1.Controls.Add(this.lblSetKeyMessage);
this.groupBox1.Controls.Add(this.lblCurrentKeys);
this.groupBox1.Location = new System.Drawing.Point(4, -1);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(369, 102);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
//
// lblCurrentKeys
//
this.lblCurrentKeys.Dock = System.Windows.Forms.DockStyle.Bottom;
this.lblCurrentKeys.Location = new System.Drawing.Point(3, 55);
this.lblCurrentKeys.Name = "lblCurrentKeys";
this.lblCurrentKeys.Size = new System.Drawing.Size(363, 44);
this.lblCurrentKeys.TabIndex = 1;
this.lblCurrentKeys.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblSetKeyMessage
//
this.lblSetKeyMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblSetKeyMessage.Location = new System.Drawing.Point(3, 16);
this.lblSetKeyMessage.Name = "lblSetKeyMessage";
this.lblSetKeyMessage.Size = new System.Drawing.Size(363, 83);
this.lblSetKeyMessage.Size = new System.Drawing.Size(363, 39);
this.lblSetKeyMessage.TabIndex = 0;
this.lblSetKeyMessage.Text = "Press any key on your keyboard or controller to set a new binding.";
this.lblSetKeyMessage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -79,5 +90,6 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label lblSetKeyMessage;
private System.Windows.Forms.Timer tmrCheckKey;
private System.Windows.Forms.Label lblCurrentKeys;
}
}

View file

@ -14,52 +14,71 @@ namespace Mesen.GUI.Forms.Config
{
const int WM_KEYDOWN = 0x100;
const int WM_KEYUP = 0x101;
const int WM_SYSKEYDOWN = 0x104;
const int WM_SYSKEYUP = 0x105;
private bool _singleKeyMode = false;
private string[] _invalidKeys = new string[] { "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12" };
public frmGetKey()
public frmGetKey(bool singleKeyMode)
{
InitializeComponent();
_singleKeyMode = singleKeyMode;
if(_singleKeyMode) {
lblCurrentKeys.Height = 1;
lblCurrentKeys.Visible = false;
}
ShortcutKey = new KeyCombination();
InteropEmu.UpdateInputDevices();
InteropEmu.ResetKeyState();
//Prevent other keybindings from interfering/activating
InteropEmu.DisableAllKeys(true);
Application.AddMessageFilter(this);
this.FormClosed += (s, e) => Application.RemoveMessageFilter(this);
}
bool IMessageFilter.PreFilterMessage(ref Message m)
{
if(m.Msg == WM_KEYUP) {
if(m.Msg == WM_KEYUP || m.Msg == WM_SYSKEYUP) {
int virtualKeyCode = (Int32)m.WParam;
int scanCode = (Int32)(((Int64)m.LParam & 0x1FF0000) >> 16);
InteropEmu.SetKeyState(scanCode, false);
} else if(m.Msg == WM_SYSKEYDOWN || m.Msg == WM_KEYDOWN) {
int virtualKeyCode = (Int32)((Int64)m.WParam & 0xFF);
int scanCode = (Int32)(((Int64)m.LParam & 0x1FF0000) >> 16);
InteropEmu.SetKeyState(scanCode, true);
}
return false;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
protected override void OnFormClosing(FormClosingEventArgs e)
{
if(msg.Msg == WM_KEYDOWN) {
int virtualKeyCode = (Int32)((Int64)msg.WParam & 0xFF);
int scanCode = (Int32)(((Int64)msg.LParam & 0x1FF0000) >> 16);
InteropEmu.SetKeyState(scanCode, true);
Application.RemoveMessageFilter(this);
InteropEmu.ResetKeyState();
InteropEmu.DisableAllKeys(false);
base.OnFormClosing(e);
}
return base.ProcessCmdKey(ref msg, keyData);
}
public string BindedKeyName { get; set; }
public UInt32 BindedKeyCode { get; set; }
public KeyCombination ShortcutKey { get; set; }
private List<UInt32> _prevScanCodes = new List<UInt32>();
private void tmrCheckKey_Tick(object sender, EventArgs e)
{
UInt32 scanCode = InteropEmu.GetPressedKey();
string pressedKey = InteropEmu.GetKeyName(scanCode);
if(!string.IsNullOrWhiteSpace(pressedKey) && !_invalidKeys.Contains(pressedKey)) {
BindedKeyName = pressedKey;
BindedKeyCode = scanCode;
List<UInt32> scanCodes = InteropEmu.GetPressedKeys();
KeyCombination key = new KeyCombination(_prevScanCodes);
lblCurrentKeys.Text = key.ToString();
if(_singleKeyMode && _prevScanCodes.Count > 0 || scanCodes.Count < _prevScanCodes.Count) {
if(!string.IsNullOrWhiteSpace(key.ToString())) {
ShortcutKey = key;
this.Close();
}
}
_prevScanCodes = scanCodes;
}
}
}

View file

@ -117,7 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="tmrCheckKey.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="tmrCheckKey.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 17</value>
</metadata>
</root>

View file

@ -337,53 +337,50 @@ namespace Mesen.GUI.Forms
//
this.mnuOpen.Image = global::Mesen.GUI.Properties.Resources.FolderOpen;
this.mnuOpen.Name = "mnuOpen";
this.mnuOpen.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.mnuOpen.Size = new System.Drawing.Size(146, 22);
this.mnuOpen.Size = new System.Drawing.Size(136, 22);
this.mnuOpen.Text = "Open";
this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click);
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(143, 6);
this.toolStripMenuItem4.Size = new System.Drawing.Size(133, 6);
//
// mnuSaveState
//
this.mnuSaveState.Name = "mnuSaveState";
this.mnuSaveState.Size = new System.Drawing.Size(146, 22);
this.mnuSaveState.Size = new System.Drawing.Size(136, 22);
this.mnuSaveState.Text = "Save State";
this.mnuSaveState.DropDownOpening += new System.EventHandler(this.mnuSaveState_DropDownOpening);
//
// mnuLoadState
//
this.mnuLoadState.Name = "mnuLoadState";
this.mnuLoadState.Size = new System.Drawing.Size(146, 22);
this.mnuLoadState.Size = new System.Drawing.Size(136, 22);
this.mnuLoadState.Text = "Load State";
this.mnuLoadState.DropDownOpening += new System.EventHandler(this.mnuLoadState_DropDownOpening);
//
// toolStripMenuItem7
//
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(143, 6);
this.toolStripMenuItem7.Size = new System.Drawing.Size(133, 6);
//
// mnuRecentFiles
//
this.mnuRecentFiles.Name = "mnuRecentFiles";
this.mnuRecentFiles.Size = new System.Drawing.Size(146, 22);
this.mnuRecentFiles.Size = new System.Drawing.Size(136, 22);
this.mnuRecentFiles.Text = "Recent Files";
//
// toolStripMenuItem6
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(143, 6);
this.toolStripMenuItem6.Size = new System.Drawing.Size(133, 6);
//
// mnuExit
//
this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit;
this.mnuExit.Name = "mnuExit";
this.mnuExit.Size = new System.Drawing.Size(146, 22);
this.mnuExit.Size = new System.Drawing.Size(136, 22);
this.mnuExit.Text = "Exit";
this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
//
// mnuGame
//
@ -410,83 +407,73 @@ namespace Mesen.GUI.Forms
this.mnuPause.Enabled = false;
this.mnuPause.Image = global::Mesen.GUI.Properties.Resources.Pause;
this.mnuPause.Name = "mnuPause";
this.mnuPause.ShortcutKeyDisplayString = "Esc";
this.mnuPause.Size = new System.Drawing.Size(200, 22);
this.mnuPause.Size = new System.Drawing.Size(182, 22);
this.mnuPause.Text = "Pause";
this.mnuPause.Click += new System.EventHandler(this.mnuPause_Click);
//
// mnuReset
//
this.mnuReset.Enabled = false;
this.mnuReset.Image = global::Mesen.GUI.Properties.Resources.Reset;
this.mnuReset.Name = "mnuReset";
this.mnuReset.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R)));
this.mnuReset.Size = new System.Drawing.Size(200, 22);
this.mnuReset.Size = new System.Drawing.Size(182, 22);
this.mnuReset.Text = "Reset";
this.mnuReset.Click += new System.EventHandler(this.mnuReset_Click);
//
// mnuPowerCycle
//
this.mnuPowerCycle.Enabled = false;
this.mnuPowerCycle.Image = global::Mesen.GUI.Properties.Resources.PowerCycle;
this.mnuPowerCycle.Name = "mnuPowerCycle";
this.mnuPowerCycle.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T)));
this.mnuPowerCycle.Size = new System.Drawing.Size(200, 22);
this.mnuPowerCycle.Size = new System.Drawing.Size(182, 22);
this.mnuPowerCycle.Text = "Power Cycle";
this.mnuPowerCycle.Click += new System.EventHandler(this.mnuPowerCycle_Click);
//
// toolStripMenuItem24
//
this.toolStripMenuItem24.Name = "toolStripMenuItem24";
this.toolStripMenuItem24.Size = new System.Drawing.Size(197, 6);
this.toolStripMenuItem24.Size = new System.Drawing.Size(179, 6);
//
// mnuPowerOff
//
this.mnuPowerOff.Image = global::Mesen.GUI.Properties.Resources.Stop;
this.mnuPowerOff.Name = "mnuPowerOff";
this.mnuPowerOff.Size = new System.Drawing.Size(200, 22);
this.mnuPowerOff.Size = new System.Drawing.Size(182, 22);
this.mnuPowerOff.Text = "Power Off";
this.mnuPowerOff.Click += new System.EventHandler(this.mnuPowerOff_Click);
//
// sepFdsDisk
//
this.sepFdsDisk.Name = "sepFdsDisk";
this.sepFdsDisk.Size = new System.Drawing.Size(197, 6);
this.sepFdsDisk.Size = new System.Drawing.Size(179, 6);
//
// mnuSwitchDiskSide
//
this.mnuSwitchDiskSide.Name = "mnuSwitchDiskSide";
this.mnuSwitchDiskSide.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B)));
this.mnuSwitchDiskSide.Size = new System.Drawing.Size(200, 22);
this.mnuSwitchDiskSide.Size = new System.Drawing.Size(182, 22);
this.mnuSwitchDiskSide.Text = "Switch Disk Side";
this.mnuSwitchDiskSide.Click += new System.EventHandler(this.mnuSwitchDiskSide_Click);
//
// mnuSelectDisk
//
this.mnuSelectDisk.Image = global::Mesen.GUI.Properties.Resources.Floppy;
this.mnuSelectDisk.Name = "mnuSelectDisk";
this.mnuSelectDisk.Size = new System.Drawing.Size(200, 22);
this.mnuSelectDisk.Size = new System.Drawing.Size(182, 22);
this.mnuSelectDisk.Text = "Select Disk";
//
// mnuEjectDisk
//
this.mnuEjectDisk.Image = global::Mesen.GUI.Properties.Resources.Eject;
this.mnuEjectDisk.Name = "mnuEjectDisk";
this.mnuEjectDisk.Size = new System.Drawing.Size(200, 22);
this.mnuEjectDisk.Size = new System.Drawing.Size(182, 22);
this.mnuEjectDisk.Text = "Eject Disk";
this.mnuEjectDisk.Click += new System.EventHandler(this.mnuEjectDisk_Click);
//
// sepVsSystem
//
this.sepVsSystem.Name = "sepVsSystem";
this.sepVsSystem.Size = new System.Drawing.Size(197, 6);
this.sepVsSystem.Size = new System.Drawing.Size(179, 6);
this.sepVsSystem.Visible = false;
//
// mnuVsGameConfig
//
this.mnuVsGameConfig.Image = global::Mesen.GUI.Properties.Resources.DipSwitches;
this.mnuVsGameConfig.Name = "mnuVsGameConfig";
this.mnuVsGameConfig.Size = new System.Drawing.Size(200, 22);
this.mnuVsGameConfig.Size = new System.Drawing.Size(182, 22);
this.mnuVsGameConfig.Text = "Game Configuration";
this.mnuVsGameConfig.Click += new System.EventHandler(this.mnuVsGameConfig_Click);
//
@ -494,19 +481,17 @@ namespace Mesen.GUI.Forms
//
this.mnuInsertCoin1.Image = global::Mesen.GUI.Properties.Resources.coins;
this.mnuInsertCoin1.Name = "mnuInsertCoin1";
this.mnuInsertCoin1.Size = new System.Drawing.Size(200, 22);
this.mnuInsertCoin1.Size = new System.Drawing.Size(182, 22);
this.mnuInsertCoin1.Text = "Insert Coin (1)";
this.mnuInsertCoin1.Visible = false;
this.mnuInsertCoin1.Click += new System.EventHandler(this.mnuInsertCoin1_Click);
//
// mnuInsertCoin2
//
this.mnuInsertCoin2.Image = global::Mesen.GUI.Properties.Resources.coins;
this.mnuInsertCoin2.Name = "mnuInsertCoin2";
this.mnuInsertCoin2.Size = new System.Drawing.Size(200, 22);
this.mnuInsertCoin2.Size = new System.Drawing.Size(182, 22);
this.mnuInsertCoin2.Text = "Insert Coin (2)";
this.mnuInsertCoin2.Visible = false;
this.mnuInsertCoin2.Click += new System.EventHandler(this.mnuInsertCoin2_Click);
//
// mnuOptions
//
@ -550,48 +535,42 @@ namespace Mesen.GUI.Forms
// mnuEmuSpeedNormal
//
this.mnuEmuSpeedNormal.Name = "mnuEmuSpeedNormal";
this.mnuEmuSpeedNormal.Size = new System.Drawing.Size(182, 22);
this.mnuEmuSpeedNormal.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedNormal.Text = "Normal (100%)";
this.mnuEmuSpeedNormal.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
//
// toolStripMenuItem8
//
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
this.toolStripMenuItem8.Size = new System.Drawing.Size(179, 6);
this.toolStripMenuItem8.Size = new System.Drawing.Size(160, 6);
//
// mnuIncreaseSpeed
//
this.mnuIncreaseSpeed.Name = "mnuIncreaseSpeed";
this.mnuIncreaseSpeed.ShortcutKeyDisplayString = "=";
this.mnuIncreaseSpeed.Size = new System.Drawing.Size(182, 22);
this.mnuIncreaseSpeed.Size = new System.Drawing.Size(163, 22);
this.mnuIncreaseSpeed.Text = "Increase Speed";
this.mnuIncreaseSpeed.Click += new System.EventHandler(this.mnuIncreaseSpeed_Click);
//
// mnuDecreaseSpeed
//
this.mnuDecreaseSpeed.Name = "mnuDecreaseSpeed";
this.mnuDecreaseSpeed.ShortcutKeyDisplayString = "-";
this.mnuDecreaseSpeed.Size = new System.Drawing.Size(182, 22);
this.mnuDecreaseSpeed.Size = new System.Drawing.Size(163, 22);
this.mnuDecreaseSpeed.Text = "Decrease Speed";
this.mnuDecreaseSpeed.Click += new System.EventHandler(this.mnuDecreaseSpeed_Click);
//
// mnuEmuSpeedMaximumSpeed
//
this.mnuEmuSpeedMaximumSpeed.Name = "mnuEmuSpeedMaximumSpeed";
this.mnuEmuSpeedMaximumSpeed.ShortcutKeys = System.Windows.Forms.Keys.F9;
this.mnuEmuSpeedMaximumSpeed.Size = new System.Drawing.Size(182, 22);
this.mnuEmuSpeedMaximumSpeed.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedMaximumSpeed.Text = "Maximum Speed";
this.mnuEmuSpeedMaximumSpeed.Click += new System.EventHandler(this.mnuEmuSpeedMaximumSpeed_Click);
//
// toolStripMenuItem9
//
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
this.toolStripMenuItem9.Size = new System.Drawing.Size(179, 6);
this.toolStripMenuItem9.Size = new System.Drawing.Size(160, 6);
//
// mnuEmuSpeedTriple
//
this.mnuEmuSpeedTriple.Name = "mnuEmuSpeedTriple";
this.mnuEmuSpeedTriple.Size = new System.Drawing.Size(182, 22);
this.mnuEmuSpeedTriple.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedTriple.Tag = "";
this.mnuEmuSpeedTriple.Text = "Triple (300%)";
this.mnuEmuSpeedTriple.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
@ -599,37 +578,35 @@ namespace Mesen.GUI.Forms
// mnuEmuSpeedDouble
//
this.mnuEmuSpeedDouble.Name = "mnuEmuSpeedDouble";
this.mnuEmuSpeedDouble.Size = new System.Drawing.Size(182, 22);
this.mnuEmuSpeedDouble.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedDouble.Text = "Double (200%)";
this.mnuEmuSpeedDouble.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
//
// mnuEmuSpeedHalf
//
this.mnuEmuSpeedHalf.Name = "mnuEmuSpeedHalf";
this.mnuEmuSpeedHalf.Size = new System.Drawing.Size(182, 22);
this.mnuEmuSpeedHalf.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedHalf.Text = "Half (50%)";
this.mnuEmuSpeedHalf.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
//
// mnuEmuSpeedQuarter
//
this.mnuEmuSpeedQuarter.Name = "mnuEmuSpeedQuarter";
this.mnuEmuSpeedQuarter.Size = new System.Drawing.Size(182, 22);
this.mnuEmuSpeedQuarter.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedQuarter.Text = "Quarter (25%)";
this.mnuEmuSpeedQuarter.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
//
// toolStripMenuItem14
//
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
this.toolStripMenuItem14.Size = new System.Drawing.Size(179, 6);
this.toolStripMenuItem14.Size = new System.Drawing.Size(160, 6);
//
// mnuShowFPS
//
this.mnuShowFPS.CheckOnClick = true;
this.mnuShowFPS.Name = "mnuShowFPS";
this.mnuShowFPS.ShortcutKeys = System.Windows.Forms.Keys.F10;
this.mnuShowFPS.Size = new System.Drawing.Size(182, 22);
this.mnuShowFPS.Size = new System.Drawing.Size(163, 22);
this.mnuShowFPS.Text = "Show FPS";
this.mnuShowFPS.Click += new System.EventHandler(this.mnuShowFPS_Click);
//
// mnuVideoScale
//
@ -650,69 +627,49 @@ namespace Mesen.GUI.Forms
// mnuScale1x
//
this.mnuScale1x.Name = "mnuScale1x";
this.mnuScale1x.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D1)));
this.mnuScale1x.Size = new System.Drawing.Size(152, 22);
this.mnuScale1x.Tag = "1";
this.mnuScale1x.Size = new System.Drawing.Size(127, 22);
this.mnuScale1x.Text = "1x";
this.mnuScale1x.Click += new System.EventHandler(this.mnuScale_Click);
//
// mnuScale2x
//
this.mnuScale2x.Name = "mnuScale2x";
this.mnuScale2x.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D2)));
this.mnuScale2x.Size = new System.Drawing.Size(152, 22);
this.mnuScale2x.Tag = "2";
this.mnuScale2x.Size = new System.Drawing.Size(127, 22);
this.mnuScale2x.Text = "2x";
this.mnuScale2x.Click += new System.EventHandler(this.mnuScale_Click);
//
// mnuScale3x
//
this.mnuScale3x.Name = "mnuScale3x";
this.mnuScale3x.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D3)));
this.mnuScale3x.Size = new System.Drawing.Size(152, 22);
this.mnuScale3x.Tag = "3";
this.mnuScale3x.Size = new System.Drawing.Size(127, 22);
this.mnuScale3x.Text = "3x";
this.mnuScale3x.Click += new System.EventHandler(this.mnuScale_Click);
//
// mnuScale4x
//
this.mnuScale4x.Name = "mnuScale4x";
this.mnuScale4x.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D4)));
this.mnuScale4x.Size = new System.Drawing.Size(152, 22);
this.mnuScale4x.Tag = "4";
this.mnuScale4x.Size = new System.Drawing.Size(127, 22);
this.mnuScale4x.Text = "4x";
this.mnuScale4x.Click += new System.EventHandler(this.mnuScale_Click);
//
// mnuScale5x
//
this.mnuScale5x.Name = "mnuScale5x";
this.mnuScale5x.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D5)));
this.mnuScale5x.Size = new System.Drawing.Size(152, 22);
this.mnuScale5x.Tag = "5";
this.mnuScale5x.Size = new System.Drawing.Size(127, 22);
this.mnuScale5x.Text = "5x";
this.mnuScale5x.Click += new System.EventHandler(this.mnuScale_Click);
//
// mnuScale6x
//
this.mnuScale6x.Name = "mnuScale6x";
this.mnuScale6x.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D6)));
this.mnuScale6x.Size = new System.Drawing.Size(152, 22);
this.mnuScale6x.Tag = "6";
this.mnuScale6x.Size = new System.Drawing.Size(127, 22);
this.mnuScale6x.Text = "6x";
this.mnuScale6x.Click += new System.EventHandler(this.mnuScale_Click);
//
// toolStripMenuItem13
//
this.toolStripMenuItem13.Name = "toolStripMenuItem13";
this.toolStripMenuItem13.Size = new System.Drawing.Size(149, 6);
this.toolStripMenuItem13.Size = new System.Drawing.Size(124, 6);
//
// mnuFullscreen
//
this.mnuFullscreen.Name = "mnuFullscreen";
this.mnuFullscreen.ShortcutKeys = System.Windows.Forms.Keys.F11;
this.mnuFullscreen.Size = new System.Drawing.Size(152, 22);
this.mnuFullscreen.Size = new System.Drawing.Size(127, 22);
this.mnuFullscreen.Text = "Fullscreen";
this.mnuFullscreen.Click += new System.EventHandler(this.mnuFullscreen_Click);
//
// mnuVideoFilter
//
@ -1095,7 +1052,7 @@ namespace Mesen.GUI.Forms
this.mnuProfile});
this.mnuNetPlay.Image = global::Mesen.GUI.Properties.Resources.NetPlay;
this.mnuNetPlay.Name = "mnuNetPlay";
this.mnuNetPlay.Size = new System.Drawing.Size(231, 22);
this.mnuNetPlay.Size = new System.Drawing.Size(182, 22);
this.mnuNetPlay.Text = "Net Play";
//
// mnuStartServer
@ -1193,7 +1150,7 @@ namespace Mesen.GUI.Forms
this.mnuStopMovie});
this.mnuMovies.Image = global::Mesen.GUI.Properties.Resources.Movie;
this.mnuMovies.Name = "mnuMovies";
this.mnuMovies.Size = new System.Drawing.Size(231, 22);
this.mnuMovies.Size = new System.Drawing.Size(182, 22);
this.mnuMovies.Text = "Movies";
//
// mnuPlayMovie
@ -1240,14 +1197,14 @@ namespace Mesen.GUI.Forms
//
this.mnuCheats.Image = global::Mesen.GUI.Properties.Resources.CheatCode;
this.mnuCheats.Name = "mnuCheats";
this.mnuCheats.Size = new System.Drawing.Size(231, 22);
this.mnuCheats.Size = new System.Drawing.Size(182, 22);
this.mnuCheats.Text = "Cheats";
this.mnuCheats.Click += new System.EventHandler(this.mnuCheats_Click);
//
// toolStripMenuItem22
//
this.toolStripMenuItem22.Name = "toolStripMenuItem22";
this.toolStripMenuItem22.Size = new System.Drawing.Size(228, 6);
this.toolStripMenuItem22.Size = new System.Drawing.Size(179, 6);
//
// mnuSoundRecorder
//
@ -1256,7 +1213,7 @@ namespace Mesen.GUI.Forms
this.mnuWaveStop});
this.mnuSoundRecorder.Image = global::Mesen.GUI.Properties.Resources.Microphone;
this.mnuSoundRecorder.Name = "mnuSoundRecorder";
this.mnuSoundRecorder.Size = new System.Drawing.Size(231, 22);
this.mnuSoundRecorder.Size = new System.Drawing.Size(182, 22);
this.mnuSoundRecorder.Text = "Sound Recorder";
//
// mnuWaveRecord
@ -1282,7 +1239,7 @@ namespace Mesen.GUI.Forms
this.mnuAviStop});
this.mnuVideoRecorder.Image = global::Mesen.GUI.Properties.Resources.VideoRecorder;
this.mnuVideoRecorder.Name = "mnuVideoRecorder";
this.mnuVideoRecorder.Size = new System.Drawing.Size(231, 22);
this.mnuVideoRecorder.Size = new System.Drawing.Size(182, 22);
this.mnuVideoRecorder.Text = "Video Recorder";
//
// mnuAviRecord
@ -1304,7 +1261,7 @@ namespace Mesen.GUI.Forms
// toolStripMenuItem12
//
this.toolStripMenuItem12.Name = "toolStripMenuItem12";
this.toolStripMenuItem12.Size = new System.Drawing.Size(228, 6);
this.toolStripMenuItem12.Size = new System.Drawing.Size(179, 6);
//
// mnuTests
//
@ -1316,13 +1273,13 @@ namespace Mesen.GUI.Forms
this.mnuRunAllGameTests,
this.mnuRunAutomaticTest});
this.mnuTests.Name = "mnuTests";
this.mnuTests.Size = new System.Drawing.Size(231, 22);
this.mnuTests.Size = new System.Drawing.Size(182, 22);
this.mnuTests.Text = "Tests";
//
// mnuTestRun
//
this.mnuTestRun.Name = "mnuTestRun";
this.mnuTestRun.Size = new System.Drawing.Size(192, 22);
this.mnuTestRun.Size = new System.Drawing.Size(174, 22);
this.mnuTestRun.Text = "Run...";
this.mnuTestRun.Click += new System.EventHandler(this.mnuTestRun_Click);
//
@ -1334,64 +1291,62 @@ namespace Mesen.GUI.Forms
this.mnuTestRecordMovie,
this.mnuTestRecordTest});
this.mnuTestRecordFrom.Name = "mnuTestRecordFrom";
this.mnuTestRecordFrom.Size = new System.Drawing.Size(192, 22);
this.mnuTestRecordFrom.Size = new System.Drawing.Size(174, 22);
this.mnuTestRecordFrom.Text = "Record from...";
//
// mnuTestRecordStart
//
this.mnuTestRecordStart.Name = "mnuTestRecordStart";
this.mnuTestRecordStart.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W)));
this.mnuTestRecordStart.Size = new System.Drawing.Size(143, 22);
this.mnuTestRecordStart.Size = new System.Drawing.Size(152, 22);
this.mnuTestRecordStart.Text = "Start";
this.mnuTestRecordStart.Click += new System.EventHandler(this.mnuTestRecordStart_Click);
//
// mnuTestRecordNow
//
this.mnuTestRecordNow.Name = "mnuTestRecordNow";
this.mnuTestRecordNow.Size = new System.Drawing.Size(143, 22);
this.mnuTestRecordNow.Size = new System.Drawing.Size(152, 22);
this.mnuTestRecordNow.Text = "Now";
this.mnuTestRecordNow.Click += new System.EventHandler(this.mnuTestRecordNow_Click);
//
// mnuTestRecordMovie
//
this.mnuTestRecordMovie.Name = "mnuTestRecordMovie";
this.mnuTestRecordMovie.Size = new System.Drawing.Size(143, 22);
this.mnuTestRecordMovie.Size = new System.Drawing.Size(152, 22);
this.mnuTestRecordMovie.Text = "Movie";
this.mnuTestRecordMovie.Click += new System.EventHandler(this.mnuTestRecordMovie_Click);
//
// mnuTestRecordTest
//
this.mnuTestRecordTest.Name = "mnuTestRecordTest";
this.mnuTestRecordTest.Size = new System.Drawing.Size(143, 22);
this.mnuTestRecordTest.Size = new System.Drawing.Size(152, 22);
this.mnuTestRecordTest.Text = "Test";
this.mnuTestRecordTest.Click += new System.EventHandler(this.mnuTestRecordTest_Click);
//
// mnuTestStopRecording
//
this.mnuTestStopRecording.Name = "mnuTestStopRecording";
this.mnuTestStopRecording.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
this.mnuTestStopRecording.Size = new System.Drawing.Size(192, 22);
this.mnuTestStopRecording.Size = new System.Drawing.Size(174, 22);
this.mnuTestStopRecording.Text = "Stop recording";
this.mnuTestStopRecording.Click += new System.EventHandler(this.mnuTestStopRecording_Click);
//
// mnuRunAllTests
//
this.mnuRunAllTests.Name = "mnuRunAllTests";
this.mnuRunAllTests.Size = new System.Drawing.Size(192, 22);
this.mnuRunAllTests.Size = new System.Drawing.Size(174, 22);
this.mnuRunAllTests.Text = "Run all tests";
this.mnuRunAllTests.Click += new System.EventHandler(this.mnuRunAllTests_Click);
//
// mnuRunAllGameTests
//
this.mnuRunAllGameTests.Name = "mnuRunAllGameTests";
this.mnuRunAllGameTests.Size = new System.Drawing.Size(192, 22);
this.mnuRunAllGameTests.Size = new System.Drawing.Size(174, 22);
this.mnuRunAllGameTests.Text = "Run all game tests";
this.mnuRunAllGameTests.Click += new System.EventHandler(this.mnuRunAllGameTests_Click);
//
// mnuRunAutomaticTest
//
this.mnuRunAutomaticTest.Name = "mnuRunAutomaticTest";
this.mnuRunAutomaticTest.Size = new System.Drawing.Size(192, 22);
this.mnuRunAutomaticTest.Size = new System.Drawing.Size(174, 22);
this.mnuRunAutomaticTest.Text = "Run automatic test";
this.mnuRunAutomaticTest.Click += new System.EventHandler(this.mnuRunAutomaticTest_Click);
//
@ -1399,16 +1354,14 @@ namespace Mesen.GUI.Forms
//
this.mnuDebugger.Image = global::Mesen.GUI.Properties.Resources.Bug;
this.mnuDebugger.Name = "mnuDebugger";
this.mnuDebugger.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
this.mnuDebugger.Size = new System.Drawing.Size(231, 22);
this.mnuDebugger.Size = new System.Drawing.Size(182, 22);
this.mnuDebugger.Text = "Debugger";
this.mnuDebugger.Click += new System.EventHandler(this.mnuDebugger_Click);
//
// mnuLogWindow
//
this.mnuLogWindow.Image = global::Mesen.GUI.Properties.Resources.LogWindow;
this.mnuLogWindow.Name = "mnuLogWindow";
this.mnuLogWindow.Size = new System.Drawing.Size(231, 22);
this.mnuLogWindow.Size = new System.Drawing.Size(182, 22);
this.mnuLogWindow.Text = "Log Window";
this.mnuLogWindow.Click += new System.EventHandler(this.mnuLogWindow_Click);
//
@ -1416,32 +1369,28 @@ namespace Mesen.GUI.Forms
//
this.mnuHdPackEditor.Image = global::Mesen.GUI.Properties.Resources.HdPack;
this.mnuHdPackEditor.Name = "mnuHdPackEditor";
this.mnuHdPackEditor.Size = new System.Drawing.Size(231, 22);
this.mnuHdPackEditor.Size = new System.Drawing.Size(182, 22);
this.mnuHdPackEditor.Text = "HD Pack Builder";
this.mnuHdPackEditor.Click += new System.EventHandler(this.mnuHdPackEditor_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(228, 6);
this.toolStripMenuItem1.Size = new System.Drawing.Size(179, 6);
//
// mnuRandomGame
//
this.mnuRandomGame.Image = global::Mesen.GUI.Properties.Resources.Dice;
this.mnuRandomGame.Name = "mnuRandomGame";
this.mnuRandomGame.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Insert)));
this.mnuRandomGame.Size = new System.Drawing.Size(231, 22);
this.mnuRandomGame.Size = new System.Drawing.Size(182, 22);
this.mnuRandomGame.Text = "Load Random Game";
this.mnuRandomGame.Click += new System.EventHandler(this.mnuRandomGame_Click);
//
// mnuTakeScreenshot
//
this.mnuTakeScreenshot.Image = global::Mesen.GUI.Properties.Resources.Camera;
this.mnuTakeScreenshot.Name = "mnuTakeScreenshot";
this.mnuTakeScreenshot.ShortcutKeys = System.Windows.Forms.Keys.F12;
this.mnuTakeScreenshot.Size = new System.Drawing.Size(231, 22);
this.mnuTakeScreenshot.Size = new System.Drawing.Size(182, 22);
this.mnuTakeScreenshot.Text = "Take Screenshot";
this.mnuTakeScreenshot.Click += new System.EventHandler(this.mnuTakeScreenshot_Click);
//
// mnuDebug
//
@ -1463,66 +1412,54 @@ namespace Mesen.GUI.Forms
//
this.mnuAssembler.Image = global::Mesen.GUI.Properties.Resources.Chip;
this.mnuAssembler.Name = "mnuAssembler";
this.mnuAssembler.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.K)));
this.mnuAssembler.Size = new System.Drawing.Size(196, 22);
this.mnuAssembler.Size = new System.Drawing.Size(162, 22);
this.mnuAssembler.Text = "Assembler";
this.mnuAssembler.Click += new System.EventHandler(this.mnuAssembler_Click);
//
// mnuDebugDebugger
//
this.mnuDebugDebugger.Image = global::Mesen.GUI.Properties.Resources.Bug;
this.mnuDebugDebugger.Name = "mnuDebugDebugger";
this.mnuDebugDebugger.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
this.mnuDebugDebugger.Size = new System.Drawing.Size(196, 22);
this.mnuDebugDebugger.Size = new System.Drawing.Size(162, 22);
this.mnuDebugDebugger.Text = "Debugger";
this.mnuDebugDebugger.Click += new System.EventHandler(this.mnuDebugDebugger_Click);
//
// mnuMemoryViewer
//
this.mnuMemoryViewer.Image = global::Mesen.GUI.Properties.Resources.CheatCode;
this.mnuMemoryViewer.Name = "mnuMemoryViewer";
this.mnuMemoryViewer.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.M)));
this.mnuMemoryViewer.Size = new System.Drawing.Size(196, 22);
this.mnuMemoryViewer.Size = new System.Drawing.Size(162, 22);
this.mnuMemoryViewer.Text = "Memory Tools";
this.mnuMemoryViewer.Click += new System.EventHandler(this.mnuMemoryViewer_Click);
//
// mnuPpuViewer
//
this.mnuPpuViewer.Image = global::Mesen.GUI.Properties.Resources.Video;
this.mnuPpuViewer.Name = "mnuPpuViewer";
this.mnuPpuViewer.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P)));
this.mnuPpuViewer.Size = new System.Drawing.Size(196, 22);
this.mnuPpuViewer.Size = new System.Drawing.Size(162, 22);
this.mnuPpuViewer.Text = "PPU Viewer";
this.mnuPpuViewer.Click += new System.EventHandler(this.mnuPpuViewer_Click);
//
// mnuScriptWindow
//
this.mnuScriptWindow.Image = global::Mesen.GUI.Properties.Resources.Script;
this.mnuScriptWindow.Name = "mnuScriptWindow";
this.mnuScriptWindow.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.J)));
this.mnuScriptWindow.Size = new System.Drawing.Size(196, 22);
this.mnuScriptWindow.Size = new System.Drawing.Size(162, 22);
this.mnuScriptWindow.Text = "Script Window";
this.mnuScriptWindow.Click += new System.EventHandler(this.mnuScriptWindow_Click);
//
// mnuTraceLogger
//
this.mnuTraceLogger.Image = global::Mesen.GUI.Properties.Resources.LogWindow;
this.mnuTraceLogger.Name = "mnuTraceLogger";
this.mnuTraceLogger.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.mnuTraceLogger.Size = new System.Drawing.Size(196, 22);
this.mnuTraceLogger.Size = new System.Drawing.Size(162, 22);
this.mnuTraceLogger.Text = "Trace Logger";
this.mnuTraceLogger.Click += new System.EventHandler(this.mnuTraceLogger_Click);
//
// toolStripMenuItem25
//
this.toolStripMenuItem25.Name = "toolStripMenuItem25";
this.toolStripMenuItem25.Size = new System.Drawing.Size(193, 6);
this.toolStripMenuItem25.Size = new System.Drawing.Size(159, 6);
//
// mnuEditHeader
//
this.mnuEditHeader.Image = global::Mesen.GUI.Properties.Resources.Edit;
this.mnuEditHeader.Name = "mnuEditHeader";
this.mnuEditHeader.Size = new System.Drawing.Size(196, 22);
this.mnuEditHeader.Size = new System.Drawing.Size(162, 22);
this.mnuEditHeader.Text = "Edit iNES Header";
this.mnuEditHeader.Click += new System.EventHandler(this.mnuEditHeader_Click);
//

View file

@ -14,14 +14,12 @@ namespace Mesen.GUI.Forms
partial class frmMain
{
const int NumberOfSaveSlots = 7;
private void InitializeStateMenu(ToolStripMenuItem menu, bool forSave)
private void UpdateStateMenu(ToolStripMenuItem menu, bool forSave)
{
if(this.InvokeRequired) {
this.BeginInvoke((MethodInvoker)(() => this.InitializeStateMenu(menu, forSave)));
this.BeginInvoke((MethodInvoker)(() => this.UpdateStateMenu(menu, forSave)));
} else {
menu.DropDownItems.Clear();
Action<uint> addSaveStateInfo = (i) => {
for(uint i = 1; i <= frmMain.NumberOfSaveSlots + (forSave ? 0 : 1); i++) {
Int64 fileTime = InteropEmu.GetStateInfo(i);
string label;
if(fileTime == 0) {
@ -31,25 +29,29 @@ namespace Mesen.GUI.Forms
label = i.ToString() + ". " + dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString();
}
ToolStripMenuItem item = new ToolStripMenuItem(label);
uint stateIndex = i;
item.Click += (object sender, EventArgs e) => {
if(_emuThread != null && !InteropEmu.IsNsf()) {
if(forSave) {
InteropEmu.SaveState(stateIndex);
if(i == NumberOfSaveSlots + 1) {
//Autosave slot (load only)
menu.DropDownItems[NumberOfSaveSlots + 1].Text = label;
} else {
if(!InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording()) {
InteropEmu.LoadState(stateIndex);
menu.DropDownItems[(int)i - 1].Text = label;
}
}
}
}
};
item.ShortcutKeys = (Keys)((int)Keys.F1 + i - 1);
if(forSave) {
item.ShortcutKeys |= Keys.Shift;
}
private void InitializeStateMenu(ToolStripMenuItem menu, bool forSave)
{
Action<uint> addSaveStateInfo = (i) => {
string label = i.ToString() + ". " + ResourceHelper.GetMessage("EmptyState");
ToolStripMenuItem item = new ToolStripMenuItem(label);
menu.DropDownItems.Add(item);
if(forSave) {
BindShortcut(item, (EmulatorShortcut)((int)EmulatorShortcut.SaveStateSlot1 + i - 1));
} else {
BindShortcut(item, (EmulatorShortcut)((int)EmulatorShortcut.LoadStateSlot1 + i - 1));
}
};
for(uint i = 1; i <= frmMain.NumberOfSaveSlots; i++) {
@ -61,20 +63,33 @@ namespace Mesen.GUI.Forms
addSaveStateInfo(NumberOfSaveSlots+1);
menu.DropDownItems.Add("-");
ToolStripMenuItem loadFromFile = new ToolStripMenuItem(ResourceHelper.GetMessage("LoadFromFile"), Resources.FolderOpen);
loadFromFile.ShortcutKeys = Keys.Control | Keys.L;
loadFromFile.Click += LoadFromFile_Click;
menu.DropDownItems.Add(loadFromFile);
BindShortcut(loadFromFile, EmulatorShortcut.LoadStateFromFile);
} else {
menu.DropDownItems.Add("-");
ToolStripMenuItem saveToFile = new ToolStripMenuItem(ResourceHelper.GetMessage("SaveToFile"), Resources.Floppy);
saveToFile.ShortcutKeys = Keys.Control | Keys.S;
saveToFile.Click += SaveToFile_Click;
menu.DropDownItems.Add(saveToFile);
BindShortcut(saveToFile, EmulatorShortcut.SaveStateToFile);
}
}
private void SaveState(uint slot)
{
if(_emuThread != null && !InteropEmu.IsNsf()) {
InteropEmu.SaveState(slot);
}
}
private void LoadState(uint slot)
{
if(_emuThread != null && !InteropEmu.IsNsf()) {
if(!InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording()) {
InteropEmu.LoadState(slot);
}
}
}
private void LoadFromFile_Click(object sender, EventArgs e)
private void LoadStateFromFile()
{
if(_emuThread != null) {
using(OpenFileDialog ofd = new OpenFileDialog()) {
@ -87,7 +102,7 @@ namespace Mesen.GUI.Forms
}
}
private void SaveToFile_Click(object sender, EventArgs e)
private void SaveStateToFile()
{
if(_emuThread != null) {
using(SaveFileDialog sfd = new SaveFileDialog()) {
@ -101,22 +116,17 @@ namespace Mesen.GUI.Forms
}
}
private void mnuExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void mnuSaveState_DropDownOpening(object sender, EventArgs e)
{
InitializeStateMenu(mnuSaveState, true);
UpdateStateMenu(mnuSaveState, true);
}
private void mnuLoadState_DropDownOpening(object sender, EventArgs e)
{
InitializeStateMenu(mnuLoadState, false);
UpdateStateMenu(mnuLoadState, false);
}
private void mnuOpen_Click(object sender, EventArgs e)
private void OpenFile()
{
using(OpenFileDialog ofd = new OpenFileDialog()) {
ofd.SetFilter(ResourceHelper.GetMessage("FilterRomIps"));

View file

@ -11,26 +11,6 @@ namespace Mesen.GUI.Forms
{
public partial class frmMain
{
private void mnuPause_Click(object sender, EventArgs e)
{
PauseEmu();
}
private void mnuReset_Click(object sender, EventArgs e)
{
ResetEmu();
}
private void mnuPowerCycle_Click(object sender, EventArgs e)
{
PowerCycleEmu();
}
private void mnuPowerOff_Click(object sender, EventArgs e)
{
InteropEmu.Stop();
}
private void InitializeFdsDiskMenu()
{
if(this.InvokeRequired) {
@ -61,16 +41,6 @@ namespace Mesen.GUI.Forms
}
}
private void mnuEjectDisk_Click(object sender, EventArgs e)
{
InteropEmu.FdsEjectDisk();
}
private void mnuSwitchDiskSide_Click(object sender, EventArgs e)
{
InteropEmu.FdsSwitchDiskSide();
}
private void InitializeVsSystemMenu()
{
if(this.InvokeRequired) {
@ -83,16 +53,6 @@ namespace Mesen.GUI.Forms
}
}
private void mnuInsertCoin1_Click(object sender, EventArgs e)
{
InteropEmu.VsInsertCoin(0);
}
private void mnuInsertCoin2_Click(object sender, EventArgs e)
{
InteropEmu.VsInsertCoin(1);
}
private void ShowVsGameConfig()
{
VsConfigInfo configInfo = VsConfigInfo.GetCurrentGameConfig(true);

View file

@ -205,25 +205,6 @@ namespace Mesen.GUI.Forms
UpdateEmulationSpeedMenu();
}
private void mnuIncreaseSpeed_Click(object sender, EventArgs e)
{
InteropEmu.IncreaseEmulationSpeed();
}
private void mnuDecreaseSpeed_Click(object sender, EventArgs e)
{
InteropEmu.DecreaseEmulationSpeed();
}
private void mnuEmuSpeedMaximumSpeed_Click(object sender, EventArgs e)
{
if(ConfigManager.Config.EmulationInfo.EmulationSpeed == 0) {
SetEmulationSpeed(100);
} else {
SetEmulationSpeed(0);
}
}
private void mnuEmulationSpeedOption_Click(object sender, EventArgs e)
{
SetEmulationSpeed((uint)(int)((ToolStripItem)sender).Tag);
@ -236,22 +217,6 @@ namespace Mesen.GUI.Forms
VideoInfo.ApplyConfig();
}
private void mnuShowFPS_Click(object sender, EventArgs e)
{
UpdateEmulationFlags();
}
private void mnuScale_Click(object sender, EventArgs e)
{
UInt32 scale = UInt32.Parse((string)((ToolStripMenuItem)sender).Tag);
SetScale(scale);
}
private void mnuFullscreen_Click(object sender, EventArgs e)
{
SetFullscreenState(!_fullscreenMode);
}
private void mnuNoneFilter_Click(object sender, EventArgs e)
{
SetVideoFilter(VideoFilterType.None);

View file

@ -20,41 +20,6 @@ namespace Mesen.GUI.Forms
mnuEditHeader.Enabled = _emuThread != null && InteropEmu.GetRomInfo().Format == RomFormat.iNes;
}
private void mnuDebugger_Click(object sender, EventArgs e)
{
DebugWindowManager.OpenDebugWindow(DebugWindow.Debugger);
}
private void mnuDebugDebugger_Click(object sender, EventArgs e)
{
DebugWindowManager.OpenDebugWindow(DebugWindow.Debugger);
}
private void mnuTraceLogger_Click(object sender, EventArgs e)
{
DebugWindowManager.OpenDebugWindow(DebugWindow.TraceLogger);
}
private void mnuPpuViewer_Click(object sender, EventArgs e)
{
DebugWindowManager.OpenDebugWindow(DebugWindow.PpuViewer);
}
private void mnuMemoryViewer_Click(object sender, EventArgs e)
{
DebugWindowManager.OpenDebugWindow(DebugWindow.MemoryViewer);
}
private void mnuAssembler_Click(object sender, EventArgs e)
{
DebugWindowManager.OpenDebugWindow(DebugWindow.Assembler);
}
private void mnuScriptWindow_Click(object sender, EventArgs e)
{
DebugWindowManager.OpenDebugWindow(DebugWindow.ScriptWindow);
}
private void mnuEditHeader_Click(object sender, EventArgs e)
{
using(frmEditHeader frm = new frmEditHeader()) {
@ -147,7 +112,7 @@ namespace Mesen.GUI.Forms
}
}
private void mnuRandomGame_Click(object sender, EventArgs e)
private void LoadRandomGame()
{
IEnumerable<string> gameFolders = ConfigManager.Config.RecentFiles.Select(recentFile => recentFile.RomFile.Folder.ToLowerInvariant()).Distinct();
List<string> gameRoms = new List<string>();
@ -195,11 +160,6 @@ namespace Mesen.GUI.Forms
}
}
private void mnuTakeScreenshot_Click(object sender, EventArgs e)
{
InteropEmu.TakeScreenshot();
}
private void mnuStartServer_Click(object sender, EventArgs e)
{
if(InteropEmu.IsServerRunning()) {

View file

@ -26,6 +26,8 @@ namespace Mesen.GUI.Forms
{
private const int WM_KEYDOWN = 0x100;
private const int WM_KEYUP = 0x101;
const int WM_SYSKEYDOWN = 0x104;
const int WM_SYSKEYUP = 0x105;
private InteropEmu.NotificationListener _notifListener;
private Thread _emuThread;
@ -46,6 +48,8 @@ namespace Mesen.GUI.Forms
private bool _removeFocus = false;
private bool _showUpgradeMessage = false;
private Dictionary<EmulatorShortcut, Func<bool>> _actionEnabledFuncs = new Dictionary<EmulatorShortcut, Func<bool>>();
private string[] _commandLineArgs;
private bool _noAudio = false;
private bool _noVideo = false;
@ -154,6 +158,9 @@ namespace Mesen.GUI.Forms
UpdateViewerSize();
InitializeStateMenu(mnuSaveState, true);
InitializeStateMenu(mnuLoadState, false);
if(ConfigManager.Config.WindowLocation.HasValue) {
this.StartPosition = FormStartPosition.Manual;
this.Location = ConfigManager.Config.WindowLocation.Value;
@ -190,6 +197,8 @@ namespace Mesen.GUI.Forms
{
base.OnShown(e);
this.BindShortcuts();
if(ConfigManager.Config.WindowSize.HasValue) {
this.Size = ConfigManager.Config.WindowSize.Value;
}
@ -384,8 +393,8 @@ namespace Mesen.GUI.Forms
InitializeVsSystemMenu();
CheatInfo.ApplyCheats();
VsConfigInfo.ApplyConfig();
InitializeStateMenu(mnuSaveState, true);
InitializeStateMenu(mnuLoadState, false);
UpdateStateMenu(mnuSaveState, true);
UpdateStateMenu(mnuLoadState, false);
if(ConfigManager.Config.PreferenceInfo.ShowVsConfigOnLoad && InteropEmu.IsVsSystem()) {
this.Invoke((MethodInvoker)(() => {
this.ShowVsGameConfig();
@ -441,34 +450,9 @@ namespace Mesen.GUI.Forms
}));
break;
case InteropEmu.ConsoleNotificationType.RequestReset:
this.BeginInvoke((MethodInvoker)(() => this.ResetEmu()));
break;
case InteropEmu.ConsoleNotificationType.RequestPowerCycle:
this.BeginInvoke((MethodInvoker)(() => this.PowerCycleEmu()));
break;
case InteropEmu.ConsoleNotificationType.RequestExit:
this.BeginInvoke((MethodInvoker)(() => this.Close()));
break;
case InteropEmu.ConsoleNotificationType.ToggleCheats:
case InteropEmu.ConsoleNotificationType.ExecuteShortcut:
this.BeginInvoke((MethodInvoker)(() => {
ConfigManager.Config.DisableAllCheats = !ConfigManager.Config.DisableAllCheats;
if(ConfigManager.Config.DisableAllCheats) {
InteropEmu.DisplayMessage("Cheats", "CheatsDisabled");
}
CheatInfo.ApplyCheats();
ConfigManager.ApplyChanges();
}));
break;
case InteropEmu.ConsoleNotificationType.ToggleAudio:
this.BeginInvoke((MethodInvoker)(() => {
ConfigManager.Config.AudioInfo.EnableAudio = !ConfigManager.Config.AudioInfo.EnableAudio;
AudioInfo.ApplyConfig();
ConfigManager.ApplyChanges();
ExecuteShortcut((EmulatorShortcut)e.Parameter);
}));
break;
@ -486,6 +470,197 @@ namespace Mesen.GUI.Forms
}
}
private void BindShortcuts()
{
Func<bool> runningNotClient = () => { return _emuThread != null && !InteropEmu.IsConnected(); };
Func<bool> runningNotClientNotMovie = () => { return _emuThread != null && !InteropEmu.IsConnected() && !InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording(); };
Func<bool> runningNotNsf = () => { return _emuThread != null && !InteropEmu.IsNsf(); };
Func<bool> runningFdsNoAutoInsert = () => { return _emuThread != null && InteropEmu.FdsGetSideCount() > 0 && !InteropEmu.FdsIsAutoInsertDiskEnabled() && !InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording(); };
Func<bool> runningVsSystem = () => { return _emuThread != null && InteropEmu.IsVsSystem() && !InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording(); };
BindShortcut(mnuOpen, EmulatorShortcut.OpenFile);
BindShortcut(mnuExit, EmulatorShortcut.Exit);
BindShortcut(mnuIncreaseSpeed, EmulatorShortcut.IncreaseSpeed, runningNotClient);
BindShortcut(mnuDecreaseSpeed, EmulatorShortcut.DecreaseSpeed, runningNotClient);
BindShortcut(mnuEmuSpeedMaximumSpeed, EmulatorShortcut.MaxSpeed, runningNotClient);
BindShortcut(mnuPause, EmulatorShortcut.Pause, runningNotClient);
BindShortcut(mnuReset, EmulatorShortcut.Reset, runningNotClientNotMovie);
BindShortcut(mnuPowerCycle, EmulatorShortcut.PowerCycle, runningNotClientNotMovie);
BindShortcut(mnuPowerOff, EmulatorShortcut.PowerOff, runningNotClient);
BindShortcut(mnuSwitchDiskSide, EmulatorShortcut.SwitchDiskSide, runningFdsNoAutoInsert);
BindShortcut(mnuEjectDisk, EmulatorShortcut.EjectDisk, runningFdsNoAutoInsert);
BindShortcut(mnuInsertCoin1, EmulatorShortcut.InsertCoin1, runningVsSystem);
BindShortcut(mnuInsertCoin2, EmulatorShortcut.InsertCoin2, runningVsSystem);
BindShortcut(mnuShowFPS, EmulatorShortcut.ToggleFps);
BindShortcut(mnuScale1x, EmulatorShortcut.SetScale1x);
BindShortcut(mnuScale2x, EmulatorShortcut.SetScale2x);
BindShortcut(mnuScale3x, EmulatorShortcut.SetScale3x);
BindShortcut(mnuScale4x, EmulatorShortcut.SetScale4x);
BindShortcut(mnuScale5x, EmulatorShortcut.SetScale5x);
BindShortcut(mnuScale6x, EmulatorShortcut.SetScale6x);
BindShortcut(mnuFullscreen, EmulatorShortcut.ToggleFullscreen);
BindShortcut(mnuTakeScreenshot, EmulatorShortcut.TakeScreenshot, runningNotNsf);
BindShortcut(mnuRandomGame, EmulatorShortcut.LoadRandomGame);
BindShortcut(mnuDebugDebugger, EmulatorShortcut.OpenDebugger, runningNotClient);
BindShortcut(mnuDebugger, EmulatorShortcut.OpenDebugger, runningNotClient);
BindShortcut(mnuAssembler, EmulatorShortcut.OpenAssembler, runningNotClient);
BindShortcut(mnuMemoryViewer, EmulatorShortcut.OpenMemoryTools, runningNotClient);
BindShortcut(mnuPpuViewer, EmulatorShortcut.OpenPpuViewer, runningNotClient);
BindShortcut(mnuScriptWindow, EmulatorShortcut.OpenScriptWindow, runningNotClient);
BindShortcut(mnuTraceLogger, EmulatorShortcut.OpenTraceLogger, runningNotClient);
}
private void BindShortcut(ToolStripMenuItem item, EmulatorShortcut shortcut, Func<bool> isActionEnabled = null)
{
item.Click += (object sender, EventArgs e) => {
if(isActionEnabled == null || isActionEnabled()) {
ExecuteShortcut(shortcut);
}
};
_actionEnabledFuncs[shortcut] = isActionEnabled;
if(item.OwnerItem is ToolStripMenuItem) {
Action updateShortcut = () => {
int keyIndex = ConfigManager.Config.PreferenceInfo.ShortcutKeys1.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
if(keyIndex >= 0) {
item.ShortcutKeyDisplayString = ConfigManager.Config.PreferenceInfo.ShortcutKeys1[keyIndex].KeyCombination.ToString();
} else {
keyIndex = ConfigManager.Config.PreferenceInfo.ShortcutKeys2.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
if(keyIndex >= 0) {
item.ShortcutKeyDisplayString = ConfigManager.Config.PreferenceInfo.ShortcutKeys2[keyIndex].KeyCombination.ToString();
} else {
item.ShortcutKeyDisplayString = "";
}
}
item.Enabled = isActionEnabled == null || isActionEnabled();
};
updateShortcut();
//Update item shortcut text when its parent opens
((ToolStripMenuItem)item.OwnerItem).DropDownOpening += (object sender, EventArgs e) => { updateShortcut(); };
}
}
private void ExecuteShortcut(EmulatorShortcut shortcut)
{
Func<bool> isActionEnabled;
if(_actionEnabledFuncs.TryGetValue(shortcut, out isActionEnabled)) {
isActionEnabled = _actionEnabledFuncs[shortcut];
if(isActionEnabled != null && !isActionEnabled()) {
//Action disabled
return;
}
}
switch(shortcut) {
case EmulatorShortcut.Pause: PauseEmu(); break;
case EmulatorShortcut.Reset: this.ResetEmu(); break;
case EmulatorShortcut.PowerCycle: this.PowerCycleEmu(); break;
case EmulatorShortcut.PowerOff: InteropEmu.Stop(); break;
case EmulatorShortcut.Exit: this.Close(); break;
case EmulatorShortcut.ToggleCheats: ToggleCheats(); break;
case EmulatorShortcut.ToggleAudio: ToggleAudio(); break;
case EmulatorShortcut.ToggleFps: ToggleFps(); break;
case EmulatorShortcut.MaxSpeed: ToggleMaxSpeed(); break;
case EmulatorShortcut.ToggleFullscreen: ToggleFullscreen(); break;
case EmulatorShortcut.OpenFile: OpenFile(); break;
case EmulatorShortcut.IncreaseSpeed: InteropEmu.IncreaseEmulationSpeed(); break;
case EmulatorShortcut.DecreaseSpeed: InteropEmu.DecreaseEmulationSpeed(); break;
case EmulatorShortcut.SwitchDiskSide: InteropEmu.FdsSwitchDiskSide(); break;
case EmulatorShortcut.EjectDisk: InteropEmu.FdsEjectDisk(); break;
case EmulatorShortcut.SetScale1x: SetScale(1); break;
case EmulatorShortcut.SetScale2x: SetScale(2); break;
case EmulatorShortcut.SetScale3x: SetScale(3); break;
case EmulatorShortcut.SetScale4x: SetScale(4); break;
case EmulatorShortcut.SetScale5x: SetScale(5); break;
case EmulatorShortcut.SetScale6x: SetScale(6); break;
case EmulatorShortcut.InsertCoin1: InteropEmu.VsInsertCoin(0); break;
case EmulatorShortcut.InsertCoin2: InteropEmu.VsInsertCoin(1); break;
case EmulatorShortcut.TakeScreenshot: InteropEmu.TakeScreenshot(); break;
case EmulatorShortcut.LoadRandomGame: LoadRandomGame(); break;
case EmulatorShortcut.OpenAssembler: DebugWindowManager.OpenDebugWindow(DebugWindow.Assembler); break;
case EmulatorShortcut.OpenDebugger: DebugWindowManager.OpenDebugWindow(DebugWindow.Debugger); break;
case EmulatorShortcut.OpenTraceLogger: DebugWindowManager.OpenDebugWindow(DebugWindow.TraceLogger); break;
case EmulatorShortcut.OpenPpuViewer: DebugWindowManager.OpenDebugWindow(DebugWindow.PpuViewer); break;
case EmulatorShortcut.OpenMemoryTools: DebugWindowManager.OpenDebugWindow(DebugWindow.MemoryViewer); break;
case EmulatorShortcut.OpenScriptWindow: DebugWindowManager.OpenDebugWindow(DebugWindow.ScriptWindow); break;
case EmulatorShortcut.LoadStateFromFile: LoadStateFromFile(); break;
case EmulatorShortcut.SaveStateToFile: SaveStateToFile(); break;
case EmulatorShortcut.SaveStateSlot1: SaveState(1); break;
case EmulatorShortcut.SaveStateSlot2: SaveState(2); break;
case EmulatorShortcut.SaveStateSlot3: SaveState(3); break;
case EmulatorShortcut.SaveStateSlot4: SaveState(4); break;
case EmulatorShortcut.SaveStateSlot5: SaveState(5); break;
case EmulatorShortcut.SaveStateSlot6: SaveState(6); break;
case EmulatorShortcut.SaveStateSlot7: SaveState(7); break;
case EmulatorShortcut.LoadStateSlot1: LoadState(1); break;
case EmulatorShortcut.LoadStateSlot2: LoadState(2); break;
case EmulatorShortcut.LoadStateSlot3: LoadState(3); break;
case EmulatorShortcut.LoadStateSlot4: LoadState(4); break;
case EmulatorShortcut.LoadStateSlot5: LoadState(5); break;
case EmulatorShortcut.LoadStateSlot6: LoadState(6); break;
case EmulatorShortcut.LoadStateSlot7: LoadState(7); break;
case EmulatorShortcut.LoadStateSlot8: LoadState(8); break;
}
}
private void ToggleFullscreen()
{
SetFullscreenState(!_fullscreenMode);
mnuFullscreen.Checked = _fullscreenMode;
}
private void ToggleMaxSpeed()
{
if(ConfigManager.Config.EmulationInfo.EmulationSpeed == 0) {
SetEmulationSpeed(100);
} else {
SetEmulationSpeed(0);
}
}
private void ToggleFps()
{
mnuShowFPS.Checked = !mnuShowFPS.Checked;
UpdateEmulationFlags();
}
private static void ToggleAudio()
{
ConfigManager.Config.AudioInfo.EnableAudio = !ConfigManager.Config.AudioInfo.EnableAudio;
AudioInfo.ApplyConfig();
ConfigManager.ApplyChanges();
}
private static void ToggleCheats()
{
ConfigManager.Config.DisableAllCheats = !ConfigManager.Config.DisableAllCheats;
if(ConfigManager.Config.DisableAllCheats) {
InteropEmu.DisplayMessage("Cheats", "CheatsDisabled");
}
CheatInfo.ApplyCheats();
ConfigManager.ApplyChanges();
}
private void UpdateFocusFlag()
{
bool hasFocus = false;
@ -512,13 +687,6 @@ namespace Mesen.GUI.Forms
bool devMode = ConfigManager.Config.PreferenceInfo.DeveloperMode;
mnuDebug.Visible = devMode;
mnuAssembler.Enabled = running;
mnuMemoryViewer.Enabled = running;
mnuPpuViewer.Enabled = running;
mnuTraceLogger.Enabled = running;
mnuDebugDebugger.Enabled = running;
mnuScriptWindow.Enabled = running;
panelInfo.Visible = !running;
ctrlRecentGames.Visible = !running;
@ -529,7 +697,6 @@ namespace Mesen.GUI.Forms
bool isNetPlayClient = InteropEmu.IsConnected();
mnuPause.Enabled = mnuPowerCycle.Enabled = mnuReset.Enabled = mnuPowerOff.Enabled = (running && !isNetPlayClient);
mnuSaveState.Enabled = (running && !isNetPlayClient && !InteropEmu.IsNsf());
mnuLoadState.Enabled = (running && !isNetPlayClient && !InteropEmu.IsNsf() && !InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording());
@ -567,9 +734,6 @@ namespace Mesen.GUI.Forms
mnuCheats.Enabled = !isNetPlayClient;
mnuEmulationSpeed.Enabled = !isNetPlayClient;
mnuIncreaseSpeed.Enabled = !isNetPlayClient;
mnuDecreaseSpeed.Enabled = !isNetPlayClient;
mnuEmuSpeedMaximumSpeed.Enabled = !isNetPlayClient;
mnuInput.Enabled = !isNetPlayClient;
mnuRegion.Enabled = !isNetPlayClient;
@ -600,10 +764,8 @@ namespace Mesen.GUI.Forms
mnuTestRecordFrom.Enabled = (mnuTestRecordStart.Enabled || mnuTestRecordNow.Enabled || mnuTestRecordMovie.Enabled || mnuTestRecordTest.Enabled);
mnuDebugger.Visible = !devMode;
mnuDebugger.Enabled = !netPlay && running && !devMode;
mnuHdPackEditor.Enabled = !netPlay && running;
mnuTakeScreenshot.Enabled = running && !InteropEmu.IsNsf();
mnuNetPlay.Enabled = !InteropEmu.IsNsf();
if(running && InteropEmu.IsNsf()) {
mnuPowerCycle.Enabled = false;
@ -617,8 +779,6 @@ namespace Mesen.GUI.Forms
bool autoInsertDisabled = !InteropEmu.FdsIsAutoInsertDiskEnabled();
mnuSelectDisk.Enabled = autoInsertDisabled;
mnuEjectDisk.Enabled = autoInsertDisabled;
mnuSwitchDiskSide.Enabled = autoInsertDisabled;
bool isHdPackLoader = InteropEmu.IsHdPpu();
mnuNtscFilter.Enabled = !isHdPackLoader;
@ -695,21 +855,20 @@ namespace Mesen.GUI.Forms
bool IMessageFilter.PreFilterMessage(ref Message m)
{
if(m.Msg == WM_KEYUP) {
if(Application.OpenForms.Count > 0 && Application.OpenForms[0].ContainsFocus) {
if(m.Msg == WM_KEYUP || m.Msg == WM_SYSKEYUP) {
int scanCode = (Int32)(((Int64)m.LParam & 0x1FF0000) >> 16);
InteropEmu.SetKeyState(scanCode, false);
} else if(m.Msg == WM_SYSKEYDOWN || m.Msg == WM_KEYDOWN) {
int scanCode = (Int32)(((Int64)m.LParam & 0x1FF0000) >> 16);
InteropEmu.SetKeyState(scanCode, true);
}
}
return false;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if(msg.Msg == WM_KEYDOWN) {
int scanCode = (Int32)(((Int64)msg.LParam & 0x1FF0000) >> 16);
InteropEmu.SetKeyState(scanCode, true);
}
if(!this.menuStrip.Enabled) {
//Make sure we disable all shortcut keys while the bar is disabled (i.e when running tests)
return false;
@ -734,16 +893,6 @@ namespace Mesen.GUI.Forms
}
#endif
if(keyData == Keys.Escape && _emuThread != null && mnuPause.Enabled) {
PauseEmu();
return true;
} else if(keyData == Keys.Oemplus) {
mnuIncreaseSpeed.PerformClick();
return true;
} else if(keyData == Keys.OemMinus) {
mnuDecreaseSpeed.PerformClick();
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}

View file

@ -44,18 +44,21 @@ namespace Mesen.GUI
[DllImport(DLLPath)] public static extern void SetZapperDetectionRadius(UInt32 detectionRadius);
[DllImport(DLLPath)] public static extern void SetExpansionDevice(ExpansionPortDevice device);
[DllImport(DLLPath)] public static extern void SetConsoleType(ConsoleType type);
[DllImport(DLLPath)] public static extern void SetEmulatorKeys(EmulatorKeyMappingSet mappings);
[DllImport(DLLPath)] public static extern void ClearShortcutKeys();
[DllImport(DLLPath)] public static extern void SetShortcutKey(EmulatorShortcut shortcut, KeyCombination keyCombination, int keySetIndex);
[DllImport(DLLPath)] public static extern ControllerType GetControllerType(int port);
[DllImport(DLLPath)] public static extern ExpansionPortDevice GetExpansionDevice();
[DllImport(DLLPath)] public static extern ConsoleType GetConsoleType();
[DllImport(DLLPath)] public static extern void UpdateInputDevices();
[DllImport(DLLPath)] public static extern UInt32 GetPressedKey();
[DllImport(DLLPath, EntryPoint = "GetPressedKeys")] private static extern void GetPressedKeysWrapper(IntPtr keyBuffer);
[DllImport(DLLPath)] public static extern UInt32 GetKeyCode([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string keyName);
[DllImport(DLLPath, EntryPoint = "GetKeyName")] private static extern IntPtr GetKeyNameWrapper(UInt32 key);
[DllImport(DLLPath)] public static extern void SetKeyState(Int32 scanCode, [MarshalAs(UnmanagedType.I1)]bool pressed);
[DllImport(DLLPath)] public static extern void ResetKeyState();
[DllImport(DLLPath)] public static extern void DisableAllKeys([MarshalAs(UnmanagedType.I1)]bool disabled);
[DllImport(DLLPath)] public static extern void Run();
[DllImport(DLLPath)] public static extern void Pause();
@ -589,6 +592,25 @@ namespace Mesen.GUI
return bankList;
}
public static List<UInt32> GetPressedKeys()
{
UInt32[] keyBuffer = new UInt32[3];
GCHandle handle = GCHandle.Alloc(keyBuffer, GCHandleType.Pinned);
try {
InteropEmu.GetPressedKeysWrapper(handle.AddrOfPinnedObject());
} finally {
handle.Free();
}
List<UInt32> keys = new List<UInt32>();
for(int i = 0; i < 3; i++) {
if(keyBuffer[i] != 0) {
keys.Add(keyBuffer[i]);
}
}
return keys;
}
public static NsfHeader NsfGetHeader()
{
NsfHeader header = new NsfHeader();
@ -702,11 +724,7 @@ namespace Mesen.GUI
ConfigChanged = 14,
DisconnectedFromServer = 15,
PpuViewerDisplayFrame = 16,
RequestExit = 17,
ToggleCheats = 18,
ToggleAudio = 19,
RequestReset = 20,
RequestPowerCycle = 21,
ExecuteShortcut = 17,
}
public enum ControllerType
@ -802,11 +820,12 @@ namespace Mesen.GUI
public class NotificationEventArgs
{
public ConsoleNotificationType NotificationType;
public IntPtr Parameter;
}
public class NotificationListener : IDisposable
{
public delegate void NotificationCallback(int type);
public delegate void NotificationCallback(int type, IntPtr parameter);
public delegate void NotificationEventHandler(NotificationEventArgs e);
public event NotificationEventHandler OnNotification;
@ -816,8 +835,8 @@ namespace Mesen.GUI
public NotificationListener()
{
_callback = (int type) => {
this.ProcessNotification(type);
_callback = (int type, IntPtr parameter) => {
this.ProcessNotification(type, parameter);
};
_notificationListener = InteropEmu.RegisterNotificationCallback(_callback);
}
@ -827,10 +846,13 @@ namespace Mesen.GUI
InteropEmu.UnregisterNotificationCallback(_notificationListener);
}
public void ProcessNotification(int type)
public void ProcessNotification(int type, IntPtr parameter)
{
if(this.OnNotification != null) {
this.OnNotification(new NotificationEventArgs() { NotificationType = (ConsoleNotificationType)type });
this.OnNotification(new NotificationEventArgs() {
NotificationType = (ConsoleNotificationType)type,
Parameter = parameter
});
}
}
}
@ -1288,46 +1310,141 @@ namespace Mesen.GUI
}
};
public struct EmulatorKeyMappingSet
public struct KeyCombination
{
public EmulatorKeyMappings KeySet1;
public EmulatorKeyMappings KeySet2;
public UInt32 Key1;
public UInt32 Key2;
public UInt32 Key3;
public bool IsEmpty { get { return Key1 == 0 && Key2 == 0 && Key3 == 0; } }
public override string ToString()
{
return GetKeyNames();
}
public struct EmulatorKeyMappings
public KeyCombination(List<UInt32> scanCodes = null)
{
public UInt32 FastForward;
if(scanCodes != null) {
Key1 = scanCodes.Count > 0 ? scanCodes[0] : 0;
Key2 = scanCodes.Count > 1 ? scanCodes[1] : 0;
Key3 = scanCodes.Count > 2 ? scanCodes[2] : 0;
} else {
Key1 = 0;
Key2 = 0;
Key3 = 0;
}
}
public UInt32 Rewind;
public UInt32 RewindTenSecs;
public UInt32 RewindOneMin;
private string GetKeyNames()
{
List<UInt32> scanCodes = new List<uint>() { Key1, Key2, Key3 };
List<string> keyNames = scanCodes.Select((UInt32 scanCode) => InteropEmu.GetKeyName(scanCode)).Where((keyName) => !string.IsNullOrWhiteSpace(keyName)).ToList();
keyNames.Sort((string a, string b) => {
if(a == b) {
return 0;
}
public UInt32 Pause;
public UInt32 Reset;
public UInt32 PowerCycle;
public UInt32 PowerOff;
public UInt32 Exit;
if(a == "Ctrl") {
return -1;
} else if(b == "Ctrl") {
return 1;
}
public UInt32 MoveToNextStateSlot;
public UInt32 MoveToPreviousStateSlot;
public UInt32 SaveState;
public UInt32 LoadState;
if(a == "Alt") {
return -1;
} else if(b == "Alt") {
return 1;
}
public UInt32 SwitchDiskSide;
public UInt32 InsertNextDisk;
if(a == "Shift") {
return -1;
} else if(b == "Shift") {
return 1;
}
public UInt32 InsertCoin1;
public UInt32 InsertCoin2;
public UInt32 VsServiceButton;
return a.CompareTo(b);
});
public UInt32 TakeScreenshot;
public UInt32 IncreaseSpeed;
public UInt32 DecreaseSpeed;
return string.Join("+", keyNames);
}
}
public UInt32 ToggleCheats;
public UInt32 ToggleAudio;
public enum EmulatorShortcut
{
FastForward,
Rewind,
RewindTenSecs,
RewindOneMin,
public UInt32 RunSingleFrame;
MoveToNextStateSlot,
MoveToPreviousStateSlot,
SaveState,
LoadState,
InsertNextDisk,
VsServiceButton,
ToggleCheats,
ToggleAudio,
RunSingleFrame,
// Everything below this is handled UI-side
SwitchDiskSide,
EjectDisk,
InsertCoin1,
InsertCoin2,
TakeScreenshot,
IncreaseSpeed,
DecreaseSpeed,
MaxSpeed,
Pause,
Reset,
PowerCycle,
PowerOff,
Exit,
SetScale1x,
SetScale2x,
SetScale3x,
SetScale4x,
SetScale5x,
SetScale6x,
ToggleFullscreen,
ToggleFps,
LoadRandomGame,
SaveStateSlot1,
SaveStateSlot2,
SaveStateSlot3,
SaveStateSlot4,
SaveStateSlot5,
SaveStateSlot6,
SaveStateSlot7,
SaveStateToFile,
LoadStateSlot1,
LoadStateSlot2,
LoadStateSlot3,
LoadStateSlot4,
LoadStateSlot5,
LoadStateSlot6,
LoadStateSlot7,
LoadStateSlot8,
LoadStateFromFile,
OpenFile,
OpenDebugger,
OpenAssembler,
OpenPpuViewer,
OpenMemoryTools,
OpenScriptWindow,
OpenTraceLogger
}
public struct InteropCheatInfo

View file

@ -22,6 +22,7 @@
#include "../Core/MovieManager.h"
#include "../Core/HdPackBuilder.h"
#include "../Utilities/AviWriter.h"
#include "../Core/ShortcutKeyHandler.h"
#ifdef WIN32
#include "../Windows/Renderer.h"
@ -36,13 +37,15 @@
IRenderingDevice *_renderer = nullptr;
IAudioDevice *_soundManager = nullptr;
IKeyManager *_keyManager = nullptr;
unique_ptr<ShortcutKeyHandler> _shortcutKeyHandler;
void* _windowHandle = nullptr;
void* _viewerHandle = nullptr;
string _returnString;
string _logString;
RecordedRomTest *_recordedRomTest = nullptr;
typedef void (__stdcall *NotificationListenerCallback)(int);
typedef void (__stdcall *NotificationListenerCallback)(int, void*);
namespace InteropEmu {
class InteropNotificationListener : public INotificationListener
@ -56,7 +59,7 @@ namespace InteropEmu {
void ProcessNotification(ConsoleNotificationType type, void* parameter)
{
_callback((int)type);
_callback((int)type, parameter);
}
};
@ -80,6 +83,7 @@ namespace InteropEmu {
DllExport void __stdcall InitializeEmu(const char* homeFolder, void *windowHandle, void *viewerHandle, bool noAudio, bool noVideo, bool noInput)
{
FolderUtilities::SetHomeFolder(homeFolder);
_shortcutKeyHandler.reset(new ShortcutKeyHandler());
if(windowHandle != nullptr && viewerHandle != nullptr) {
_windowHandle = windowHandle;
@ -137,7 +141,9 @@ namespace InteropEmu {
DllExport void __stdcall SetZapperDetectionRadius(uint32_t detectionRadius) { EmulationSettings::SetZapperDetectionRadius(detectionRadius); }
DllExport void __stdcall SetExpansionDevice(ExpansionPortDevice device) { EmulationSettings::SetExpansionDevice(device); }
DllExport void __stdcall SetConsoleType(ConsoleType type) { EmulationSettings::SetConsoleType(type); }
DllExport void __stdcall SetEmulatorKeys(EmulatorKeyMappingSet mappings) { EmulationSettings::SetEmulatorKeys(mappings); }
DllExport void __stdcall ClearShortcutKeys() { EmulationSettings::ClearShortcutKeys(); }
DllExport void __stdcall SetShortcutKey(EmulatorShortcut shortcut, KeyCombination keyCombination, int keySetIndex) { EmulationSettings::SetShortcutKey(shortcut, keyCombination, keySetIndex); }
DllExport ControllerType __stdcall GetControllerType(uint32_t port) { return EmulationSettings::GetControllerType(port); }
DllExport ExpansionPortDevice GetExpansionDevice() { return EmulationSettings::GetExpansionDevice(); }
@ -150,8 +156,23 @@ namespace InteropEmu {
DllExport void __stdcall SetMousePosition(double x, double y) { ControlManager::SetMousePosition(x, y); }
DllExport void __stdcall UpdateInputDevices() { if(_keyManager) { _keyManager->UpdateDevices(); } }
DllExport uint32_t __stdcall GetPressedKey() { return ControlManager::GetPressedKey(); }
DllExport void __stdcall SetKeyState(int32_t scanCode, bool state) { if(_keyManager) { _keyManager->SetKeyState(scanCode, state); } }
DllExport void __stdcall GetPressedKeys(uint32_t *keyBuffer) {
vector<uint32_t> pressedKeys = ControlManager::GetPressedKeys();
for(int i = 0; i < pressedKeys.size() && i < 3; i++) {
keyBuffer[i] = pressedKeys[i];
}
}
DllExport void __stdcall DisableAllKeys(bool disabled) {
if(_keyManager) {
_keyManager->SetDisabled(disabled);
}
}
DllExport void __stdcall SetKeyState(int32_t scanCode, bool state) {
if(_keyManager) {
_keyManager->SetKeyState(scanCode, state);
_shortcutKeyHandler->ProcessKeys();
}
}
DllExport void __stdcall ResetKeyState() { if(_keyManager) { _keyManager->ResetKeyState(); } }
DllExport const char* __stdcall GetKeyName(uint32_t keyCode)
{
@ -276,6 +297,8 @@ namespace InteropEmu {
DllExport void __stdcall Release()
{
_shortcutKeyHandler.reset();
Console::Release();
GameServer::StopServer();
GameClient::Disconnect();

View file

@ -5,7 +5,7 @@
#include "../Core/Console.h"
static vector<KeyDefinition> _keyDefinitions = {
{ "", 9, "Escape", "" },
{ "", 9, "Esc", "" },
{ "", 10, "1", "" },
{ "", 11, "2", "" },
{ "", 12, "3", "" },
@ -16,8 +16,8 @@ static vector<KeyDefinition> _keyDefinitions = {
{ "", 17, "8", "" },
{ "", 18, "9", "" },
{ "", 19, "0", "" },
{ "", 20, "Minus", "" },
{ "", 21, "Equal", "" },
{ "", 20, "-", "" },
{ "", 21, "=", "" },
{ "", 22, "BackSpace", "" },
{ "", 23, "Tab", "" },
{ "", 24, "Q", "" },
@ -33,7 +33,7 @@ static vector<KeyDefinition> _keyDefinitions = {
{ "", 34, "Left Bracket", "" },
{ "", 35, "Right Bracket", "" },
{ "", 36, "Return", "" },
{ "", 37, "Left Control", "" },
{ "", 37, "Ctrl", "" },
{ "", 38, "A", "" },
{ "", 39, "S", "" },
{ "", 40, "D", "" },
@ -46,7 +46,7 @@ static vector<KeyDefinition> _keyDefinitions = {
{ "", 47, "Semicolor", "" },
{ "", 48, "Apostrophe", "" },
{ "", 49, "Grave", "" },
{ "", 50, "Left Shift", "" },
{ "", 50, "Shift", "" },
{ "", 51, "\\", "" },
{ "", 52, "Z", "" },
{ "", 53, "X", "" },
@ -60,7 +60,7 @@ static vector<KeyDefinition> _keyDefinitions = {
{ "", 61, "/", "" },
{ "", 62, "Right Shift", "" },
{ "", 63, "KP Multiply", "" },
{ "", 64, "Left Alt", "" },
{ "", 64, "Alt", "" },
{ "", 65, "Space", "" },
{ "", 66, "Caps Lock", "" },
{ "", 67, "F1", "" },
@ -262,6 +262,7 @@ LinuxKeyManager::LinuxKeyManager()
}
}
_disableAllKeys = false;
_stopUpdateDeviceThread = false;
StartUpdateDeviceThread();
}
@ -280,6 +281,10 @@ void LinuxKeyManager::RefreshState()
bool LinuxKeyManager::IsKeyPressed(uint32_t key)
{
if(_disableAllKeys) {
return false;
}
if(key >= 0x10000) {
uint8_t gamepadPort = (key - 0x10000) / 0x100;
uint8_t gamepadButton = (key - 0x10000) % 0x100;
@ -303,22 +308,23 @@ bool LinuxKeyManager::IsMouseButtonPressed(MouseButton button)
return false;
}
uint32_t LinuxKeyManager::GetPressedKey()
vector<uint32_t> LinuxKeyManager::GetPressedKeys()
{
vector<uint32_t> pressedKeys;
for(size_t i = 0; i < _controllers.size(); i++) {
for(int j = 0; j <= 54; j++) {
if(_controllers[i]->IsButtonPressed(j)) {
return 0x10000 + i * 0x100 + j;
pressedKeys.push_back(0x10000 + i * 0x100 + j);
}
}
}
for(int i = 0; i < 0x200; i++) {
if(_keyState[i]) {
return i;
pressedKeys.push_back(i);
}
}
return 0;
return pressedKeys;
}
string LinuxKeyManager::GetKeyName(uint32_t key)
@ -391,6 +397,17 @@ void LinuxKeyManager::SetKeyState(uint16_t scanCode, bool state)
if(scanCode > 0x1FF) {
_mouseState[scanCode & 0x03] = state;
} else {
scanCode &= 0xFF;
if(scanCode == 105) {
//Left + Right Ctrl
scanCode = 37;
} else if(scanCode == 62) {
//Left + Right Shift
scanCode = 50;
} else if(scanCode == 108) {
//Left + Right Alt
scanCode = 64;
}
_keyState[scanCode & 0xFF] = state;
}
}
@ -400,3 +417,8 @@ void LinuxKeyManager::ResetKeyState()
memset(_mouseState, 0, sizeof(_mouseState));
memset(_keyState, 0, sizeof(_keyState));
}
void WindowsKeyManager::SetDisabled(bool disabled)
{
_disableAllKeys = disabled;
}

View file

@ -24,6 +24,7 @@ private:
std::thread _updateDeviceThread;
atomic<bool> _stopUpdateDeviceThread;
bool _disableAllKeys;
void StartUpdateDeviceThread();
@ -34,11 +35,13 @@ public:
void RefreshState();
bool IsKeyPressed(uint32_t key);
bool IsMouseButtonPressed(MouseButton button);
uint32_t GetPressedKey();
std::vector<uint32_t> GetPressedKeys();
string GetKeyName(uint32_t key);
uint32_t GetKeyCode(string keyName);
void UpdateDevices();
void SetKeyState(uint16_t scanCode, bool state);
void ResetKeyState();
void SetDisabled(bool disabled);
};

View file

@ -165,7 +165,7 @@ static vector<KeyDefinition> _keyDefinitions = {
{ "VK_LAUNCH_APP2", 0xB7, "Start Application 2", "" },
//{ "-", 0xB8 - B9, "Reserved", "" },
{ "VK_OEM_1", 0xBA, ";", "" },
{ "VK_OEM_PLUS", 0xBB, "+", "" },
{ "VK_OEM_PLUS", 0xBB, "=", "" },
{ "VK_OEM_COMMA", 0xBC, ",", "" },
{ "VK_OEM_MINUS", 0xBD, "-", "" },
{ "VK_OEM_PERIOD", 0xBE, ".", "" },
@ -282,6 +282,10 @@ void WindowsKeyManager::RefreshState()
bool WindowsKeyManager::IsKeyPressed(uint32_t key)
{
if(_disableAllKeys) {
return false;
}
if(key >= 0x10000) {
if(!_xInput || !_directInput) {
return false;
@ -315,17 +319,18 @@ bool WindowsKeyManager::IsMouseButtonPressed(MouseButton button)
return false;
}
uint32_t WindowsKeyManager::GetPressedKey()
vector<uint32_t> WindowsKeyManager::GetPressedKeys()
{
vector<uint32_t> result;
if(!_xInput || !_directInput) {
return 0;
return result;
}
_xInput->RefreshState();
for(int i = 0; i < XUSER_MAX_COUNT; i++) {
for(int j = 1; j <= 26; j++) {
if(_xInput->IsPressed(i, j)) {
return 0xFFFF + i * 0x100 + j;
result.push_back(0xFFFF + i * 0x100 + j);
}
}
}
@ -334,17 +339,17 @@ uint32_t WindowsKeyManager::GetPressedKey()
for(int i = _directInput->GetJoystickCount() - 1; i >= 0; i--) {
for(int j = 0; j < 0x29; j++) {
if(_directInput->IsPressed(i, j)) {
return 0x11000 + i * 0x100 + j;
result.push_back(0x11000 + i * 0x100 + j);
}
}
}
for(int i = 0; i < 0x200; i++) {
if(_keyState[i]) {
return i;
result.push_back(i);
}
}
return 0;
return result;
}
string WindowsKeyManager::GetKeyName(uint32_t scanCode)
@ -384,10 +389,20 @@ void WindowsKeyManager::SetKeyState(uint16_t scanCode, bool state)
if(scanCode > 0x1FF) {
_mouseState[scanCode & 0x03] = state;
} else {
uint32_t keyCode = MapVirtualKeyEx(scanCode & 0xFF, MAPVK_VSC_TO_VK, nullptr);
if(keyCode >= 0x10 && keyCode <= 0x12) {
//Ignore "ext" flag for alt, ctrl & shift
scanCode &= 0xFF;
}
_keyState[scanCode & 0x1FF] = state;
}
}
void WindowsKeyManager::SetDisabled(bool disabled)
{
_disableAllKeys = disabled;
}
void WindowsKeyManager::ResetKeyState()
{
memset(_mouseState, 0, sizeof(_mouseState));

View file

@ -28,6 +28,7 @@ class WindowsKeyManager : public IKeyManager
std::thread _updateDeviceThread;
atomic<bool> _stopUpdateDeviceThread = false;
bool _disableAllKeys = false;
void StartUpdateDeviceThread();
@ -38,12 +39,13 @@ class WindowsKeyManager : public IKeyManager
void RefreshState();
bool IsKeyPressed(uint32_t key);
bool IsMouseButtonPressed(MouseButton button);
uint32_t GetPressedKey();
vector<uint32_t> GetPressedKeys();
string GetKeyName(uint32_t key);
uint32_t GetKeyCode(string keyName);
void SetKeyState(uint16_t scanCode, bool state);
void ResetKeyState();
void SetDisabled(bool disabled);
void UpdateDevices();
};