UI: Preferences, shortcut keys, emulation speed, etc.

This commit is contained in:
Sour 2019-03-11 17:56:54 -04:00
parent 0d70e9be28
commit fe958a8285
46 changed files with 4623 additions and 194 deletions

View file

@ -2,6 +2,7 @@
#include <cmath>
#include "BaseRenderer.h"
#include "Console.h"
#include "EmuSettings.h"
#include "Ppu.h"
#include "MessageManager.h"
@ -145,11 +146,10 @@ void BaseRenderer::ShowFpsCounter(int lineNumber)
void BaseRenderer::ShowGameTimer(int lineNumber)
{
//TODO
/*int yPos = 13 + 24 * lineNumber;
double frameCount = _console->GetFrameCount();
double frameRate = _console->GetModel() == NesModel::NTSC ? 60.098811862348404716732985230828 : 50.006977968268290848936010226333;
//uint32_t milliseconds = (uint32_t)(frameCount / 60.1 * 1000) % 1000;
int yPos = 13 + 24 * lineNumber;
double frameCount = _console->GetPpu()->GetFrameCount();
bool isPal = false; //TODO
double frameRate = isPal ? 50.006977968268290848936010226333 : 60.098811862348404716732985230828;
uint32_t seconds = (uint32_t)(frameCount / frameRate) % 60;
uint32_t minutes = (uint32_t)(frameCount / frameRate / 60) % 60;
uint32_t hours = (uint32_t)(frameCount / frameRate / 3600);
@ -158,8 +158,7 @@ void BaseRenderer::ShowGameTimer(int lineNumber)
ss << std::setw(2) << std::setfill('0') << hours << ":";
ss << std::setw(2) << std::setfill('0') << minutes << ":";
ss << std::setw(2) << std::setfill('0') << seconds;
//ss << "." << std::setw(3) << std::setfill('0') << milliseconds;
DrawString(ss.str(), _screenWidth - 95, yPos, 250, 235, 215);*/
DrawString(ss.str(), _screenWidth - 95, yPos, 250, 235, 215);
}
void BaseRenderer::ShowFrameCounter(int lineNumber)
@ -174,23 +173,16 @@ void BaseRenderer::ShowFrameCounter(int lineNumber)
void BaseRenderer::DrawCounters()
{
int lineNumber = 0;
ShowFpsCounter(lineNumber++);
ShowFrameCounter(lineNumber++);
//TODO
/*int lineNumber = 0;
EmulationSettings* settings = _console->GetSettings();
if(settings->CheckFlag(EmulationFlags::ShowGameTimer)) {
PreferencesConfig cfg = _console->GetSettings()->GetPreferences();
if(cfg.ShowGameTimer) {
ShowGameTimer(lineNumber++);
}
if(settings->CheckFlag(EmulationFlags::ShowFPS)) {
if(cfg.ShowFps) {
ShowFpsCounter(lineNumber++);
}
if(settings->CheckFlag(EmulationFlags::ShowLagCounter)) {
ShowLagCounter(lineNumber++);
}
if(settings->CheckFlag(EmulationFlags::ShowFrameCounter)) {
if(cfg.ShowFrameCounter) {
ShowFrameCounter(lineNumber++);
}*/
}
}
bool BaseRenderer::IsMessageShown()

View file

