diff --git a/Core/Console.cpp b/Core/Console.cpp index 69421d9d..2b8788eb 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -16,6 +16,7 @@ #include "NsfPpu.h" #include "SoundMixer.h" #include "NsfMapper.h" +#include "ShortcutKeyHandler.h" shared_ptr Console::Instance(new Console()); @@ -264,6 +265,7 @@ void Console::Run() double targetTime; uint32_t lastFrameNumber = -1; + ShortcutKeyHandler shortcutKeyHandler; _autoSaveManager.reset(new AutoSaveManager()); _runLock.Acquire(); diff --git a/Core/ControlManager.cpp b/Core/ControlManager.cpp index 0038eeb9..7b135c18 100644 --- a/Core/ControlManager.cpp +++ b/Core/ControlManager.cpp @@ -27,6 +27,13 @@ void ControlManager::RegisterKeyManager(IKeyManager* keyManager) _keyManager.reset(keyManager); } +void ControlManager::RefreshKeyState() +{ + if(_keyManager != nullptr) { + return _keyManager->RefreshState(); + } +} + bool ControlManager::IsKeyPressed(uint32_t keyCode) { if(_keyManager != nullptr) { diff --git a/Core/ControlManager.h b/Core/ControlManager.h index 02dccf60..03f2b780 100644 --- a/Core/ControlManager.h +++ b/Core/ControlManager.h @@ -55,6 +55,7 @@ class ControlManager : public Snapshotable, public IMemoryHandler static void UnregisterBroadcaster(IGameBroadcaster* gameBroadcaster); static void RegisterKeyManager(IKeyManager* keyManager); + static void RefreshKeyState(); static bool IsKeyPressed(uint32_t keyCode); static bool IsMouseButtonPressed(MouseButton button); static uint32_t GetPressedKey(); diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 62330ea6..0c1481b1 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -542,6 +542,7 @@ + @@ -714,6 +715,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 80f2fd55..06cfde04 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -928,6 +928,9 @@ Misc + + Misc + @@ -1101,5 +1104,8 @@ Misc + + Misc + \ No newline at end of file diff --git a/Core/EmulationSettings.cpp b/Core/EmulationSettings.cpp index 093431a4..5d43fe45 100644 --- a/Core/EmulationSettings.cpp +++ b/Core/EmulationSettings.cpp @@ -25,6 +25,8 @@ NesModel EmulationSettings::_model = NesModel::Auto; PpuModel EmulationSettings::_ppuModel = PpuModel::Ppu2C02; uint32_t EmulationSettings::_emulationSpeed = 100; +uint32_t EmulationSettings::_turboSpeed = 300; + uint32_t EmulationSettings::_overclockRate = 100; uint32_t EmulationSettings::_extraScanlinesBeforeNmi = 0; uint32_t EmulationSettings::_extraScanlinesAfterNmi = 0; @@ -41,6 +43,8 @@ bool EmulationSettings::_nsfDisableApuIrqs = true; uint32_t EmulationSettings::_autoSaveDelay = 5; bool EmulationSettings::_autoSaveNotify = false; +EmulatorKeyMappingSet EmulationSettings::_emulatorKeys; + RamPowerOnState EmulationSettings::_ramPowerOnState = RamPowerOnState::AllZeros; InputDisplaySettings EmulationSettings::_inputDisplaySettings = { 0, InputDisplayPosition::TopLeft, false }; diff --git a/Core/EmulationSettings.h b/Core/EmulationSettings.h index a3a69aab..60576312 100644 --- a/Core/EmulationSettings.h +++ b/Core/EmulationSettings.h @@ -33,6 +33,7 @@ enum EmulationFlags SilenceTriangleHighFreq = 0x100000, + Turbo = 0x20000000, InBackground = 0x40000000, NsfPlayerEnabled = 0x80000000, }; @@ -202,6 +203,32 @@ struct KeyMappingSet uint32_t TurboSpeed; }; +struct EmulatorKeyMappings +{ + uint32_t FastForward; + uint32_t Pause; + uint32_t Reset; + + uint32_t MoveToNextStateSlot; + uint32_t MoveToPreviousStateSlot; + uint32_t SaveState; + uint32_t LoadState; + + uint32_t SwitchDiskSide; + uint32_t InsertNextDisk; + + uint32_t InsertCoin1; + uint32_t InsertCoin2; + + uint32_t TakeScreenshot; +}; + +struct EmulatorKeyMappingSet +{ + EmulatorKeyMappings KeySet1 = {}; + EmulatorKeyMappings KeySet2 = {}; +}; + enum class Language { SystemDefault = 0, @@ -276,6 +303,8 @@ private: static PpuModel _ppuModel; static uint32_t _emulationSpeed; + static uint32_t _turboSpeed; + static uint32_t _overclockRate; static bool _overclockAdjustApu; static bool _disableOverclocking; @@ -308,6 +337,8 @@ private: static uint32_t _autoSaveDelay; static bool _autoSaveNotify; + static EmulatorKeyMappingSet _emulatorKeys; + static RamPowerOnState _ramPowerOnState; public: @@ -449,9 +480,14 @@ public: _emulationSpeed = emulationSpeed; } - static uint32_t GetEmulationSpeed() + static void SetTurboSpeed(uint32_t turboSpeed) { - return _emulationSpeed; + _turboSpeed = turboSpeed; + } + + static uint32_t GetEmulationSpeed(bool ignoreTurbo = false) + { + return (CheckFlag(EmulationFlags::Turbo) && !ignoreTurbo) ? _turboSpeed : _emulationSpeed; } static void UpdateEffectiveOverclockRate() @@ -719,6 +755,16 @@ public: return _controllerKeys[port]; } + static void SetEmulatorKeys(EmulatorKeyMappingSet keyMappings) + { + _emulatorKeys = keyMappings; + } + + static EmulatorKeyMappingSet GetEmulatorKeys() + { + return _emulatorKeys; + } + static bool NeedControllerUpdate() { if(_needControllerUpdate) { diff --git a/Core/FDS.cpp b/Core/FDS.cpp index 2d45bb58..df8df2c9 100644 --- a/Core/FDS.cpp +++ b/Core/FDS.cpp @@ -85,8 +85,9 @@ void FDS::ProcessCpuClock() { if(EmulationSettings::CheckFlag(EmulationFlags::FdsFastForwardOnLoad)) { bool enableFastforward = (_scanningDisk || _gameStarted < 2); - if(EmulationSettings::GetEmulationSpeed() > 0 || !_fastForwarding) { - _previousSpeed = EmulationSettings::GetEmulationSpeed(); + uint32_t emulationSpeed = EmulationSettings::GetEmulationSpeed(true); + if(emulationSpeed > 0 || !_fastForwarding) { + _previousSpeed = emulationSpeed; } EmulationSettings::SetEmulationSpeed(enableFastforward ? 0 : _previousSpeed); _fastForwarding = enableFastforward; @@ -366,12 +367,19 @@ void FDS::InsertDisk(uint32_t diskNumber) } } +void FDS::InsertNextDisk() +{ + InsertDisk(((FDS::Instance->_diskNumber & 0xFE) + 2) % GetSideCount()); +} + void FDS::SwitchDiskSide() { if(FDS::Instance) { Console::Pause(); - FDS::Instance->_newDiskNumber = (FDS::Instance->_diskNumber & 0x01) ? (FDS::Instance->_diskNumber & 0xFE) : (FDS::Instance->_diskNumber | 0x01); - FDS::Instance->_newDiskInsertDelay = FDS::DiskInsertDelay; + if(FDS::Instance->_newDiskInsertDelay == 0 && FDS::Instance->_diskNumber != NoDiskInserted) { + FDS::Instance->_newDiskNumber = (FDS::Instance->_diskNumber & 0x01) ? (FDS::Instance->_diskNumber & 0xFE) : (FDS::Instance->_diskNumber | 0x01); + FDS::Instance->_newDiskInsertDelay = FDS::DiskInsertDelay; + } Console::Resume(); MessageManager::SendNotification(ConsoleNotificationType::FdsDiskChanged); diff --git a/Core/FDS.h b/Core/FDS.h index 4937a52c..d0c87e69 100644 --- a/Core/FDS.h +++ b/Core/FDS.h @@ -107,6 +107,7 @@ public: static uint32_t GetSideCount(); static void InsertDisk(uint32_t diskNumber); + static void InsertNextDisk(); static void SwitchDiskSide(); static void EjectDisk(); }; \ No newline at end of file diff --git a/Core/MessageManager.cpp b/Core/MessageManager.cpp index affb0e50..0cd5a555 100644 --- a/Core/MessageManager.cpp +++ b/Core/MessageManager.cpp @@ -53,6 +53,7 @@ std::unordered_map MessageManager::_enResources = { { "SaveStateLoaded", u8"State #%1 loaded." }, { "SaveStateNewerVersion", u8"Cannot load save states created by a more recent version of Mesen. Please download the latest version." }, { "SaveStateSaved", u8"State #%1 saved." }, + { "SaveStateSlotSelected", u8"Slot #%1 selected." }, { "ScanlineTimingWarning", u8"PPU timing has been changed." }, { "ServerStarted", u8"Server started (Port: %1)" }, { "ServerStopped", u8"Server stopped" }, @@ -116,6 +117,7 @@ std::unordered_map MessageManager::_frResources = { { "SaveStateLoaded", u8"Sauvegarde #%1 chargée." }, { "SaveStateNewerVersion", u8"Impossible de charger une sauvegarde qui a été créée avec une version plus récente de Mesen. Veuillez mettre à jour Mesen." }, { "SaveStateSaved", u8"Sauvegarde #%1 sauvegardée." }, + { "SaveStateSlotSelected", u8"Position de sauvegarde #%1 choisie." }, { "ScanlineTimingWarning", u8"Le timing du PPU a été modifié." }, { "ServerStarted", u8"Le serveur a été démarré (Port : %1)" }, { "ServerStopped", u8"Le serveur a été arrêté" }, @@ -179,6 +181,7 @@ std::unordered_map MessageManager::_jaResources = { { "SaveStateLoaded", u8"クイックセーブ%1をロードしました。" }, { "SaveStateNewerVersion", u8"クイックセーブデータは使用中のMesenより新しいバージョンで作られたため、ロードできません。 Mesenのサイトで最新のバージョンをダウンロードしてください。" }, { "SaveStateSaved", u8"クイックセーブ%1をセーブしました。" }, + { "SaveStateSlotSelected", u8"クイックセーブスロット%1。" }, { "ServerStarted", u8"サーバは起動しました (ポート: %1)" }, { "ServerStopped", u8"サーバは停止しました。" }, { "ScanlineTimingWarning", u8"PPUのタイミングは変更されました。" }, diff --git a/Core/SaveStateManager.cpp b/Core/SaveStateManager.cpp index db42ed67..ff7277f8 100644 --- a/Core/SaveStateManager.cpp +++ b/Core/SaveStateManager.cpp @@ -7,6 +7,7 @@ #include "EmulationSettings.h" const uint32_t SaveStateManager::FileFormatVersion; +atomic SaveStateManager::_lastIndex = 1; string SaveStateManager::GetStateFilepath(int stateIndex) { @@ -27,12 +28,36 @@ uint64_t SaveStateManager::GetStateInfo(int stateIndex) return 0; } +void SaveStateManager::MoveToNextSlot() +{ + _lastIndex = (_lastIndex % MaxIndex) + 1; + MessageManager::DisplayMessage("SaveStates", "SaveStateSlotSelected", std::to_string(_lastIndex)); +} + +void SaveStateManager::MoveToPreviousSlot() +{ + _lastIndex = (_lastIndex == 1 ? SaveStateManager::MaxIndex : (_lastIndex - 1)); + MessageManager::DisplayMessage("SaveStates", "SaveStateSlotSelected", std::to_string(_lastIndex)); +} + +void SaveStateManager::SaveState() +{ + SaveState(_lastIndex); +} + +bool SaveStateManager::LoadState() +{ + return LoadState(_lastIndex); +} + void SaveStateManager::SaveState(int stateIndex, bool displayMessage) { string filepath = SaveStateManager::GetStateFilepath(stateIndex); ofstream file(filepath, ios::out | ios::binary); if(file) { + _lastIndex = stateIndex; + Console::Pause(); uint32_t emuVersion = EmulationSettings::GetMesenVersion(); @@ -74,6 +99,8 @@ bool SaveStateManager::LoadState(int stateIndex) return false; } + _lastIndex = stateIndex; + Console::Pause(); Console::LoadState(file); Console::Resume(); diff --git a/Core/SaveStateManager.h b/Core/SaveStateManager.h index 45af013a..bd244905 100644 --- a/Core/SaveStateManager.h +++ b/Core/SaveStateManager.h @@ -5,12 +5,22 @@ class SaveStateManager { private: - static string GetStateFilepath(int stateIndex); + static const uint32_t MaxIndex = 5; + static atomic _lastIndex; + + static string GetStateFilepath(int stateIndex); public: static const uint32_t FileFormatVersion = 5; static uint64_t GetStateInfo(int stateIndex); + + static void SaveState(); + static bool LoadState(); + static void SaveState(int stateIndex, bool displayMessage = true); static bool LoadState(int stateIndex); + + static void MoveToNextSlot(); + static void MoveToPreviousSlot(); }; \ No newline at end of file diff --git a/Core/ShortcutKeyHandler.cpp b/Core/ShortcutKeyHandler.cpp new file mode 100644 index 00000000..3e380c06 --- /dev/null +++ b/Core/ShortcutKeyHandler.cpp @@ -0,0 +1,114 @@ +#include "stdafx.h" +#include "ShortcutKeyHandler.h" +#include "EmulationSettings.h" +#include "ControlManager.h" +#include "VideoDecoder.h" +#include "VsControlManager.h" +#include "FDS.h" +#include "SaveStateManager.h" + +ShortcutKeyHandler::ShortcutKeyHandler() +{ + _stopThread = false; + _thread = std::thread([=]() { + while(!_stopThread) { + ProcessKeys(EmulationSettings::GetEmulatorKeys()); + std::this_thread::sleep_for(std::chrono::duration(50)); + } + }); +} + +ShortcutKeyHandler::~ShortcutKeyHandler() +{ + _stopThread = true; + _thread.join(); +} + +bool ShortcutKeyHandler::DetectKeyPress(uint32_t keyCode) +{ + if(ControlManager::IsKeyPressed(keyCode)) { + _keysDown.emplace(keyCode); + + if(_prevKeysDown.find(keyCode) == _prevKeysDown.end()) { + return true; + } + } + return false; +} + +void ShortcutKeyHandler::CheckMappedKeys(EmulatorKeyMappings mappings) +{ + if(ControlManager::IsKeyPressed(mappings.FastForward)) { + _turboEnabled = true; + } + + if(DetectKeyPress(mappings.TakeScreenshot)) { + VideoDecoder::GetInstance()->TakeScreenshot(); + } + + if(DetectKeyPress(mappings.InsertCoin1)) { + if(VsControlManager::GetInstance()) { + VsControlManager::GetInstance()->InsertCoin(0); + } + } + + if(DetectKeyPress(mappings.InsertCoin2)) { + if(VsControlManager::GetInstance()) { + VsControlManager::GetInstance()->InsertCoin(1); + } + } + + if(DetectKeyPress(mappings.SwitchDiskSide)) { + FDS::SwitchDiskSide(); + } + + if(DetectKeyPress(mappings.InsertNextDisk)) { + FDS::InsertNextDisk(); + } + + if(DetectKeyPress(mappings.MoveToNextStateSlot)) { + SaveStateManager::MoveToNextSlot(); + } + + if(DetectKeyPress(mappings.MoveToPreviousStateSlot)) { + SaveStateManager::MoveToPreviousSlot(); + } + + if(DetectKeyPress(mappings.SaveState)) { + SaveStateManager::SaveState(); + } + + if(DetectKeyPress(mappings.LoadState)) { + SaveStateManager::LoadState(); + } + + if(DetectKeyPress(mappings.Reset)) { + Console::Reset(true); + } + + if(DetectKeyPress(mappings.Pause)) { + if(EmulationSettings::CheckFlag(EmulationFlags::Paused)) { + EmulationSettings::ClearFlags(EmulationFlags::Paused); + } else { + EmulationSettings::SetFlags(EmulationFlags::Paused); + } + } +} + +void ShortcutKeyHandler::ProcessKeys(EmulatorKeyMappingSet mappings) +{ + ControlManager::RefreshKeyState(); + + _keysDown.clear(); + + _turboEnabled = false; + CheckMappedKeys(mappings.KeySet1); + CheckMappedKeys(mappings.KeySet2); + if(_turboEnabled) { + EmulationSettings::SetFlags(EmulationFlags::Turbo); + } else { + EmulationSettings::ClearFlags(EmulationFlags::Turbo); + } + + _prevKeysDown = _keysDown; +} \ No newline at end of file diff --git a/Core/ShortcutKeyHandler.h b/Core/ShortcutKeyHandler.h new file mode 100644 index 00000000..be6bb743 --- /dev/null +++ b/Core/ShortcutKeyHandler.h @@ -0,0 +1,24 @@ +#pragma once +#include "stdafx.h" +#include +#include +#include "EmulationSettings.h" + +class ShortcutKeyHandler +{ +private: + std::thread _thread; + atomic _stopThread; + + std::unordered_set _keysDown; + std::unordered_set _prevKeysDown; + bool _turboEnabled; + + void CheckMappedKeys(EmulatorKeyMappings mappings); + void ProcessKeys(EmulatorKeyMappingSet mappings); + bool DetectKeyPress(uint32_t keyCode); + +public: + ShortcutKeyHandler(); + ~ShortcutKeyHandler(); +}; \ No newline at end of file diff --git a/GUI.NET/Config/Configuration.cs b/GUI.NET/Config/Configuration.cs index 9bae3944..cc533423 100644 --- a/GUI.NET/Config/Configuration.cs +++ b/GUI.NET/Config/Configuration.cs @@ -58,6 +58,7 @@ namespace Mesen.GUI.Config public void InitializeDefaults() { InputInfo.InitializeDefaults(); + PreferenceInfo.InitializeDefaults(); } public void AddRecentFile(string filepath, string romName, int archiveFileIndex) diff --git a/GUI.NET/Config/EmulationInfo.cs b/GUI.NET/Config/EmulationInfo.cs index 2b943cf3..b5a3ee26 100644 --- a/GUI.NET/Config/EmulationInfo.cs +++ b/GUI.NET/Config/EmulationInfo.cs @@ -30,6 +30,7 @@ namespace Mesen.GUI.Config public bool ShowLagCounter = false; public UInt32 EmulationSpeed = 100; + public UInt32 TurboSpeed = 300; public EmulationInfo() { @@ -40,6 +41,7 @@ namespace Mesen.GUI.Config EmulationInfo emulationInfo = ConfigManager.Config.EmulationInfo; InteropEmu.SetEmulationSpeed(emulationInfo.EmulationSpeed); + InteropEmu.SetTurboSpeed(emulationInfo.TurboSpeed); InteropEmu.SetFlag(EmulationFlags.Mmc3IrqAltBehavior, emulationInfo.UseAlternativeMmc3Irq); InteropEmu.SetFlag(EmulationFlags.AllowInvalidInput, emulationInfo.AllowInvalidInput); diff --git a/GUI.NET/Config/PreferenceInfo.cs b/GUI.NET/Config/PreferenceInfo.cs index 7a950731..11bf5a97 100644 --- a/GUI.NET/Config/PreferenceInfo.cs +++ b/GUI.NET/Config/PreferenceInfo.cs @@ -52,12 +52,30 @@ namespace Mesen.GUI.Config public bool CloudSaveIntegration = false; public DateTime CloudLastSync = DateTime.MinValue; + public EmulatorKeyMappings? EmulatorKeySet1; + public EmulatorKeyMappings? EmulatorKeySet2; + public bool DisableGameDatabase = false; public PreferenceInfo() { } + public void InitializeDefaults() + { + if(EmulatorKeySet1 == null) { + EmulatorKeySet1 = new EmulatorKeyMappings() { + FastForward = InteropEmu.GetKeyCode("Tab") + }; + } + + if(EmulatorKeySet2 == null) { + EmulatorKeySet2 = new EmulatorKeyMappings() { + FastForward = InteropEmu.GetKeyCode("Pad1 R2") + }; + } + } + static private void UpdateFileAssociation(string extension, bool associate) { string key = @"HKEY_CURRENT_USER\Software\Classes\." + extension; @@ -97,6 +115,7 @@ namespace Mesen.GUI.Config InteropEmu.NsfSetNsfConfig(preferenceInfo.NsfAutoDetectSilence ? preferenceInfo.NsfAutoDetectSilenceDelay : 0, preferenceInfo.NsfMoveToNextTrackAfterTime ? preferenceInfo.NsfMoveToNextTrackTime : -1, preferenceInfo.NsfDisableApuIrqs); InteropEmu.SetAutoSaveOptions(preferenceInfo.AutoSave ? (uint)preferenceInfo.AutoSaveDelay : 0, preferenceInfo.AutoSaveNotify); + InteropEmu.SetEmulatorKeys(new EmulatorKeyMappingSet() { KeySet1 = preferenceInfo.EmulatorKeySet1.Value, KeySet2 = preferenceInfo.EmulatorKeySet2.Value }); } } } diff --git a/GUI.NET/Dependencies/resources.en.xml b/GUI.NET/Dependencies/resources.en.xml index e87b546e..733b88b1 100644 --- a/GUI.NET/Dependencies/resources.en.xml +++ b/GUI.NET/Dependencies/resources.en.xml @@ -52,6 +52,19 @@ The selected file ({0}) is not a valid cheat file. The selected file ({0}) is not a valid XML file. The selected cheat file ({0}) contains no cheats that match the selected game. + + Fast Forward + Pause + Reset + Take Screenshot + FDS - Switch Side + FDS - Insert Next Disk + VS - Insert Coin 1 + VS - Insert Coin 2 + Select Next Save Slot + Select Previous Save Slot + Save State + Load State diff --git a/GUI.NET/Dependencies/resources.fr.xml b/GUI.NET/Dependencies/resources.fr.xml index acbec76c..931f9223 100644 --- a/GUI.NET/Dependencies/resources.fr.xml +++ b/GUI.NET/Dependencies/resources.fr.xml @@ -247,6 +247,8 @@ Général % (0 = Vitesse maximale) Vitesse d'émulation : + % (0 = Vitesse maximale) + Vitesse d'avance rapide: Avancé Utiliser la version alternative du comportement des IRQs du MMC3 @@ -295,6 +297,11 @@ Insérer le côté A du disque 1 lors du chargement d'un jeu de FDS Augmenter la vitesse d'émulation pendant le chargement des jeux FDS + Raccourcis + Action + Raccourci #1 + Raccourci #2 + Sauvegardes Sauvegarde d'état automatique Créer une sauvegarde d'état à chaque @@ -497,6 +504,19 @@ Le fichier sélectionné ({0}) n'est pas un fichier de codes valide. Le fichier sélectionné ({0}) n'est pas un fichier XML valide. Le fichier sélectionné ({0}) ne contient aucun code correspondant au jeu sélectionné. + + Avance rapide + Pause + Reset + Capture d'écran + FDS - Changer le disque de côté + FDS - Insérer le disque suivant + VS - Insérer une pièce (1) + VS - Insérer une pièce (2) + Position de sauvegarde suivante + Position de sauvegarde précédente + Sauvegarder l'état à la position courante + Charger l'état de la position courante diff --git a/GUI.NET/Dependencies/resources.ja.xml b/GUI.NET/Dependencies/resources.ja.xml index 14982a8d..49290af7 100644 --- a/GUI.NET/Dependencies/resources.ja.xml +++ b/GUI.NET/Dependencies/resources.ja.xml @@ -247,6 +247,8 @@ 全般 % (0 = 最高速度) エミュレーションの速度: + % (0 = 最高速度) + 早送りの速度: 詳細設定 MMC3AのIRQ仕様を使う @@ -294,6 +296,11 @@ ファミコンディスクシステムのゲームをロードする時に自動的にディスク1のA面を入れる ファミコンディスクシステムのゲームをディスクからロードする時に自動的に最高速度にする + ショートカットキー + 機能 + ショートカットキー1 + ショートカットキー2 + セーブデータ オートクイックセーブ オートクイックセーブを @@ -479,6 +486,19 @@ このファイル({0})にはチートコードを見つかりませんでした。 このファイル({0})はXMLファイルではないため読めませんでした. このファイル({0})に選択されたゲームに該当するチートコードを見つかりませんでした。 + + 早送り + ポーズ + リセット + スクリーンショットを撮る + FDS - A面B面切り替え + FDS - 次のディスクを入れる + VS - インサートコイン 1 + VS - インサートコイン 2 + 次のクイックセーブスロットを選ぶ + 前のクイックセーブスロットを選ぶ + 選択中スロットにクイックセーブ + 選択中スロットからクイックロード diff --git a/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.Designer.cs b/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.Designer.cs new file mode 100644 index 00000000..7fd73098 --- /dev/null +++ b/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.Designer.cs @@ -0,0 +1,100 @@ +namespace Mesen.GUI.Forms.Config +{ + partial class ctrlEmulatorShortcuts + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.gridShortcuts = new System.Windows.Forms.DataGridView(); + this.colAction = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colBinding1 = new System.Windows.Forms.DataGridViewButtonColumn(); + this.colBinding2 = new System.Windows.Forms.DataGridViewButtonColumn(); + ((System.ComponentModel.ISupportInitialize)(this.gridShortcuts)).BeginInit(); + this.SuspendLayout(); + // + // gridShortcuts + // + this.gridShortcuts.AllowUserToAddRows = false; + this.gridShortcuts.AllowUserToDeleteRows = false; + this.gridShortcuts.AllowUserToResizeColumns = false; + this.gridShortcuts.AllowUserToResizeRows = false; + this.gridShortcuts.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; + this.gridShortcuts.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.gridShortcuts.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.colAction, + this.colBinding1, + this.colBinding2}); + this.gridShortcuts.Dock = System.Windows.Forms.DockStyle.Fill; + this.gridShortcuts.Location = new System.Drawing.Point(0, 0); + this.gridShortcuts.MultiSelect = false; + this.gridShortcuts.Name = "gridShortcuts"; + this.gridShortcuts.RowHeadersVisible = false; + this.gridShortcuts.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.gridShortcuts.Size = new System.Drawing.Size(448, 248); + this.gridShortcuts.TabIndex = 2; + this.gridShortcuts.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.gridShortcuts_CellContentClick); + // + // colAction + // + this.colAction.HeaderText = "Action"; + this.colAction.Name = "colAction"; + this.colAction.ReadOnly = true; + this.colAction.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.colAction.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.colAction.Width = 250; + // + // colBinding1 + // + this.colBinding1.HeaderText = "Binding #1"; + this.colBinding1.Name = "colBinding1"; + this.colBinding1.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.colBinding1.Width = 110; + // + // colBinding2 + // + this.colBinding2.HeaderText = "Binding #2"; + this.colBinding2.Name = "colBinding2"; + this.colBinding2.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.colBinding2.Width = 110; + // + // ctrlEmulatorShortcuts + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.gridShortcuts); + this.Name = "ctrlEmulatorShortcuts"; + this.Size = new System.Drawing.Size(448, 248); + ((System.ComponentModel.ISupportInitialize)(this.gridShortcuts)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.DataGridView gridShortcuts; + private System.Windows.Forms.DataGridViewTextBoxColumn colAction; + private System.Windows.Forms.DataGridViewButtonColumn colBinding1; + private System.Windows.Forms.DataGridViewButtonColumn colBinding2; + } +} diff --git a/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.cs b/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.cs new file mode 100644 index 00000000..db3984c8 --- /dev/null +++ b/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.cs @@ -0,0 +1,67 @@ +using System; +using System.ComponentModel; +using System.Windows.Forms; +using Mesen.GUI.Config; +using System.Reflection; + +namespace Mesen.GUI.Forms.Config +{ + public partial class ctrlEmulatorShortcuts : UserControl + { + public ctrlEmulatorShortcuts() + { + InitializeComponent(); + + if(LicenseManager.UsageMode != LicenseUsageMode.Designtime) { + InitializeGrid(); + } + } + + 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); + + 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; + + keyCode = (UInt32)fieldInfo.GetValue(ConfigManager.Config.PreferenceInfo.EmulatorKeySet2); + gridShortcuts.Rows[index].Cells[2].Value = InteropEmu.GetKeyName(keyCode); + gridShortcuts.Rows[index].Cells[2].Tag = keyCode; + } + } + + public void UpdateConfig() + { + //Need to box the structs into objects for SetValue to work properly + object keySet1 = new EmulatorKeyMappings(); + object keySet2 = new EmulatorKeyMappings(); + + 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); + } + + ConfigManager.Config.PreferenceInfo.EmulatorKeySet1 = (EmulatorKeyMappings)keySet1; + ConfigManager.Config.PreferenceInfo.EmulatorKeySet2 = (EmulatorKeyMappings)keySet2; + } + + private void gridShortcuts_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + 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(); + frm.ShowDialog(); + button.Value = frm.BindedKeyName; + button.Tag = frm.BindedKeyCode; + } + } + } + } +} diff --git a/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.resx b/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.resx new file mode 100644 index 00000000..0acf3c02 --- /dev/null +++ b/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + \ No newline at end of file diff --git a/GUI.NET/Forms/Config/frmEmulationConfig.Designer.cs b/GUI.NET/Forms/Config/frmEmulationConfig.Designer.cs index 0a240dac..d8cb04f1 100644 --- a/GUI.NET/Forms/Config/frmEmulationConfig.Designer.cs +++ b/GUI.NET/Forms/Config/frmEmulationConfig.Designer.cs @@ -31,6 +31,9 @@ this.tabMain = new System.Windows.Forms.TabControl(); this.tpgGeneral = new System.Windows.Forms.TabPage(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel9 = new System.Windows.Forms.FlowLayoutPanel(); + this.nudTurboSpeed = new System.Windows.Forms.NumericUpDown(); + this.lblTurboSpeed = new System.Windows.Forms.Label(); this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel(); this.nudEmulationSpeed = new System.Windows.Forms.NumericUpDown(); this.lblEmuSpeedHint = new System.Windows.Forms.Label(); @@ -72,9 +75,12 @@ this.chkShowLagCounter = new System.Windows.Forms.CheckBox(); this.btnResetLagCounter = new System.Windows.Forms.Button(); this.tmrUpdateClockRate = new System.Windows.Forms.Timer(this.components); + this.lblTurboSpeedHint = new System.Windows.Forms.Label(); this.tabMain.SuspendLayout(); this.tpgGeneral.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout(); + this.flowLayoutPanel9.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudTurboSpeed)).BeginInit(); this.flowLayoutPanel6.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudEmulationSpeed)).BeginInit(); this.tpgAdvanced.SuspendLayout(); @@ -129,27 +135,64 @@ this.tableLayoutPanel4.ColumnCount = 2; this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Controls.Add(this.flowLayoutPanel9, 1, 1); + this.tableLayoutPanel4.Controls.Add(this.lblTurboSpeed, 0, 1); this.tableLayoutPanel4.Controls.Add(this.flowLayoutPanel6, 1, 0); this.tableLayoutPanel4.Controls.Add(this.lblEmulationSpeed, 0, 0); this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 3); this.tableLayoutPanel4.Name = "tableLayoutPanel4"; - this.tableLayoutPanel4.RowCount = 2; + this.tableLayoutPanel4.RowCount = 3; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel4.Size = new System.Drawing.Size(473, 267); this.tableLayoutPanel4.TabIndex = 0; // + // flowLayoutPanel9 + // + this.flowLayoutPanel9.AutoSize = true; + this.flowLayoutPanel9.Controls.Add(this.nudTurboSpeed); + this.flowLayoutPanel9.Controls.Add(this.lblTurboSpeedHint); + this.flowLayoutPanel9.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel9.Location = new System.Drawing.Point(111, 26); + this.flowLayoutPanel9.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel9.Name = "flowLayoutPanel9"; + this.flowLayoutPanel9.Size = new System.Drawing.Size(362, 26); + this.flowLayoutPanel9.TabIndex = 14; + // + // nudTurboSpeed + // + this.nudTurboSpeed.Location = new System.Drawing.Point(3, 3); + this.nudTurboSpeed.Maximum = new decimal(new int[] { + 500, + 0, + 0, + 0}); + this.nudTurboSpeed.Name = "nudTurboSpeed"; + this.nudTurboSpeed.Size = new System.Drawing.Size(48, 20); + this.nudTurboSpeed.TabIndex = 1; + // + // lblTurboSpeed + // + this.lblTurboSpeed.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblTurboSpeed.AutoSize = true; + this.lblTurboSpeed.Location = new System.Drawing.Point(3, 32); + this.lblTurboSpeed.Name = "lblTurboSpeed"; + this.lblTurboSpeed.Size = new System.Drawing.Size(105, 13); + this.lblTurboSpeed.TabIndex = 13; + this.lblTurboSpeed.Text = "Fast Forward Speed:"; + // // flowLayoutPanel6 // this.flowLayoutPanel6.AutoSize = true; this.flowLayoutPanel6.Controls.Add(this.nudEmulationSpeed); this.flowLayoutPanel6.Controls.Add(this.lblEmuSpeedHint); this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel6.Location = new System.Drawing.Point(96, 0); + this.flowLayoutPanel6.Location = new System.Drawing.Point(111, 0); this.flowLayoutPanel6.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel6.Name = "flowLayoutPanel6"; - this.flowLayoutPanel6.Size = new System.Drawing.Size(377, 26); + this.flowLayoutPanel6.Size = new System.Drawing.Size(362, 26); this.flowLayoutPanel6.TabIndex = 11; // // nudEmulationSpeed @@ -636,6 +679,16 @@ this.tmrUpdateClockRate.Enabled = true; this.tmrUpdateClockRate.Tick += new System.EventHandler(this.tmrUpdateClockRate_Tick); // + // lblTurboSpeedHint + // + this.lblTurboSpeedHint.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblTurboSpeedHint.AutoSize = true; + this.lblTurboSpeedHint.Location = new System.Drawing.Point(57, 6); + this.lblTurboSpeedHint.Name = "lblTurboSpeedHint"; + this.lblTurboSpeedHint.Size = new System.Drawing.Size(121, 13); + this.lblTurboSpeedHint.TabIndex = 2; + this.lblTurboSpeedHint.Text = "% (0 = Maximum speed)"; + // // frmEmulationConfig // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -655,6 +708,9 @@ this.tpgGeneral.ResumeLayout(false); this.tableLayoutPanel4.ResumeLayout(false); this.tableLayoutPanel4.PerformLayout(); + this.flowLayoutPanel9.ResumeLayout(false); + this.flowLayoutPanel9.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudTurboSpeed)).EndInit(); this.flowLayoutPanel6.ResumeLayout(false); this.flowLayoutPanel6.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudEmulationSpeed)).EndInit(); @@ -733,5 +789,9 @@ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel8; private System.Windows.Forms.Label lblRamPowerOnState; private System.Windows.Forms.ComboBox cboRamPowerOnState; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel9; + private System.Windows.Forms.NumericUpDown nudTurboSpeed; + private System.Windows.Forms.Label lblTurboSpeed; + private System.Windows.Forms.Label lblTurboSpeedHint; } } \ No newline at end of file diff --git a/GUI.NET/Forms/Config/frmEmulationConfig.cs b/GUI.NET/Forms/Config/frmEmulationConfig.cs index c4c1416f..de08a79b 100644 --- a/GUI.NET/Forms/Config/frmEmulationConfig.cs +++ b/GUI.NET/Forms/Config/frmEmulationConfig.cs @@ -21,6 +21,7 @@ namespace Mesen.GUI.Forms.Config Entity = ConfigManager.Config.EmulationInfo; AddBinding("EmulationSpeed", nudEmulationSpeed); + AddBinding("TurboSpeed", nudTurboSpeed); AddBinding("UseAlternativeMmc3Irq", chkUseAlternativeMmc3Irq); AddBinding("AllowInvalidInput", chkAllowInvalidInput); diff --git a/GUI.NET/Forms/Config/frmGetKey.cs b/GUI.NET/Forms/Config/frmGetKey.cs index 7579cd65..77e3238c 100644 --- a/GUI.NET/Forms/Config/frmGetKey.cs +++ b/GUI.NET/Forms/Config/frmGetKey.cs @@ -15,6 +15,8 @@ namespace Mesen.GUI.Forms.Config const int WM_KEYDOWN = 0x100; const int WM_KEYUP = 0x101; + private string[] _invalidKeys = new string[] { "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12" }; + public frmGetKey() { InitializeComponent(); @@ -53,7 +55,7 @@ namespace Mesen.GUI.Forms.Config { UInt32 scanCode = InteropEmu.GetPressedKey(); string pressedKey = InteropEmu.GetKeyName(scanCode); - if(!string.IsNullOrWhiteSpace(pressedKey)) { + if(!string.IsNullOrWhiteSpace(pressedKey) && !_invalidKeys.Contains(pressedKey)) { BindedKeyName = pressedKey; BindedKeyCode = scanCode; this.Close(); diff --git a/GUI.NET/Forms/Config/frmPreferences.Designer.cs b/GUI.NET/Forms/Config/frmPreferences.Designer.cs index a871d377..eb1325be 100644 --- a/GUI.NET/Forms/Config/frmPreferences.Designer.cs +++ b/GUI.NET/Forms/Config/frmPreferences.Designer.cs @@ -44,6 +44,8 @@ this.tabMain = new System.Windows.Forms.TabControl(); this.tpgGeneral = new System.Windows.Forms.TabPage(); this.tpgSaveData = new System.Windows.Forms.TabPage(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.grpCloudSaves = new System.Windows.Forms.GroupBox(); this.tlpCloudSaves = new System.Windows.Forms.TableLayoutPanel(); this.tlpCloudSaveDesc = new System.Windows.Forms.TableLayoutPanel(); this.lblGoogleDriveIntegration = new System.Windows.Forms.Label(); @@ -57,6 +59,13 @@ this.lblLastSync = new System.Windows.Forms.Label(); this.lblLastSyncDateTime = new System.Windows.Forms.Label(); this.btnResync = new System.Windows.Forms.Button(); + this.grpAutomaticSaves = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.chkAutoSaveNotify = new System.Windows.Forms.CheckBox(); + this.flpAutoSave = new System.Windows.Forms.FlowLayoutPanel(); + this.chkAutoSave = new System.Windows.Forms.CheckBox(); + this.nudAutoSave = new System.Windows.Forms.NumericUpDown(); + this.lblAutoSave = new System.Windows.Forms.Label(); this.tpgNsf = new System.Windows.Forms.TabPage(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.flowLayoutPanel7 = new System.Windows.Forms.FlowLayoutPanel(); @@ -84,26 +93,25 @@ this.chkFdsAutoLoadDisk = new System.Windows.Forms.CheckBox(); this.chkFdsFastForwardOnLoad = new System.Windows.Forms.CheckBox(); this.tmrSyncDateTime = new System.Windows.Forms.Timer(this.components); - this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); - this.grpCloudSaves = new System.Windows.Forms.GroupBox(); - this.grpAutomaticSaves = new System.Windows.Forms.GroupBox(); - this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); - this.flpAutoSave = new System.Windows.Forms.FlowLayoutPanel(); - this.chkAutoSave = new System.Windows.Forms.CheckBox(); - this.nudAutoSave = new System.Windows.Forms.NumericUpDown(); - this.lblAutoSave = new System.Windows.Forms.Label(); - this.chkAutoSaveNotify = new System.Windows.Forms.CheckBox(); + this.tpgShortcuts = new System.Windows.Forms.TabPage(); + this.ctrlEmulatorShortcuts = new Mesen.GUI.Forms.Config.ctrlEmulatorShortcuts(); this.tlpMain.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout(); this.tabMain.SuspendLayout(); this.tpgGeneral.SuspendLayout(); this.tpgSaveData.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + this.grpCloudSaves.SuspendLayout(); this.tlpCloudSaves.SuspendLayout(); this.tlpCloudSaveDesc.SuspendLayout(); this.tlpCloudSaveEnabled.SuspendLayout(); this.flowLayoutPanel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picOK)).BeginInit(); this.flowLayoutPanel4.SuspendLayout(); + this.grpAutomaticSaves.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); + this.flpAutoSave.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudAutoSave)).BeginInit(); this.tpgNsf.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.flowLayoutPanel7.SuspendLayout(); @@ -115,12 +123,7 @@ this.tlpFileFormat.SuspendLayout(); this.tpgAdvanced.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); - this.tableLayoutPanel3.SuspendLayout(); - this.grpCloudSaves.SuspendLayout(); - this.grpAutomaticSaves.SuspendLayout(); - this.tableLayoutPanel4.SuspendLayout(); - this.flpAutoSave.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nudAutoSave)).BeginInit(); + this.tpgShortcuts.SuspendLayout(); this.SuspendLayout(); // // baseConfigPanel @@ -155,7 +158,7 @@ this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tlpMain.Size = new System.Drawing.Size(473, 223); + this.tlpMain.Size = new System.Drawing.Size(473, 337); this.tlpMain.TabIndex = 1; // // chkSingleInstance @@ -232,7 +235,7 @@ // btnOpenMesenFolder // this.btnOpenMesenFolder.AutoSize = true; - this.btnOpenMesenFolder.Location = new System.Drawing.Point(3, 197); + this.btnOpenMesenFolder.Location = new System.Drawing.Point(3, 311); this.btnOpenMesenFolder.Name = "btnOpenMesenFolder"; this.btnOpenMesenFolder.Size = new System.Drawing.Size(117, 23); this.btnOpenMesenFolder.TabIndex = 16; @@ -272,6 +275,7 @@ // tabMain // this.tabMain.Controls.Add(this.tpgGeneral); + this.tabMain.Controls.Add(this.tpgShortcuts); this.tabMain.Controls.Add(this.tpgSaveData); this.tabMain.Controls.Add(this.tpgNsf); this.tabMain.Controls.Add(this.tpgFileAssociations); @@ -289,7 +293,7 @@ this.tpgGeneral.Location = new System.Drawing.Point(4, 22); this.tpgGeneral.Name = "tpgGeneral"; this.tpgGeneral.Padding = new System.Windows.Forms.Padding(3); - this.tpgGeneral.Size = new System.Drawing.Size(479, 229); + this.tpgGeneral.Size = new System.Drawing.Size(479, 343); this.tpgGeneral.TabIndex = 0; this.tpgGeneral.Text = "General"; this.tpgGeneral.UseVisualStyleBackColor = true; @@ -305,6 +309,32 @@ this.tpgSaveData.Text = "Save Data"; this.tpgSaveData.UseVisualStyleBackColor = true; // + // tableLayoutPanel3 + // + this.tableLayoutPanel3.ColumnCount = 1; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Controls.Add(this.grpCloudSaves, 0, 1); + this.tableLayoutPanel3.Controls.Add(this.grpAutomaticSaves, 0, 0); + this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.RowCount = 2; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Size = new System.Drawing.Size(473, 337); + this.tableLayoutPanel3.TabIndex = 1; + // + // grpCloudSaves + // + this.grpCloudSaves.Controls.Add(this.tlpCloudSaves); + this.grpCloudSaves.Dock = System.Windows.Forms.DockStyle.Fill; + this.grpCloudSaves.Location = new System.Drawing.Point(3, 76); + this.grpCloudSaves.Name = "grpCloudSaves"; + this.grpCloudSaves.Size = new System.Drawing.Size(467, 258); + this.grpCloudSaves.TabIndex = 2; + this.grpCloudSaves.TabStop = false; + this.grpCloudSaves.Text = "Cloud Saves"; + // // tlpCloudSaves // this.tlpCloudSaves.ColumnCount = 1; @@ -462,13 +492,108 @@ this.btnResync.UseVisualStyleBackColor = true; this.btnResync.Click += new System.EventHandler(this.btnResync_Click); // + // grpAutomaticSaves + // + this.grpAutomaticSaves.Controls.Add(this.tableLayoutPanel4); + this.grpAutomaticSaves.Dock = System.Windows.Forms.DockStyle.Fill; + this.grpAutomaticSaves.Location = new System.Drawing.Point(3, 3); + this.grpAutomaticSaves.Name = "grpAutomaticSaves"; + this.grpAutomaticSaves.Size = new System.Drawing.Size(467, 67); + this.grpAutomaticSaves.TabIndex = 3; + this.grpAutomaticSaves.TabStop = false; + this.grpAutomaticSaves.Text = "Automatic Save States"; + // + // tableLayoutPanel4 + // + this.tableLayoutPanel4.ColumnCount = 1; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Controls.Add(this.chkAutoSaveNotify, 0, 2); + this.tableLayoutPanel4.Controls.Add(this.flpAutoSave, 0, 0); + this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 16); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + this.tableLayoutPanel4.RowCount = 3; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Size = new System.Drawing.Size(461, 48); + this.tableLayoutPanel4.TabIndex = 0; + // + // chkAutoSaveNotify + // + this.chkAutoSaveNotify.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.chkAutoSaveNotify.AutoSize = true; + this.chkAutoSaveNotify.Location = new System.Drawing.Point(15, 27); + this.chkAutoSaveNotify.Margin = new System.Windows.Forms.Padding(15, 3, 3, 3); + this.chkAutoSaveNotify.Name = "chkAutoSaveNotify"; + this.chkAutoSaveNotify.Size = new System.Drawing.Size(240, 17); + this.chkAutoSaveNotify.TabIndex = 1; + this.chkAutoSaveNotify.Text = "Notify when an automatic save state is saved"; + this.chkAutoSaveNotify.UseVisualStyleBackColor = true; + // + // flpAutoSave + // + this.flpAutoSave.Controls.Add(this.chkAutoSave); + this.flpAutoSave.Controls.Add(this.nudAutoSave); + this.flpAutoSave.Controls.Add(this.lblAutoSave); + this.flpAutoSave.Dock = System.Windows.Forms.DockStyle.Fill; + this.flpAutoSave.Location = new System.Drawing.Point(0, 0); + this.flpAutoSave.Margin = new System.Windows.Forms.Padding(0); + this.flpAutoSave.Name = "flpAutoSave"; + this.flpAutoSave.Size = new System.Drawing.Size(461, 23); + this.flpAutoSave.TabIndex = 0; + // + // chkAutoSave + // + this.chkAutoSave.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.chkAutoSave.AutoSize = true; + this.chkAutoSave.Location = new System.Drawing.Point(3, 4); + this.chkAutoSave.Name = "chkAutoSave"; + this.chkAutoSave.Size = new System.Drawing.Size(211, 17); + this.chkAutoSave.TabIndex = 0; + this.chkAutoSave.Text = "Automatically create a save state every"; + this.chkAutoSave.UseVisualStyleBackColor = true; + this.chkAutoSave.CheckedChanged += new System.EventHandler(this.chkAutoSave_CheckedChanged); + // + // nudAutoSave + // + this.nudAutoSave.Location = new System.Drawing.Point(220, 3); + this.nudAutoSave.Maximum = new decimal(new int[] { + 600, + 0, + 0, + 0}); + this.nudAutoSave.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nudAutoSave.Name = "nudAutoSave"; + this.nudAutoSave.Size = new System.Drawing.Size(42, 20); + this.nudAutoSave.TabIndex = 1; + this.nudAutoSave.Value = new decimal(new int[] { + 5, + 0, + 0, + 0}); + // + // lblAutoSave + // + this.lblAutoSave.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblAutoSave.AutoSize = true; + this.lblAutoSave.Location = new System.Drawing.Point(268, 6); + this.lblAutoSave.Name = "lblAutoSave"; + this.lblAutoSave.Size = new System.Drawing.Size(99, 13); + this.lblAutoSave.TabIndex = 2; + this.lblAutoSave.Text = "minutes (F6 to load)"; + // // tpgNsf // this.tpgNsf.Controls.Add(this.tableLayoutPanel2); this.tpgNsf.Location = new System.Drawing.Point(4, 22); this.tpgNsf.Name = "tpgNsf"; this.tpgNsf.Padding = new System.Windows.Forms.Padding(3); - this.tpgNsf.Size = new System.Drawing.Size(479, 259); + this.tpgNsf.Size = new System.Drawing.Size(479, 343); this.tpgNsf.TabIndex = 4; this.tpgNsf.Text = "NSF / NSFe"; this.tpgNsf.UseVisualStyleBackColor = true; @@ -487,7 +612,7 @@ this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(473, 253); + this.tableLayoutPanel2.Size = new System.Drawing.Size(473, 337); this.tableLayoutPanel2.TabIndex = 0; // // flowLayoutPanel7 @@ -611,7 +736,7 @@ this.tpgFileAssociations.Location = new System.Drawing.Point(4, 22); this.tpgFileAssociations.Name = "tpgFileAssociations"; this.tpgFileAssociations.Padding = new System.Windows.Forms.Padding(3); - this.tpgFileAssociations.Size = new System.Drawing.Size(479, 259); + this.tpgFileAssociations.Size = new System.Drawing.Size(479, 343); this.tpgFileAssociations.TabIndex = 2; this.tpgFileAssociations.Text = "File Associations"; this.tpgFileAssociations.UseVisualStyleBackColor = true; @@ -622,7 +747,7 @@ this.grpFileAssociations.Dock = System.Windows.Forms.DockStyle.Fill; this.grpFileAssociations.Location = new System.Drawing.Point(3, 3); this.grpFileAssociations.Name = "grpFileAssociations"; - this.grpFileAssociations.Size = new System.Drawing.Size(473, 253); + this.grpFileAssociations.Size = new System.Drawing.Size(473, 337); this.grpFileAssociations.TabIndex = 12; this.grpFileAssociations.TabStop = false; this.grpFileAssociations.Text = "File Associations"; @@ -648,7 +773,7 @@ this.tlpFileFormat.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpFileFormat.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpFileFormat.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tlpFileFormat.Size = new System.Drawing.Size(467, 234); + this.tlpFileFormat.Size = new System.Drawing.Size(467, 318); this.tlpFileFormat.TabIndex = 0; // // chkNsfeFormat @@ -728,7 +853,7 @@ this.tpgAdvanced.Location = new System.Drawing.Point(4, 22); this.tpgAdvanced.Name = "tpgAdvanced"; this.tpgAdvanced.Padding = new System.Windows.Forms.Padding(3); - this.tpgAdvanced.Size = new System.Drawing.Size(479, 259); + this.tpgAdvanced.Size = new System.Drawing.Size(479, 343); this.tpgAdvanced.TabIndex = 1; this.tpgAdvanced.Text = "Advanced"; this.tpgAdvanced.UseVisualStyleBackColor = true; @@ -788,126 +913,24 @@ this.tmrSyncDateTime.Enabled = true; this.tmrSyncDateTime.Tick += new System.EventHandler(this.tmrSyncDateTime_Tick); // - // tableLayoutPanel3 + // tpgShortcuts // - this.tableLayoutPanel3.ColumnCount = 1; - this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel3.Controls.Add(this.grpCloudSaves, 0, 1); - this.tableLayoutPanel3.Controls.Add(this.grpAutomaticSaves, 0, 0); - this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 3); - this.tableLayoutPanel3.Name = "tableLayoutPanel3"; - this.tableLayoutPanel3.RowCount = 2; - this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(473, 337); - this.tableLayoutPanel3.TabIndex = 1; + this.tpgShortcuts.Controls.Add(this.ctrlEmulatorShortcuts); + this.tpgShortcuts.Location = new System.Drawing.Point(4, 22); + this.tpgShortcuts.Name = "tpgShortcuts"; + this.tpgShortcuts.Padding = new System.Windows.Forms.Padding(3); + this.tpgShortcuts.Size = new System.Drawing.Size(479, 343); + this.tpgShortcuts.TabIndex = 7; + this.tpgShortcuts.Text = "Shortcut Keys"; + this.tpgShortcuts.UseVisualStyleBackColor = true; // - // grpCloudSaves + // ctrlEmulatorShortcuts // - this.grpCloudSaves.Controls.Add(this.tlpCloudSaves); - this.grpCloudSaves.Dock = System.Windows.Forms.DockStyle.Fill; - this.grpCloudSaves.Location = new System.Drawing.Point(3, 76); - this.grpCloudSaves.Name = "grpCloudSaves"; - this.grpCloudSaves.Size = new System.Drawing.Size(467, 258); - this.grpCloudSaves.TabIndex = 2; - this.grpCloudSaves.TabStop = false; - this.grpCloudSaves.Text = "Cloud Saves"; - // - // grpAutomaticSaves - // - this.grpAutomaticSaves.Controls.Add(this.tableLayoutPanel4); - this.grpAutomaticSaves.Dock = System.Windows.Forms.DockStyle.Fill; - this.grpAutomaticSaves.Location = new System.Drawing.Point(3, 3); - this.grpAutomaticSaves.Name = "grpAutomaticSaves"; - this.grpAutomaticSaves.Size = new System.Drawing.Size(467, 67); - this.grpAutomaticSaves.TabIndex = 3; - this.grpAutomaticSaves.TabStop = false; - this.grpAutomaticSaves.Text = "Automatic Save States"; - // - // tableLayoutPanel4 - // - this.tableLayoutPanel4.ColumnCount = 1; - this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel4.Controls.Add(this.chkAutoSaveNotify, 0, 2); - this.tableLayoutPanel4.Controls.Add(this.flpAutoSave, 0, 0); - this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 16); - this.tableLayoutPanel4.Name = "tableLayoutPanel4"; - this.tableLayoutPanel4.RowCount = 3; - this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel4.Size = new System.Drawing.Size(461, 48); - this.tableLayoutPanel4.TabIndex = 0; - // - // flpAutoSave - // - this.flpAutoSave.Controls.Add(this.chkAutoSave); - this.flpAutoSave.Controls.Add(this.nudAutoSave); - this.flpAutoSave.Controls.Add(this.lblAutoSave); - this.flpAutoSave.Dock = System.Windows.Forms.DockStyle.Fill; - this.flpAutoSave.Location = new System.Drawing.Point(0, 0); - this.flpAutoSave.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0); - this.flpAutoSave.Name = "flpAutoSave"; - this.flpAutoSave.Size = new System.Drawing.Size(461, 23); - this.flpAutoSave.TabIndex = 0; - // - // chkAutoSave - // - this.chkAutoSave.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.chkAutoSave.AutoSize = true; - this.chkAutoSave.Location = new System.Drawing.Point(3, 4); - this.chkAutoSave.Name = "chkAutoSave"; - this.chkAutoSave.Size = new System.Drawing.Size(211, 17); - this.chkAutoSave.TabIndex = 0; - this.chkAutoSave.Text = "Automatically create a save state every"; - this.chkAutoSave.UseVisualStyleBackColor = true; - this.chkAutoSave.CheckedChanged += new System.EventHandler(this.chkAutoSave_CheckedChanged); - // - // nudAutoSave - // - this.nudAutoSave.Location = new System.Drawing.Point(220, 3); - this.nudAutoSave.Maximum = new decimal(new int[] { - 600, - 0, - 0, - 0}); - this.nudAutoSave.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.nudAutoSave.Name = "nudAutoSave"; - this.nudAutoSave.Size = new System.Drawing.Size(42, 20); - this.nudAutoSave.TabIndex = 1; - this.nudAutoSave.Value = new decimal(new int[] { - 5, - 0, - 0, - 0}); - // - // lblAutoSave - // - this.lblAutoSave.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.lblAutoSave.AutoSize = true; - this.lblAutoSave.Location = new System.Drawing.Point(268, 6); - this.lblAutoSave.Name = "lblAutoSave"; - this.lblAutoSave.Size = new System.Drawing.Size(99, 13); - this.lblAutoSave.TabIndex = 2; - this.lblAutoSave.Text = "minutes (F6 to load)"; - // - // chkAutoSaveNotify - // - this.chkAutoSaveNotify.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.chkAutoSaveNotify.AutoSize = true; - this.chkAutoSaveNotify.Location = new System.Drawing.Point(15, 27); - this.chkAutoSaveNotify.Margin = new System.Windows.Forms.Padding(15, 3, 3, 3); - this.chkAutoSaveNotify.Name = "chkAutoSaveNotify"; - this.chkAutoSaveNotify.Size = new System.Drawing.Size(240, 17); - this.chkAutoSaveNotify.TabIndex = 1; - this.chkAutoSaveNotify.Text = "Notify when an automatic save state is saved"; - this.chkAutoSaveNotify.UseVisualStyleBackColor = true; + this.ctrlEmulatorShortcuts.Dock = System.Windows.Forms.DockStyle.Fill; + this.ctrlEmulatorShortcuts.Location = new System.Drawing.Point(3, 3); + this.ctrlEmulatorShortcuts.Name = "ctrlEmulatorShortcuts"; + this.ctrlEmulatorShortcuts.Size = new System.Drawing.Size(473, 337); + this.ctrlEmulatorShortcuts.TabIndex = 0; // // frmPreferences // @@ -931,6 +954,8 @@ this.tabMain.ResumeLayout(false); this.tpgGeneral.ResumeLayout(false); this.tpgSaveData.ResumeLayout(false); + this.tableLayoutPanel3.ResumeLayout(false); + this.grpCloudSaves.ResumeLayout(false); this.tlpCloudSaves.ResumeLayout(false); this.tlpCloudSaveDesc.ResumeLayout(false); this.tlpCloudSaveDesc.PerformLayout(); @@ -940,6 +965,12 @@ ((System.ComponentModel.ISupportInitialize)(this.picOK)).EndInit(); this.flowLayoutPanel4.ResumeLayout(false); this.flowLayoutPanel4.PerformLayout(); + this.grpAutomaticSaves.ResumeLayout(false); + this.tableLayoutPanel4.ResumeLayout(false); + this.tableLayoutPanel4.PerformLayout(); + this.flpAutoSave.ResumeLayout(false); + this.flpAutoSave.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudAutoSave)).EndInit(); this.tpgNsf.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel2.PerformLayout(); @@ -956,14 +987,7 @@ this.tpgAdvanced.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); - this.tableLayoutPanel3.ResumeLayout(false); - this.grpCloudSaves.ResumeLayout(false); - this.grpAutomaticSaves.ResumeLayout(false); - this.tableLayoutPanel4.ResumeLayout(false); - this.tableLayoutPanel4.PerformLayout(); - this.flpAutoSave.ResumeLayout(false); - this.flpAutoSave.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nudAutoSave)).EndInit(); + this.tpgShortcuts.ResumeLayout(false); this.ResumeLayout(false); } @@ -1034,5 +1058,7 @@ private System.Windows.Forms.NumericUpDown nudAutoSave; private System.Windows.Forms.Label lblAutoSave; private System.Windows.Forms.CheckBox chkAutoSaveNotify; + private System.Windows.Forms.TabPage tpgShortcuts; + private ctrlEmulatorShortcuts ctrlEmulatorShortcuts; } } \ No newline at end of file diff --git a/GUI.NET/Forms/Config/frmPreferences.cs b/GUI.NET/Forms/Config/frmPreferences.cs index 59d14db1..385e15e9 100644 --- a/GUI.NET/Forms/Config/frmPreferences.cs +++ b/GUI.NET/Forms/Config/frmPreferences.cs @@ -56,6 +56,12 @@ namespace Mesen.GUI.Forms.Config UpdateCloudDisplay(); } + protected override void UpdateConfig() + { + base.UpdateConfig(); + ctrlEmulatorShortcuts.UpdateConfig(); + } + protected override void OnFormClosed(FormClosedEventArgs e) { base.OnFormClosed(e); diff --git a/GUI.NET/Forms/ResourceHelper.cs b/GUI.NET/Forms/ResourceHelper.cs index 4361e65e..0e88f17c 100644 --- a/GUI.NET/Forms/ResourceHelper.cs +++ b/GUI.NET/Forms/ResourceHelper.cs @@ -142,9 +142,11 @@ namespace Mesen.GUI.Forms name = ((ToolStripItem)ctrl).Name; } else if(ctrl is ColumnHeader) { name = ((ColumnHeader)ctrl).Name; + } else if(ctrl is DataGridViewColumn) { + name = ((DataGridViewColumn)ctrl).Name; } - var controlNode = baseNode.SelectSingleNode("Control[@ID='" + name + "']"); + var controlNode = baseNode.SelectSingleNode("Control[@ID='" + name + "']"); if(controlNode != null) { if(ctrl is Control) { ((Control)ctrl).Text = controlNode.InnerText; @@ -155,10 +157,14 @@ namespace Mesen.GUI.Forms } } else if(ctrl is ColumnHeader) { ((ColumnHeader)ctrl).Text = controlNode.InnerText; + } else if(ctrl is DataGridViewColumn) { + ((DataGridViewColumn)ctrl).HeaderText = controlNode.InnerText; } } - if(ctrl is MenuStrip) { + if(ctrl is DataGridView) { + ApplyResources(baseNode, ((DataGridView)ctrl).Columns); + } else if(ctrl is MenuStrip) { ApplyResources(baseNode, ((MenuStrip)ctrl).Items); } else if(ctrl is ContextMenuStrip) { ApplyResources(baseNode, ((ContextMenuStrip)ctrl).Items); diff --git a/GUI.NET/GUI.NET.csproj b/GUI.NET/GUI.NET.csproj index 8859fe3e..dcbc4588 100644 --- a/GUI.NET/GUI.NET.csproj +++ b/GUI.NET/GUI.NET.csproj @@ -414,6 +414,12 @@ ctrlDipSwitch.cs + + UserControl + + + ctrlEmulatorShortcuts.cs + UserControl @@ -635,6 +641,9 @@ ctrlDipSwitch.cs + + ctrlEmulatorShortcuts.cs + ctrlInputPortConfig.cs diff --git a/GUI.NET/InteropEmu.cs b/GUI.NET/InteropEmu.cs index d08ec06e..cfac733c 100644 --- a/GUI.NET/InteropEmu.cs +++ b/GUI.NET/InteropEmu.cs @@ -41,6 +41,7 @@ namespace Mesen.GUI [DllImport(DLLPath)] public static extern void SetControllerKeys(int port, KeyMappingSet mapping); [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 ControllerType GetControllerType(int port); [DllImport(DLLPath)] public static extern ExpansionPortDevice GetExpansionDevice(); @@ -135,6 +136,7 @@ namespace Mesen.GUI [DllImport(DLLPath)] public static extern void SetReverbParameters(double strength, double delay); [DllImport(DLLPath)] public static extern void SetNesModel(NesModel model); [DllImport(DLLPath)] public static extern void SetEmulationSpeed(UInt32 emulationSpeed); + [DllImport(DLLPath)] public static extern void SetTurboSpeed(UInt32 turboSpeed); [DllImport(DLLPath)] public static extern void SetOverclockRate(UInt32 overclockRate, [MarshalAs(UnmanagedType.I1)]bool adjustApu); [DllImport(DLLPath)] public static extern void SetPpuNmiConfig(UInt32 extraScanlinesBeforeNmi, UInt32 extraScanlineAfterNmi); [DllImport(DLLPath)] public static extern void SetOverscanDimensions(UInt32 left, UInt32 right, UInt32 top, UInt32 bottom); @@ -700,6 +702,32 @@ namespace Mesen.GUI } }; + public struct EmulatorKeyMappingSet + { + public EmulatorKeyMappings KeySet1; + public EmulatorKeyMappings KeySet2; + } + + public struct EmulatorKeyMappings + { + public UInt32 FastForward; + public UInt32 Pause; + public UInt32 Reset; + + public UInt32 MoveToNextStateSlot; + public UInt32 MoveToPreviousStateSlot; + public UInt32 SaveState; + public UInt32 LoadState; + + public UInt32 SwitchDiskSide; + public UInt32 InsertNextDisk; + + public UInt32 InsertCoin1; + public UInt32 InsertCoin2; + + public UInt32 TakeScreenshot; + } + public struct InteropCheatInfo { public CheatType CheatType; diff --git a/InteropDLL/ConsoleWrapper.cpp b/InteropDLL/ConsoleWrapper.cpp index 024c7c05..8f2fd283 100644 --- a/InteropDLL/ConsoleWrapper.cpp +++ b/InteropDLL/ConsoleWrapper.cpp @@ -102,6 +102,7 @@ namespace InteropEmu { DllExport void __stdcall SetControllerKeys(uint32_t port, KeyMappingSet mappings) { EmulationSettings::SetControllerKeys(port, mappings); } 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 ControllerType __stdcall GetControllerType(uint32_t port) { return EmulationSettings::GetControllerType(port); } DllExport ExpansionPortDevice GetExpansionDevice() { return EmulationSettings::GetExpansionDevice(); } @@ -335,6 +336,7 @@ namespace InteropEmu { DllExport void __stdcall SetNesModel(uint32_t model) { EmulationSettings::SetNesModel((NesModel)model); } DllExport void __stdcall SetOverscanDimensions(uint32_t left, uint32_t right, uint32_t top, uint32_t bottom) { EmulationSettings::SetOverscanDimensions(left, right, top, bottom); } DllExport void __stdcall SetEmulationSpeed(uint32_t emulationSpeed) { EmulationSettings::SetEmulationSpeed(emulationSpeed); } + DllExport void __stdcall SetTurboSpeed(uint32_t turboSpeed) { EmulationSettings::SetTurboSpeed(turboSpeed); } DllExport void __stdcall SetOverclockRate(uint32_t overclockRate, bool adjustApu) { EmulationSettings::SetOverclockRate(overclockRate, adjustApu); } DllExport void __stdcall SetPpuNmiConfig(uint32_t extraScanlinesBeforeNmi, uint32_t extraScanlinesAfterNmi) { EmulationSettings::SetPpuNmiConfig(extraScanlinesBeforeNmi, extraScanlinesAfterNmi); } DllExport void __stdcall SetVideoScale(double scale) { EmulationSettings::SetVideoScale(scale); }