@ -68,13 +68,11 @@ void Console::Run()
_stopFlag = false;
uint32_t previousFrameCount = 0;
FrameLimiter frameLimiter(16.63926405550947);
double frameDelay = GetFrameDelay();
FrameLimiter frameLimiter(frameDelay);
PlatformUtilities::EnableHighResolutionTimer();
uint32_t tabKeyCode = KeyManager::GetKeyCode("Tab");
uint32_t semiKeyCode = KeyManager::GetKeyCode(";");
_videoDecoder->StartThread();
_emulationThreadId = std::this_thread::get_id();
@ -83,12 +81,17 @@ void Console::Run()
_cpu->Exec();
if(previousFrameCount != _ppu->GetFrameCount()) {
if(!KeyManager::IsKeyPressed(tabKeyCode)) {
frameLimiter.ProcessFrame();
frameLimiter.WaitForNextFrame();
frameLimiter.ProcessFrame();
frameLimiter.WaitForNextFrame();
double newFrameDelay = GetFrameDelay();
if(newFrameDelay != frameDelay) {
frameDelay = newFrameDelay;
frameLimiter.SetDelay(frameDelay);
}
if(KeyManager::IsKeyPressed(semiKeyCode)) {
PreferencesConfig cfg = _settings->GetPreferences();
if(cfg.ShowDebugInfo) {
double lastFrameTime = lastFrameTimer.GetElapsedMS();
lastFrameTimer.Reset();
stats.DisplayStats(lastFrameTime);
@ -169,6 +172,18 @@ void Console::LoadRom(VirtualFile romFile, VirtualFile patchFile)
}
}
double Console::GetFrameDelay()
{
uint32_t emulationSpeed = _settings->GetEmulationSpeed();
double frameDelay;
if(emulationSpeed == 0) {
frameDelay = 0;
} else {
frameDelay = 16.63926405550947 / (emulationSpeed / 100.0);
}
return frameDelay;
}
shared_ptr<SoundMixer> Console::GetSoundMixer()
{
return _soundMixer;

View file

@ -49,6 +49,8 @@ private:
SimpleLock _debuggerLock;
atomic<bool> _stopFlag;
double GetFrameDelay();
public:
~Console();

View file

@ -106,6 +106,7 @@
<ClInclude Include="RomHandler.h" />
<ClInclude Include="ScaleFilter.h" />
<ClInclude Include="SettingTypes.h" />
<ClInclude Include="ShortcutKeyHandler.h" />
<ClInclude Include="SnesController.h" />
<ClInclude Include="SNES_SPC.h" />
<ClInclude Include="SoundMixer.h" />
@ -152,6 +153,7 @@
<ClCompile Include="Ppu.cpp" />
<ClCompile Include="PpuTools.cpp" />
<ClCompile Include="ScaleFilter.cpp" />
<ClCompile Include="ShortcutKeyHandler.cpp" />
<ClCompile Include="SNES_SPC.cpp" />
<ClCompile Include="SNES_SPC_misc.cpp" />
<ClCompile Include="SNES_SPC_state.cpp" />

View file

@ -224,6 +224,9 @@
<ClInclude Include="DebugStats.h">
<Filter>Misc</Filter>
</ClInclude>
<ClInclude Include="ShortcutKeyHandler.h">
<Filter>Misc</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp" />
@ -353,7 +356,12 @@
<ClCompile Include="BaseSoundManager.cpp">
<Filter>Audio</Filter>
</ClCompile>
<ClCompile Include="DebugStats.cpp" />
<ClCompile Include="ShortcutKeyHandler.cpp">
<Filter>Misc</Filter>
</ClCompile>
<ClCompile Include="DebugStats.cpp">
<Filter>Misc</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="SNES">

View file

@ -1,5 +1,15 @@
#include "stdafx.h"
#include "EmuSettings.h"
#include "KeyManager.h"
#include "MessageManager.h"
#include "../Utilities/FolderUtilities.h"
void EmuSettings::ProcessString(string & str, const char ** strPointer)
{
//Make a copy of the string and keep it (the original pointer will not be valid after the call is over)
str = *strPointer;
*strPointer = str.c_str();
}
void EmuSettings::SetVideoConfig(VideoConfig config)
{
@ -13,9 +23,7 @@ VideoConfig EmuSettings::GetVideoConfig()
void EmuSettings::SetAudioConfig(AudioConfig config)
{
//Make a copy of the string and keep it (the original pointer will not be valid after the call is over)
_audioDevice = config.AudioDevice;
config.AudioDevice = _audioDevice.c_str();
ProcessString(_audioDevice, &config.AudioDevice);
_audio = config;
}
@ -25,9 +33,99 @@ AudioConfig EmuSettings::GetAudioConfig()
return _audio;
}
void EmuSettings::SetEmulationConfig(EmulationConfig config)
{
_emulation = config;
}
EmulationConfig EmuSettings::GetEmulationConfig()
{
return _emulation;
}
void EmuSettings::SetPreferences(PreferencesConfig config)
{
ProcessString(_saveFolder, &config.SaveFolderOverride);
ProcessString(_saveStateFolder, &config.SaveStateFolderOverride);
ProcessString(_screenshotFolder, &config.ScreenshotFolderOverride);
MessageManager::SetOsdState(!config.DisableOsd);
FolderUtilities::SetFolderOverrides(
_saveFolder,
_saveStateFolder,
_screenshotFolder
);
_preferences = config;
}
PreferencesConfig EmuSettings::GetPreferences()
{
return _preferences;
}
void EmuSettings::ClearShortcutKeys()
{
_emulatorKeys[0].clear();
_emulatorKeys[1].clear();
_emulatorKeys[2].clear();
_shortcutSupersets[0].clear();
_shortcutSupersets[1].clear();
_shortcutSupersets[2].clear();
//Add Alt-F4 as a fake shortcut to prevent Alt-F4 from triggering Alt or F4 key bindings. (e.g load save state 4)
KeyCombination keyComb;
keyComb.Key1 = KeyManager::GetKeyCode("Alt");
keyComb.Key2 = KeyManager::GetKeyCode("F4");
SetShortcutKey(EmulatorShortcut::Exit, keyComb, 2);
}
void EmuSettings::SetShortcutKey(EmulatorShortcut shortcut, KeyCombination keyCombination, int keySetIndex)
{
_emulatorKeys[keySetIndex][(uint32_t)shortcut] = keyCombination;
for(int i = 0; i < 3; i++) {
for(std::pair<const uint32_t, KeyCombination> &kvp : _emulatorKeys[i]) {
if(keyCombination.IsSubsetOf(kvp.second)) {
_shortcutSupersets[keySetIndex][(uint32_t)shortcut].push_back(kvp.second);
} else if(kvp.second.IsSubsetOf(keyCombination)) {
_shortcutSupersets[i][kvp.first].push_back(keyCombination);
}
}
}
}
void EmuSettings::SetShortcutKeys(vector<ShortcutKeyInfo> shortcuts)
{
ClearShortcutKeys();
for(ShortcutKeyInfo &shortcut : shortcuts) {
if(_emulatorKeys[0][(uint32_t)shortcut.Shortcut].GetKeys().empty()) {
SetShortcutKey(shortcut.Shortcut, shortcut.KeyCombination, 0);
} else {
SetShortcutKey(shortcut.Shortcut, shortcut.KeyCombination, 1);
}
}
}
KeyCombination EmuSettings::GetShortcutKey(EmulatorShortcut shortcut, int keySetIndex)
{
auto result = _emulatorKeys[keySetIndex].find((int)shortcut);
if(result != _emulatorKeys[keySetIndex].end()) {
return result->second;
}
return {};
}
vector<KeyCombination> EmuSettings::GetShortcutSupersets(EmulatorShortcut shortcut, int keySetIndex)
{
return _shortcutSupersets[keySetIndex][(uint32_t)shortcut];
}
uint32_t EmuSettings::GetEmulationSpeed()
{
return 100;
return _emulation.EmulationSpeed;
}
double EmuSettings::GetAspectRatio()

View file

@ -7,7 +7,21 @@ class EmuSettings
private:
VideoConfig _video;
AudioConfig _audio;
EmulationConfig _emulation;
PreferencesConfig _preferences;
string _audioDevice;
string _saveFolder;
string _saveStateFolder;
string _screenshotFolder;
std::unordered_map<uint32_t, KeyCombination> _emulatorKeys[3];
std::unordered_map<uint32_t, vector<KeyCombination>> _shortcutSupersets[3];
void ProcessString(string &str, const char** strPointer);
void ClearShortcutKeys();
void SetShortcutKey(EmulatorShortcut shortcut, KeyCombination keyCombination, int keySetIndex);
public:
void SetVideoConfig(VideoConfig config);
@ -16,6 +30,16 @@ public:
void SetAudioConfig(AudioConfig config);
AudioConfig GetAudioConfig();
void SetEmulationConfig(EmulationConfig config);
EmulationConfig GetEmulationConfig();
void SetPreferences(PreferencesConfig config);
PreferencesConfig GetPreferences();
void SetShortcutKeys(vector<ShortcutKeyInfo> shortcuts);
KeyCombination GetShortcutKey(EmulatorShortcut shortcut, int keySetIndex);
vector<KeyCombination> GetShortcutSupersets(EmulatorShortcut shortcut, int keySetIndex);
uint32_t GetEmulationSpeed();
double GetAspectRatio();
};

View file

@ -59,7 +59,7 @@ struct VideoConfig
{
double VideoScale = 2;
double CustomAspectRatio = 1.0;
VideoFilterType VideoFilter = VideoFilterType::NTSC;
VideoFilterType VideoFilter = VideoFilterType::None;
VideoAspectRatio AspectRatio = VideoAspectRatio::NoStretching;
bool UseBilinearInterpolation = false;
bool VerticalSync = false;
@ -122,6 +122,41 @@ struct AudioConfig
double Band20Gain = 0;
};
enum class RamPowerOnState
{
AllZeros = 0,
AllOnes = 1,
Random = 2
};
struct EmulationConfig
{
uint32_t EmulationSpeed = 100;
uint32_t TurboSpeed = 300;
uint32_t RewindSpeed = 100;
bool AllowInvalidInput = false;
bool EnableRandomPowerOnState = false;
uint32_t PpuExtraScanlinesBeforeNmi = 0;
uint32_t PpuExtraScanlinesAfterNmi = 0;
RamPowerOnState RamPowerOnState = RamPowerOnState::AllZeros;
};
struct PreferencesConfig
{
bool ShowFps;
bool ShowFrameCounter;
bool ShowGameTimer;
bool ShowDebugInfo;
bool DisableOsd;
const char* SaveFolderOverride;
const char* SaveStateFolderOverride;
const char* ScreenshotFolderOverride;
};
struct OverscanDimensions
{
uint32_t Left = 0;
@ -214,6 +249,124 @@ struct KeyMappingSet
}
};
enum class EmulatorShortcut
{
FastForward,
Rewind,
RewindTenSecs,
RewindOneMin,
MoveToNextStateSlot,
MoveToPreviousStateSlot,
SaveState,
LoadState,
ToggleAudio,
ToggleFastForward,
ToggleRewind,
RunSingleFrame,
// Everything below this is handled UI-side
TakeScreenshot,
IncreaseSpeed,
DecreaseSpeed,
MaxSpeed,
Pause,
Reset,
PowerCycle,
PowerOff,
Exit,
SetScale1x,
SetScale2x,
SetScale3x,
SetScale4x,
SetScale5x,
SetScale6x,
ToggleFullscreen,
ToggleFps,
ToggleGameTimer,
ToggleFrameCounter,
ToggleOsd,
ToggleAlwaysOnTop,
ToggleDebugInfo,
SaveStateSlot1,
SaveStateSlot2,
SaveStateSlot3,
SaveStateSlot4,
SaveStateSlot5,
SaveStateSlot6,
SaveStateSlot7,
SaveStateSlot8,
SaveStateSlot9,
SaveStateSlot10,
SaveStateToFile,
LoadStateSlot1,
LoadStateSlot2,
LoadStateSlot3,
LoadStateSlot4,
LoadStateSlot5,
LoadStateSlot6,
LoadStateSlot7,
LoadStateSlot8,
LoadStateSlot9,
LoadStateSlot10,
LoadStateFromFile,
OpenFile,
ShortcutCount
};
struct KeyCombination
{
uint32_t Key1 = 0;
uint32_t Key2 = 0;
uint32_t Key3 = 0;
vector<uint32_t> GetKeys()
{
vector<uint32_t> result;
if(Key1) {
result.push_back(Key1);
}
if(Key2) {
result.push_back(Key2);
}
if(Key3) {
result.push_back(Key3);
}
return result;
}
bool IsSubsetOf(KeyCombination keyCombination)
{
vector<uint32_t> myKeys = GetKeys();
vector<uint32_t> otherKeys = keyCombination.GetKeys();
if(otherKeys.size() > myKeys.size()) {
for(size_t i = 0; i < myKeys.size(); i++) {
if(std::find(otherKeys.begin(), otherKeys.end(), myKeys[i]) == otherKeys.end()) {
//Current key combination contains a key not found in the other combination, so it's not a subset
return false;
}
}
return true;
}
return false;
}
};
struct ShortcutKeyInfo
{
EmulatorShortcut Shortcut;
KeyCombination KeyCombination;
};
enum class ControllerType
{
None = 0,

247
Core/ShortcutKeyHandler.cpp Normal file
View file

@ -0,0 +1,247 @@
#include "stdafx.h"
#include "ShortcutKeyHandler.h"
#include "EmuSettings.h"
#include "KeyManager.h"
#include "VideoDecoder.h"
#include "ControlManager.h"
#include "Console.h"
#include "NotificationManager.h"
ShortcutKeyHandler::ShortcutKeyHandler(shared_ptr<Console> console)
{
_console = console;
_keySetIndex = 0;
_isKeyUp = false;
_keyboardMode = false;
_repeatStarted = false;
_stopThread = false;
_thread = std::thread([=]() {
while(!_stopThread) {
ProcessKeys();
std::this_thread::sleep_for(std::chrono::duration<int, std::milli>(50));
}
});
}
ShortcutKeyHandler::~ShortcutKeyHandler()
{
_stopThread = true;
_thread.join();
}
bool ShortcutKeyHandler::IsKeyPressed(EmulatorShortcut shortcut)
{
KeyCombination keyComb = _console->GetSettings()->GetShortcutKey(shortcut, _keySetIndex);
vector<KeyCombination> supersets = _console->GetSettings()->GetShortcutSupersets(shortcut, _keySetIndex);
for(KeyCombination &superset : supersets) {
if(IsKeyPressed(superset)) {
//A superset is pressed, ignore this subset
return false;
}
}
//No supersets are pressed, check if all matching keys are pressed
return IsKeyPressed(keyComb);
}
bool ShortcutKeyHandler::IsKeyPressed(KeyCombination comb)
{
int keyCount = (comb.Key1 ? 1 : 0) + (comb.Key2 ? 1 : 0) + (comb.Key3 ? 1 : 0);
if(keyCount == 0 || _pressedKeys.empty()) {
return false;
}
return IsKeyPressed(comb.Key1) &&
(comb.Key2 == 0 || IsKeyPressed(comb.Key2)) &&
(comb.Key3 == 0 || IsKeyPressed(comb.Key3));
}
bool ShortcutKeyHandler::IsKeyPressed(uint32_t keyCode)
{
if(keyCode >= 0x200 || !_keyboardMode) {
return KeyManager::IsKeyPressed(keyCode);
} else {
return false;
}
}
bool ShortcutKeyHandler::DetectKeyPress(EmulatorShortcut shortcut)
{
if(IsKeyPressed(shortcut)) {
bool newlyPressed = _prevKeysDown[_keySetIndex].find((uint32_t)shortcut) == _prevKeysDown[_keySetIndex].end();
_keysDown[_keySetIndex].emplace((uint32_t)shortcut);
if(newlyPressed && !_isKeyUp) {
return true;
}
}
return false;
}
bool ShortcutKeyHandler::DetectKeyRelease(EmulatorShortcut shortcut)
{
if(!IsKeyPressed(shortcut)) {
if(_prevKeysDown[_keySetIndex].find((uint32_t)shortcut) != _prevKeysDown[_keySetIndex].end()) {
return true;
}
}
return false;
}
void ShortcutKeyHandler::ProcessRunSingleFrame()
{
//TODO
/*shared_ptr<EmuSettings> settings = _console->GetSettings();
if(!_runSingleFrameRepeatTimer) {
_runSingleFrameRepeatTimer.reset(new Timer());
}
_runSingleFrameRepeatTimer->Reset();
if(settings->CheckFlag(EmulationFlags::DebuggerWindowEnabled)) {
shared_ptr<Debugger> debugger = _console->GetDebugger(false);
if(debugger) {
debugger->BreakOnScanline(241);
}
} else {
_console->PauseOnNextFrame();
settings->ClearFlags(EmulationFlags::Paused);
}*/
}
void ShortcutKeyHandler::CheckMappedKeys()
{
shared_ptr<EmuSettings> settings = _console->GetSettings();
bool isNetplayClient = false; //TODO GameClient::Connected();
bool isMovieActive = false; //TODO MovieManager::Playing() || MovieManager::Recording();
bool isMovieRecording = false; //TODO MovieManager::Recording();
//Let the UI handle these shortcuts
for(uint64_t i = (uint64_t)EmulatorShortcut::TakeScreenshot; i < (uint64_t)EmulatorShortcut::ShortcutCount; i++) {
if(DetectKeyPress((EmulatorShortcut)i)) {
void* param = (void*)i;
_console->GetNotificationManager()->SendNotification(ConsoleNotificationType::ExecuteShortcut, param);
}
}
//TODO
/*
if(DetectKeyPress(EmulatorShortcut::FastForward)) {
settings->SetFlags(EmulationFlags::Turbo);
} else if(DetectKeyRelease(EmulatorShortcut::FastForward)) {
settings->ClearFlags(EmulationFlags::Turbo);
}
if(DetectKeyPress(EmulatorShortcut::ToggleFastForward)) {
if(settings->CheckFlag(EmulationFlags::Turbo)) {
settings->ClearFlags(EmulationFlags::Turbo);
} else {
settings->SetFlags(EmulationFlags::Turbo);
}
}
if(DetectKeyPress(EmulatorShortcut::MoveToNextStateSlot)) {
_console->GetSaveStateManager()->MoveToNextSlot();
}
if(DetectKeyPress(EmulatorShortcut::MoveToPreviousStateSlot)) {
_console->GetSaveStateManager()->MoveToPreviousSlot();
}
if(DetectKeyPress(EmulatorShortcut::SaveState)) {
_console->GetSaveStateManager()->SaveState();
}
if(DetectKeyPress(EmulatorShortcut::LoadState) && !isNetplayClient) {
_console->GetSaveStateManager()->LoadState();
}
if(DetectKeyPress(EmulatorShortcut::ToggleCheats) && !isNetplayClient && !isMovieActive) {
_console->GetNotificationManager()->SendNotification(ConsoleNotificationType::ExecuteShortcut, (void*)EmulatorShortcut::ToggleCheats);
}*/
if(DetectKeyPress(EmulatorShortcut::ToggleAudio)) {
_console->GetNotificationManager()->SendNotification(ConsoleNotificationType::ExecuteShortcut, (void*)EmulatorShortcut::ToggleAudio);
}
if(DetectKeyPress(EmulatorShortcut::RunSingleFrame)) {
ProcessRunSingleFrame();
}
if(DetectKeyRelease(EmulatorShortcut::RunSingleFrame)) {
_runSingleFrameRepeatTimer.reset();
_repeatStarted = false;
}
if(!isNetplayClient && !isMovieRecording) {
//TODO
/*shared_ptr<RewindManager> rewindManager = _console->GetRewindManager();
if(rewindManager) {
if(DetectKeyPress(EmulatorShortcut::ToggleRewind)) {
if(rewindManager->IsRewinding()) {
rewindManager->StopRewinding();
} else {
rewindManager->StartRewinding();
}
}
if(DetectKeyPress(EmulatorShortcut::Rewind)) {
rewindManager->StartRewinding();
} else if(DetectKeyRelease(EmulatorShortcut::Rewind)) {
rewindManager->StopRewinding();
} else if(DetectKeyPress(EmulatorShortcut::RewindTenSecs)) {
rewindManager->RewindSeconds(10);
} else if(DetectKeyPress(EmulatorShortcut::RewindOneMin)) {
rewindManager->RewindSeconds(60);
}
}*/
}
}
void ShortcutKeyHandler::ProcessKeys()
{
//TODO
/*if(!_console->GetSettings()->IsInputEnabled()) {
return;
}*/
auto lock = _lock.AcquireSafe();
KeyManager::RefreshKeyState();
_pressedKeys = KeyManager::GetPressedKeys();
_isKeyUp = _pressedKeys.size() < _lastPressedKeys.size();
bool noChange = false;
if(_pressedKeys.size() == _lastPressedKeys.size()) {
noChange = true;
for(size_t i = 0; i < _pressedKeys.size(); i++) {
if(_pressedKeys[i] != _lastPressedKeys[i]) {
noChange = false;
break;
}
}
}
if(!noChange) {
//Only run this if the keys have changed
for(int i = 0; i < 2; i++) {
_keysDown[i].clear();
_keySetIndex = i;
CheckMappedKeys();
_prevKeysDown[i] = _keysDown[i];
}
_lastPressedKeys = _pressedKeys;
}
if(_runSingleFrameRepeatTimer) {
double elapsedMs = _runSingleFrameRepeatTimer->GetElapsedMS();
if((_repeatStarted && elapsedMs >= 50) || (!_repeatStarted && elapsedMs >= 500)) {
//Over 500ms has elapsed since the key was first pressed, or over 50ms since repeat mode started (20fps)
//In this case, run another frame and pause again.
_repeatStarted = true;
ProcessRunSingleFrame();
}
}
}

46
Core/ShortcutKeyHandler.h Normal file
View file

@ -0,0 +1,46 @@
#pragma once
#include "stdafx.h"
#include "../Utilities/SimpleLock.h"
#include "../Utilities/Timer.h"
#include "SettingTypes.h"
class Console;
class ShortcutKeyHandler
{
private:
shared_ptr<Console> _console;
thread _thread;
atomic<bool> _stopThread;
SimpleLock _lock;
int _keySetIndex;
vector<uint32_t> _pressedKeys;
vector<uint32_t> _lastPressedKeys;
bool _isKeyUp;
bool _keyboardMode;
shared_ptr<Timer> _runSingleFrameRepeatTimer;
bool _repeatStarted;
unordered_set<uint32_t> _keysDown[2];
unordered_set<uint32_t> _prevKeysDown[2];
void CheckMappedKeys();
bool IsKeyPressed(EmulatorShortcut key);
bool IsKeyPressed(KeyCombination comb);
bool IsKeyPressed(uint32_t keyCode);
bool DetectKeyPress(EmulatorShortcut key);
bool DetectKeyRelease(EmulatorShortcut key);
void ProcessRunSingleFrame();
public:
ShortcutKeyHandler(shared_ptr<Console> console);
~ShortcutKeyHandler();
void ProcessKeys();
};

View file

@ -19,6 +19,22 @@ extern "C" {
_console->GetSettings()->SetAudioConfig(config);
}
DllExport void __stdcall SetEmulationConfig(EmulationConfig config)
{
_console->GetSettings()->SetEmulationConfig(config);
}
DllExport void __stdcall SetPreferences(PreferencesConfig config)
{
_console->GetSettings()->SetPreferences(config);
}
DllExport void __stdcall SetShortcutKeys(ShortcutKeyInfo shortcuts[], uint32_t count)
{
vector<ShortcutKeyInfo> shortcutList(shortcuts, shortcuts + count);
_console->GetSettings()->SetShortcutKeys(shortcutList);
}
DllExport const char* __stdcall GetAudioDevices()
{
_returnString = _soundManager ? _soundManager->GetAvailableDevices() : "";

View file

@ -4,6 +4,7 @@
#include "../Core/MessageManager.h"
#include "../Core/INotificationListener.h"
#include "../Core/KeyManager.h"
#include "../Core/ShortcutKeyHandler.h"
#include "../Utilities/ArchiveReader.h"
#include "InteropNotificationListeners.h"
@ -20,7 +21,7 @@
unique_ptr<IRenderingDevice> _renderer;
unique_ptr<IAudioDevice> _soundManager;
unique_ptr<IKeyManager> _keyManager;
//unique_ptr<ShortcutKeyHandler> _shortcutKeyHandler;
unique_ptr<ShortcutKeyHandler> _shortcutKeyHandler;
void* _windowHandle = nullptr;
void* _viewerHandle = nullptr;
@ -46,7 +47,7 @@ extern "C" {
DllExport void __stdcall InitializeEmu(const char* homeFolder, void *windowHandle, void *viewerHandle, bool noAudio, bool noVideo, bool noInput)
{
FolderUtilities::SetHomeFolder(homeFolder);
//_shortcutKeyHandler.reset(new ShortcutKeyHandler(_console));
_shortcutKeyHandler.reset(new ShortcutKeyHandler(_console));
if(windowHandle != nullptr && viewerHandle != nullptr) {
_windowHandle = windowHandle;
@ -89,7 +90,8 @@ extern "C" {
DllExport void __stdcall LoadRom(char* filename, char* patchFile) { _console->LoadRom((VirtualFile)filename, patchFile ? (VirtualFile)patchFile : VirtualFile()); }
//DllExport void __stdcall AddKnownGameFolder(char* folder) { FolderUtilities::AddKnownGameFolder(folder); }
//DllExport void __stdcall SetFolderOverrides(char* saveFolder, char* saveStateFolder, char* screenshotFolder) { FolderUtilities::SetFolderOverrides(saveFolder, saveStateFolder, screenshotFolder); }
DllExport void __stdcall TakeScreenshot() { _console->GetVideoDecoder()->TakeScreenshot(); }
DllExport const char* __stdcall GetArchiveRomList(char* filename) {
std::ostringstream out;
@ -103,41 +105,6 @@ extern "C" {
return _returnString.c_str();
}
DllExport void __stdcall SetMousePosition(double x, double y) { KeyManager::SetMousePosition(x, y); }
DllExport void __stdcall SetMouseMovement(int16_t x, int16_t y) { KeyManager::SetMouseMovement(x, y); }
DllExport void __stdcall UpdateInputDevices() { if(_keyManager) { _keyManager->UpdateDevices(); } }
DllExport void __stdcall GetPressedKeys(uint32_t *keyBuffer) {
vector<uint32_t> pressedKeys = KeyManager::GetPressedKeys();
for(size_t 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)
{
_returnString = KeyManager::GetKeyName(keyCode);
return _returnString.c_str();
}
DllExport uint32_t __stdcall GetKeyCode(char* keyName) {
if(keyName) {
return KeyManager::GetKeyCode(keyName);
} else {
return 0;
}
}
DllExport void __stdcall Run()
{
if(_console) {
@ -163,7 +130,7 @@ extern "C" {
_console->Release();
_console.reset();
//_shortcutKeyHandler.reset();
_shortcutKeyHandler.reset();
}
DllExport INotificationListener* __stdcall RegisterNotificationCallback(NotificationListenerCallback callback)

View file

@ -0,0 +1,73 @@
#include "stdafx.h"
#include "../Core/KeyManager.h"
#include "../Core/ShortcutKeyHandler.h"
extern unique_ptr<IKeyManager> _keyManager;
extern unique_ptr<ShortcutKeyHandler> _shortcutKeyHandler;
static string _returnString;
extern "C"
{
DllExport void __stdcall SetMousePosition(double x, double y)
{
KeyManager::SetMousePosition(x, y);
}
DllExport void __stdcall SetMouseMovement(int16_t x, int16_t y)
{
KeyManager::SetMouseMovement(x, y);
}
DllExport void __stdcall UpdateInputDevices()
{
if(_keyManager) {
_keyManager->UpdateDevices();
}
}
DllExport void __stdcall GetPressedKeys(uint32_t *keyBuffer)
{
vector<uint32_t> pressedKeys = KeyManager::GetPressedKeys();
for(size_t 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)
{
_returnString = KeyManager::GetKeyName(keyCode);
return _returnString.c_str();
}
DllExport uint32_t __stdcall GetKeyCode(char* keyName)
{
if(keyName) {
return KeyManager::GetKeyCode(keyName);
} else {
return 0;
}
}
}

View file

@ -456,6 +456,7 @@
<ClCompile Include="ConfigApiWrapper.cpp" />
<ClCompile Include="EmuApiWrapper.cpp" />
<ClCompile Include="DebugApiWrapper.cpp" />
<ClCompile Include="InputApiWrapper.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>

View file

@ -34,5 +34,8 @@
<ClCompile Include="ConfigApiWrapper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="InputApiWrapper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -45,7 +45,6 @@ namespace Mesen.GUI.Config
string portableFolder = DefaultPortableFolder;
string documentsFolder = DefaultDocumentsFolder;
//Linux only
string portableConfig = Path.Combine(portableFolder, "settings.xml");
string documentsConfig = Path.Combine(documentsFolder, "settings.xml");
@ -169,10 +168,9 @@ namespace Mesen.GUI.Config
string switchName = match.Groups[1].Value;
string switchValue = match.Groups[2].Value;
/*ApplySetting(typeof(VideoInfo), Config.VideoInfo, switchName, switchValue);
ApplySetting(typeof(AudioInfo), Config.AudioInfo, switchName, switchValue);
ApplySetting(typeof(EmulationInfo), Config.EmulationInfo, switchName, switchValue);*/
ApplySetting(typeof(Configuration), Config, switchName, switchValue);
ApplySetting(typeof(VideoConfig), Config.Video, switchName, switchValue);
ApplySetting(typeof(AudioConfig), Config.Audio, switchName, switchValue);
ApplySetting(typeof(EmulationConfig), Config.Emulation, switchName, switchValue);
}
}
}
@ -199,19 +197,19 @@ namespace Mesen.GUI.Config
}
} catch {
//If the folder doesn't exist and we couldn't create it, use the default folder
//EmuApi.WriteLogEntry("[UI] Folder could not be created: " + folder);
EmuApi.WriteLogEntry("[UI] Folder could not be created: " + folder);
folder = defaultFolderName;
}
return folder;
}
/* public static string AviFolder { get { return GetFolder(DefaultAviFolder, Config.PreferenceInfo.AviFolder, Config.PreferenceInfo.OverrideAviFolder); } }
public static string MovieFolder { get { return GetFolder(DefaultMovieFolder, Config.PreferenceInfo.MovieFolder, Config.PreferenceInfo.OverrideMovieFolder); } }
public static string SaveFolder { get { return GetFolder(DefaultSaveDataFolder, Config.PreferenceInfo.SaveDataFolder, Config.PreferenceInfo.OverrideSaveDataFolder); } }
public static string SaveStateFolder { get { return GetFolder(DefaultSaveStateFolder, Config.PreferenceInfo.SaveStateFolder, Config.PreferenceInfo.OverrideSaveStateFolder); } }
public static string ScreenshotFolder { get { return GetFolder(DefaultScreenshotFolder, Config.PreferenceInfo.ScreenshotFolder, Config.PreferenceInfo.OverrideScreenshotFolder); } }
public static string WaveFolder { get { return GetFolder(DefaultWaveFolder, Config.PreferenceInfo.WaveFolder, Config.PreferenceInfo.OverrideWaveFolder); } }
*/
public static string AviFolder { get { return GetFolder(DefaultAviFolder, Config.Preferences.AviFolder, Config.Preferences.OverrideAviFolder); } }
public static string MovieFolder { get { return GetFolder(DefaultMovieFolder, Config.Preferences.MovieFolder, Config.Preferences.OverrideMovieFolder); } }
public static string SaveFolder { get { return GetFolder(DefaultSaveDataFolder, Config.Preferences.SaveDataFolder, Config.Preferences.OverrideSaveDataFolder); } }
public static string SaveStateFolder { get { return GetFolder(DefaultSaveStateFolder, Config.Preferences.SaveStateFolder, Config.Preferences.OverrideSaveStateFolder); } }
public static string ScreenshotFolder { get { return GetFolder(DefaultScreenshotFolder, Config.Preferences.ScreenshotFolder, Config.Preferences.OverrideScreenshotFolder); } }
public static string WaveFolder { get { return GetFolder(DefaultWaveFolder, Config.Preferences.WaveFolder, Config.Preferences.OverrideWaveFolder); } }
public static string DebuggerFolder { get { return GetFolder(Path.Combine(ConfigManager.HomeFolder, "Debugger"), null, false); } }
public static string DownloadFolder { get { return GetFolder(Path.Combine(ConfigManager.HomeFolder, "Downloads"), null, false); } }
public static string BackupFolder { get { return GetFolder(Path.Combine(ConfigManager.HomeFolder, "Backups"), null, false); } }
@ -277,6 +275,7 @@ namespace Mesen.GUI.Config
public static void ResetSettings()
{
//TODO
//DefaultKeyMappingType defaultMappings = Config.InputInfo.DefaultMapping;
_dirtyConfig = new Configuration();
//Config.InputInfo.DefaultMapping = defaultMappings;

View file

@ -18,6 +18,8 @@ namespace Mesen.GUI.Config
public RecentItems RecentFiles;
public VideoConfig Video;
public AudioConfig Audio;
public EmulationConfig Emulation;
public PreferencesConfig Preferences;
public DebugInfo Debug;
public Point? WindowLocation;
public Size? WindowSize;
@ -28,6 +30,8 @@ namespace Mesen.GUI.Config
Debug = new DebugInfo();
Video = new VideoConfig();
Audio = new AudioConfig();
Emulation = new EmulationConfig();
Preferences = new PreferencesConfig();
}
~Configuration()
@ -55,10 +59,13 @@ namespace Mesen.GUI.Config
{
Video.ApplyConfig();
Audio.ApplyConfig();
Preferences.ApplyConfig();
Emulation.ApplyConfig();
}
public void InitializeDefaults()
{
Preferences.InitializeDefaultShortcuts();
}
public static Configuration Deserialize(string configFile)

View file

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Mesen.GUI.Config
{
[StructLayout(LayoutKind.Sequential)]
public class EmulationConfig : BaseConfig<EmulationConfig>
{
[MinMax(0, 5000)] public UInt32 EmulationSpeed = 100;
[MinMax(0, 5000)] public UInt32 TurboSpeed = 300;
[MinMax(0, 5000)] public UInt32 RewindSpeed = 100;
[MarshalAs(UnmanagedType.I1)] public bool AllowInvalidInput = false;
[MarshalAs(UnmanagedType.I1)] public bool EnableMapperRandomPowerOnState = false;
[MinMax(0, 1000)] public UInt32 PpuExtraScanlinesBeforeNmi = 0;
[MinMax(0, 1000)] public UInt32 PpuExtraScanlinesAfterNmi = 0;
public RamPowerOnState RamPowerOnState;
public void ApplyConfig()
{
ConfigApi.SetEmulationConfig(this);
}
}
public enum RamPowerOnState
{
AllZeros = 0,
AllOnes = 1,
Random = 2
}
}

View file

@ -0,0 +1,138 @@
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Microsoft.Win32;
namespace Mesen.GUI.Config
{
class FileAssociationHelper
{
static private string CreateMimeType(string mimeType, string extension, string description, List<string> mimeTypes, bool addType)
{
string baseFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ".local", "share", "mime", "packages");
if(!Directory.Exists(baseFolder)) {
Directory.CreateDirectory(baseFolder);
}
string filename = Path.Combine(baseFolder, mimeType + ".xml");
if(addType) {
File.WriteAllText(filename,
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
"<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">" + Environment.NewLine +
"\t<mime-type type=\"application/" + mimeType + "\">" + Environment.NewLine +
"\t\t<glob-deleteall/>" + Environment.NewLine +
"\t\t<glob pattern=\"*." + extension + "\"/>" + Environment.NewLine +
"\t\t<comment>" + description + "</comment>" + Environment.NewLine +
"\t\t<icon>MesenIcon</icon>" + Environment.NewLine +
"\t</mime-type>" + Environment.NewLine +
"</mime-info>" + Environment.NewLine);
mimeTypes.Add(mimeType);
} else if(File.Exists(filename)) {
try {
File.Delete(filename);
} catch { }
}
return mimeType;
}
static public void ConfigureLinuxMimeTypes()
{
PreferencesConfig cfg = ConfigManager.Config.Preferences;
string baseFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ".local", "share");
string desktopFolder = Path.Combine(baseFolder, "applications");
string mimeFolder = Path.Combine(baseFolder, "mime");
string iconFolder = Path.Combine(baseFolder, "icons");
if(!Directory.Exists(mimeFolder)) {
Directory.CreateDirectory(mimeFolder);
}
if(!Directory.Exists(iconFolder)) {
Directory.CreateDirectory(iconFolder);
}
if(!Directory.Exists(desktopFolder)) {
Directory.CreateDirectory(desktopFolder);
}
//Use a GUID to get a unique filename and then delete old files to force a reset of file associations
//Otherwise they are sometimes not refreshed properly
string desktopFilename = "mesen-s." + Guid.NewGuid().ToString() + ".desktop";
string desktopFile = Path.Combine(desktopFolder, desktopFilename);
foreach(string file in Directory.GetFiles(desktopFolder, "mesen-s.*.desktop")) {
if(File.Exists(file)) {
try {
File.Delete(file);
} catch { }
}
}
List<string> mimeTypes = new List<string>();
CreateMimeType("x-mesen-nes", "sfc", "SNES Rom", mimeTypes, cfg.AssociateRomFiles);
CreateMimeType("x-mesen-nes", "smc", "SNES Rom", mimeTypes, cfg.AssociateRomFiles);
CreateMimeType("x-mesen-nes", "swc", "SNES Rom", mimeTypes, cfg.AssociateRomFiles);
CreateMimeType("x-mesen-nes", "fig", "SNES Rom", mimeTypes, cfg.AssociateRomFiles);
CreateMimeType("x-mesen-mst", "mst", "Mesen-S Save State", mimeTypes, cfg.AssociateMssFiles);
CreateMimeType("x-mesen-mmo", "mmo", "Mesen-S Movie File", mimeTypes, cfg.AssociateMsmFiles);
//Icon used for shortcuts
//TOOD
//Mesen.GUI.Properties.Resources.MesenIcon.Save(Path.Combine(iconFolder, "MesenSIcon.png"), ImageFormat.Png);
CreateShortcutFile(desktopFile, mimeTypes);
//Update databases
try {
System.Diagnostics.Process.Start("update-mime-database", mimeFolder).WaitForExit();
System.Diagnostics.Process.Start("update-desktop-database", desktopFolder);
} catch {
try {
EmuApi.WriteLogEntry("An error occurred while updating file associations");
} catch {
//For some reason, Mono crashes when trying to call this if libMesenCore.dll was not already next to the .exe before the process starts?
//This causes a "MesenCore.dll not found" popup, so catch it here and ignore it.
}
}
}
static public void CreateShortcutFile(string filename, List<string> mimeTypes = null)
{
string content =
"[Desktop Entry]" + Environment.NewLine +
"Type=Application" + Environment.NewLine +
"Name=Mesen-S" + Environment.NewLine +
"Comment=SNES Emulator" + Environment.NewLine +
"Keywords=game;snes;super;famicom;emulator;emu;ファミコン;nintendo" + Environment.NewLine +
"Categories=GNOME;GTK;Game;Emulator;" + Environment.NewLine;
if(mimeTypes != null) {
content += "MimeType=" + string.Join(";", mimeTypes.Select(type => "application/" + type)) + Environment.NewLine;
}
content +=
"Exec=mono " + System.Reflection.Assembly.GetEntryAssembly().Location + " %f" + Environment.NewLine +
"NoDisplay=false" + Environment.NewLine +
"StartupNotify=true" + Environment.NewLine +
"Icon=MesenSIcon" + Environment.NewLine;
File.WriteAllText(filename, content);
}
static public void UpdateFileAssociation(string extension, bool associate)
{
string key = @"HKEY_CURRENT_USER\Software\Classes\." + extension;
if(associate) {
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Classes\Mesen-S\shell\open\command", null, Application.ExecutablePath + " \"%1\"");
Registry.SetValue(key, null, "Mesen-S");
} else {
object regKey = Registry.GetValue(key, null, "");
if(regKey != null && regKey.Equals("Mesen-S")) {
Registry.SetValue(key, null, "");
}
}
}
}
}

View file

@ -0,0 +1,168 @@
using Mesen.GUI.Config.Shortcuts;
using Mesen.GUI.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesen.GUI.Config
{
public class PreferencesConfig
{
public Language DisplayLanguage = Language.SystemDefault;
public bool AutomaticallyCheckForUpdates = true;
public bool SingleInstance = true;
public bool AutoLoadPatches = true;
public bool AssociateRomFiles = false;
public bool AssociateMsmFiles = false;
public bool AssociateMssFiles = false;
public bool AlwaysOnTop = false;
public bool ShowFps = false;
public bool ShowFrameCounter = false;
public bool ShowGameTimer = false;
public bool ShowTitleBarInfo = false;
public bool ShowDebugInfo = false;
public bool DisableOsd = false;
public List<ShortcutKeyInfo> ShortcutKeys1;
public List<ShortcutKeyInfo> ShortcutKeys2;
public bool OverrideGameFolder = false;
public bool OverrideAviFolder = false;
public bool OverrideMovieFolder = false;
public bool OverrideSaveDataFolder = false;
public bool OverrideSaveStateFolder = false;
public bool OverrideScreenshotFolder = false;
public bool OverrideWaveFolder = false;
public string GameFolder = "";
public string AviFolder = "";
public string MovieFolder = "";
public string SaveDataFolder = "";
public string SaveStateFolder = "";
public string ScreenshotFolder = "";
public string WaveFolder = "";
public PreferencesConfig()
{
}
public PreferencesConfig Clone()
{
PreferencesConfig copy = (PreferencesConfig)this.MemberwiseClone();
copy.ShortcutKeys1 = new List<ShortcutKeyInfo>(copy.ShortcutKeys1);
copy.ShortcutKeys2 = new List<ShortcutKeyInfo>(copy.ShortcutKeys2);
return copy;
}
public void InitializeDefaultShortcuts()
{
if(ShortcutKeys1 != null && ShortcutKeys2 != null) {
return;
}
ShortcutKeys1 = new List<ShortcutKeyInfo>();
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.FastForward, new KeyCombination() { Key1 = InputApi.GetKeyCode("Tab") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Rewind, new KeyCombination() { Key1 = InputApi.GetKeyCode("Backspace") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.IncreaseSpeed, new KeyCombination() { Key1 = InputApi.GetKeyCode("=") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.DecreaseSpeed, new KeyCombination() { Key1 = InputApi.GetKeyCode("-") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.MaxSpeed, new KeyCombination() { Key1 = InputApi.GetKeyCode("F9") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.ToggleFps, new KeyCombination() { Key1 = InputApi.GetKeyCode("F10") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.ToggleFullscreen, new KeyCombination() { Key1 = InputApi.GetKeyCode("F11") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.TakeScreenshot, new KeyCombination() { Key1 = InputApi.GetKeyCode("F12") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Reset, new KeyCombination() { Key1 = InputApi.GetKeyCode("Ctrl"), Key2 = InputApi.GetKeyCode("R") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.PowerCycle, new KeyCombination() { Key1 = InputApi.GetKeyCode("Ctrl"), Key2 = InputApi.GetKeyCode("T") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Pause, new KeyCombination() { Key1 = InputApi.GetKeyCode("Esc") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale1x, new KeyCombination() { Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("1") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale2x, new KeyCombination() { Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("2") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale3x, new KeyCombination() { Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("3") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale4x, new KeyCombination() { Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("4") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale5x, new KeyCombination() { Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("5") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale6x, new KeyCombination() { Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("6") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.OpenFile, new KeyCombination() { Key1 = InputApi.GetKeyCode("Ctrl"), Key2 = InputApi.GetKeyCode("O") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot1, new KeyCombination() { Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F1") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot2, new KeyCombination() { Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F2") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot3, new KeyCombination() { Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F3") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot4, new KeyCombination() { Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F4") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot5, new KeyCombination() { Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F5") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot6, new KeyCombination() { Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F6") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot7, new KeyCombination() { Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F7") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateToFile, new KeyCombination() { Key1 = InputApi.GetKeyCode("Ctrl"), Key2 = InputApi.GetKeyCode("S") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot1, new KeyCombination() { Key1 = InputApi.GetKeyCode("F1") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot2, new KeyCombination() { Key1 = InputApi.GetKeyCode("F2") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot3, new KeyCombination() { Key1 = InputApi.GetKeyCode("F3") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot4, new KeyCombination() { Key1 = InputApi.GetKeyCode("F4") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot5, new KeyCombination() { Key1 = InputApi.GetKeyCode("F5") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot6, new KeyCombination() { Key1 = InputApi.GetKeyCode("F6") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot7, new KeyCombination() { Key1 = InputApi.GetKeyCode("F7") }));
//TODO ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlotAuto, new KeyCombination() { Key1 = InputApi.GetKeyCode("F8") }));
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateFromFile, new KeyCombination() { Key1 = InputApi.GetKeyCode("Ctrl"), Key2 = InputApi.GetKeyCode("L") }));
ShortcutKeys2 = new List<ShortcutKeyInfo>();
ShortcutKeys2.Add(new ShortcutKeyInfo(EmulatorShortcut.FastForward, new KeyCombination() { Key1 = InputApi.GetKeyCode("Pad1 R2") }));
ShortcutKeys2.Add(new ShortcutKeyInfo(EmulatorShortcut.Rewind, new KeyCombination() { Key1 = InputApi.GetKeyCode("Pad1 L2") }));
}
public void ApplyConfig()
{
if(Program.IsMono) {
FileAssociationHelper.ConfigureLinuxMimeTypes();
} else {
FileAssociationHelper.UpdateFileAssociation("sfc", this.AssociateRomFiles);
FileAssociationHelper.UpdateFileAssociation("smc", this.AssociateRomFiles);
FileAssociationHelper.UpdateFileAssociation("swc", this.AssociateRomFiles);
FileAssociationHelper.UpdateFileAssociation("fig", this.AssociateRomFiles);
FileAssociationHelper.UpdateFileAssociation("msm", this.AssociateMsmFiles);
FileAssociationHelper.UpdateFileAssociation("mss", this.AssociateMssFiles);
}
ConfigApi.SetPreferences(new InteropPreferencesConfig() {
ShowFps = ShowFps,
ShowFrameCounter = ShowFrameCounter,
ShowGameTimer = ShowGameTimer,
ShowDebugInfo = ShowDebugInfo,
DisableOsd = DisableOsd,
SaveFolderOverride = OverrideSaveDataFolder ? SaveDataFolder : "",
SaveStateFolderOverride = OverrideSaveStateFolder ? SaveStateFolder : "",
ScreenshotFolderOverride = OverrideScreenshotFolder ? ScreenshotFolder : ""
});
Application.OpenForms[0].TopMost = AlwaysOnTop;
ShortcutKeyInfo[] shortcutKeys = new ShortcutKeyInfo[ShortcutKeys1.Count + ShortcutKeys2.Count];
int i = 0;
foreach(ShortcutKeyInfo shortcutInfo in ShortcutKeys1) {
shortcutKeys[i++] = shortcutInfo;
}
foreach(ShortcutKeyInfo shortcutInfo in ShortcutKeys2) {
shortcutKeys[i++] = shortcutInfo;
}
ConfigApi.SetShortcutKeys(shortcutKeys, (UInt32)shortcutKeys.Length);
}
}
public struct InteropPreferencesConfig
{
[MarshalAs(UnmanagedType.I1)] public bool ShowFps;
[MarshalAs(UnmanagedType.I1)] public bool ShowFrameCounter;
[MarshalAs(UnmanagedType.I1)] public bool ShowGameTimer;
[MarshalAs(UnmanagedType.I1)] public bool ShowDebugInfo;
[MarshalAs(UnmanagedType.I1)] public bool DisableOsd;
public string SaveFolderOverride;
public string SaveStateFolderOverride;
public string ScreenshotFolderOverride;
}
}

View file

@ -55,16 +55,15 @@ namespace Mesen.GUI.Config
public override string ToString()
{
string text;
/*if(ConfigManager.Config.PreferenceInfo.ShowFullPathInRecents) {
text = RomFile.ReadablePath.Replace("&", "&&");
} else {*/
text = Path.GetFileName(RomFile.FileName).Replace("&", "&&");
//}
string path = RomFile.ReadablePath.Replace("&", "&&");
string file = Path.GetFileName(path);
string folder = Path.GetDirectoryName(path);
string text = file;
if(PatchFile.HasValue) {
text += " [" + Path.GetFileName(PatchFile.Value) + "]";
}
text += " (" + folder + ")";
return text;
}
}

View file

@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mesen.GUI.Config.Shortcuts
{
public enum EmulatorShortcut
{
FastForward,
Rewind,
RewindTenSecs,
RewindOneMin,
MoveToNextStateSlot,
MoveToPreviousStateSlot,
SaveState,
LoadState,
ToggleAudio,
ToggleFastForward,
ToggleRewind,
RunSingleFrame,
// Everything below this is handled UI-side
TakeScreenshot,
IncreaseSpeed,
DecreaseSpeed,
MaxSpeed,
Pause,
Reset,
PowerCycle,
PowerOff,
Exit,
SetScale1x,
SetScale2x,
SetScale3x,
SetScale4x,
SetScale5x,
SetScale6x,
ToggleFullscreen,
ToggleFps,
ToggleGameTimer,
ToggleFrameCounter,
ToggleOsd,
ToggleAlwaysOnTop,
ToggleDebugInfo,
SaveStateSlot1,
SaveStateSlot2,
SaveStateSlot3,
SaveStateSlot4,
SaveStateSlot5,
SaveStateSlot6,
SaveStateSlot7,
SaveStateSlot8,
SaveStateSlot9,
SaveStateSlot10,
SaveStateToFile,
LoadStateSlot1,
LoadStateSlot2,
LoadStateSlot3,
LoadStateSlot4,
LoadStateSlot5,
LoadStateSlot6,
LoadStateSlot7,
LoadStateSlot8,
LoadStateSlot9,
LoadStateSlot10,
LoadStateFromFile,
OpenFile
}
}

View file

@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mesen.GUI.Config.Shortcuts
{
public struct KeyCombination
{
public UInt32 Key1;
public UInt32 Key2;
public UInt32 Key3;
public bool IsEmpty { get { return Key1 == 0 && Key2 == 0 && Key3 == 0; } }
public override string ToString()
{
if(IsEmpty) {
return "";
} else {
return GetKeyNames();
}
}
public KeyCombination(List<UInt32> scanCodes = null)
{
if(scanCodes != null) {
if(scanCodes.Any(code => code > 0xFFFF)) {
//If both keyboard & gamepad codes exist, only use the gamepad codes
//This fixes an issue with Steam where Steam can remap gamepad buttons to send keyboard keys
//See: Settings -> Controller Settings -> General Controller Settings -> Checking the Xbox/PS4/Generic/etc controller checkboxes will cause this
scanCodes = scanCodes.Where(code => code > 0xFFFF).ToList();
}
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;
}
}
private string GetKeyNames()
{
List<UInt32> scanCodes = new List<uint>() { Key1, Key2, Key3 };
List<string> keyNames = scanCodes.Select((UInt32 scanCode) => InputApi.GetKeyName(scanCode)).Where((keyName) => !string.IsNullOrWhiteSpace(keyName)).ToList();
keyNames.Sort((string a, string b) => {
if(a == b) {
return 0;
}
if(a == "Ctrl") {
return -1;
} else if(b == "Ctrl") {
return 1;
}
if(a == "Alt") {
return -1;
} else if(b == "Alt") {
return 1;
}
if(a == "Shift") {
return -1;
} else if(b == "Shift") {
return 1;
}
return a.CompareTo(b);
});
return string.Join("+", keyNames);
}
}
}

View file

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Mesen.GUI.Config.Shortcuts
{
public struct ShortcutKeyInfo
{
public EmulatorShortcut Shortcut;
public KeyCombination KeyCombination;
public ShortcutKeyInfo(EmulatorShortcut key, KeyCombination keyCombination)
{
Shortcut = key;
KeyCombination = keyCombination;
}
}
}

View file

@ -36,9 +36,9 @@ namespace Mesen.GUI.Controls
private void SetMouseButtonState(MouseButtons pressedButtons)
{
EmuApi.SetKeyState(LeftMouseButtonKeyCode, pressedButtons.HasFlag(MouseButtons.Left));
EmuApi.SetKeyState(RightMouseButtonKeyCode, pressedButtons.HasFlag(MouseButtons.Right));
EmuApi.SetKeyState(MiddleMouseButtonKeyCode, pressedButtons.HasFlag(MouseButtons.Middle));
InputApi.SetKeyState(LeftMouseButtonKeyCode, pressedButtons.HasFlag(MouseButtons.Left));
InputApi.SetKeyState(RightMouseButtonKeyCode, pressedButtons.HasFlag(MouseButtons.Right));
InputApi.SetKeyState(MiddleMouseButtonKeyCode, pressedButtons.HasFlag(MouseButtons.Middle));
}
private void ctrlRenderer_MouseMove(object sender, MouseEventArgs e)
@ -55,13 +55,13 @@ namespace Mesen.GUI.Controls
xPos = Math.Max(0.0, Math.Min(1.0, xPos));
yPos = Math.Max(0.0, Math.Min(1.0, yPos));
EmuApi.SetMousePosition(xPos, yPos);
InputApi.SetMousePosition(xPos, yPos);
}
private void ctrlRenderer_MouseLeave(object sender, EventArgs e)
{
//CursorManager.OnMouseLeave();
EmuApi.SetMousePosition(-1, -1);
InputApi.SetMousePosition(-1, -1);
}
}
}

View file

@ -347,7 +347,7 @@
<Form ID="frmPreferences" Title="Preferences">
<Control ID="tpgGeneral">General</Control>
<Control ID="lblDisplayLanguage">Display Language:</Control>
<Control ID="chkSingleInstance">Only allow one instance of Mesen at a time</Control>
<Control ID="chkSingleInstance">Only allow one instance of Mesen-S at a time</Control>
<Control ID="chkAutomaticallyCheckForUpdates">Automatically check for updates</Control>
<Control ID="chkDeveloperMode">Enable developer mode</Control>
@ -370,19 +370,18 @@
<Control ID="chkAutoLoadIps">Automatically load IPS/BPS patches</Control>
<Control ID="chkHidePauseOverlay">Hide the pause screen</Control>
<Control ID="chkDisplayMovieIcons">Display play/record icon when playing or recording a movie</Control>
<Control ID="btnOpenMesenFolder">Open Mesen Folder</Control>
<Control ID="btnOpenMesenFolder">Open Mesen-S Folder</Control>
<Control ID="btnResetSettings">Reset All Settings</Control>
<Control ID="tpgFiles">Folders/Files</Control>
<Control ID="grpFileAssociations">File Associations</Control>
<Control ID="chkNesFormat">.NES</Control>
<Control ID="chkFdsFormat">.FDS (Famicom Disk System)</Control>
<Control ID="chkMmoFormat">.MMO (Mesen Movies)</Control>
<Control ID="chkMstFormat">.MST (Mesen Save State)</Control>
<Control ID="chkRomFormat">.SFC, .SMC, .SWC, .FIG (Roms)</Control>
<Control ID="chkMsmFormat">.MMO (Movie)</Control>
<Control ID="chkMssFormat">.MST (Save State)</Control>
<Control ID="grpDataStorageLocation">Data Storage Location</Control>
<Control ID="radStorageDocuments">Store Mesen's data in my user profile</Control>
<Control ID="radStoragePortable">Store Mesen's data in the same folder as the application</Control>
<Control ID="radStorageDocuments">Store data in my user profile</Control>
<Control ID="radStoragePortable">Store data in the same folder as the application</Control>
<Control ID="lblDataLocation">Folder:</Control>
<Control ID="grpPathOverrides">Folder Overrides</Control>
@ -554,24 +553,24 @@
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Cancel</Control>
</Form>
<Form ID="frmAbout" Title="About - Mesen">
<Control ID="labelProductName">Mesen</Control>
<Form ID="frmAbout" Title="About - Mesen-S">
<Control ID="labelProductName">Mesen-S</Control>
<Control ID="labelCopyright">© 2019 M. Bibaud (aka Sour)</Control>
<Control ID="lblWebsite">Website:</Control>
<Control ID="lblLink">www.mesen.ca</Control>
<Control ID="labelVersion">Version:</Control>
<Control ID="lblBuildDateLabel">Build Date:</Control>
<Control ID="lblDonate">If you want to support Mesen, please consider donating.&#13;Thank you for your support!</Control>
<Control ID="lblDonate">If you want to support Mesen-S, please consider donating.&#13;Thank you for your support!</Control>
<Control ID="okButton">&amp;OK</Control>
</Form>
<Form ID="frmGameConfig" Title="Game Configuration">
<Control ID="grpDipSwitches">DIP Switches</Control>
</Form>
<Form ID="frmUpdatePrompt" Title="Mesen - Update Available">
<Form ID="frmUpdatePrompt" Title="Mesen-S - Update Available">
<Control ID="lblLatestVersion">Latest Version:</Control>
<Control ID="lblCurrentVersion">Current Version:</Control>
<Control ID="lblChangeLog">Changelog:</Control>
<Control ID="lblDonate">If you want to support Mesen, please consider donating. Thank you!</Control>
<Control ID="lblDonate">If you want to support Mesen-S, please consider donating. Thank you!</Control>
<Control ID="btnUpdate">Update</Control>
<Control ID="btnCancel">Cancel</Control>
</Form>
@ -644,17 +643,17 @@
<Control ID="tpgVideoOptions">Video Options</Control>
<Control ID="tpgAudioOptions">Audio Options</Control>
<Control ID="tpgEmulationOptions">Emulation Options</Control>
<Control ID="lblExplanation">This will start Mesen in fullscreen mode with the "MyGame.nes" rom loaded. It will also use the NTSC filter, set at a 2x scale and configure the Overscan settings. The "DoNotSaveSettings" flag is used to prevent the command line switches from pernanently altering Mesen's settings.</Control>
<Control ID="lblExplanation">This will start Mesen-S in fullscreen mode with the "MyGame.nes" rom loaded. It will also use the NTSC filter, set at a 2x scale and configure the Overscan settings. The "DoNotSaveSettings" flag is used to prevent the command line switches from pernanently altering Mesen-S's settings.</Control>
</Form>
<Form ID="frmCopyFiles" Title="Please wait...">
<Control ID="lblCopying">Copying:</Control>
</Form>
<Form ID="frmConfigWizard" Title="Mesen - Configuration">
<Control ID="lblMesen">Mesen - NES Emulator</Control>
<Form ID="frmConfigWizard" Title="Mesen-S - Configuration">
<Control ID="lblMesen">Mesen-S - SNES Emulator</Control>
<Control ID="lblConfigWizard">Configuration Wizard</Control>
<Control ID="lblInitialSetup">Please take a moment to perform Mesen's initial setup.</Control>
<Control ID="lblInitialSetup">Please take a moment to perform Mesen-S's initial setup.</Control>
<Control ID="lblStorageLocation">Data Storage Location</Control>
<Control ID="lblStorageHint">Select where you want to store Mesen's data:</Control>
<Control ID="lblStorageHint">Select where you want to store Mesen-S's data:</Control>
<Control ID="radStorageDocuments">Store the data in my user profile</Control>
<Control ID="radStoragePortable">Store the data in the same folder as the application</Control>
<Control ID="lblDataLocation">Folder:</Control>
@ -774,7 +773,7 @@
<Message ID="FilterRomIps">All supported formats (*.nes, *.zip, *.7z, *.fds, *.nsf, *.nsfe, *.unf, *.ips, *.bps, *.ups)|*.NES;*.ZIP;*.7z;*.IPS;*.BPS;*.UPS;*.FDS;*.NSF;*.NSFE;*.UNF|NES Roms (*.nes, *.unf)|*.NES;*.UNF|Famicom Disk System Roms (*.fds)|*.FDS|NSF files (*.nsf, *.nsfe)|*.nsf;*.nsfe|ZIP Archives (*.zip)|*.ZIP|7-Zip Archives (*.7z)|*.7z|IPS/UPS/BPS Patches (*.ips, *.bps, *.ups)|*.IPS;*.BPS;*.UPS|All (*.*)|*.*</Message>
<Message ID="FilterTest">Test files (*.mtp)|*.mtp|All (*.*)|*.*</Message>
<Message ID="FilterCheat">All supported formats (*.cht, *.xml)|*.cht;*.xml</Message>
<Message ID="FilterSavestate">Mesen Savestates (*.mst)|*.mst|All files (*.*)|*.*</Message>
<Message ID="FilterSavestate">Mesen-S Savestates (*.mss)|*.mss|All files (*.*)|*.*</Message>
<Message ID="FilterTapeFiles">Family Basic Tape files (*.fbt)|*.fbt|All Files (*.*)|*.*</Message>
<Message ID="LoadFromFile">Load from file...</Message>
@ -793,7 +792,7 @@
<Message ID="BandaiMicrophone">Bandai Microphone</Message>
<Message ID="DatachBarcodeReader">Datach Barcode Reader</Message>
<Message ID="HelpFullscreen">/fullscreen - Start Mesen in fullscreen mode</Message>
<Message ID="HelpFullscreen">/fullscreen - Start Mesen-S in fullscreen mode</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings)</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.mmo" - Start recording a movie after the specified game is loaded.</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - Resumes the game in the state it was left in when it was last played.</Message>
@ -815,11 +814,11 @@
<Message ID="ResetSettingsConfirmation">Warning: This will reset ALL of settings and cannot be undone!&#xA;&#xA;Continue?</Message>
<Message ID="RandomGameNoGameFound">Mesen could not find any games to load.</Message>
<Message ID="RandomGameNoGameFound">Mesen-S could not find any games to load.</Message>
<Message ID="CannotWriteToFolder">The selected folder cannot be written to - please select another folder and try again.&#xA;&#xA;Details:&#xA;{0}</Message>
<Message ID="InvalidPaths">The following path overrides are invalid:&#xA;&#xA;{0}&#xA;&#xA;Please use valid and writable folders and try again.</Message>
<Message ID="CopyMesenDataPrompt">All files will be copied from:&#xA;&#xA;{0}&#xA;to&#xA;{1}&#xA;&#xA;Once the copy is completed, Mesen will restart.&#xA;Continue?</Message>
<Message ID="CopyMesenDataPrompt">All files will be copied from:&#xA;&#xA;{0}&#xA;to&#xA;{1}&#xA;&#xA;Once the copy is completed, Mesen-S will restart.&#xA;Continue?</Message>
<Message ID="CheatsFound">{0} games and {1} cheats in database</Message>
<Message ID="CheatsImported">{0} cheats imported for {1}.</Message>
@ -831,41 +830,24 @@
<Message ID="CouldNotInstallRuntime">The Visual Studio Runtime could not be installed properly.</Message>
<Message ID="EmptyState">&lt;empty&gt;</Message>
<Message ID="ErrorWhileCheckingUpdates">An error has occurred while trying to check for updates. Check your internet connection and try again.&#xA;&#xA;Error details:&#xA;{0}</Message>
<Message ID="AutoUpdateDisabledMessage">Automatic updates are not enabled on this build - please download the latest version of the code and recompile Mesen to get the latest updates.</Message>
<Message ID="AutoUpdateDisabledMessage">Automatic updates are not enabled on this build - please download the latest version of the code and recompile Mesen-S to get the latest updates.</Message>
<Message ID="FdsBiosNotFound">FDS bios not found. The bios is required to run FDS games.&#xA;&#xA;Select bios file now?</Message>
<Message ID="FdsDiskSide">Disk {0} Side {1}</Message>
<Message ID="FileNotFound">File not found: {0}</Message>
<Message ID="InvalidFdsBios">The selected bios file is invalid.</Message>
<Message ID="HDNesTooltip">This option allows Mesen to load HDNes-format HD packs if they are found.&#xA;&#xA;HD Packs should be placed in the "HdPacks" folder in a subfolder matching the name of the ROM.&#xA;e.g: MyRom.nes should have their HD Pack in "HdPacks\MyRom\hires.txt".</Message>
<Message ID="HdPackBuilderScaleHelp">Selects the scale and video filter to use when generating the PNG files&#xA;for the HD Pack. Use the "Prescale" filters to generate the tiles&#xA;at a larger scale without applying any transformation to the pixels.</Message>
<Message ID="HdPackBuilderBankSizeHelp">This option is only available for CHR RAM games. CHR RAM games have no&#xA;fixed "banks" - they are dynamically created by the game's code.&#xA;This option alters the HD Pack Builder's behavior when grouping the tiles into &#xA;the PNG files - a smaller bank size will usually result in less PNG &#xA;files (but depending on the game's code, larger values may produce &#xA;better results).</Message>
<Message ID="HdPackBuilderFrequencyHelp">When this option is enabled, the tiles in PNG files are sorted by the&#xA;frequency at which they are shown on the screen while recording (more &#xA;common palettes will be grouped together in the first PNG for a specific bank &#xA;number. If this option is unchecked, the PNGs will be sorted by palette - &#xA;each PNG will only contain up to 4 different colors in this case.</Message>
<Message ID="HdPackBuilderGroupBlankHelp">This option groups all the blank tiles sequentially into the same PNG&#xA;files - this helps reduce the number of PNG files produced by removing &#xA;almost-empty PNG files containing only blank tiles.</Message>
<Message ID="HdPackBuilderLargeSpritesHelp">When enabled, this option will alter the display order of CHR banks&#xA;that contain only sprites to make the sprites easier to edit in the PNG file.</Message>
<Message ID="HdPackBuilderIgnoreOverscanHelp">When enabled, this will make the builder ignore any pixels in the overscan area.&#xA;This is useful in games that contain glitches on the outer edge of the screen.&#xA;Incorrect palette combinations due to these glitches will be ignored and won't be shown in the PNG files.</Message>
<Message ID="InstallHdPackWrongRom">The selected HD Pack is not compatible with the currently running game and cannot be installed.</Message>
<Message ID="InstallHdPackError">An error occurred while trying to install the HD Pack: &#xA;&#xA;{0}</Message>
<Message ID="InstallHdPackInvalidPack">The selected file is not a valid HD Pack.</Message>
<Message ID="InstallHdPackInvalidZipFile">The selected file is not a valid Zip file.</Message>
<Message ID="InstallHdPackConfirmOverwrite">The destination folder ({0}) already exists - are you sure you want to overwrite it?</Message>
<Message ID="InstallHdPackConfirmReset">The HD Pack has been installed successfully. Do you want to reset the game and load the HD Pack now?</Message>
<Message ID="MesenUpToDate">You are running the latest version of Mesen</Message>
<Message ID="MesenUpToDate">You are running the latest version of Mesen-S.</Message>
<Message ID="PatchAndReset">Patch and reset the current game?</Message>
<Message ID="SelectRomIps">Please select a ROM matching the IPS/UPS/BPS patch file.</Message>
<Message ID="UnableToDownload">Unable to download file. Check your internet connection and try again.&#xA;&#xA;Details:&#xA;{0}</Message>
<Message ID="UnableToStartMissingDependencies">Mesen could not launch because it was unable to load MesenCore.dll due to missing dependencies.</Message>
<Message ID="UnableToStartMissingFiles">Mesen was unable to start due to missing files.&#xA;&#xA;Error: MesenCore.dll is missing.</Message>
<Message ID="UnableToStartMissingDependencies">Mesen-S could not launch because it was unable to load MesenSCore.dll due to missing dependencies.</Message>
<Message ID="UnableToStartMissingFiles">Mesen-S was unable to start due to missing files.&#xA;&#xA;Error: MesenSCore.dll is missing.</Message>
<Message ID="UnexpectedError">An unexpected error has occurred.&#xA;&#xA;Error details:&#xA;{0}</Message>
<Message ID="UpdateDownloadFailed">Download failed - the file appears to be corrupted. Please visit the Mesen website to download the latest version manually.</Message>
<Message ID="UpgradeSuccess">Upgrade completed successfully.</Message>
<Message ID="UpdaterNotFound">The update process could not be started due to missing files.</Message>
<Message ID="Net45NotFound">The Microsoft .NET Framework 4.5 could not be found. Please download and install the latest version of the .NET Framework from Microsoft's website and try again.</Message>
<Message ID="GoogleDriveIntegrationError">Mesen could not connect to your Google Drive account - please try again.</Message>
<Message ID="InvalidCheatFile">The selected file ({0}) is not a valid cheat file.</Message>
<Message ID="InvalidXmlFile">The selected file ({0}) is not a valid XML file.</Message>
<Message ID="NoMatchingCheats">The selected cheat file ({0}) contains no cheats that match the selected game.</Message>

View file

@ -6,6 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesen.GUI
{
@ -28,5 +29,52 @@ namespace Mesen.GUI
});
_emuThread.Start();
}
public static bool IsRunning()
{
return _emuThread != null;
}
public static void SaveState(uint slot)
{
if(_emuThread != null) {
//EmuApi.SaveState(slot);
}
}
public static void LoadState(uint slot)
{
if(_emuThread != null) {
//EmuApi.LoadState(slot);
}
}
public static void LoadStateFromFile()
{
if(_emuThread != null) {
using(OpenFileDialog ofd = new OpenFileDialog()) {
ofd.InitialDirectory = ConfigManager.SaveStateFolder;
ofd.SetFilter(ResourceHelper.GetMessage("FilterSavestate"));
if(ofd.ShowDialog(Application.OpenForms[0]) == DialogResult.OK) {
//EmuApi.LoadStateFile(ofd.FileName);
}
}
}
}
public static void SaveStateToFile()
{
if(_emuThread != null) {
using(SaveFileDialog sfd = new SaveFileDialog()) {
sfd.InitialDirectory = ConfigManager.SaveStateFolder;
//TODO
//sfd.FileName = EmuApi.GetRomInfo().GetRomName() + ".mst";
sfd.SetFilter(ResourceHelper.GetMessage("FilterSavestate"));
if(sfd.ShowDialog(Application.OpenForms[0]) == DialogResult.OK) {
//EmuApi.SaveStateFile(sfd.FileName);
}
}
}
}
}
}

View file

@ -37,10 +37,10 @@ namespace Mesen.GUI.Forms
if(this.ContainsFocus) {
if(m.Msg == WM_KEYUP || m.Msg == WM_SYSKEYUP) {
int scanCode = (Int32)(((Int64)m.LParam & 0x1FF0000) >> 16);
EmuApi.SetKeyState(scanCode, false);
InputApi.SetKeyState(scanCode, false);
} else if(m.Msg == WM_SYSKEYDOWN || m.Msg == WM_KEYDOWN) {
int scanCode = (Int32)(((Int64)m.LParam & 0x1FF0000) >> 16);
EmuApi.SetKeyState(scanCode, true);
InputApi.SetKeyState(scanCode, true);
}
}
return false;
@ -60,7 +60,7 @@ namespace Mesen.GUI.Forms
//Mono does not trigger the activate/deactivate events when opening a modal popup, but it does set the form to disabled
//Use this to reset key states
this.EnabledChanged += (object s, EventArgs evt) => {
EmuApi.ResetKeyState();
InputApi.ResetKeyState();
};
}
}
@ -68,13 +68,13 @@ namespace Mesen.GUI.Forms
protected override void OnDeactivate(EventArgs e)
{
base.OnDeactivate(e);
EmuApi.ResetKeyState();
InputApi.ResetKeyState();
}
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
EmuApi.ResetKeyState();
InputApi.ResetKeyState();
}
}
}

View file

@ -0,0 +1,201 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
using Mesen.GUI.Config;
using System.Reflection;
using Mesen.GUI.Controls;
using System.Collections.Generic;
using Mesen.GUI.Config.Shortcuts;
namespace Mesen.GUI.Forms.Config
{
public partial class ctrlEmulatorShortcuts : BaseControl
{
private PreferencesConfig _config;
public ctrlEmulatorShortcuts()
{
InitializeComponent();
if(IsDesignMode) {
return;
}
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
this.colAction.Width = (int)(this.Width / 2.2);
this.colBinding1.Width = this.Width / 4;
this.colBinding2.Width = this.Width / 4;
}
public void InitializeGrid(PreferencesConfig config)
{
_config = config;
EmulatorShortcut[] displayOrder = new EmulatorShortcut[] {
EmulatorShortcut.FastForward,
EmulatorShortcut.ToggleFastForward,
EmulatorShortcut.Rewind,
EmulatorShortcut.ToggleRewind,
EmulatorShortcut.RewindTenSecs,
EmulatorShortcut.RewindOneMin,
EmulatorShortcut.Pause,
EmulatorShortcut.Reset,
EmulatorShortcut.PowerCycle,
EmulatorShortcut.PowerOff,
EmulatorShortcut.Exit,
EmulatorShortcut.TakeScreenshot,
EmulatorShortcut.RunSingleFrame,
EmulatorShortcut.SetScale1x,
EmulatorShortcut.SetScale2x,
EmulatorShortcut.SetScale3x,
EmulatorShortcut.SetScale4x,
EmulatorShortcut.SetScale5x,
EmulatorShortcut.SetScale6x,
EmulatorShortcut.ToggleFullscreen,
EmulatorShortcut.ToggleDebugInfo,
EmulatorShortcut.ToggleFps,
EmulatorShortcut.ToggleGameTimer,
EmulatorShortcut.ToggleFrameCounter,
EmulatorShortcut.ToggleOsd,
EmulatorShortcut.ToggleAlwaysOnTop,
EmulatorShortcut.ToggleAudio,
EmulatorShortcut.MaxSpeed,
EmulatorShortcut.IncreaseSpeed,
EmulatorShortcut.DecreaseSpeed,
EmulatorShortcut.OpenFile,
EmulatorShortcut.MoveToNextStateSlot,
EmulatorShortcut.MoveToPreviousStateSlot,
EmulatorShortcut.SaveState,
EmulatorShortcut.LoadState,
EmulatorShortcut.SaveStateSlot1,
EmulatorShortcut.SaveStateSlot2,
EmulatorShortcut.SaveStateSlot3,
EmulatorShortcut.SaveStateSlot4,
EmulatorShortcut.SaveStateSlot5,
EmulatorShortcut.SaveStateSlot6,
EmulatorShortcut.SaveStateSlot7,
EmulatorShortcut.SaveStateSlot8,
EmulatorShortcut.SaveStateSlot9,
EmulatorShortcut.SaveStateSlot10,
EmulatorShortcut.SaveStateToFile,
EmulatorShortcut.LoadStateSlot1,
EmulatorShortcut.LoadStateSlot2,
EmulatorShortcut.LoadStateSlot3,
EmulatorShortcut.LoadStateSlot4,
EmulatorShortcut.LoadStateSlot5,
EmulatorShortcut.LoadStateSlot6,
EmulatorShortcut.LoadStateSlot7,
EmulatorShortcut.LoadStateSlot8,
EmulatorShortcut.LoadStateSlot9,
EmulatorShortcut.LoadStateSlot10,
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 = config.ShortcutKeys1.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
if(keyIndex >= 0) {
KeyCombination keyComb = config.ShortcutKeys1[keyIndex].KeyCombination;
keyCombinations.Add(keyComb.ToString());
gridShortcuts.Rows[i].Cells[1].Value = keyComb.ToString();
gridShortcuts.Rows[i].Cells[1].Tag = keyComb;
}
keyIndex = config.ShortcutKeys2.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
if(keyIndex >= 0) {
KeyCombination keyComb = config.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
var keySet1 = new List<ShortcutKeyInfo>();
var keySet2 = new List<ShortcutKeyInfo>();
for(int i = gridShortcuts.Rows.Count - 1; i >= 0; i--) {
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));
}
}
}
_config.ShortcutKeys1 = keySet1;
_config.ShortcutKeys2 = keySet2;
}
private void gridShortcuts_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
//Right-click on buttons to clear mappings
if(gridShortcuts.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) {
DataGridViewButtonCell button = gridShortcuts.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewButtonCell;
if(button != null) {
if(e.Button == MouseButtons.Right) {
button.Value = "";
button.Tag = new KeyCombination();
CheckConflicts();
} else if(e.Button == MouseButtons.Left) {
using(frmGetKey frm = new frmGetKey(false)) {
frm.ShowDialog();
button.Value = frm.ShortcutKey.ToString();
button.Tag = frm.ShortcutKey;
CheckConflicts();
}
}
}
}
}
}
}

View file

@ -0,0 +1,184 @@
namespace Mesen.GUI.Forms.Config
{
partial class ctrlEmulatorShortcuts
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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();
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
//
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, 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, 216);
this.gridShortcuts.TabIndex = 2;
this.gridShortcuts.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.gridShortcuts_CellMouseDown);
//
// 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 = 233;
//
// 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;
//
// 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.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);
}
#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;
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

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="colAction.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colBinding1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colBinding2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -0,0 +1,80 @@
using Mesen.GUI.Config.Shortcuts;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesen.GUI.Forms.Config
{
public partial class frmGetKey : BaseInputForm
{
private bool _singleKeyMode = false;
private List<UInt32> _prevScanCodes = new List<UInt32>();
public KeyCombination ShortcutKey { get; set; }
public frmGetKey(bool singleKeyMode)
{
InitializeComponent();
_singleKeyMode = singleKeyMode;
if(_singleKeyMode) {
tableLayoutPanel1.RowStyles[1].SizeType = SizeType.Absolute;
tableLayoutPanel1.RowStyles[1].Height = 0;
}
if(_singleKeyMode) {
lblCurrentKeys.Height = 1;
lblCurrentKeys.Visible = false;
}
ShortcutKey = new KeyCombination();
InputApi.UpdateInputDevices();
InputApi.ResetKeyState();
//Prevent other keybindings from interfering/activating
InputApi.DisableAllKeys(true);
}
protected override bool IsConfigForm { get { return true; } }
protected override void OnFormClosing(FormClosingEventArgs e)
{
InputApi.DisableAllKeys(false);
base.OnFormClosing(e);
}
private void SelectKeyCombination(KeyCombination key)
{
if(!string.IsNullOrWhiteSpace(key.ToString())) {
ShortcutKey = key;
this.Close();
}
}
private void tmrCheckKey_Tick(object sender, EventArgs e)
{
List<UInt32> scanCodes = InputApi.GetPressedKeys();
if(_singleKeyMode) {
if(scanCodes.Count >= 1) {
//Always use the largest scancode (when multiple buttons are pressed at once)
scanCodes = new List<UInt32> { scanCodes.OrderBy(code => -code).First() };
this.SelectKeyCombination(new KeyCombination(scanCodes));
}
} else {
KeyCombination key = new KeyCombination(_prevScanCodes);
lblCurrentKeys.Text = key.ToString();
if(scanCodes.Count < _prevScanCodes.Count) {
//Confirm key selection when the user releases a key
this.SelectKeyCombination(key);
}
_prevScanCodes = scanCodes;
}
}
}
}

123
UI/Forms/Config/frmGetKey.designer.cs generated Normal file
View file

@ -0,0 +1,123 @@
namespace Mesen.GUI.Forms.Config
{
partial class frmGetKey
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.lblSetKeyMessage = new System.Windows.Forms.Label();
this.lblCurrentKeys = new System.Windows.Forms.Label();
this.tmrCheckKey = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.AutoSize = true;
this.groupBox1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.groupBox1.Controls.Add(this.tableLayoutPanel1);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(3, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(391, 105);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.AutoSize = true;
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.lblSetKeyMessage, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.lblCurrentKeys, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(385, 86);
this.tableLayoutPanel1.TabIndex = 2;
//
// lblSetKeyMessage
//
this.lblSetKeyMessage.AutoSize = true;
this.lblSetKeyMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblSetKeyMessage.Location = new System.Drawing.Point(3, 0);
this.lblSetKeyMessage.Name = "lblSetKeyMessage";
this.lblSetKeyMessage.Size = new System.Drawing.Size(379, 43);
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;
//
// lblCurrentKeys
//
this.lblCurrentKeys.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblCurrentKeys.Location = new System.Drawing.Point(3, 43);
this.lblCurrentKeys.Name = "lblCurrentKeys";
this.lblCurrentKeys.Size = new System.Drawing.Size(379, 43);
this.lblCurrentKeys.TabIndex = 1;
this.lblCurrentKeys.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// tmrCheckKey
//
this.tmrCheckKey.Enabled = true;
this.tmrCheckKey.Interval = 10;
this.tmrCheckKey.Tick += new System.EventHandler(this.tmrCheckKey_Tick);
//
// frmGetKey
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(397, 108);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "frmGetKey";
this.Padding = new System.Windows.Forms.Padding(3, 0, 3, 3);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Set key binding...";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label lblSetKeyMessage;
private System.Windows.Forms.Timer tmrCheckKey;
private System.Windows.Forms.Label lblCurrentKeys;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
}
}

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<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>

971
UI/Forms/Config/frmPreferences.Designer.cs generated Normal file
View file

@ -0,0 +1,971 @@
namespace Mesen.GUI.Forms.Config
{
partial class frmPreferences
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tabMain = new System.Windows.Forms.TabControl();
this.tpgGeneral = new System.Windows.Forms.TabPage();
this.tlpMain = new System.Windows.Forms.TableLayoutPanel();
this.chkSingleInstance = new System.Windows.Forms.CheckBox();
this.chkAutomaticallyCheckForUpdates = new System.Windows.Forms.CheckBox();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.lblDisplayLanguage = new System.Windows.Forms.Label();
this.cboDisplayLanguage = new System.Windows.Forms.ComboBox();
this.lblMiscSettings = new System.Windows.Forms.Label();
this.chkAutoLoadPatches = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
this.btnOpenMesenFolder = new System.Windows.Forms.Button();
this.btnResetSettings = new System.Windows.Forms.Button();
this.tpgShortcuts = new System.Windows.Forms.TabPage();
this.tpgFiles = new System.Windows.Forms.TabPage();
this.tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel();
this.grpPathOverrides = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel10 = new System.Windows.Forms.TableLayoutPanel();
this.psGame = new Mesen.GUI.Forms.Config.ctrlPathSelection();
this.chkGameOverride = new System.Windows.Forms.CheckBox();
this.psWave = new Mesen.GUI.Forms.Config.ctrlPathSelection();
this.psMovies = new Mesen.GUI.Forms.Config.ctrlPathSelection();
this.psSaveData = new Mesen.GUI.Forms.Config.ctrlPathSelection();
this.psSaveStates = new Mesen.GUI.Forms.Config.ctrlPathSelection();
this.psScreenshots = new Mesen.GUI.Forms.Config.ctrlPathSelection();
this.psAvi = new Mesen.GUI.Forms.Config.ctrlPathSelection();
this.chkAviOverride = new System.Windows.Forms.CheckBox();
this.chkScreenshotsOverride = new System.Windows.Forms.CheckBox();
this.chkSaveDataOverride = new System.Windows.Forms.CheckBox();
this.chkWaveOverride = new System.Windows.Forms.CheckBox();
this.chkSaveStatesOverride = new System.Windows.Forms.CheckBox();
this.chkMoviesOverride = new System.Windows.Forms.CheckBox();
this.grpFileAssociations = new System.Windows.Forms.GroupBox();
this.tlpFileFormat = new System.Windows.Forms.TableLayoutPanel();
this.chkRomFormat = new System.Windows.Forms.CheckBox();
this.chkMssFormat = new System.Windows.Forms.CheckBox();
this.chkMsmFormat = new System.Windows.Forms.CheckBox();
this.grpDataStorageLocation = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel7 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel8 = new System.Windows.Forms.TableLayoutPanel();
this.radStorageDocuments = new System.Windows.Forms.RadioButton();
this.radStoragePortable = new System.Windows.Forms.RadioButton();
this.tableLayoutPanel9 = new System.Windows.Forms.TableLayoutPanel();
this.lblLocation = new System.Windows.Forms.Label();
this.lblDataLocation = new System.Windows.Forms.Label();
this.tpgAdvanced = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.chkDisplayTitleBarInfo = new System.Windows.Forms.CheckBox();
this.chkShowGameTimer = new System.Windows.Forms.CheckBox();
this.chkShowFrameCounter = new System.Windows.Forms.CheckBox();
this.chkDisableOsd = new System.Windows.Forms.CheckBox();
this.lblUiDisplaySettings = new System.Windows.Forms.Label();
this.lblWindowSettings = new System.Windows.Forms.Label();
this.chkAlwaysOnTop = new System.Windows.Forms.CheckBox();
this.chkShowFps = new System.Windows.Forms.CheckBox();
this.ctrlEmulatorShortcuts = new Mesen.GUI.Forms.Config.ctrlEmulatorShortcuts();
this.chkShowDebugInfo = new System.Windows.Forms.CheckBox();
this.tabMain.SuspendLayout();
this.tpgGeneral.SuspendLayout();
this.tlpMain.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
this.tableLayoutPanel5.SuspendLayout();
this.tpgShortcuts.SuspendLayout();
this.tpgFiles.SuspendLayout();
this.tableLayoutPanel6.SuspendLayout();
this.grpPathOverrides.SuspendLayout();
this.tableLayoutPanel10.SuspendLayout();
this.grpFileAssociations.SuspendLayout();
this.tlpFileFormat.SuspendLayout();
this.grpDataStorageLocation.SuspendLayout();
this.tableLayoutPanel7.SuspendLayout();
this.tableLayoutPanel8.SuspendLayout();
this.tableLayoutPanel9.SuspendLayout();
this.tpgAdvanced.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// baseConfigPanel
//
this.baseConfigPanel.Location = new System.Drawing.Point(0, 415);
this.baseConfigPanel.Size = new System.Drawing.Size(548, 29);
//
// tabMain
//
this.tabMain.Controls.Add(this.tpgGeneral);
this.tabMain.Controls.Add(this.tpgShortcuts);
this.tabMain.Controls.Add(this.tpgFiles);
this.tabMain.Controls.Add(this.tpgAdvanced);
this.tabMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabMain.Location = new System.Drawing.Point(0, 0);
this.tabMain.Name = "tabMain";
this.tabMain.SelectedIndex = 0;
this.tabMain.Size = new System.Drawing.Size(548, 415);
this.tabMain.TabIndex = 3;
//
// tpgGeneral
//
this.tpgGeneral.Controls.Add(this.tlpMain);
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(540, 389);
this.tpgGeneral.TabIndex = 0;
this.tpgGeneral.Text = "General";
this.tpgGeneral.UseVisualStyleBackColor = true;
//
// tlpMain
//
this.tlpMain.ColumnCount = 1;
this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tlpMain.Controls.Add(this.chkSingleInstance, 0, 2);
this.tlpMain.Controls.Add(this.chkAutomaticallyCheckForUpdates, 0, 1);
this.tlpMain.Controls.Add(this.flowLayoutPanel2, 0, 0);
this.tlpMain.Controls.Add(this.lblMiscSettings, 0, 3);
this.tlpMain.Controls.Add(this.chkAutoLoadPatches, 0, 4);
this.tlpMain.Controls.Add(this.tableLayoutPanel5, 0, 6);
this.tlpMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.tlpMain.Location = new System.Drawing.Point(3, 3);
this.tlpMain.Name = "tlpMain";
this.tlpMain.RowCount = 7;
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
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.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.Size = new System.Drawing.Size(534, 383);
this.tlpMain.TabIndex = 1;
//
// chkSingleInstance
//
this.chkSingleInstance.AutoSize = true;
this.chkSingleInstance.Location = new System.Drawing.Point(3, 52);
this.chkSingleInstance.Name = "chkSingleInstance";
this.chkSingleInstance.Size = new System.Drawing.Size(228, 17);
this.chkSingleInstance.TabIndex = 11;
this.chkSingleInstance.Text = "Only allow one instance of Mesen at a time";
this.chkSingleInstance.UseVisualStyleBackColor = true;
//
// chkAutomaticallyCheckForUpdates
//
this.chkAutomaticallyCheckForUpdates.AutoSize = true;
this.chkAutomaticallyCheckForUpdates.Location = new System.Drawing.Point(3, 29);
this.chkAutomaticallyCheckForUpdates.Name = "chkAutomaticallyCheckForUpdates";
this.chkAutomaticallyCheckForUpdates.Size = new System.Drawing.Size(177, 17);
this.chkAutomaticallyCheckForUpdates.TabIndex = 17;
this.chkAutomaticallyCheckForUpdates.Text = "Automatically check for updates";
this.chkAutomaticallyCheckForUpdates.UseVisualStyleBackColor = true;
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.Controls.Add(this.lblDisplayLanguage);
this.flowLayoutPanel2.Controls.Add(this.cboDisplayLanguage);
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(534, 26);
this.flowLayoutPanel2.TabIndex = 18;
//
// lblDisplayLanguage
//
this.lblDisplayLanguage.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblDisplayLanguage.AutoSize = true;
this.lblDisplayLanguage.Location = new System.Drawing.Point(3, 7);
this.lblDisplayLanguage.Name = "lblDisplayLanguage";
this.lblDisplayLanguage.Size = new System.Drawing.Size(95, 13);
this.lblDisplayLanguage.TabIndex = 0;
this.lblDisplayLanguage.Text = "Display Language:";
//
// cboDisplayLanguage
//
this.cboDisplayLanguage.FormattingEnabled = true;
this.cboDisplayLanguage.Location = new System.Drawing.Point(104, 3);
this.cboDisplayLanguage.Name = "cboDisplayLanguage";
this.cboDisplayLanguage.Size = new System.Drawing.Size(206, 21);
this.cboDisplayLanguage.TabIndex = 1;
//
// lblMiscSettings
//
this.lblMiscSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblMiscSettings.AutoSize = true;
this.lblMiscSettings.ForeColor = System.Drawing.SystemColors.GrayText;
this.lblMiscSettings.Location = new System.Drawing.Point(0, 79);
this.lblMiscSettings.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.lblMiscSettings.Name = "lblMiscSettings";
this.lblMiscSettings.Size = new System.Drawing.Size(73, 13);
this.lblMiscSettings.TabIndex = 22;
this.lblMiscSettings.Text = "Misc. Settings";
//
// chkAutoLoadPatches
//
this.chkAutoLoadPatches.AutoSize = true;
this.chkAutoLoadPatches.Location = new System.Drawing.Point(13, 95);
this.chkAutoLoadPatches.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkAutoLoadPatches.Name = "chkAutoLoadPatches";
this.chkAutoLoadPatches.Size = new System.Drawing.Size(198, 17);
this.chkAutoLoadPatches.TabIndex = 9;
this.chkAutoLoadPatches.Text = "Automatically load IPS/BPS patches";
this.chkAutoLoadPatches.UseVisualStyleBackColor = true;
//
// tableLayoutPanel5
//
this.tableLayoutPanel5.ColumnCount = 3;
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel5.Controls.Add(this.btnOpenMesenFolder, 0, 0);
this.tableLayoutPanel5.Controls.Add(this.btnResetSettings, 2, 0);
this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel5.Location = new System.Drawing.Point(0, 354);
this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel5.Name = "tableLayoutPanel5";
this.tableLayoutPanel5.RowCount = 1;
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel5.Size = new System.Drawing.Size(534, 29);
this.tableLayoutPanel5.TabIndex = 24;
//
// btnOpenMesenFolder
//
this.btnOpenMesenFolder.AutoSize = true;
this.btnOpenMesenFolder.Location = new System.Drawing.Point(3, 3);
this.btnOpenMesenFolder.Name = "btnOpenMesenFolder";
this.btnOpenMesenFolder.Size = new System.Drawing.Size(120, 23);
this.btnOpenMesenFolder.TabIndex = 16;
this.btnOpenMesenFolder.Text = "Open Mesen-S Folder";
this.btnOpenMesenFolder.UseVisualStyleBackColor = true;
this.btnOpenMesenFolder.Click += new System.EventHandler(this.btnOpenMesenFolder_Click);
//
// btnResetSettings
//
this.btnResetSettings.AutoSize = true;
this.btnResetSettings.Location = new System.Drawing.Point(431, 3);
this.btnResetSettings.Name = "btnResetSettings";
this.btnResetSettings.Size = new System.Drawing.Size(100, 23);
this.btnResetSettings.TabIndex = 17;
this.btnResetSettings.Text = "Reset All Settings";
this.btnResetSettings.UseVisualStyleBackColor = true;
this.btnResetSettings.Click += new System.EventHandler(this.btnResetSettings_Click);
//
// tpgShortcuts
//
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(540, 389);
this.tpgShortcuts.TabIndex = 7;
this.tpgShortcuts.Text = "Shortcut Keys";
this.tpgShortcuts.UseVisualStyleBackColor = true;
//
// tpgFiles
//
this.tpgFiles.Controls.Add(this.tableLayoutPanel6);
this.tpgFiles.Location = new System.Drawing.Point(4, 22);
this.tpgFiles.Name = "tpgFiles";
this.tpgFiles.Padding = new System.Windows.Forms.Padding(3);
this.tpgFiles.Size = new System.Drawing.Size(540, 389);
this.tpgFiles.TabIndex = 2;
this.tpgFiles.Text = "Folders/Files";
this.tpgFiles.UseVisualStyleBackColor = true;
//
// tableLayoutPanel6
//
this.tableLayoutPanel6.ColumnCount = 1;
this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel6.Controls.Add(this.grpPathOverrides, 0, 2);
this.tableLayoutPanel6.Controls.Add(this.grpFileAssociations, 0, 0);
this.tableLayoutPanel6.Controls.Add(this.grpDataStorageLocation, 0, 1);
this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel6.Name = "tableLayoutPanel6";
this.tableLayoutPanel6.RowCount = 4;
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel6.Size = new System.Drawing.Size(534, 383);
this.tableLayoutPanel6.TabIndex = 13;
//
// grpPathOverrides
//
this.grpPathOverrides.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grpPathOverrides.Controls.Add(this.tableLayoutPanel10);
this.grpPathOverrides.Location = new System.Drawing.Point(3, 177);
this.grpPathOverrides.Name = "grpPathOverrides";
this.grpPathOverrides.Size = new System.Drawing.Size(528, 186);
this.grpPathOverrides.TabIndex = 15;
this.grpPathOverrides.TabStop = false;
this.grpPathOverrides.Text = "Folder Overrides";
//
// tableLayoutPanel10
//
this.tableLayoutPanel10.ColumnCount = 2;
this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel10.Controls.Add(this.psGame, 1, 0);
this.tableLayoutPanel10.Controls.Add(this.chkGameOverride, 0, 0);
this.tableLayoutPanel10.Controls.Add(this.psWave, 1, 2);
this.tableLayoutPanel10.Controls.Add(this.psMovies, 1, 3);
this.tableLayoutPanel10.Controls.Add(this.psSaveData, 1, 4);
this.tableLayoutPanel10.Controls.Add(this.psSaveStates, 1, 5);
this.tableLayoutPanel10.Controls.Add(this.psScreenshots, 1, 6);
this.tableLayoutPanel10.Controls.Add(this.psAvi, 1, 7);
this.tableLayoutPanel10.Controls.Add(this.chkAviOverride, 0, 7);
this.tableLayoutPanel10.Controls.Add(this.chkScreenshotsOverride, 0, 6);
this.tableLayoutPanel10.Controls.Add(this.chkSaveDataOverride, 0, 4);
this.tableLayoutPanel10.Controls.Add(this.chkWaveOverride, 0, 2);
this.tableLayoutPanel10.Controls.Add(this.chkSaveStatesOverride, 0, 5);
this.tableLayoutPanel10.Controls.Add(this.chkMoviesOverride, 0, 3);
this.tableLayoutPanel10.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel10.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel10.Name = "tableLayoutPanel10";
this.tableLayoutPanel10.RowCount = 9;
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel10.Size = new System.Drawing.Size(522, 167);
this.tableLayoutPanel10.TabIndex = 0;
//
// psGame
//
this.psGame.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.psGame.DisabledText = "";
this.psGame.Location = new System.Drawing.Point(94, 0);
this.psGame.Margin = new System.Windows.Forms.Padding(0);
this.psGame.MaximumSize = new System.Drawing.Size(1000, 20);
this.psGame.MinimumSize = new System.Drawing.Size(0, 20);
this.psGame.Name = "psGame";
this.psGame.Size = new System.Drawing.Size(428, 20);
this.psGame.TabIndex = 13;
//
// chkGameOverride
//
this.chkGameOverride.AutoSize = true;
this.chkGameOverride.Location = new System.Drawing.Point(3, 3);
this.chkGameOverride.Name = "chkGameOverride";
this.chkGameOverride.Size = new System.Drawing.Size(62, 17);
this.chkGameOverride.TabIndex = 12;
this.chkGameOverride.Text = "Games:";
this.chkGameOverride.UseVisualStyleBackColor = true;
this.chkGameOverride.CheckedChanged += new System.EventHandler(this.chkOverride_CheckedChanged);
//
// psWave
//
this.psWave.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.psWave.DisabledText = "";
this.psWave.Location = new System.Drawing.Point(94, 28);
this.psWave.Margin = new System.Windows.Forms.Padding(0);
this.psWave.MaximumSize = new System.Drawing.Size(1000, 20);
this.psWave.MinimumSize = new System.Drawing.Size(0, 20);
this.psWave.Name = "psWave";
this.psWave.Size = new System.Drawing.Size(428, 20);
this.psWave.TabIndex = 6;
//
// psMovies
//
this.psMovies.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.psMovies.DisabledText = "";
this.psMovies.Location = new System.Drawing.Point(94, 51);
this.psMovies.Margin = new System.Windows.Forms.Padding(0);
this.psMovies.MaximumSize = new System.Drawing.Size(1000, 20);
this.psMovies.MinimumSize = new System.Drawing.Size(0, 20);
this.psMovies.Name = "psMovies";
this.psMovies.Size = new System.Drawing.Size(428, 20);
this.psMovies.TabIndex = 7;
//
// psSaveData
//
this.psSaveData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.psSaveData.DisabledText = "";
this.psSaveData.Location = new System.Drawing.Point(94, 74);
this.psSaveData.Margin = new System.Windows.Forms.Padding(0);
this.psSaveData.MaximumSize = new System.Drawing.Size(1000, 20);
this.psSaveData.MinimumSize = new System.Drawing.Size(0, 20);
this.psSaveData.Name = "psSaveData";
this.psSaveData.Size = new System.Drawing.Size(428, 20);
this.psSaveData.TabIndex = 8;
//
// psSaveStates
//
this.psSaveStates.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.psSaveStates.DisabledText = "";
this.psSaveStates.Location = new System.Drawing.Point(94, 97);
this.psSaveStates.Margin = new System.Windows.Forms.Padding(0);
this.psSaveStates.MaximumSize = new System.Drawing.Size(1000, 20);
this.psSaveStates.MinimumSize = new System.Drawing.Size(0, 20);
this.psSaveStates.Name = "psSaveStates";
this.psSaveStates.Size = new System.Drawing.Size(428, 20);
this.psSaveStates.TabIndex = 9;
//
// psScreenshots
//
this.psScreenshots.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.psScreenshots.DisabledText = "";
this.psScreenshots.Location = new System.Drawing.Point(94, 120);
this.psScreenshots.Margin = new System.Windows.Forms.Padding(0);
this.psScreenshots.MaximumSize = new System.Drawing.Size(1000, 20);
this.psScreenshots.MinimumSize = new System.Drawing.Size(0, 20);
this.psScreenshots.Name = "psScreenshots";
this.psScreenshots.Size = new System.Drawing.Size(428, 20);
this.psScreenshots.TabIndex = 10;
//
// psAvi
//
this.psAvi.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.psAvi.DisabledText = "";
this.psAvi.Location = new System.Drawing.Point(94, 143);
this.psAvi.Margin = new System.Windows.Forms.Padding(0);
this.psAvi.MaximumSize = new System.Drawing.Size(1000, 20);
this.psAvi.MinimumSize = new System.Drawing.Size(0, 20);
this.psAvi.Name = "psAvi";
this.psAvi.Size = new System.Drawing.Size(428, 20);
this.psAvi.TabIndex = 11;
//
// chkAviOverride
//
this.chkAviOverride.AutoSize = true;
this.chkAviOverride.Location = new System.Drawing.Point(3, 146);
this.chkAviOverride.Name = "chkAviOverride";
this.chkAviOverride.Size = new System.Drawing.Size(61, 17);
this.chkAviOverride.TabIndex = 4;
this.chkAviOverride.Text = "Videos:";
this.chkAviOverride.UseVisualStyleBackColor = true;
this.chkAviOverride.CheckedChanged += new System.EventHandler(this.chkOverride_CheckedChanged);
//
// chkScreenshotsOverride
//
this.chkScreenshotsOverride.AutoSize = true;
this.chkScreenshotsOverride.Location = new System.Drawing.Point(3, 123);
this.chkScreenshotsOverride.Name = "chkScreenshotsOverride";
this.chkScreenshotsOverride.Size = new System.Drawing.Size(88, 17);
this.chkScreenshotsOverride.TabIndex = 3;
this.chkScreenshotsOverride.Text = "Screenshots:";
this.chkScreenshotsOverride.UseVisualStyleBackColor = true;
this.chkScreenshotsOverride.CheckedChanged += new System.EventHandler(this.chkOverride_CheckedChanged);
//
// chkSaveDataOverride
//
this.chkSaveDataOverride.AutoSize = true;
this.chkSaveDataOverride.Location = new System.Drawing.Point(3, 77);
this.chkSaveDataOverride.Name = "chkSaveDataOverride";
this.chkSaveDataOverride.Size = new System.Drawing.Size(80, 17);
this.chkSaveDataOverride.TabIndex = 0;
this.chkSaveDataOverride.Text = "Save Data:";
this.chkSaveDataOverride.UseVisualStyleBackColor = true;
this.chkSaveDataOverride.CheckedChanged += new System.EventHandler(this.chkOverride_CheckedChanged);
//
// chkWaveOverride
//
this.chkWaveOverride.AutoSize = true;
this.chkWaveOverride.Location = new System.Drawing.Point(3, 31);
this.chkWaveOverride.Name = "chkWaveOverride";
this.chkWaveOverride.Size = new System.Drawing.Size(56, 17);
this.chkWaveOverride.TabIndex = 5;
this.chkWaveOverride.Text = "Audio:";
this.chkWaveOverride.UseVisualStyleBackColor = true;
this.chkWaveOverride.CheckedChanged += new System.EventHandler(this.chkOverride_CheckedChanged);
//
// chkSaveStatesOverride
//
this.chkSaveStatesOverride.AutoSize = true;
this.chkSaveStatesOverride.Location = new System.Drawing.Point(3, 100);
this.chkSaveStatesOverride.Name = "chkSaveStatesOverride";
this.chkSaveStatesOverride.Size = new System.Drawing.Size(87, 17);
this.chkSaveStatesOverride.TabIndex = 2;
this.chkSaveStatesOverride.Text = "Save States:";
this.chkSaveStatesOverride.UseVisualStyleBackColor = true;
this.chkSaveStatesOverride.CheckedChanged += new System.EventHandler(this.chkOverride_CheckedChanged);
//
// chkMoviesOverride
//
this.chkMoviesOverride.AutoSize = true;
this.chkMoviesOverride.Location = new System.Drawing.Point(3, 54);
this.chkMoviesOverride.Name = "chkMoviesOverride";
this.chkMoviesOverride.Size = new System.Drawing.Size(63, 17);
this.chkMoviesOverride.TabIndex = 1;
this.chkMoviesOverride.Text = "Movies:";
this.chkMoviesOverride.UseVisualStyleBackColor = true;
this.chkMoviesOverride.CheckedChanged += new System.EventHandler(this.chkOverride_CheckedChanged);
//
// grpFileAssociations
//
this.grpFileAssociations.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grpFileAssociations.Controls.Add(this.tlpFileFormat);
this.grpFileAssociations.Location = new System.Drawing.Point(3, 3);
this.grpFileAssociations.Name = "grpFileAssociations";
this.grpFileAssociations.Size = new System.Drawing.Size(528, 65);
this.grpFileAssociations.TabIndex = 12;
this.grpFileAssociations.TabStop = false;
this.grpFileAssociations.Text = "File Associations";
//
// tlpFileFormat
//
this.tlpFileFormat.ColumnCount = 2;
this.tlpFileFormat.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpFileFormat.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpFileFormat.Controls.Add(this.chkRomFormat, 0, 0);
this.tlpFileFormat.Controls.Add(this.chkMssFormat, 1, 0);
this.tlpFileFormat.Controls.Add(this.chkMsmFormat, 1, 1);
this.tlpFileFormat.Dock = System.Windows.Forms.DockStyle.Fill;
this.tlpFileFormat.Location = new System.Drawing.Point(3, 16);
this.tlpFileFormat.Name = "tlpFileFormat";
this.tlpFileFormat.RowCount = 3;
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.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpFileFormat.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpFileFormat.Size = new System.Drawing.Size(522, 46);
this.tlpFileFormat.TabIndex = 0;
//
// chkRomFormat
//
this.chkRomFormat.AutoSize = true;
this.chkRomFormat.Location = new System.Drawing.Point(3, 3);
this.chkRomFormat.Name = "chkRomFormat";
this.chkRomFormat.Size = new System.Drawing.Size(141, 17);
this.chkRomFormat.TabIndex = 10;
this.chkRomFormat.Text = ".SFC, .SMC, .SWC, .FIG";
this.chkRomFormat.UseVisualStyleBackColor = true;
//
// chkMssFormat
//
this.chkMssFormat.AutoSize = true;
this.chkMssFormat.Location = new System.Drawing.Point(264, 3);
this.chkMssFormat.Name = "chkMssFormat";
this.chkMssFormat.Size = new System.Drawing.Size(159, 17);
this.chkMssFormat.TabIndex = 15;
this.chkMssFormat.Text = ".MSS (Mesen-S Save State)";
this.chkMssFormat.UseVisualStyleBackColor = true;
//
// chkMsmFormat
//
this.chkMsmFormat.AutoSize = true;
this.chkMsmFormat.Location = new System.Drawing.Point(264, 26);
this.chkMsmFormat.Name = "chkMsmFormat";
this.chkMsmFormat.Size = new System.Drawing.Size(142, 17);
this.chkMsmFormat.TabIndex = 11;
this.chkMsmFormat.Text = ".MSM (Mesen-S Movies)";
this.chkMsmFormat.UseVisualStyleBackColor = true;
//
// grpDataStorageLocation
//
this.grpDataStorageLocation.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grpDataStorageLocation.Controls.Add(this.tableLayoutPanel7);
this.grpDataStorageLocation.Location = new System.Drawing.Point(3, 74);
this.grpDataStorageLocation.Name = "grpDataStorageLocation";
this.grpDataStorageLocation.Size = new System.Drawing.Size(528, 97);
this.grpDataStorageLocation.TabIndex = 14;
this.grpDataStorageLocation.TabStop = false;
this.grpDataStorageLocation.Text = "Data Storage Location";
//
// tableLayoutPanel7
//
this.tableLayoutPanel7.ColumnCount = 1;
this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel7.Controls.Add(this.tableLayoutPanel8, 0, 0);
this.tableLayoutPanel7.Controls.Add(this.tableLayoutPanel9, 0, 1);
this.tableLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel7.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel7.Name = "tableLayoutPanel7";
this.tableLayoutPanel7.RowCount = 3;
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel7.Size = new System.Drawing.Size(522, 78);
this.tableLayoutPanel7.TabIndex = 13;
//
// tableLayoutPanel8
//
this.tableLayoutPanel8.ColumnCount = 1;
this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel8.Controls.Add(this.radStorageDocuments, 0, 0);
this.tableLayoutPanel8.Controls.Add(this.radStoragePortable, 0, 1);
this.tableLayoutPanel8.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel8.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel8.Name = "tableLayoutPanel8";
this.tableLayoutPanel8.RowCount = 2;
this.tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel8.Size = new System.Drawing.Size(516, 47);
this.tableLayoutPanel8.TabIndex = 0;
//
// radStorageDocuments
//
this.radStorageDocuments.AutoSize = true;
this.radStorageDocuments.Checked = true;
this.radStorageDocuments.Cursor = System.Windows.Forms.Cursors.Default;
this.radStorageDocuments.Location = new System.Drawing.Point(3, 3);
this.radStorageDocuments.Name = "radStorageDocuments";
this.radStorageDocuments.Size = new System.Drawing.Size(207, 17);
this.radStorageDocuments.TabIndex = 0;
this.radStorageDocuments.TabStop = true;
this.radStorageDocuments.Text = "Store Mesen-S\'s data in my user profile";
this.radStorageDocuments.UseVisualStyleBackColor = true;
this.radStorageDocuments.CheckedChanged += new System.EventHandler(this.radStorageDocuments_CheckedChanged);
//
// radStoragePortable
//
this.radStoragePortable.AutoSize = true;
this.radStoragePortable.Cursor = System.Windows.Forms.Cursors.Default;
this.radStoragePortable.Location = new System.Drawing.Point(3, 26);
this.radStoragePortable.Name = "radStoragePortable";
this.radStoragePortable.Size = new System.Drawing.Size(298, 17);
this.radStoragePortable.TabIndex = 1;
this.radStoragePortable.Text = "Store Mesen-S\'s data in the same folder as the application";
this.radStoragePortable.UseVisualStyleBackColor = true;
this.radStoragePortable.CheckedChanged += new System.EventHandler(this.radStorageDocuments_CheckedChanged);
//
// tableLayoutPanel9
//
this.tableLayoutPanel9.AutoSize = true;
this.tableLayoutPanel9.ColumnCount = 2;
this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel9.Controls.Add(this.lblLocation, 1, 0);
this.tableLayoutPanel9.Controls.Add(this.lblDataLocation, 0, 0);
this.tableLayoutPanel9.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel9.Location = new System.Drawing.Point(3, 56);
this.tableLayoutPanel9.Name = "tableLayoutPanel9";
this.tableLayoutPanel9.Padding = new System.Windows.Forms.Padding(0, 5, 0, 0);
this.tableLayoutPanel9.RowCount = 1;
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel9.Size = new System.Drawing.Size(516, 18);
this.tableLayoutPanel9.TabIndex = 39;
//
// lblLocation
//
this.lblLocation.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblLocation.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLocation.ForeColor = System.Drawing.SystemColors.ControlText;
this.lblLocation.Location = new System.Drawing.Point(48, 5);
this.lblLocation.Name = "lblLocation";
this.lblLocation.Size = new System.Drawing.Size(465, 13);
this.lblLocation.TabIndex = 1;
this.lblLocation.Text = "....";
//
// lblDataLocation
//
this.lblDataLocation.AutoSize = true;
this.lblDataLocation.Location = new System.Drawing.Point(3, 5);
this.lblDataLocation.Name = "lblDataLocation";
this.lblDataLocation.Size = new System.Drawing.Size(39, 13);
this.lblDataLocation.TabIndex = 0;
this.lblDataLocation.Text = "Folder:";
//
// tpgAdvanced
//
this.tpgAdvanced.Controls.Add(this.tableLayoutPanel1);
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(540, 389);
this.tpgAdvanced.TabIndex = 1;
this.tpgAdvanced.Text = "Advanced";
this.tpgAdvanced.UseVisualStyleBackColor = true;
//
// 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.chkDisplayTitleBarInfo, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.chkShowGameTimer, 0, 7);
this.tableLayoutPanel1.Controls.Add(this.chkShowFrameCounter, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.chkDisableOsd, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.lblUiDisplaySettings, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.lblWindowSettings, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.chkAlwaysOnTop, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.chkShowFps, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.chkShowDebugInfo, 0, 8);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 10;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
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(534, 383);
this.tableLayoutPanel1.TabIndex = 0;
//
// chkDisplayTitleBarInfo
//
this.chkDisplayTitleBarInfo.AutoSize = true;
this.chkDisplayTitleBarInfo.Location = new System.Drawing.Point(13, 89);
this.chkDisplayTitleBarInfo.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkDisplayTitleBarInfo.Name = "chkDisplayTitleBarInfo";
this.chkDisplayTitleBarInfo.Size = new System.Drawing.Size(210, 17);
this.chkDisplayTitleBarInfo.TabIndex = 8;
this.chkDisplayTitleBarInfo.Text = "Display additional information in title bar";
this.chkDisplayTitleBarInfo.UseVisualStyleBackColor = true;
//
// chkShowGameTimer
//
this.chkShowGameTimer.AutoSize = true;
this.chkShowGameTimer.Location = new System.Drawing.Point(13, 158);
this.chkShowGameTimer.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkShowGameTimer.Name = "chkShowGameTimer";
this.chkShowGameTimer.Size = new System.Drawing.Size(107, 17);
this.chkShowGameTimer.TabIndex = 11;
this.chkShowGameTimer.Text = "Show game timer";
this.chkShowGameTimer.UseVisualStyleBackColor = true;
//
// chkShowFrameCounter
//
this.chkShowFrameCounter.AutoSize = true;
this.chkShowFrameCounter.Location = new System.Drawing.Point(13, 135);
this.chkShowFrameCounter.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkShowFrameCounter.Name = "chkShowFrameCounter";
this.chkShowFrameCounter.Size = new System.Drawing.Size(121, 17);
this.chkShowFrameCounter.TabIndex = 12;
this.chkShowFrameCounter.Text = "Show frame counter";
this.chkShowFrameCounter.UseVisualStyleBackColor = true;
//
// chkDisableOsd
//
this.chkDisableOsd.AutoSize = true;
this.chkDisableOsd.Location = new System.Drawing.Point(13, 66);
this.chkDisableOsd.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkDisableOsd.Name = "chkDisableOsd";
this.chkDisableOsd.Size = new System.Drawing.Size(178, 17);
this.chkDisableOsd.TabIndex = 14;
this.chkDisableOsd.Text = "Disable on-screen display (OSD)";
this.chkDisableOsd.UseVisualStyleBackColor = true;
//
// lblUiDisplaySettings
//
this.lblUiDisplaySettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblUiDisplaySettings.AutoSize = true;
this.lblUiDisplaySettings.ForeColor = System.Drawing.SystemColors.GrayText;
this.lblUiDisplaySettings.Location = new System.Drawing.Point(0, 50);
this.lblUiDisplaySettings.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.lblUiDisplaySettings.Name = "lblUiDisplaySettings";
this.lblUiDisplaySettings.Size = new System.Drawing.Size(96, 13);
this.lblUiDisplaySettings.TabIndex = 25;
this.lblUiDisplaySettings.Text = "UI Display Settings";
//
// lblWindowSettings
//
this.lblWindowSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblWindowSettings.AutoSize = true;
this.lblWindowSettings.ForeColor = System.Drawing.SystemColors.GrayText;
this.lblWindowSettings.Location = new System.Drawing.Point(0, 7);
this.lblWindowSettings.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.lblWindowSettings.Name = "lblWindowSettings";
this.lblWindowSettings.Size = new System.Drawing.Size(87, 13);
this.lblWindowSettings.TabIndex = 32;
this.lblWindowSettings.Text = "Window Settings";
//
// chkAlwaysOnTop
//
this.chkAlwaysOnTop.AutoSize = true;
this.chkAlwaysOnTop.Location = new System.Drawing.Point(13, 23);
this.chkAlwaysOnTop.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkAlwaysOnTop.Name = "chkAlwaysOnTop";
this.chkAlwaysOnTop.Size = new System.Drawing.Size(210, 17);
this.chkAlwaysOnTop.TabIndex = 29;
this.chkAlwaysOnTop.Text = "Always display on top of other windows";
this.chkAlwaysOnTop.UseVisualStyleBackColor = true;
//
// chkShowFps
//
this.chkShowFps.AutoSize = true;
this.chkShowFps.Location = new System.Drawing.Point(13, 112);
this.chkShowFps.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkShowFps.Name = "chkShowFps";
this.chkShowFps.Size = new System.Drawing.Size(76, 17);
this.chkShowFps.TabIndex = 33;
this.chkShowFps.Text = "Show FPS";
this.chkShowFps.UseVisualStyleBackColor = true;
//
// ctrlEmulatorShortcuts
//
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(534, 383);
this.ctrlEmulatorShortcuts.TabIndex = 0;
//
// chkShowDebugInfo
//
this.chkShowDebugInfo.AutoSize = true;
this.chkShowDebugInfo.Location = new System.Drawing.Point(13, 181);
this.chkShowDebugInfo.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkShowDebugInfo.Name = "chkShowDebugInfo";
this.chkShowDebugInfo.Size = new System.Drawing.Size(140, 17);
this.chkShowDebugInfo.TabIndex = 34;
this.chkShowDebugInfo.Text = "Show debug information";
this.chkShowDebugInfo.UseVisualStyleBackColor = true;
//
// frmPreferences
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(548, 444);
this.Controls.Add(this.tabMain);
this.Name = "frmPreferences";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Preferences";
this.Controls.SetChildIndex(this.baseConfigPanel, 0);
this.Controls.SetChildIndex(this.tabMain, 0);
this.tabMain.ResumeLayout(false);
this.tpgGeneral.ResumeLayout(false);
this.tlpMain.ResumeLayout(false);
this.tlpMain.PerformLayout();
this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout();
this.tableLayoutPanel5.ResumeLayout(false);
this.tableLayoutPanel5.PerformLayout();
this.tpgShortcuts.ResumeLayout(false);
this.tpgFiles.ResumeLayout(false);
this.tableLayoutPanel6.ResumeLayout(false);
this.grpPathOverrides.ResumeLayout(false);
this.tableLayoutPanel10.ResumeLayout(false);
this.tableLayoutPanel10.PerformLayout();
this.grpFileAssociations.ResumeLayout(false);
this.tlpFileFormat.ResumeLayout(false);
this.tlpFileFormat.PerformLayout();
this.grpDataStorageLocation.ResumeLayout(false);
this.tableLayoutPanel7.ResumeLayout(false);
this.tableLayoutPanel7.PerformLayout();
this.tableLayoutPanel8.ResumeLayout(false);
this.tableLayoutPanel8.PerformLayout();
this.tableLayoutPanel9.ResumeLayout(false);
this.tableLayoutPanel9.PerformLayout();
this.tpgAdvanced.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabMain;
private System.Windows.Forms.TabPage tpgGeneral;
private System.Windows.Forms.TabPage tpgShortcuts;
private System.Windows.Forms.TabPage tpgFiles;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel6;
private System.Windows.Forms.GroupBox grpPathOverrides;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel10;
private ctrlPathSelection psGame;
private System.Windows.Forms.CheckBox chkGameOverride;
private ctrlPathSelection psWave;
private ctrlPathSelection psMovies;
private ctrlPathSelection psSaveData;
private ctrlPathSelection psSaveStates;
private ctrlPathSelection psScreenshots;
private ctrlPathSelection psAvi;
private System.Windows.Forms.CheckBox chkAviOverride;
private System.Windows.Forms.CheckBox chkScreenshotsOverride;
private System.Windows.Forms.CheckBox chkSaveDataOverride;
private System.Windows.Forms.CheckBox chkWaveOverride;
private System.Windows.Forms.CheckBox chkSaveStatesOverride;
private System.Windows.Forms.CheckBox chkMoviesOverride;
private System.Windows.Forms.GroupBox grpFileAssociations;
private System.Windows.Forms.TableLayoutPanel tlpFileFormat;
private System.Windows.Forms.CheckBox chkRomFormat;
private System.Windows.Forms.CheckBox chkMsmFormat;
private System.Windows.Forms.CheckBox chkMssFormat;
private System.Windows.Forms.GroupBox grpDataStorageLocation;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel7;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel8;
private System.Windows.Forms.RadioButton radStorageDocuments;
private System.Windows.Forms.RadioButton radStoragePortable;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel9;
private System.Windows.Forms.Label lblLocation;
private System.Windows.Forms.Label lblDataLocation;
private System.Windows.Forms.TabPage tpgAdvanced;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.CheckBox chkDisplayTitleBarInfo;
private System.Windows.Forms.CheckBox chkShowGameTimer;
private System.Windows.Forms.CheckBox chkShowFrameCounter;
private System.Windows.Forms.CheckBox chkDisableOsd;
private System.Windows.Forms.Label lblUiDisplaySettings;
private System.Windows.Forms.Label lblWindowSettings;
private System.Windows.Forms.CheckBox chkAlwaysOnTop;
private System.Windows.Forms.CheckBox chkShowFps;
private System.Windows.Forms.TableLayoutPanel tlpMain;
private System.Windows.Forms.CheckBox chkSingleInstance;
private System.Windows.Forms.CheckBox chkAutomaticallyCheckForUpdates;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.Label lblDisplayLanguage;
private System.Windows.Forms.ComboBox cboDisplayLanguage;
private System.Windows.Forms.Label lblMiscSettings;
private System.Windows.Forms.CheckBox chkAutoLoadPatches;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5;
private System.Windows.Forms.Button btnOpenMesenFolder;
private System.Windows.Forms.Button btnResetSettings;
private ctrlEmulatorShortcuts ctrlEmulatorShortcuts;
private System.Windows.Forms.CheckBox chkShowDebugInfo;
}
}

View file

@ -0,0 +1,124 @@
using Mesen.GUI.Config;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesen.GUI.Forms.Config
{
public partial class frmPreferences : BaseConfigForm
{
public frmPreferences()
{
InitializeComponent();
if(DesignMode) {
return;
}
Entity = ConfigManager.Config.Preferences.Clone();
ctrlEmulatorShortcuts.InitializeGrid((PreferencesConfig)Entity);
AddBinding(nameof(PreferencesConfig.DisplayLanguage), cboDisplayLanguage);
AddBinding(nameof(PreferencesConfig.AutomaticallyCheckForUpdates), chkAutomaticallyCheckForUpdates);
AddBinding(nameof(PreferencesConfig.SingleInstance), chkSingleInstance);
AddBinding(nameof(PreferencesConfig.AutoLoadPatches), chkAutoLoadPatches);
AddBinding(nameof(PreferencesConfig.AssociateRomFiles), chkRomFormat);
AddBinding(nameof(PreferencesConfig.AssociateMsmFiles), chkMsmFormat);
AddBinding(nameof(PreferencesConfig.AssociateMssFiles), chkMssFormat);
AddBinding(nameof(PreferencesConfig.AlwaysOnTop), chkAlwaysOnTop);
AddBinding(nameof(PreferencesConfig.ShowTitleBarInfo), chkDisplayTitleBarInfo);
AddBinding(nameof(PreferencesConfig.DisableOsd), chkDisableOsd);
AddBinding(nameof(PreferencesConfig.ShowFps), chkShowFps);
AddBinding(nameof(PreferencesConfig.ShowFrameCounter), chkShowFrameCounter);
AddBinding(nameof(PreferencesConfig.ShowGameTimer), chkShowGameTimer);
AddBinding(nameof(PreferencesConfig.ShowDebugInfo), chkShowDebugInfo);
AddBinding(nameof(PreferencesConfig.GameFolder), psGame);
AddBinding(nameof(PreferencesConfig.AviFolder), psAvi);
AddBinding(nameof(PreferencesConfig.MovieFolder), psMovies);
AddBinding(nameof(PreferencesConfig.SaveDataFolder), psSaveData);
AddBinding(nameof(PreferencesConfig.SaveStateFolder), psSaveStates);
AddBinding(nameof(PreferencesConfig.ScreenshotFolder), psScreenshots);
AddBinding(nameof(PreferencesConfig.WaveFolder), psWave);
AddBinding(nameof(PreferencesConfig.OverrideGameFolder), chkGameOverride);
AddBinding(nameof(PreferencesConfig.OverrideAviFolder), chkAviOverride);
AddBinding(nameof(PreferencesConfig.OverrideMovieFolder), chkMoviesOverride);
AddBinding(nameof(PreferencesConfig.OverrideSaveDataFolder), chkSaveDataOverride);
AddBinding(nameof(PreferencesConfig.OverrideSaveStateFolder), chkSaveStatesOverride);
AddBinding(nameof(PreferencesConfig.OverrideScreenshotFolder), chkScreenshotsOverride);
AddBinding(nameof(PreferencesConfig.OverrideWaveFolder), chkWaveOverride);
radStorageDocuments.Checked = ConfigManager.HomeFolder == ConfigManager.DefaultDocumentsFolder;
radStoragePortable.Checked = !radStorageDocuments.Checked;
UpdateLocationText();
UpdateFolderOverrideUi();
}
protected override void OnApply()
{
ctrlEmulatorShortcuts.UpdateConfig();
ConfigManager.Config.Preferences = (PreferencesConfig)this.Entity;
ConfigManager.ApplyChanges();
}
private void btnOpenMesenFolder_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(ConfigManager.HomeFolder);
}
private void btnResetSettings_Click(object sender, EventArgs e)
{
if(MesenMsgBox.Show("ResetSettingsConfirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) {
ConfigManager.ResetSettings();
this.Close();
}
}
private void UpdateFolderOverrideUi()
{
psGame.Enabled = chkGameOverride.Checked;
psAvi.Enabled = chkAviOverride.Checked;
psMovies.Enabled = chkMoviesOverride.Checked;
psSaveData.Enabled = chkSaveDataOverride.Checked;
psSaveStates.Enabled = chkSaveStatesOverride.Checked;
psScreenshots.Enabled = chkScreenshotsOverride.Checked;
psWave.Enabled = chkWaveOverride.Checked;
psGame.DisabledText = ResourceHelper.GetMessage("LastFolderUsed");
psAvi.DisabledText = ConfigManager.DefaultAviFolder;
psMovies.DisabledText = ConfigManager.DefaultMovieFolder;
psSaveData.DisabledText = ConfigManager.DefaultSaveDataFolder;
psSaveStates.DisabledText = ConfigManager.DefaultSaveStateFolder;
psScreenshots.DisabledText = ConfigManager.DefaultScreenshotFolder;
psWave.DisabledText = ConfigManager.DefaultWaveFolder;
}
private void UpdateLocationText()
{
lblLocation.Text = radStorageDocuments.Checked ? ConfigManager.DefaultDocumentsFolder : ConfigManager.DefaultPortableFolder;
}
private void chkOverride_CheckedChanged(object sender, EventArgs e)
{
UpdateFolderOverrideUi();
}
private void radStorageDocuments_CheckedChanged(object sender, EventArgs e)
{
UpdateLocationText();
}
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

280
UI/Forms/ShortcutHandler.cs Normal file
View file

@ -0,0 +1,280 @@
using Mesen.GUI.Config;
using Mesen.GUI.Config.Shortcuts;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesen.GUI.Forms
{
public class ShortcutHandler
{
private Dictionary<EmulatorShortcut, Func<bool>> _actionEnabledFuncs = new Dictionary<EmulatorShortcut, Func<bool>>();
private List<uint> _speedValues = new List<uint> { 1, 3, 6, 12, 25, 50, 75, 100, 150, 200, 250, 300, 350, 400, 450, 500, 750, 1000, 2000, 4000 };
public 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;
PreferencesConfig cfg = ConfigManager.Config.Preferences;
if(item.OwnerItem is ToolStripMenuItem) {
Action updateShortcut = () => {
int keyIndex = cfg.ShortcutKeys1.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
if(keyIndex >= 0) {
item.ShortcutKeyDisplayString = cfg.ShortcutKeys1[keyIndex].KeyCombination.ToString();
} else {
keyIndex = cfg.ShortcutKeys2.FindIndex((ShortcutKeyInfo shortcutInfo) => shortcutInfo.Shortcut == shortcut);
if(keyIndex >= 0) {
item.ShortcutKeyDisplayString = cfg.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(); };
}
}
public void ExecuteShortcut(EmulatorShortcut shortcut)
{
Func<bool> isActionEnabled;
if(_actionEnabledFuncs.TryGetValue(shortcut, out isActionEnabled)) {
isActionEnabled = _actionEnabledFuncs[shortcut];
if(isActionEnabled != null && !isActionEnabled()) {
//Action disabled
return;
}
}
//TODO bool restoreFullscreen = _frmFullscreenRenderer != null;
switch(shortcut) {
case EmulatorShortcut.Pause: PauseEmu(); break;
case EmulatorShortcut.Reset: ResetEmu(); break;
case EmulatorShortcut.PowerCycle: PowerCycleEmu(); break;
case EmulatorShortcut.PowerOff: Task.Run(() => EmuApi.Stop()); break;
case EmulatorShortcut.Exit: Application.OpenForms[0].Close(); break;
case EmulatorShortcut.ToggleAudio: ToggleAudio(); break;
case EmulatorShortcut.ToggleFps: ToggleFps(); break;
case EmulatorShortcut.ToggleGameTimer: ToggleGameTimer(); break;
case EmulatorShortcut.ToggleFrameCounter: ToggleFrameCounter(); break;
case EmulatorShortcut.ToggleOsd: ToggleOsd(); break;
case EmulatorShortcut.ToggleAlwaysOnTop: ToggleAlwaysOnTop(); break;
case EmulatorShortcut.ToggleDebugInfo: ToggleDebugInfo(); break;
case EmulatorShortcut.MaxSpeed: ToggleMaxSpeed(); break;
//case EmulatorShortcut.ToggleFullscreen: ToggleFullscreen(); restoreFullscreen = false; break;
case EmulatorShortcut.OpenFile: OpenFile(); break;
case EmulatorShortcut.IncreaseSpeed: IncreaseEmulationSpeed(); break;
case EmulatorShortcut.DecreaseSpeed: DecreaseEmulationSpeed(); 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.TakeScreenshot: EmuApi.TakeScreenshot(); break;
case EmulatorShortcut.LoadStateFromFile: EmuRunner.LoadStateFromFile(); break;
case EmulatorShortcut.SaveStateToFile: EmuRunner.SaveStateToFile(); break;
case EmulatorShortcut.SaveStateSlot1: EmuRunner.SaveState(1); break;
case EmulatorShortcut.SaveStateSlot2: EmuRunner.SaveState(2); break;
case EmulatorShortcut.SaveStateSlot3: EmuRunner.SaveState(3); break;
case EmulatorShortcut.SaveStateSlot4: EmuRunner.SaveState(4); break;
case EmulatorShortcut.SaveStateSlot5: EmuRunner.SaveState(5); break;
case EmulatorShortcut.SaveStateSlot6: EmuRunner.SaveState(6); break;
case EmulatorShortcut.SaveStateSlot7: EmuRunner.SaveState(7); break;
case EmulatorShortcut.SaveStateSlot8: EmuRunner.SaveState(8); break;
case EmulatorShortcut.SaveStateSlot9: EmuRunner.SaveState(9); break;
case EmulatorShortcut.SaveStateSlot10: EmuRunner.SaveState(10); break;
case EmulatorShortcut.LoadStateSlot1: EmuRunner.LoadState(1); break;
case EmulatorShortcut.LoadStateSlot2: EmuRunner.LoadState(2); break;
case EmulatorShortcut.LoadStateSlot3: EmuRunner.LoadState(3); break;
case EmulatorShortcut.LoadStateSlot4: EmuRunner.LoadState(4); break;
case EmulatorShortcut.LoadStateSlot5: EmuRunner.LoadState(5); break;
case EmulatorShortcut.LoadStateSlot6: EmuRunner.LoadState(6); break;
case EmulatorShortcut.LoadStateSlot7: EmuRunner.LoadState(7); break;
case EmulatorShortcut.LoadStateSlot8: EmuRunner.LoadState(8); break;
case EmulatorShortcut.LoadStateSlot9: EmuRunner.LoadState(9); break;
case EmulatorShortcut.LoadStateSlot10: EmuRunner.LoadState(10); break;
}
//TODO
/*
if(restoreFullscreen && _frmFullscreenRenderer == null && !_shuttingDown) {
//Need to restore fullscreen mode after showing a dialog
this.SetFullscreenState(true);
}*/
}
private void OpenFile()
{
using(OpenFileDialog ofd = new OpenFileDialog()) {
ofd.Filter = ResourceHelper.GetMessage("FilterRom");
if(ConfigManager.Config.Preferences.OverrideGameFolder && Directory.Exists(ConfigManager.Config.Preferences.GameFolder)) {
ofd.InitialDirectory = ConfigManager.Config.Preferences.GameFolder;
} else if(ConfigManager.Config.RecentFiles.Items.Count > 0) {
ofd.InitialDirectory = ConfigManager.Config.RecentFiles.Items[0].RomFile.Folder;
}
if(ofd.ShowDialog(Application.OpenForms[0]) == DialogResult.OK) {
EmuRunner.LoadRom(ofd.FileName);
}
}
}
public void SetVideoFilter(VideoFilterType filter)
{
ConfigManager.Config.Video.VideoFilter = filter;
ConfigManager.Config.Video.ApplyConfig();
ConfigManager.ApplyChanges();
}
private void SetScale(int scale)
{
ConfigManager.Config.Video.VideoScale = scale;
ConfigManager.Config.Video.ApplyConfig();
ConfigManager.ApplyChanges();
}
public void ToggleBilinearInterpolation()
{
ConfigManager.Config.Video.UseBilinearInterpolation = !ConfigManager.Config.Video.UseBilinearInterpolation;
ConfigManager.Config.Video.ApplyConfig();
ConfigManager.ApplyChanges();
}
private void SetEmulationSpeed(uint emulationSpeed)
{
ConfigManager.Config.Emulation.EmulationSpeed = emulationSpeed;
ConfigManager.Config.Emulation.ApplyConfig();
ConfigManager.ApplyChanges();
if(emulationSpeed == 0) {
EmuApi.DisplayMessage("EmulationSpeed", "EmulationMaximumSpeed");
} else {
EmuApi.DisplayMessage("EmulationSpeed", "EmulationSpeedPercent", emulationSpeed.ToString());
}
}
private void IncreaseEmulationSpeed()
{
uint emulationSpeed = ConfigManager.Config.Emulation.EmulationSpeed;
if(emulationSpeed == _speedValues[_speedValues.Count - 1]) {
SetEmulationSpeed(0);
} else if(emulationSpeed != 0) {
for(int i = 0; i < _speedValues.Count; i++) {
if(_speedValues[i] > emulationSpeed) {
SetEmulationSpeed(_speedValues[i]);
break;
}
}
}
}
private void DecreaseEmulationSpeed()
{
uint emulationSpeed = ConfigManager.Config.Emulation.EmulationSpeed;
if(emulationSpeed == 0) {
SetEmulationSpeed(_speedValues[_speedValues.Count - 1]);
} else if(emulationSpeed > _speedValues[0]) {
for(int i = _speedValues.Count - 1; i >= 0; i--) {
if(_speedValues[i] < emulationSpeed) {
SetEmulationSpeed(_speedValues[i]);
break;
}
}
}
}
private void ToggleMaxSpeed()
{
if(ConfigManager.Config.Emulation.EmulationSpeed == 0) {
SetEmulationSpeed(100);
} else {
SetEmulationSpeed(0);
}
}
private void ToggleOsd()
{
//TODO
}
private void ToggleFps()
{
ConfigManager.Config.Preferences.ShowFps = !ConfigManager.Config.Preferences.ShowFps;
ConfigManager.Config.Preferences.ApplyConfig();
ConfigManager.ApplyChanges();
}
private void ToggleAudio()
{
ConfigManager.Config.Audio.EnableAudio = !ConfigManager.Config.Audio.EnableAudio;
ConfigManager.Config.Audio.ApplyConfig();
ConfigManager.ApplyChanges();
}
private void ToggleFrameCounter()
{
ConfigManager.Config.Preferences.ShowFrameCounter = !ConfigManager.Config.Preferences.ShowFrameCounter;
ConfigManager.Config.Preferences.ApplyConfig();
ConfigManager.ApplyChanges();
}
private void ToggleGameTimer()
{
ConfigManager.Config.Preferences.ShowGameTimer = !ConfigManager.Config.Preferences.ShowGameTimer;
ConfigManager.Config.Preferences.ApplyConfig();
ConfigManager.ApplyChanges();
}
private void ToggleAlwaysOnTop()
{
ConfigManager.Config.Preferences.AlwaysOnTop = !ConfigManager.Config.Preferences.AlwaysOnTop;
ConfigManager.Config.Preferences.ApplyConfig();
ConfigManager.ApplyChanges();
}
private void ToggleDebugInfo()
{
ConfigManager.Config.Preferences.ShowDebugInfo = !ConfigManager.Config.Preferences.ShowDebugInfo;
ConfigManager.Config.Preferences.ApplyConfig();
ConfigManager.ApplyChanges();
}
private void PauseEmu()
{
//TODO
}
private void ResetEmu()
{
//TODO
}
private void PowerCycleEmu()
{
//TODO
}
}
}

View file

@ -31,9 +31,79 @@
this.mnuMain = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.mnuFile = new System.Windows.Forms.ToolStripMenuItem();
this.mnuOpen = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.mnuRecentFiles = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator();
this.mnuExit = new System.Windows.Forms.ToolStripMenuItem();
this.mnuGame = new System.Windows.Forms.ToolStripMenuItem();
this.mnuPause = new System.Windows.Forms.ToolStripMenuItem();
this.mnuReset = new System.Windows.Forms.ToolStripMenuItem();
this.mnuPowerCycle = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem24 = new System.Windows.Forms.ToolStripSeparator();
this.mnuPowerOff = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEmulationSpeed = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEmuSpeedNormal = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripSeparator();
this.mnuIncreaseSpeed = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDecreaseSpeed = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEmuSpeedMaximumSpeed = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripSeparator();
this.mnuEmuSpeedTriple = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEmuSpeedDouble = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEmuSpeedHalf = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEmuSpeedQuarter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem14 = new System.Windows.Forms.ToolStripSeparator();
this.mnuShowFPS = new System.Windows.Forms.ToolStripMenuItem();
this.mnuVideoScale = new System.Windows.Forms.ToolStripMenuItem();
this.mnuScale1x = new System.Windows.Forms.ToolStripMenuItem();
this.mnuScale2x = new System.Windows.Forms.ToolStripMenuItem();
this.mnuScale3x = new System.Windows.Forms.ToolStripMenuItem();
this.mnuScale4x = new System.Windows.Forms.ToolStripMenuItem();
this.mnuScale5x = new System.Windows.Forms.ToolStripMenuItem();
this.mnuScale6x = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem13 = new System.Windows.Forms.ToolStripSeparator();
this.mnuFullscreen = new System.Windows.Forms.ToolStripMenuItem();
this.mnuVideoFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuNoneFilter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem21 = new System.Windows.Forms.ToolStripSeparator();
this.mnuNtscFilter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem15 = new System.Windows.Forms.ToolStripSeparator();
this.mnuXBRZ2xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuXBRZ3xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuXBRZ4xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuXBRZ5xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuXBRZ6xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem16 = new System.Windows.Forms.ToolStripSeparator();
this.mnuHQ2xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHQ3xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHQ4xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem17 = new System.Windows.Forms.ToolStripSeparator();
this.mnuScale2xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuScale3xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuScale4xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem23 = new System.Windows.Forms.ToolStripSeparator();
this.mnu2xSaiFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuSuper2xSaiFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuSuperEagleFilter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem18 = new System.Windows.Forms.ToolStripSeparator();
this.mnuPrescale2xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuPrescale3xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuPrescale4xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuPrescale6xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuPrescale8xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.mnuPrescale10xFilter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem19 = new System.Windows.Forms.ToolStripSeparator();
this.mnuBilinearInterpolation = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
this.mnuAudioConfig = new System.Windows.Forms.ToolStripMenuItem();
this.mnuVideoConfig = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
this.mnuPreferences = new System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuLogWindow = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripSeparator();
this.mnuTakeScreenshot = new System.Windows.Forms.ToolStripMenuItem();
this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuRun = new System.Windows.Forms.ToolStripMenuItem();
this.mnuStep = new System.Windows.Forms.ToolStripMenuItem();
@ -44,11 +114,13 @@
this.mnuTraceLogger = new System.Windows.Forms.ToolStripMenuItem();
this.mnuTilemapViewer = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEventViewer = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem();
this.mnuCheckForUpdates = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem20 = new System.Windows.Forms.ToolStripSeparator();
this.mnuReportBug = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
this.pnlRenderer = new System.Windows.Forms.Panel();
this.mnuRecentFiles = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator();
this.mnuExit = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.mnuMain.SuspendLayout();
this.pnlRenderer.SuspendLayout();
this.SuspendLayout();
@ -64,8 +136,11 @@
//
this.mnuMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuFile,
this.mnuGame,
this.optionsToolStripMenuItem,
this.debugToolStripMenuItem});
this.toolsToolStripMenuItem,
this.debugToolStripMenuItem,
this.mnuHelp});
this.mnuMain.Location = new System.Drawing.Point(0, 0);
this.mnuMain.Name = "mnuMain";
this.mnuMain.Size = new System.Drawing.Size(512, 24);
@ -90,19 +165,470 @@
this.mnuOpen.Image = global::Mesen.GUI.Properties.Resources.Folder;
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(152, 22);
this.mnuOpen.Size = new System.Drawing.Size(146, 22);
this.mnuOpen.Text = "Open";
this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(143, 6);
//
// mnuRecentFiles
//
this.mnuRecentFiles.Name = "mnuRecentFiles";
this.mnuRecentFiles.Size = new System.Drawing.Size(146, 22);
this.mnuRecentFiles.Text = "Recent Files";
//
// toolStripMenuItem6
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(143, 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.Text = "Exit";
this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
//
// mnuGame
//
this.mnuGame.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuPause,
this.mnuReset,
this.mnuPowerCycle,
this.toolStripMenuItem24,
this.mnuPowerOff});
this.mnuGame.Name = "mnuGame";
this.mnuGame.Size = new System.Drawing.Size(50, 20);
this.mnuGame.Text = "Game";
//
// mnuPause
//
this.mnuPause.Enabled = false;
this.mnuPause.Image = global::Mesen.GUI.Properties.Resources.MediaPause;
this.mnuPause.Name = "mnuPause";
this.mnuPause.Size = new System.Drawing.Size(139, 22);
this.mnuPause.Text = "Pause";
//
// mnuReset
//
this.mnuReset.Enabled = false;
this.mnuReset.Image = global::Mesen.GUI.Properties.Resources.Refresh;
this.mnuReset.Name = "mnuReset";
this.mnuReset.Size = new System.Drawing.Size(139, 22);
this.mnuReset.Text = "Reset";
//
// mnuPowerCycle
//
this.mnuPowerCycle.Enabled = false;
this.mnuPowerCycle.Image = global::Mesen.GUI.Properties.Resources.PowerCycle;
this.mnuPowerCycle.Name = "mnuPowerCycle";
this.mnuPowerCycle.Size = new System.Drawing.Size(139, 22);
this.mnuPowerCycle.Text = "Power Cycle";
//
// toolStripMenuItem24
//
this.toolStripMenuItem24.Name = "toolStripMenuItem24";
this.toolStripMenuItem24.Size = new System.Drawing.Size(136, 6);
//
// mnuPowerOff
//
this.mnuPowerOff.Image = global::Mesen.GUI.Properties.Resources.MediaStop;
this.mnuPowerOff.Name = "mnuPowerOff";
this.mnuPowerOff.Size = new System.Drawing.Size(139, 22);
this.mnuPowerOff.Text = "Power Off";
//
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuEmulationSpeed,
this.mnuVideoScale,
this.mnuVideoFilter,
this.toolStripMenuItem4,
this.mnuAudioConfig,
this.mnuVideoConfig});
this.mnuVideoConfig,
this.toolStripMenuItem3,
this.mnuPreferences});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.optionsToolStripMenuItem.Text = "Options";
//
// mnuEmulationSpeed
//
this.mnuEmulationSpeed.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuEmuSpeedNormal,
this.toolStripMenuItem8,
this.mnuIncreaseSpeed,
this.mnuDecreaseSpeed,
this.mnuEmuSpeedMaximumSpeed,
this.toolStripMenuItem9,
this.mnuEmuSpeedTriple,
this.mnuEmuSpeedDouble,
this.mnuEmuSpeedHalf,
this.mnuEmuSpeedQuarter,
this.toolStripMenuItem14,
this.mnuShowFPS});
this.mnuEmulationSpeed.Image = global::Mesen.GUI.Properties.Resources.Speed;
this.mnuEmulationSpeed.Name = "mnuEmulationSpeed";
this.mnuEmulationSpeed.Size = new System.Drawing.Size(152, 22);
this.mnuEmulationSpeed.Text = "Speed";
this.mnuEmulationSpeed.DropDownOpening += new System.EventHandler(this.mnuEmulationSpeed_DropDownOpening);
//
// mnuEmuSpeedNormal
//
this.mnuEmuSpeedNormal.Name = "mnuEmuSpeedNormal";
this.mnuEmuSpeedNormal.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedNormal.Text = "Normal (100%)";
//
// toolStripMenuItem8
//
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
this.toolStripMenuItem8.Size = new System.Drawing.Size(160, 6);
//
// mnuIncreaseSpeed
//
this.mnuIncreaseSpeed.Name = "mnuIncreaseSpeed";
this.mnuIncreaseSpeed.Size = new System.Drawing.Size(163, 22);
this.mnuIncreaseSpeed.Text = "Increase Speed";
//
// mnuDecreaseSpeed
//
this.mnuDecreaseSpeed.Name = "mnuDecreaseSpeed";
this.mnuDecreaseSpeed.Size = new System.Drawing.Size(163, 22);
this.mnuDecreaseSpeed.Text = "Decrease Speed";
//
// mnuEmuSpeedMaximumSpeed
//
this.mnuEmuSpeedMaximumSpeed.Name = "mnuEmuSpeedMaximumSpeed";
this.mnuEmuSpeedMaximumSpeed.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedMaximumSpeed.Text = "Maximum Speed";
//
// toolStripMenuItem9
//
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
this.toolStripMenuItem9.Size = new System.Drawing.Size(160, 6);
//
// mnuEmuSpeedTriple
//
this.mnuEmuSpeedTriple.Name = "mnuEmuSpeedTriple";
this.mnuEmuSpeedTriple.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedTriple.Tag = "";
this.mnuEmuSpeedTriple.Text = "Triple (300%)";
//
// mnuEmuSpeedDouble
//
this.mnuEmuSpeedDouble.Name = "mnuEmuSpeedDouble";
this.mnuEmuSpeedDouble.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedDouble.Text = "Double (200%)";
//
// mnuEmuSpeedHalf
//
this.mnuEmuSpeedHalf.Name = "mnuEmuSpeedHalf";
this.mnuEmuSpeedHalf.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedHalf.Text = "Half (50%)";
//
// mnuEmuSpeedQuarter
//
this.mnuEmuSpeedQuarter.Name = "mnuEmuSpeedQuarter";
this.mnuEmuSpeedQuarter.Size = new System.Drawing.Size(163, 22);
this.mnuEmuSpeedQuarter.Text = "Quarter (25%)";
//
// toolStripMenuItem14
//
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
this.toolStripMenuItem14.Size = new System.Drawing.Size(160, 6);
//
// mnuShowFPS
//
this.mnuShowFPS.CheckOnClick = true;
this.mnuShowFPS.Name = "mnuShowFPS";
this.mnuShowFPS.Size = new System.Drawing.Size(163, 22);
this.mnuShowFPS.Text = "Show FPS";
//
// mnuVideoScale
//
this.mnuVideoScale.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuScale1x,
this.mnuScale2x,
this.mnuScale3x,
this.mnuScale4x,
this.mnuScale5x,
this.mnuScale6x,
this.toolStripMenuItem13,
this.mnuFullscreen});
this.mnuVideoScale.Image = global::Mesen.GUI.Properties.Resources.Fullscreen;
this.mnuVideoScale.Name = "mnuVideoScale";
this.mnuVideoScale.Size = new System.Drawing.Size(152, 22);
this.mnuVideoScale.Text = "Video Size";
this.mnuVideoScale.DropDownOpening += new System.EventHandler(this.mnuVideoScale_DropDownOpening);
//
// mnuScale1x
//
this.mnuScale1x.Name = "mnuScale1x";
this.mnuScale1x.Size = new System.Drawing.Size(127, 22);
this.mnuScale1x.Text = "1x";
//
// mnuScale2x
//
this.mnuScale2x.Name = "mnuScale2x";
this.mnuScale2x.Size = new System.Drawing.Size(127, 22);
this.mnuScale2x.Text = "2x";
//
// mnuScale3x
//
this.mnuScale3x.Name = "mnuScale3x";
this.mnuScale3x.Size = new System.Drawing.Size(127, 22);
this.mnuScale3x.Text = "3x";
//
// mnuScale4x
//
this.mnuScale4x.Name = "mnuScale4x";
this.mnuScale4x.Size = new System.Drawing.Size(127, 22);
this.mnuScale4x.Text = "4x";
//
// mnuScale5x
//
this.mnuScale5x.Name = "mnuScale5x";
this.mnuScale5x.Size = new System.Drawing.Size(127, 22);
this.mnuScale5x.Text = "5x";
//
// mnuScale6x
//
this.mnuScale6x.Name = "mnuScale6x";
this.mnuScale6x.Size = new System.Drawing.Size(127, 22);
this.mnuScale6x.Text = "6x";
//
// toolStripMenuItem13
//
this.toolStripMenuItem13.Name = "toolStripMenuItem13";
this.toolStripMenuItem13.Size = new System.Drawing.Size(124, 6);
//
// mnuFullscreen
//
this.mnuFullscreen.Name = "mnuFullscreen";
this.mnuFullscreen.Size = new System.Drawing.Size(127, 22);
this.mnuFullscreen.Text = "Fullscreen";
//
// mnuVideoFilter
//
this.mnuVideoFilter.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuNoneFilter,
this.toolStripMenuItem21,
this.mnuNtscFilter,
this.toolStripMenuItem15,
this.mnuXBRZ2xFilter,
this.mnuXBRZ3xFilter,
this.mnuXBRZ4xFilter,
this.mnuXBRZ5xFilter,
this.mnuXBRZ6xFilter,
this.toolStripMenuItem16,
this.mnuHQ2xFilter,
this.mnuHQ3xFilter,
this.mnuHQ4xFilter,
this.toolStripMenuItem17,
this.mnuScale2xFilter,
this.mnuScale3xFilter,
this.mnuScale4xFilter,
this.toolStripMenuItem23,
this.mnu2xSaiFilter,
this.mnuSuper2xSaiFilter,
this.mnuSuperEagleFilter,
this.toolStripMenuItem18,
this.mnuPrescale2xFilter,
this.mnuPrescale3xFilter,
this.mnuPrescale4xFilter,
this.mnuPrescale6xFilter,
this.mnuPrescale8xFilter,
this.mnuPrescale10xFilter,
this.toolStripMenuItem19,
this.mnuBilinearInterpolation});
this.mnuVideoFilter.Image = global::Mesen.GUI.Properties.Resources.VideoFilter;
this.mnuVideoFilter.Name = "mnuVideoFilter";
this.mnuVideoFilter.Size = new System.Drawing.Size(152, 22);
this.mnuVideoFilter.Text = "Video Filter";
this.mnuVideoFilter.DropDownOpening += new System.EventHandler(this.mnuVideoFilter_DropDownOpening);
//
// mnuNoneFilter
//
this.mnuNoneFilter.Name = "mnuNoneFilter";
this.mnuNoneFilter.Size = new System.Drawing.Size(206, 22);
this.mnuNoneFilter.Text = "None";
//
// toolStripMenuItem21
//
this.toolStripMenuItem21.Name = "toolStripMenuItem21";
this.toolStripMenuItem21.Size = new System.Drawing.Size(203, 6);
//
// mnuNtscFilter
//
this.mnuNtscFilter.Name = "mnuNtscFilter";
this.mnuNtscFilter.Size = new System.Drawing.Size(206, 22);
this.mnuNtscFilter.Text = "NTSC";
//
// toolStripMenuItem15
//
this.toolStripMenuItem15.Name = "toolStripMenuItem15";
this.toolStripMenuItem15.Size = new System.Drawing.Size(203, 6);
//
// mnuXBRZ2xFilter
//
this.mnuXBRZ2xFilter.Name = "mnuXBRZ2xFilter";
this.mnuXBRZ2xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuXBRZ2xFilter.Text = "xBRZ 2x";
//
// mnuXBRZ3xFilter
//
this.mnuXBRZ3xFilter.Name = "mnuXBRZ3xFilter";
this.mnuXBRZ3xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuXBRZ3xFilter.Text = "xBRZ 3x";
//
// mnuXBRZ4xFilter
//
this.mnuXBRZ4xFilter.Name = "mnuXBRZ4xFilter";
this.mnuXBRZ4xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuXBRZ4xFilter.Text = "xBRZ 4x";
//
// mnuXBRZ5xFilter
//
this.mnuXBRZ5xFilter.Name = "mnuXBRZ5xFilter";
this.mnuXBRZ5xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuXBRZ5xFilter.Text = "xBRZ 5x";
//
// mnuXBRZ6xFilter
//
this.mnuXBRZ6xFilter.Name = "mnuXBRZ6xFilter";
this.mnuXBRZ6xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuXBRZ6xFilter.Text = "xBRZ 6x";
//
// toolStripMenuItem16
//
this.toolStripMenuItem16.Name = "toolStripMenuItem16";
this.toolStripMenuItem16.Size = new System.Drawing.Size(203, 6);
//
// mnuHQ2xFilter
//
this.mnuHQ2xFilter.Name = "mnuHQ2xFilter";
this.mnuHQ2xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuHQ2xFilter.Text = "HQ 2x";
//
// mnuHQ3xFilter
//
this.mnuHQ3xFilter.Name = "mnuHQ3xFilter";
this.mnuHQ3xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuHQ3xFilter.Text = "HQ 3x";
//
// mnuHQ4xFilter
//
this.mnuHQ4xFilter.Name = "mnuHQ4xFilter";
this.mnuHQ4xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuHQ4xFilter.Text = "HQ 4x";
//
// toolStripMenuItem17
//
this.toolStripMenuItem17.Name = "toolStripMenuItem17";
this.toolStripMenuItem17.Size = new System.Drawing.Size(203, 6);
//
// mnuScale2xFilter
//
this.mnuScale2xFilter.Name = "mnuScale2xFilter";
this.mnuScale2xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuScale2xFilter.Text = "Scale2x";
//
// mnuScale3xFilter
//
this.mnuScale3xFilter.Name = "mnuScale3xFilter";
this.mnuScale3xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuScale3xFilter.Text = "Scale3x";
//
// mnuScale4xFilter
//
this.mnuScale4xFilter.Name = "mnuScale4xFilter";
this.mnuScale4xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuScale4xFilter.Text = "Scale4x";
//
// toolStripMenuItem23
//
this.toolStripMenuItem23.Name = "toolStripMenuItem23";
this.toolStripMenuItem23.Size = new System.Drawing.Size(203, 6);
//
// mnu2xSaiFilter
//
this.mnu2xSaiFilter.Name = "mnu2xSaiFilter";
this.mnu2xSaiFilter.Size = new System.Drawing.Size(206, 22);
this.mnu2xSaiFilter.Text = "2xSai";
//
// mnuSuper2xSaiFilter
//
this.mnuSuper2xSaiFilter.Name = "mnuSuper2xSaiFilter";
this.mnuSuper2xSaiFilter.Size = new System.Drawing.Size(206, 22);
this.mnuSuper2xSaiFilter.Text = "Super2xSai";
//
// mnuSuperEagleFilter
//
this.mnuSuperEagleFilter.Name = "mnuSuperEagleFilter";
this.mnuSuperEagleFilter.Size = new System.Drawing.Size(206, 22);
this.mnuSuperEagleFilter.Text = "SuperEagle";
//
// toolStripMenuItem18
//
this.toolStripMenuItem18.Name = "toolStripMenuItem18";
this.toolStripMenuItem18.Size = new System.Drawing.Size(203, 6);
//
// mnuPrescale2xFilter
//
this.mnuPrescale2xFilter.Name = "mnuPrescale2xFilter";
this.mnuPrescale2xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuPrescale2xFilter.Text = "Prescale 2x";
//
// mnuPrescale3xFilter
//
this.mnuPrescale3xFilter.Name = "mnuPrescale3xFilter";
this.mnuPrescale3xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuPrescale3xFilter.Text = "Prescale 3x";
//
// mnuPrescale4xFilter
//
this.mnuPrescale4xFilter.Name = "mnuPrescale4xFilter";
this.mnuPrescale4xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuPrescale4xFilter.Text = "Prescale 4x";
//
// mnuPrescale6xFilter
//
this.mnuPrescale6xFilter.Name = "mnuPrescale6xFilter";
this.mnuPrescale6xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuPrescale6xFilter.Text = "Prescale 6x";
//
// mnuPrescale8xFilter
//
this.mnuPrescale8xFilter.Name = "mnuPrescale8xFilter";
this.mnuPrescale8xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuPrescale8xFilter.Text = "Prescale 8x";
//
// mnuPrescale10xFilter
//
this.mnuPrescale10xFilter.Name = "mnuPrescale10xFilter";
this.mnuPrescale10xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuPrescale10xFilter.Text = "Prescale 10x";
//
// toolStripMenuItem19
//
this.toolStripMenuItem19.Name = "toolStripMenuItem19";
this.toolStripMenuItem19.Size = new System.Drawing.Size(203, 6);
//
// mnuBilinearInterpolation
//
this.mnuBilinearInterpolation.CheckOnClick = true;
this.mnuBilinearInterpolation.Name = "mnuBilinearInterpolation";
this.mnuBilinearInterpolation.Size = new System.Drawing.Size(206, 22);
this.mnuBilinearInterpolation.Text = "Use Bilinear Interpolation";
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(149, 6);
//
// mnuAudioConfig
//
this.mnuAudioConfig.Image = global::Mesen.GUI.Properties.Resources.Audio;
@ -119,6 +645,49 @@
this.mnuVideoConfig.Text = "Video";
this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(149, 6);
//
// mnuPreferences
//
this.mnuPreferences.Image = global::Mesen.GUI.Properties.Resources.Settings;
this.mnuPreferences.Name = "mnuPreferences";
this.mnuPreferences.Size = new System.Drawing.Size(152, 22);
this.mnuPreferences.Text = "Preferences";
this.mnuPreferences.Click += new System.EventHandler(this.mnuPreferences_Click);
//
// toolsToolStripMenuItem
//
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuLogWindow,
this.toolStripMenuItem7,
this.mnuTakeScreenshot});
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
this.toolsToolStripMenuItem.Text = "Tools";
//
// mnuLogWindow
//
this.mnuLogWindow.Image = global::Mesen.GUI.Properties.Resources.LogWindow;
this.mnuLogWindow.Name = "mnuLogWindow";
this.mnuLogWindow.Size = new System.Drawing.Size(159, 22);
this.mnuLogWindow.Text = "Log Window";
this.mnuLogWindow.Click += new System.EventHandler(this.mnuLogWindow_Click);
//
// toolStripMenuItem7
//
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(156, 6);
//
// mnuTakeScreenshot
//
this.mnuTakeScreenshot.Image = global::Mesen.GUI.Properties.Resources.Camera;
this.mnuTakeScreenshot.Name = "mnuTakeScreenshot";
this.mnuTakeScreenshot.Size = new System.Drawing.Size(159, 22);
this.mnuTakeScreenshot.Text = "Take Screenshot";
//
// debugToolStripMenuItem
//
this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -204,6 +773,48 @@
this.mnuEventViewer.Text = "Event Viewer";
this.mnuEventViewer.Click += new System.EventHandler(this.mnuEventViewer_Click);
//
// mnuHelp
//
this.mnuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuCheckForUpdates,
this.toolStripMenuItem20,
this.mnuReportBug,
this.toolStripMenuItem5,
this.mnuAbout});
this.mnuHelp.Name = "mnuHelp";
this.mnuHelp.Size = new System.Drawing.Size(44, 20);
this.mnuHelp.Text = "Help";
//
// mnuCheckForUpdates
//
this.mnuCheckForUpdates.Name = "mnuCheckForUpdates";
this.mnuCheckForUpdates.Size = new System.Drawing.Size(170, 22);
this.mnuCheckForUpdates.Text = "Check for updates";
//
// toolStripMenuItem20
//
this.toolStripMenuItem20.Name = "toolStripMenuItem20";
this.toolStripMenuItem20.Size = new System.Drawing.Size(167, 6);
//
// mnuReportBug
//
this.mnuReportBug.Image = global::Mesen.GUI.Properties.Resources.Comment;
this.mnuReportBug.Name = "mnuReportBug";
this.mnuReportBug.Size = new System.Drawing.Size(170, 22);
this.mnuReportBug.Text = "Report a bug";
//
// toolStripMenuItem5
//
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
this.toolStripMenuItem5.Size = new System.Drawing.Size(167, 6);
//
// mnuAbout
//
this.mnuAbout.Image = global::Mesen.GUI.Properties.Resources.Exclamation;
this.mnuAbout.Name = "mnuAbout";
this.mnuAbout.Size = new System.Drawing.Size(170, 22);
this.mnuAbout.Text = "About";
//
// pnlRenderer
//
this.pnlRenderer.BackColor = System.Drawing.Color.Black;
@ -214,30 +825,6 @@
this.pnlRenderer.Size = new System.Drawing.Size(512, 448);
this.pnlRenderer.TabIndex = 2;
//
// mnuRecentFiles
//
this.mnuRecentFiles.Name = "mnuRecentFiles";
this.mnuRecentFiles.Size = new System.Drawing.Size(152, 22);
this.mnuRecentFiles.Text = "Recent Files";
//
// toolStripMenuItem6
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(149, 6);
//
// mnuExit
//
this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit;
this.mnuExit.Name = "mnuExit";
this.mnuExit.Size = new System.Drawing.Size(152, 22);
this.mnuExit.Text = "Exit";
this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6);
//
// frmMain
//
this.AllowDrop = true;
@ -281,5 +868,77 @@
private System.Windows.Forms.ToolStripMenuItem mnuRecentFiles;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem6;
private System.Windows.Forms.ToolStripMenuItem mnuExit;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
private System.Windows.Forms.ToolStripMenuItem mnuPreferences;
private System.Windows.Forms.ToolStripMenuItem mnuGame;
private System.Windows.Forms.ToolStripMenuItem mnuPause;
private System.Windows.Forms.ToolStripMenuItem mnuReset;
private System.Windows.Forms.ToolStripMenuItem mnuPowerCycle;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem24;
private System.Windows.Forms.ToolStripMenuItem mnuPowerOff;
private System.Windows.Forms.ToolStripMenuItem mnuEmulationSpeed;
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedNormal;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem8;
private System.Windows.Forms.ToolStripMenuItem mnuIncreaseSpeed;
private System.Windows.Forms.ToolStripMenuItem mnuDecreaseSpeed;
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedMaximumSpeed;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem9;
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedTriple;
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedDouble;
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedHalf;
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedQuarter;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem14;
private System.Windows.Forms.ToolStripMenuItem mnuShowFPS;
private System.Windows.Forms.ToolStripMenuItem mnuVideoScale;
private System.Windows.Forms.ToolStripMenuItem mnuScale1x;
private System.Windows.Forms.ToolStripMenuItem mnuScale2x;
private System.Windows.Forms.ToolStripMenuItem mnuScale3x;
private System.Windows.Forms.ToolStripMenuItem mnuScale4x;
private System.Windows.Forms.ToolStripMenuItem mnuScale5x;
private System.Windows.Forms.ToolStripMenuItem mnuScale6x;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem13;
private System.Windows.Forms.ToolStripMenuItem mnuFullscreen;
private System.Windows.Forms.ToolStripMenuItem mnuVideoFilter;
private System.Windows.Forms.ToolStripMenuItem mnuNoneFilter;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem21;
private System.Windows.Forms.ToolStripMenuItem mnuNtscFilter;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem15;
private System.Windows.Forms.ToolStripMenuItem mnuXBRZ2xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuXBRZ3xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuXBRZ4xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuXBRZ5xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuXBRZ6xFilter;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem16;
private System.Windows.Forms.ToolStripMenuItem mnuHQ2xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuHQ3xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuHQ4xFilter;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem17;
private System.Windows.Forms.ToolStripMenuItem mnuScale2xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuScale3xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuScale4xFilter;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem23;
private System.Windows.Forms.ToolStripMenuItem mnu2xSaiFilter;
private System.Windows.Forms.ToolStripMenuItem mnuSuper2xSaiFilter;
private System.Windows.Forms.ToolStripMenuItem mnuSuperEagleFilter;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem18;
private System.Windows.Forms.ToolStripMenuItem mnuPrescale2xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuPrescale3xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuPrescale4xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuPrescale6xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuPrescale8xFilter;
private System.Windows.Forms.ToolStripMenuItem mnuPrescale10xFilter;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem19;
private System.Windows.Forms.ToolStripMenuItem mnuBilinearInterpolation;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
private System.Windows.Forms.ToolStripMenuItem mnuHelp;
private System.Windows.Forms.ToolStripMenuItem mnuCheckForUpdates;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem20;
private System.Windows.Forms.ToolStripMenuItem mnuReportBug;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5;
private System.Windows.Forms.ToolStripMenuItem mnuAbout;
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuLogWindow;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem7;
private System.Windows.Forms.ToolStripMenuItem mnuTakeScreenshot;
}
}

View file

@ -1,4 +1,5 @@
using Mesen.GUI.Config;
using Mesen.GUI.Config.Shortcuts;
using Mesen.GUI.Debugger;
using Mesen.GUI.Forms.Config;
using System;
@ -17,6 +18,7 @@ namespace Mesen.GUI.Forms
public partial class frmMain : BaseInputForm
{
private NotificationListener _notifListener;
private ShortcutHandler _shortcuts;
public frmMain(string[] args)
{
@ -28,15 +30,19 @@ namespace Mesen.GUI.Forms
{
base.OnShown(e);
_shortcuts = new ShortcutHandler();
EmuApi.InitDll();
ConfigManager.Config.Video.ApplyConfig();
EmuApi.InitializeEmu(ConfigManager.HomeFolder, Handle, ctrlRenderer.Handle, false, false, false);
ConfigManager.Config.InitializeDefaults();
ConfigManager.Config.ApplyConfig();
_notifListener = new NotificationListener();
_notifListener.OnNotification += OnNotificationReceived;
new frmLogWindow().Show();
BindShortcuts();
}
protected override void OnFormClosing(FormClosingEventArgs e)
@ -64,8 +70,81 @@ namespace Mesen.GUI.Forms
UpdateViewerSize(size);
}));
break;
case ConsoleNotificationType.ExecuteShortcut:
this.BeginInvoke((Action)(() => {
_shortcuts.ExecuteShortcut((EmulatorShortcut)e.Parameter);
}));
break;
}
}
private void BindShortcuts()
{
Func<bool> notClient = () => { return true; }; //TODO
Func<bool> runningNotClient = () => { return EmuRunner.IsRunning(); }; //TODO
Func<bool> runningNotClientNotMovie = () => { return EmuRunner.IsRunning(); }; //TODO
_shortcuts.BindShortcut(mnuOpen, EmulatorShortcut.OpenFile);
_shortcuts.BindShortcut(mnuExit, EmulatorShortcut.Exit);
_shortcuts.BindShortcut(mnuIncreaseSpeed, EmulatorShortcut.IncreaseSpeed, notClient);
_shortcuts.BindShortcut(mnuDecreaseSpeed, EmulatorShortcut.DecreaseSpeed, notClient);
_shortcuts.BindShortcut(mnuEmuSpeedMaximumSpeed, EmulatorShortcut.MaxSpeed, notClient);
_shortcuts.BindShortcut(mnuPause, EmulatorShortcut.Pause, runningNotClient);
_shortcuts.BindShortcut(mnuReset, EmulatorShortcut.Reset, runningNotClientNotMovie);
_shortcuts.BindShortcut(mnuPowerCycle, EmulatorShortcut.PowerCycle, runningNotClientNotMovie);
_shortcuts.BindShortcut(mnuPowerOff, EmulatorShortcut.PowerOff, runningNotClient);
_shortcuts.BindShortcut(mnuShowFPS, EmulatorShortcut.ToggleFps);
_shortcuts.BindShortcut(mnuScale1x, EmulatorShortcut.SetScale1x);
_shortcuts.BindShortcut(mnuScale2x, EmulatorShortcut.SetScale2x);
_shortcuts.BindShortcut(mnuScale3x, EmulatorShortcut.SetScale3x);
_shortcuts.BindShortcut(mnuScale4x, EmulatorShortcut.SetScale4x);
_shortcuts.BindShortcut(mnuScale5x, EmulatorShortcut.SetScale5x);
_shortcuts.BindShortcut(mnuScale6x, EmulatorShortcut.SetScale6x);
_shortcuts.BindShortcut(mnuFullscreen, EmulatorShortcut.ToggleFullscreen);
_shortcuts.BindShortcut(mnuTakeScreenshot, EmulatorShortcut.TakeScreenshot);
mnuDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenDebugger));
mnuMemoryTools.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenMemoryTools));
mnuEventViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenEventViewer));
mnuTilemapViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenPpuViewer));
mnuTraceLogger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTraceLogger));
mnuNoneFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.None); };
mnuNtscFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.NTSC); };
mnuHQ2xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.HQ2x); };
mnuHQ3xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.HQ3x); };
mnuHQ4xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.HQ4x); };
mnuPrescale2xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale2x); };
mnuPrescale3xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale3x); };
mnuPrescale4xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale4x); };
mnuPrescale6xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale6x); };
mnuPrescale8xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale8x); };
mnuPrescale10xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale10x); };
mnuScale2xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Scale2x); };
mnuScale3xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Scale3x); };
mnuScale4xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Scale4x); };
mnu2xSaiFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType._2xSai); };
mnuSuper2xSaiFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Super2xSai); };
mnuSuperEagleFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.SuperEagle); };
mnuXBRZ2xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ2x); };
mnuXBRZ3xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ3x); };
mnuXBRZ4xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ4x); };
mnuXBRZ5xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ5x); };
mnuXBRZ6xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ6x); };
mnuBilinearInterpolation.Click += (s, e) => { _shortcuts.ToggleBilinearInterpolation(); };
}
private void UpdateViewerSize(ScreenSize screenSize)
{
@ -100,6 +179,14 @@ namespace Mesen.GUI.Forms
}
ConfigManager.Config.Audio.ApplyConfig();
}
private void mnuPreferences_Click(object sender, EventArgs e)
{
using(frmPreferences frm = new frmPreferences()) {
frm.ShowDialog(sender, this);
}
ConfigManager.Config.Preferences.ApplyConfig();
}
private void mnuDebugger_Click(object sender, EventArgs e)
{
@ -131,16 +218,6 @@ namespace Mesen.GUI.Forms
DebugApi.Step(1);
}
private void mnuOpen_Click(object sender, EventArgs e)
{
using(OpenFileDialog ofd = new OpenFileDialog()) {
ofd.Filter = ResourceHelper.GetMessage("FilterRom");
if(ofd.ShowDialog() == DialogResult.OK) {
EmuRunner.LoadRom(ofd.FileName);
}
}
}
private void mnuRun_Click(object sender, EventArgs e)
{
DebugApi.ResumeExecution();
@ -187,6 +264,11 @@ namespace Mesen.GUI.Forms
{
this.Close();
}
private void mnuLogWindow_Click(object sender, EventArgs e)
{
new frmLogWindow().Show();
}
private void mnuFile_DropDownOpening(object sender, EventArgs e)
{
@ -194,5 +276,56 @@ namespace Mesen.GUI.Forms
mnuRecentFiles.DropDownItems.AddRange(ConfigManager.Config.RecentFiles.GetMenuItems().ToArray());
mnuRecentFiles.Enabled = ConfigManager.Config.RecentFiles.Items.Count > 0;
}
private void mnuVideoFilter_DropDownOpening(object sender, EventArgs e)
{
VideoFilterType filterType = ConfigManager.Config.Video.VideoFilter;
mnuNoneFilter.Checked = (filterType == VideoFilterType.None);
mnuNtscFilter.Checked = (filterType == VideoFilterType.NTSC);
mnuXBRZ2xFilter.Checked = (filterType == VideoFilterType.xBRZ2x);
mnuXBRZ3xFilter.Checked = (filterType == VideoFilterType.xBRZ3x);
mnuXBRZ4xFilter.Checked = (filterType == VideoFilterType.xBRZ4x);
mnuXBRZ5xFilter.Checked = (filterType == VideoFilterType.xBRZ5x);
mnuXBRZ6xFilter.Checked = (filterType == VideoFilterType.xBRZ6x);
mnuHQ2xFilter.Checked = (filterType == VideoFilterType.HQ2x);
mnuHQ3xFilter.Checked = (filterType == VideoFilterType.HQ3x);
mnuHQ4xFilter.Checked = (filterType == VideoFilterType.HQ4x);
mnuScale2xFilter.Checked = (filterType == VideoFilterType.Scale2x);
mnuScale3xFilter.Checked = (filterType == VideoFilterType.Scale3x);
mnuScale4xFilter.Checked = (filterType == VideoFilterType.Scale4x);
mnu2xSaiFilter.Checked = (filterType == VideoFilterType._2xSai);
mnuSuper2xSaiFilter.Checked = (filterType == VideoFilterType.Super2xSai);
mnuSuperEagleFilter.Checked = (filterType == VideoFilterType.SuperEagle);
mnuPrescale2xFilter.Checked = (filterType == VideoFilterType.Prescale2x);
mnuPrescale3xFilter.Checked = (filterType == VideoFilterType.Prescale3x);
mnuPrescale4xFilter.Checked = (filterType == VideoFilterType.Prescale4x);
mnuPrescale6xFilter.Checked = (filterType == VideoFilterType.Prescale6x);
mnuPrescale8xFilter.Checked = (filterType == VideoFilterType.Prescale8x);
mnuPrescale10xFilter.Checked = (filterType == VideoFilterType.Prescale10x);
mnuBilinearInterpolation.Checked = ConfigManager.Config.Video.UseBilinearInterpolation;
}
private void mnuVideoScale_DropDownOpening(object sender, EventArgs e)
{
double scale = ConfigManager.Config.Video.VideoScale;
mnuScale1x.Checked = (scale == 1.0);
mnuScale2x.Checked = (scale == 2.0);
mnuScale3x.Checked = (scale == 3.0);
mnuScale4x.Checked = (scale == 4.0);
mnuScale5x.Checked = (scale == 5.0);
mnuScale6x.Checked = (scale == 6.0);
}
private void mnuEmulationSpeed_DropDownOpening(object sender, EventArgs e)
{
uint emulationSpeed = ConfigManager.Config.Emulation.EmulationSpeed;
mnuEmuSpeedNormal.Checked = emulationSpeed == 100;
mnuEmuSpeedQuarter.Checked = emulationSpeed == 25;
mnuEmuSpeedHalf.Checked = emulationSpeed == 50;
mnuEmuSpeedDouble.Checked = emulationSpeed == 200;
mnuEmuSpeedTriple.Checked = emulationSpeed == 300;
mnuEmuSpeedMaximumSpeed.Checked = emulationSpeed == 0;
}
}
}

View file

@ -121,6 +121,6 @@
<value>17, 17</value>
</metadata>
<metadata name="tmrSearch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 17</value>
<value>17, 56</value>
</metadata>
</root>

View file

@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Config.Shortcuts;
using Mesen.GUI.Forms;
namespace Mesen.GUI
@ -18,6 +19,10 @@ namespace Mesen.GUI
[DllImport(DllPath)] public static extern void SetVideoConfig(VideoConfig config);
[DllImport(DllPath)] public static extern void SetAudioConfig(AudioConfig config);
[DllImport(DllPath)] public static extern void SetEmulationConfig(EmulationConfig config);
[DllImport(DllPath)] public static extern void SetPreferences(InteropPreferencesConfig config);
[DllImport(DllPath)] public static extern void SetShortcutKeys([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]ShortcutKeyInfo[] shortcuts, UInt32 count);
[DllImport(DllPath, EntryPoint = "GetAudioDevices")] private static extern IntPtr GetAudioDevicesWrapper();
public static List<string> GetAudioDevices()

View file

@ -29,14 +29,20 @@ namespace Mesen.GUI
[DllImport(DllPath)] public static extern void Run();
[DllImport(DllPath)] public static extern void Stop();
[DllImport(DllPath)] public static extern void TakeScreenshot();
[DllImport(DllPath)] public static extern void LoadRom(
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string filepath,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string patchFile = ""
);
[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 SetMousePosition(double x, double y);
[DllImport(DllPath)] public static extern void AddKnownGameFolder([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string folder);
[DllImport(DllPath)] public static extern void SetFolderOverrides(
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string saveDataFolder,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string saveStateFolder,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string screenshotFolder
);
[DllImport(DllPath)] public static extern void SetDisplayLanguage(Language lang);
@ -44,6 +50,8 @@ namespace Mesen.GUI
[DllImport(DllPath, EntryPoint = "GetLog")] private static extern IntPtr GetLogWrapper();
public static string GetLog() { return Utf8Marshaler.PtrToStringUtf8(EmuApi.GetLogWrapper()).Replace("\n", Environment.NewLine); }
[DllImport(DllPath)] public static extern void WriteLogEntry([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string message);
[DllImport(DllPath)] public static extern void DisplayMessage([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string title, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string message, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string param1 = null);
[DllImport(DllPath)] public static extern IntPtr GetArchiveRomList([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string filename);
}

43
UI/Interop/InputApi.cs Normal file
View file

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Mesen.GUI
{
public class InputApi
{
private const string DllPath = "MesenSCore.dll";
[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 SetMousePosition(double x, double y);
[DllImport(DllPath)] public static extern void DisableAllKeys([MarshalAs(UnmanagedType.I1)]bool disabled);
[DllImport(DllPath)] public static extern void UpdateInputDevices();
[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);
public static string GetKeyName(UInt32 key) { return Utf8Marshaler.PtrToStringUtf8(InputApi.GetKeyNameWrapper(key)); }
[DllImport(DllPath, EntryPoint = "GetPressedKeys")] private static extern void GetPressedKeysWrapper(IntPtr keyBuffer);
public static List<UInt32> GetPressedKeys()
{
UInt32[] keyBuffer = new UInt32[3];
GCHandle handle = GCHandle.Alloc(keyBuffer, GCHandleType.Pinned);
try {
InputApi.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;
}
}
}

View file

@ -111,7 +111,7 @@ namespace Mesen.GUI
}
using(SingleInstance singleInstance = new SingleInstance()) {
//if(singleInstance.FirstInstance || !ConfigManager.Config.PreferenceInfo.SingleInstance) {
if(singleInstance.FirstInstance || !ConfigManager.Config.Preferences.SingleInstance) {
frmMain frmMain = new frmMain(args);
singleInstance.ListenForArgumentsFromSuccessiveInstances();
@ -125,7 +125,7 @@ namespace Mesen.GUI
};
Application.Run(frmMain);
/*} else {
} else {
if(singleInstance.PassArgumentsToFirstInstance(args)) {
Process current = Process.GetCurrentProcess();
foreach(Process process in Process.GetProcessesByName(current.ProcessName)) {
@ -137,7 +137,7 @@ namespace Mesen.GUI
} else {
Application.Run(new frmMain(args));
}
}*/
}
}
} catch(Exception e) {
MesenMsgBox.Show("UnexpectedError", MessageBoxButtons.OK, MessageBoxIcon.Error, e.ToString());

View file

@ -214,6 +214,12 @@
<Compile Include="Config\ConfigAttributes.cs" />
<Compile Include="Config\Configuration.cs" />
<Compile Include="Config\ConfigManager.cs" />
<Compile Include="Config\FileAssociationHelper.cs" />
<Compile Include="Config\PreferencesConfig.cs" />
<Compile Include="Config\Shortcuts\EmulatorShortcut.cs" />
<Compile Include="Config\Shortcuts\KeyCombination.cs" />
<Compile Include="Config\Shortcuts\ShortcutKeyInfo.cs" />
<Compile Include="Config\EmulationConfig.cs" />
<Compile Include="Config\VideoConfig.cs" />
<Compile Include="Debugger\Breakpoints\Breakpoint.cs" />
<Compile Include="Debugger\Breakpoints\BreakpointManager.cs" />
@ -466,12 +472,30 @@
<Compile Include="Forms\BaseInputForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Config\ctrlEmulatorShortcuts.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\Config\ctrlEmulatorShortcuts.designer.cs">
<DependentUpon>ctrlEmulatorShortcuts.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Config\frmAudioConfig.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Config\frmAudioConfig.Designer.cs">
<DependentUpon>frmAudioConfig.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Config\frmGetKey.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Config\frmGetKey.designer.cs">
<DependentUpon>frmGetKey.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Config\frmPreferences.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Config\frmPreferences.Designer.cs">
<DependentUpon>frmPreferences.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Config\frmVideoConfig.cs">
<SubType>Form</SubType>
</Compile>
@ -501,8 +525,10 @@
<Compile Include="Forms\OpenSaveFileDialogExtensions.cs" />
<Compile Include="Forms\ResourceHelper.cs" />
<Compile Include="Forms\ResourcePath.cs" />
<Compile Include="Forms\ShortcutHandler.cs" />
<Compile Include="Interop\DebugApi.cs" />
<Compile Include="Interop\ConfigApi.cs" />
<Compile Include="Interop\InputApi.cs" />
<Compile Include="Interop\EmuApi.cs" />
<Compile Include="Interop\NotificationListener.cs" />
<Compile Include="Interop\Utf8Marshaler.cs" />
@ -610,9 +636,18 @@
<EmbeddedResource Include="Forms\BaseInputForm.resx">
<DependentUpon>BaseInputForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Config\ctrlEmulatorShortcuts.resx">
<DependentUpon>ctrlEmulatorShortcuts.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Config\frmAudioConfig.resx">
<DependentUpon>frmAudioConfig.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Config\frmGetKey.resx">
<DependentUpon>frmGetKey.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Config\frmPreferences.resx">
<DependentUpon>frmPreferences.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Config\frmVideoConfig.resx">
<DependentUpon>frmVideoConfig.cs</DependentUpon>
</EmbeddedResource>