From 48409ae82b6759d72e906f229b0324eb6aee8b19 Mon Sep 17 00:00:00 2001 From: Souryo Date: Wed, 1 Jul 2015 23:17:14 -0400 Subject: [PATCH] -Rewrote entire GUI in .NET -Several other fixes (bugfixes, refactoring, etc.) -Added a few more features to debugger --- Core/APU.cpp | 11 +- Core/APU.h | 1 + Core/BaseMapper.h | 2 +- Core/CPU.cpp | 39 +- Core/CPU.h | 55 +- Core/ClientConnectionData.h | 32 + Core/Console.cpp | 158 +- Core/Console.h | 25 +- Core/Core.vcxproj | 6 + Core/Core.vcxproj.filters | 15 + Core/Debugger.cpp | 81 +- Core/Debugger.h | 77 + Core/Disassembler.cpp | 95 +- Core/Disassembler.h | 6 +- Core/DisassemblyInfo.cpp | 2 +- Core/GameClient.cpp | 22 +- Core/GameClient.h | 8 +- Core/GameClientConnection.cpp | 24 +- Core/GameClientConnection.h | 7 +- Core/GameConnection.cpp | 15 +- Core/GameConnection.h | 9 +- Core/GameInformationMessage.h | 99 +- Core/GameServer.cpp | 68 +- Core/GameServer.h | 10 +- Core/GameServerConnection.cpp | 62 +- Core/HandShakeMessage.h | 44 +- Core/IAudioDevice.h | 1 + Core/IMessageManager.h | 111 +- Core/InputDataMessage.h | 25 +- Core/MMC1.h | 1 + Core/MapperFactory.cpp | 4 +- Core/MemoryManager.cpp | 6 + Core/MemoryManager.h | 6 +- Core/MessageManager.cpp | 46 + Core/MessageManager.h | 22 + Core/Movie.cpp | 8 +- Core/Movie.h | 4 +- Core/MovieDataMessage.h | 38 +- Core/NetMessage.h | 96 +- Core/PPU.cpp | 14 +- Core/PPU.h | 12 +- Core/SaveStateManager.cpp | 57 + Core/SaveStateManager.h | 15 + Core/SaveStateMessage.h | 29 +- Core/Snapshotable.h | 2 +- Core/VirtualController.h | 3 + Core/stdafx.h | 10 +- GUI.NET/App.config | 6 + GUI.NET/ConfigManager/ConfigManager.cs | 205 ++ GUI.NET/Controls/DXViewer.Designer.cs | 36 + GUI.NET/Controls/DXViewer.cs | 20 + .../Controls/ctrlConsoleStatus.Designer.cs | 1119 +++++++++ .../Debugger/Controls/ctrlConsoleStatus.cs | 89 + .../Debugger/Controls/ctrlConsoleStatus.resx | 120 + .../Controls/ctrlDebuggerCode.Designer.cs | 206 ++ GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs | 292 +++ .../Debugger/Controls/ctrlDebuggerCode.resx | 126 + GUI.NET/Debugger/Controls/ctrlSyncTextBox.cs | 110 + .../Debugger/Controls/ctrlWatch.Designer.cs | 126 + GUI.NET/Debugger/Controls/ctrlWatch.cs | 143 ++ GUI.NET/Debugger/Controls/ctrlWatch.resx | 123 + GUI.NET/Debugger/frmDebugger.Designer.cs | 522 ++++ GUI.NET/Debugger/frmDebugger.cs | 139 ++ GUI.NET/Debugger/frmDebugger.resx | 418 ++++ GUI.NET/Forms/BaseConfigForm.cs | 27 + .../Forms/Config/frmVideoConfig.Designer.cs | 177 ++ GUI.NET/Forms/Config/frmVideoConfig.cs | 20 + GUI.NET/Forms/Config/frmVideoConfig.resx | 409 +++ .../Forms/NetPlay/frmClientConfig.Designer.cs | 186 ++ GUI.NET/Forms/NetPlay/frmClientConfig.cs | 39 + GUI.NET/Forms/NetPlay/frmClientConfig.resx | 409 +++ .../NetPlay/frmPlayerProfile.Designer.cs | 171 ++ GUI.NET/Forms/NetPlay/frmPlayerProfile.cs | 44 + GUI.NET/Forms/NetPlay/frmPlayerProfile.resx | 409 +++ .../Forms/NetPlay/frmServerConfig.Designer.cs | 270 ++ GUI.NET/Forms/NetPlay/frmServerConfig.cs | 49 + GUI.NET/Forms/NetPlay/frmServerConfig.resx | 409 +++ GUI.NET/Forms/frmMain.Designer.cs | 526 ++++ GUI.NET/Forms/frmMain.cs | 353 +++ GUI.NET/Forms/frmMain.resx | 412 ++++ GUI.NET/GUI.NET.csproj | 185 ++ GUI.NET/Icon.bmp | Bin 0 -> 5174 bytes GUI.NET/Icon.ico | Bin 0 -> 17006 bytes GUI.NET/InteropEmu.cs | 195 ++ GUI.NET/Program.cs | 22 + GUI.NET/Properties/AssemblyInfo.cs | 36 + GUI.NET/Properties/Resources.Designer.cs | 73 + GUI.NET/Properties/Resources.resx | 124 + GUI.NET/Properties/Settings.Designer.cs | 26 + GUI.NET/Properties/Settings.settings | 7 + GUI.NET/Resources/MesenLogo.bmp | Bin 0 -> 5174 bytes GUI/GUI.vcxproj | 24 - GUI/GUI.vcxproj.filters | 75 - InteropDLL/ConsoleWrapper.cpp | 130 + InteropDLL/DebugWrapper.cpp | 40 + InteropDLL/InteropDLL.vcxproj | 96 + InteropDLL/InteropDLL.vcxproj.filters | 36 + InteropDLL/stdafx.cpp | 8 + InteropDLL/stdafx.h | 31 + InteropDLL/targetver.h | 8 + NES.sln | 69 + Utilities/ConfigManager.cpp | 111 - Utilities/ConfigManager.h | 110 - Utilities/FolderUtilities.cpp | 43 +- Utilities/FolderUtilities.h | 5 +- Utilities/SimpleLock.cpp | 54 + Utilities/SimpleLock.h | 52 +- Utilities/Socket.h | 13 +- Utilities/UPnPPortMapper.h | 2 +- Utilities/Utilities.vcxproj | 8 +- Utilities/Utilities.vcxproj.filters | 24 +- Utilities/stdafx.h | 4 +- Utilities/tinyxml2.cpp | 2188 ----------------- Utilities/tinyxml2.h | 2076 ---------------- Utilities/utf8conv.h | 162 -- Utilities/utf8conv_inl.h | 368 --- {GUI => Windows}/DirectXTK/Audio.h | 0 {GUI => Windows}/DirectXTK/CommonStates.h | 0 {GUI => Windows}/DirectXTK/DDSTextureLoader.h | 0 {GUI => Windows}/DirectXTK/DirectXHelpers.h | 0 .../DirectXTK/DirectXTK.debug.lib | Bin {GUI => Windows}/DirectXTK/DirectXTK.lib | Bin {GUI => Windows}/DirectXTK/Effects.h | 0 .../DirectXTK/GeometricPrimitive.h | 0 {GUI => Windows}/DirectXTK/Model.h | 0 {GUI => Windows}/DirectXTK/PrimitiveBatch.h | 0 {GUI => Windows}/DirectXTK/ScreenGrab.h | 0 {GUI => Windows}/DirectXTK/SimpleMath.h | 0 {GUI => Windows}/DirectXTK/SimpleMath.inl | 0 {GUI => Windows}/DirectXTK/SpriteBatch.h | 0 {GUI => Windows}/DirectXTK/SpriteFont.h | 0 {GUI => Windows}/DirectXTK/VertexTypes.h | 0 {GUI => Windows}/DirectXTK/WICTextureLoader.h | 0 .../DirectXTK/XboxDDSTextureLoader.h | 0 {GUI => Windows}/GamePad.cpp | 0 {GUI => Windows}/GamePad.h | 0 {GUI => Windows}/InputManager.cpp | 7 + {GUI => Windows}/InputManager.h | 1 + {GUI => Windows}/Renderer.cpp | 284 ++- {GUI => Windows}/Renderer.h | 30 +- {GUI => Windows}/SoundManager.cpp | 0 {GUI => Windows}/SoundManager.h | 0 Windows/Toast.dds | Bin 0 -> 95328 bytes Windows/Windows.vcxproj | 111 + Windows/Windows.vcxproj.filters | 107 + Windows/stdafx.cpp | 8 + Windows/stdafx.h | 53 + Windows/targetver.h | 8 + 148 files changed, 10445 insertions(+), 5762 deletions(-) create mode 100644 Core/ClientConnectionData.h create mode 100644 Core/Debugger.h create mode 100644 Core/MessageManager.cpp create mode 100644 Core/MessageManager.h create mode 100644 Core/SaveStateManager.cpp create mode 100644 Core/SaveStateManager.h create mode 100644 GUI.NET/App.config create mode 100644 GUI.NET/ConfigManager/ConfigManager.cs create mode 100644 GUI.NET/Controls/DXViewer.Designer.cs create mode 100644 GUI.NET/Controls/DXViewer.cs create mode 100644 GUI.NET/Debugger/Controls/ctrlConsoleStatus.Designer.cs create mode 100644 GUI.NET/Debugger/Controls/ctrlConsoleStatus.cs create mode 100644 GUI.NET/Debugger/Controls/ctrlConsoleStatus.resx create mode 100644 GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs create mode 100644 GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs create mode 100644 GUI.NET/Debugger/Controls/ctrlDebuggerCode.resx create mode 100644 GUI.NET/Debugger/Controls/ctrlSyncTextBox.cs create mode 100644 GUI.NET/Debugger/Controls/ctrlWatch.Designer.cs create mode 100644 GUI.NET/Debugger/Controls/ctrlWatch.cs create mode 100644 GUI.NET/Debugger/Controls/ctrlWatch.resx create mode 100644 GUI.NET/Debugger/frmDebugger.Designer.cs create mode 100644 GUI.NET/Debugger/frmDebugger.cs create mode 100644 GUI.NET/Debugger/frmDebugger.resx create mode 100644 GUI.NET/Forms/BaseConfigForm.cs create mode 100644 GUI.NET/Forms/Config/frmVideoConfig.Designer.cs create mode 100644 GUI.NET/Forms/Config/frmVideoConfig.cs create mode 100644 GUI.NET/Forms/Config/frmVideoConfig.resx create mode 100644 GUI.NET/Forms/NetPlay/frmClientConfig.Designer.cs create mode 100644 GUI.NET/Forms/NetPlay/frmClientConfig.cs create mode 100644 GUI.NET/Forms/NetPlay/frmClientConfig.resx create mode 100644 GUI.NET/Forms/NetPlay/frmPlayerProfile.Designer.cs create mode 100644 GUI.NET/Forms/NetPlay/frmPlayerProfile.cs create mode 100644 GUI.NET/Forms/NetPlay/frmPlayerProfile.resx create mode 100644 GUI.NET/Forms/NetPlay/frmServerConfig.Designer.cs create mode 100644 GUI.NET/Forms/NetPlay/frmServerConfig.cs create mode 100644 GUI.NET/Forms/NetPlay/frmServerConfig.resx create mode 100644 GUI.NET/Forms/frmMain.Designer.cs create mode 100644 GUI.NET/Forms/frmMain.cs create mode 100644 GUI.NET/Forms/frmMain.resx create mode 100644 GUI.NET/GUI.NET.csproj create mode 100644 GUI.NET/Icon.bmp create mode 100644 GUI.NET/Icon.ico create mode 100644 GUI.NET/InteropEmu.cs create mode 100644 GUI.NET/Program.cs create mode 100644 GUI.NET/Properties/AssemblyInfo.cs create mode 100644 GUI.NET/Properties/Resources.Designer.cs create mode 100644 GUI.NET/Properties/Resources.resx create mode 100644 GUI.NET/Properties/Settings.Designer.cs create mode 100644 GUI.NET/Properties/Settings.settings create mode 100644 GUI.NET/Resources/MesenLogo.bmp create mode 100644 InteropDLL/ConsoleWrapper.cpp create mode 100644 InteropDLL/DebugWrapper.cpp create mode 100644 InteropDLL/InteropDLL.vcxproj create mode 100644 InteropDLL/InteropDLL.vcxproj.filters create mode 100644 InteropDLL/stdafx.cpp create mode 100644 InteropDLL/stdafx.h create mode 100644 InteropDLL/targetver.h delete mode 100644 Utilities/ConfigManager.cpp delete mode 100644 Utilities/ConfigManager.h create mode 100644 Utilities/SimpleLock.cpp delete mode 100644 Utilities/tinyxml2.cpp delete mode 100644 Utilities/tinyxml2.h delete mode 100644 Utilities/utf8conv.h delete mode 100644 Utilities/utf8conv_inl.h rename {GUI => Windows}/DirectXTK/Audio.h (100%) rename {GUI => Windows}/DirectXTK/CommonStates.h (100%) rename {GUI => Windows}/DirectXTK/DDSTextureLoader.h (100%) rename {GUI => Windows}/DirectXTK/DirectXHelpers.h (100%) rename {GUI => Windows}/DirectXTK/DirectXTK.debug.lib (100%) rename {GUI => Windows}/DirectXTK/DirectXTK.lib (100%) rename {GUI => Windows}/DirectXTK/Effects.h (100%) rename {GUI => Windows}/DirectXTK/GeometricPrimitive.h (100%) rename {GUI => Windows}/DirectXTK/Model.h (100%) rename {GUI => Windows}/DirectXTK/PrimitiveBatch.h (100%) rename {GUI => Windows}/DirectXTK/ScreenGrab.h (100%) rename {GUI => Windows}/DirectXTK/SimpleMath.h (100%) rename {GUI => Windows}/DirectXTK/SimpleMath.inl (100%) rename {GUI => Windows}/DirectXTK/SpriteBatch.h (100%) rename {GUI => Windows}/DirectXTK/SpriteFont.h (100%) rename {GUI => Windows}/DirectXTK/VertexTypes.h (100%) rename {GUI => Windows}/DirectXTK/WICTextureLoader.h (100%) rename {GUI => Windows}/DirectXTK/XboxDDSTextureLoader.h (100%) rename {GUI => Windows}/GamePad.cpp (100%) rename {GUI => Windows}/GamePad.h (100%) rename {GUI => Windows}/InputManager.cpp (88%) rename {GUI => Windows}/InputManager.h (94%) rename {GUI => Windows}/Renderer.cpp (64%) rename {GUI => Windows}/Renderer.h (76%) rename {GUI => Windows}/SoundManager.cpp (100%) rename {GUI => Windows}/SoundManager.h (100%) create mode 100644 Windows/Toast.dds create mode 100644 Windows/Windows.vcxproj create mode 100644 Windows/Windows.vcxproj.filters create mode 100644 Windows/stdafx.cpp create mode 100644 Windows/stdafx.h create mode 100644 Windows/targetver.h diff --git a/Core/APU.cpp b/Core/APU.cpp index a2d8bb98..e25e08d9 100644 --- a/Core/APU.cpp +++ b/Core/APU.cpp @@ -77,13 +77,22 @@ bool APU::Exec(uint32_t executedCycles) uint32_t availableSampleCount = _buf.samples_avail(); if(availableSampleCount >= APU::SamplesPerFrame) { size_t sampleCount = _buf.read_samples(_outputBuffer, APU::SamplesPerFrame); - APU::AudioDevice->PlayBuffer(_outputBuffer, sampleCount * BitsPerSample / 8); + if(APU::AudioDevice) { + APU::AudioDevice->PlayBuffer(_outputBuffer, sampleCount * BitsPerSample / 8); + } } return true; } return false; } +void APU::StopAudio() +{ + if(APU::AudioDevice) { + APU::AudioDevice->Pause(); + } +} + void APU::StreamState(bool saving) { apu_snapshot_t snapshot; diff --git a/Core/APU.h b/Core/APU.h index d1b3af27..3c0862d7 100644 --- a/Core/APU.h +++ b/Core/APU.h @@ -55,4 +55,5 @@ class APU : public IMemoryHandler, public Snapshotable void WriteRAM(uint16_t addr, uint8_t value); bool Exec(uint32_t executedCycles); + static void StopAudio(); }; \ No newline at end of file diff --git a/Core/BaseMapper.h b/Core/BaseMapper.h index 0ad6de6a..bc7e80bf 100644 --- a/Core/BaseMapper.h +++ b/Core/BaseMapper.h @@ -327,7 +327,7 @@ class BaseMapper : public IMemoryHandler, public Snapshotable if(_hasCHRRAM) { _chrPages[AddrToCHRSlot(addr)][addr & (GetCHRPageSize() - 1)] = value; } else { - assert(false); + //assert(false); } } diff --git a/Core/CPU.cpp b/Core/CPU.cpp index fa67e470..b1611e8f 100644 --- a/Core/CPU.cpp +++ b/Core/CPU.cpp @@ -1,14 +1,12 @@ #include "stdafx.h" #include "CPU.h" -int32_t CPU::CycleCount = 0; -int32_t CPU::RelativeCycleCount = 0; -uint32_t CPU::CyclePenalty = 0; -bool CPU::NMIFlag = false; -uint32_t CPU::IRQFlag = 0; +CPU* CPU::Instance = nullptr; CPU::CPU(MemoryManager *memoryManager) : _memoryManager(memoryManager) { + CPU::Instance = this; + Func opTable[] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F &CPU::BRK, &CPU::ORA, nullptr, nullptr, &CPU::NOP, &CPU::ORA, &CPU::ASL_Memory, nullptr, &CPU::PHP, &CPU::ORA, &CPU::ASL_Acc, nullptr, &CPU::NOP, &CPU::ORA, &CPU::ASL_Memory, nullptr, //0 @@ -94,10 +92,11 @@ CPU::CPU(MemoryManager *memoryManager) : _memoryManager(memoryManager) void CPU::Reset(bool softReset) { - CPU::NMIFlag = false; - CPU::IRQFlag = 0; - CPU::CycleCount = 0; - CPU::RelativeCycleCount = 0; + _state.NMIFlag = false; + _state.IRQFlag = 0; + _cycleCount = 0; + _relativeCycleCount = 0; + _cyclePenalty = 0; _state.PC = MemoryReadWord(CPU::ResetVector); if(softReset) { @@ -122,9 +121,9 @@ uint32_t CPU::Exec() if(!_runNMI && !_runIRQ) { uint8_t opCode = GetOPCode(); - if(CPU::NMIFlag) { + if(_state.NMIFlag) { _runNMI = true; - } else if(opCode != 0x40 && CPU::IRQFlag > 0 && !CheckFlag(PSFlags::Interrupt)) { + } else if(opCode != 0x40 && _state.IRQFlag > 0 && !CheckFlag(PSFlags::Interrupt)) { _runIRQ = true; } @@ -139,7 +138,7 @@ uint32_t CPU::Exec() //throw exception("Invalid opcode"); } - if(!_runIRQ && opCode == 0x40 && CPU::IRQFlag > 0 && !CheckFlag(PSFlags::Interrupt)) { + if(!_runIRQ && opCode == 0x40 && _state.IRQFlag > 0 && !CheckFlag(PSFlags::Interrupt)) { //"If an IRQ is pending and an RTI is executed that clears the I flag, the CPU will invoke the IRQ handler immediately after RTI finishes executing." _runIRQ = true; } @@ -147,7 +146,7 @@ uint32_t CPU::Exec() if(_runNMI) { NMI(); _runNMI = false; - CPU::NMIFlag = false; + _state.NMIFlag = false; } else if(_runIRQ) { IRQ(); } @@ -156,14 +155,14 @@ uint32_t CPU::Exec() executedCycles = 7; } - CPU::CycleCount += executedCycles; + _cycleCount += executedCycles; return executedCycles + GetCyclePenalty(); } void CPU::EndFrame() { - CPU::RelativeCycleCount += CPU::CycleCount; - CPU::CycleCount = 0; + _relativeCycleCount += _cycleCount; + _cycleCount = 0; } void CPU::StreamState(bool saving) @@ -175,12 +174,12 @@ void CPU::StreamState(bool saving) Stream(_state.X); Stream(_state.Y); - Stream(CPU::CycleCount); - Stream(CPU::NMIFlag); - Stream(CPU::IRQFlag); + Stream(_cycleCount); + Stream(_state.NMIFlag); + Stream(_state.IRQFlag); Stream(_runNMI); Stream(_runIRQ); - Stream(CPU::RelativeCycleCount); + Stream(_relativeCycleCount); } \ No newline at end of file diff --git a/Core/CPU.h b/Core/CPU.h index 9379017f..59bc984d 100644 --- a/Core/CPU.h +++ b/Core/CPU.h @@ -36,12 +36,14 @@ enum class IRQSource struct State { - uint16_t PC; - uint8_t SP; - uint8_t A; - uint8_t X; - uint8_t Y; - uint8_t PS; + uint16_t PC = 0; + uint8_t SP = 0; + uint8_t A = 0; + uint8_t X = 0; + uint8_t Y = 0; + uint8_t PS = 0; + uint32_t IRQFlag = 0; + bool NMIFlag = false; }; class CPU : public Snapshotable @@ -51,11 +53,13 @@ private: const uint16_t ResetVector = 0xFFFC; const uint16_t IRQVector = 0xFFFE; + static CPU* Instance; + typedef void(CPU::*Func)(); - static int32_t CycleCount; - static int32_t RelativeCycleCount; - static uint32_t CyclePenalty; + int32_t _cycleCount; + int32_t _relativeCycleCount; + uint32_t _cyclePenalty; Func _opTable[256]; uint8_t _cycles[256]; @@ -67,8 +71,6 @@ private: State _state; MemoryManager *_memoryManager = nullptr; - static bool NMIFlag; - static uint32_t IRQFlag; bool _runNMI = false; bool _runIRQ = false; @@ -465,8 +467,8 @@ private: } uint32_t GetCyclePenalty() { - uint32_t cyclePenalty = CPU::CyclePenalty; - CPU::CyclePenalty = 0; + uint32_t cyclePenalty = _cyclePenalty; + _cyclePenalty = 0; return cyclePenalty; } @@ -570,7 +572,7 @@ private: Push((uint16_t)(PC() + 1)); uint8_t flags = PS() | PSFlags::Break; - if(CPU::NMIFlag) { + if(_state.NMIFlag) { Push((uint8_t)flags); SetFlags(PSFlags::Interrupt); @@ -594,7 +596,7 @@ private: void IRQ() { Push((uint16_t)(PC())); - if(CPU::NMIFlag) { + if(_state.NMIFlag) { Push((uint8_t)PS()); SetFlags(PSFlags::Interrupt); @@ -624,27 +626,20 @@ public: static const uint32_t ClockRate = 1789773; CPU(MemoryManager *memoryManager); - static int32_t GetCycleCount() { return CPU::CycleCount; } - static int32_t GetRelativeCycleCount() { return CPU::RelativeCycleCount + CPU::CycleCount; } + static int32_t GetCycleCount() { return CPU::Instance->_cycleCount; } + static int32_t GetRelativeCycleCount() { return CPU::Instance->_relativeCycleCount + CPU::Instance->_cycleCount; } static void IncCycleCount(uint32_t cycles) { - CPU::CyclePenalty += cycles; - CPU::CycleCount += cycles; - } - static void SetNMIFlag() { CPU::NMIFlag = true; } - static void ClearNMIFlag() { CPU::NMIFlag = false; } - static void SetIRQSource(IRQSource source) - { - CPU::IRQFlag |= (int)source; - } - static void ClearIRQSource(IRQSource source) - { - CPU::IRQFlag &= ~(int)source; + CPU::Instance->_cyclePenalty += cycles; + CPU::Instance->_cycleCount += cycles; } + static void SetNMIFlag() { CPU::Instance->_state.NMIFlag = true; } + static void ClearNMIFlag() { CPU::Instance->_state.NMIFlag = false; } + static void SetIRQSource(IRQSource source) { CPU::Instance->_state.IRQFlag |= (int)source; } + static void ClearIRQSource(IRQSource source) { CPU::Instance->_state.IRQFlag &= ~(int)source; } void Reset(bool softReset); uint32_t Exec(); void EndFrame(); State GetState() { return _state; } - }; \ No newline at end of file diff --git a/Core/ClientConnectionData.h b/Core/ClientConnectionData.h new file mode 100644 index 00000000..adc8c870 --- /dev/null +++ b/Core/ClientConnectionData.h @@ -0,0 +1,32 @@ +#pragma once + +#include "stdafx.h" + +class ClientConnectionData +{ +public: + string Host; + uint16_t Port; + + wstring PlayerName; + uint8_t* AvatarData; + uint32_t AvatarSize; + + ClientConnectionData(string host, uint16_t port, wstring playerName, uint8_t* avatarData, uint32_t avatarSize) : + Host(host), Port(port), PlayerName(playerName), AvatarSize(avatarSize) + { + if(avatarSize > 0) { + AvatarData = new uint8_t[avatarSize]; + memcpy(AvatarData, avatarData, avatarSize); + } else { + AvatarData = nullptr; + } + } + + ~ClientConnectionData() + { + if(AvatarData) { + delete[] AvatarData; + } + } +}; \ No newline at end of file diff --git a/Core/Console.cpp b/Core/Console.cpp index 968b0c1c..ce545e46 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -1,13 +1,14 @@ #include "stdafx.h" +#include #include "Console.h" +#include "BaseMapper.h" #include "MapperFactory.h" +#include "Debugger.h" #include "../Utilities/Timer.h" #include "../Utilities/FolderUtilities.h" -#include "../Utilities/ConfigManager.h" +#include "../Core/MessageManager.h" -Console* Console::Instance = nullptr; -IMessageManager* Console::MessageManager = nullptr; -list Console::NotificationListeners; +shared_ptr Console::Instance = nullptr; uint32_t Console::Flags = 0; uint32_t Console::CurrentFPS = 0; SimpleLock Console::PauseLock; @@ -15,26 +16,28 @@ SimpleLock Console::RunningLock; Console::Console(wstring filename) { - Console::Instance = this; - Initialize(filename); } Console::~Console() { Movie::Stop(); - if(Console::Instance == this) { - Console::Instance = nullptr; + if(Console::Instance.get() == this) { + Console::Instance.reset(); } } -Console* Console::GetInstance() +shared_ptr Console::GetInstance() { return Console::Instance; } void Console::Initialize(wstring filename) { + if(Console::Instance == nullptr) { + Console::Instance.reset(this); + } + shared_ptr mapper = MapperFactory::InitializeFromFile(filename); if(mapper) { _romFilepath = filename; @@ -54,10 +57,9 @@ void Console::Initialize(wstring filename) ResetComponents(false); - Console::SendNotification(ConsoleNotificationType::GameLoaded); - Console::DisplayMessage(wstring(L"Game loaded: ") + FolderUtilities::GetFilename(filename, false)); + MessageManager::DisplayMessage(L"Game loaded", FolderUtilities::GetFilename(filename, false)); } else { - Console::DisplayMessage(wstring(L"Could not load file: ") + FolderUtilities::GetFilename(filename, true)); + MessageManager::DisplayMessage(L"Error", wstring(L"Could not load file: ") + FolderUtilities::GetFilename(filename, true)); } } @@ -73,42 +75,6 @@ void Console::LoadROM(wstring filename) } } -bool Console::AttemptLoadROM(wstring filename, uint32_t crc32Hash) -{ - if(Instance) { - if(ROMLoader::GetCRC32(Instance->_romFilepath) == crc32Hash) { - //Current game matches, no need to do anything - return true; - } - } - - vector romFiles = FolderUtilities::GetFilesInFolder(ConfigManager::GetValue(Config::LastGameFolder), L"*.nes", true); - for(wstring zipFile : FolderUtilities::GetFilesInFolder(ConfigManager::GetValue(Config::LastGameFolder), L"*.zip", true)) { - romFiles.push_back(zipFile); - } - for(wstring romFile : romFiles) { - //Quick search by filename - if(FolderUtilities::GetFilename(romFile, true).compare(filename) == 0) { - if(ROMLoader::GetCRC32(romFile) == crc32Hash) { - //Matching ROM found - Console::LoadROM(romFile); - return true; - } - } - } - - for(wstring romFile : romFiles) { - //Slower search by CRC value - if(ROMLoader::GetCRC32(romFile) == crc32Hash) { - //Matching ROM found - Console::LoadROM(romFile); - return true; - } - } - - return false; -} - wstring Console::GetROMPath() { wstring filepath; @@ -122,21 +88,30 @@ void Console::Reset() { Movie::Stop(); if(Instance) { + Console::Pause(); Instance->ResetComponents(true); + Console::Resume(); } } void Console::ResetComponents(bool softReset) { - _cpu->Reset(softReset); _ppu->Reset(); _apu->Reset(); + _cpu->Reset(softReset); + if(softReset) { + MessageManager::SendNotification(ConsoleNotificationType::GameReset); + } else { + MessageManager::SendNotification(ConsoleNotificationType::GameLoaded); + } } void Console::Stop() { _stop = true; Console::ClearFlags(EmulationFlags::Paused); + Console::RunningLock.Acquire(); + Console::RunningLock.Release(); } void Console::Pause() @@ -168,45 +143,11 @@ bool Console::CheckFlag(int flag) return (Console::Flags & flag) == flag; } -void Console::RegisterMessageManager(IMessageManager* messageManager) -{ - Console::MessageManager = messageManager; -} - -void Console::DisplayMessage(wstring message) -{ - std::wcout << message << std::endl; - if(Console::MessageManager) { - Console::MessageManager->DisplayMessage(message); - } -} - uint32_t Console::GetFPS() { return Console::CurrentFPS; } -void Console::RegisterNotificationListener(INotificationListener* notificationListener) -{ - Console::NotificationListeners.push_back(notificationListener); - Console::NotificationListeners.unique(); -} - -void Console::UnregisterNotificationListener(INotificationListener* notificationListener) -{ - Console::NotificationListeners.remove(notificationListener); -} - -void Console::SendNotification(ConsoleNotificationType type) -{ - list listeners = Console::NotificationListeners; - - //Iterate on a copy to prevent issues if a notification causes a listener to unregister itself - for(INotificationListener* notificationListener : listeners) { - notificationListener->ProcessNotification(type); - } -} - void Console::Run() { Timer clockTimer; @@ -247,14 +188,18 @@ void Console::Run() } if(CheckFlag(EmulationFlags::Paused) && !_stop) { - Console::SendNotification(ConsoleNotificationType::GamePaused); + MessageManager::SendNotification(ConsoleNotificationType::GamePaused); Console::RunningLock.Release(); + + //Prevent audio from looping endlessly while game is paused + _apu->StopAudio(); + while(CheckFlag(EmulationFlags::Paused)) { //Sleep until emulation is resumed std::this_thread::sleep_for(std::chrono::duration(100)); } Console::RunningLock.Acquire(); - Console::SendNotification(ConsoleNotificationType::GameResumed); + MessageManager::SendNotification(ConsoleNotificationType::GameResumed); } clockTimer.Reset(); @@ -263,45 +208,20 @@ void Console::Run() break; } } - + if(fpsTimer.GetElapsedMS() > 1000) { uint32_t frameCount = _ppu->GetFrameCount(); - Console::CurrentFPS = (int)(std::round((double)(frameCount - lastFrameCount) / (fpsTimer.GetElapsedMS() / 1000))); + if((int32_t)frameCount - (int32_t)lastFrameCount < 0) { + Console::CurrentFPS = 0; + } else { + Console::CurrentFPS = (int)(std::round((double)(frameCount - lastFrameCount) / (fpsTimer.GetElapsedMS() / 1000))); + } lastFrameCount = frameCount; fpsTimer.Reset(); } } Console::RunningLock.Release(); -} - -void Console::SaveState(wstring filename) -{ - ofstream file(filename, ios::out | ios::binary); - - if(file) { - Console::Pause(); - Console::SaveState(file); - Console::Resume(); - file.close(); - Console::DisplayMessage(L"State saved."); - } -} - -bool Console::LoadState(wstring filename) -{ - ifstream file(filename, ios::out | ios::binary); - - if(file) { - Console::Pause(); - Console::LoadState(file); - Console::Resume(); - file.close(); - Console::DisplayMessage(L"State loaded."); - return true; - } - - Console::DisplayMessage(L"Slot is empty."); - return false; + _apu->StopAudio(); } void Console::SaveState(ostream &saveStream) @@ -326,7 +246,7 @@ void Console::LoadState(istream &loadStream) Instance->_apu->LoadSnapshot(&loadStream); Instance->_controlManager->LoadSnapshot(&loadStream); - Console::SendNotification(ConsoleNotificationType::StateLoaded); + MessageManager::SendNotification(ConsoleNotificationType::StateLoaded); } } @@ -340,7 +260,7 @@ void Console::LoadState(uint8_t *buffer, uint32_t bufferSize) shared_ptr Console::GetDebugger() { - return shared_ptr(new Debugger(shared_ptr(this), _cpu, _memoryManager, _mapper)); + return shared_ptr(new Debugger(Console::Instance, _cpu, _ppu, _memoryManager, _mapper)); } bool Console::RunTest(uint8_t *expectedResult) diff --git a/Core/Console.h b/Core/Console.h index d6ab949f..d563cf4c 100644 --- a/Core/Console.h +++ b/Core/Console.h @@ -4,13 +4,9 @@ #include "CPU.h" #include "PPU.h" #include "APU.h" -#include "BaseMapper.h" #include "MemoryManager.h" #include "ControlManager.h" -#include "Debugger.h" #include "../Utilities/SimpleLock.h" -#include "IMessageManager.h" -#include "INotificationListener.h" enum EmulationFlags { @@ -18,19 +14,20 @@ enum EmulationFlags Paused = 0x02, }; +class Debugger; +class BaseMapper; + class Console { private: - static Console* Instance; + static shared_ptr Instance; static uint32_t Flags; static uint32_t CurrentFPS; static SimpleLock PauseLock; static SimpleLock RunningLock; - static IMessageManager* MessageManager; - static list NotificationListeners; shared_ptr _cpu; - unique_ptr _ppu; + shared_ptr _ppu; unique_ptr _apu; shared_ptr _mapper; unique_ptr _controlManager; @@ -62,14 +59,11 @@ class Console shared_ptr Console::GetDebugger(); - static void SaveState(wstring filename); static void SaveState(ostream &saveStream); - static bool LoadState(wstring filename); static void LoadState(istream &loadStream); static void LoadState(uint8_t *buffer, uint32_t bufferSize); static void LoadROM(wstring filename); - static bool AttemptLoadROM(wstring filename, uint32_t crc32Hash); static wstring GetROMPath(); static bool CheckFlag(int flag); @@ -77,12 +71,5 @@ class Console static void ClearFlags(int flags); static uint32_t GetFPS(); - static void RegisterMessageManager(IMessageManager* messageManager); - static void DisplayMessage(wstring message); - - static void RegisterNotificationListener(INotificationListener* notificationListener); - static void UnregisterNotificationListener(INotificationListener* notificationListener); - static void SendNotification(ConsoleNotificationType type); - - static Console* GetInstance(); + static shared_ptr GetInstance(); }; diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index fc8e5833..41dc2c10 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -58,6 +58,7 @@ ProgramDatabase Default + Cdecl Console @@ -93,6 +94,7 @@ + @@ -114,6 +116,7 @@ + @@ -121,6 +124,7 @@ + @@ -163,9 +167,11 @@ + + Create Create diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 32addb06..a7b4d955 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -206,6 +206,15 @@ Debugger + + Header Files\NetPlay + + + Header Files + + + Header Files + @@ -265,5 +274,11 @@ Debugger + + Source Files + + + Source Files + \ No newline at end of file diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index 9e8d973a..878f5503 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -1,20 +1,25 @@ #pragma once #include "stdafx.h" +#include +#include "MessageManager.h" #include "Debugger.h" #include "Console.h" +#include "BaseMapper.h" #include "Disassembler.h" +#include "APU.h" Debugger* Debugger::Instance = nullptr; -Debugger::Debugger(shared_ptr console, shared_ptr cpu, shared_ptr memoryManager, shared_ptr mapper) +Debugger::Debugger(shared_ptr console, shared_ptr cpu, shared_ptr ppu, shared_ptr memoryManager, shared_ptr mapper) { _console = console; _cpu = cpu; + _ppu = ppu; _memoryManager = memoryManager; _mapper = mapper; - _disassembler.reset(new Disassembler(mapper->GetPRGCopy(), mapper->GetPRGSize())); + _disassembler.reset(new Disassembler(memoryManager->GetInternalRAM(), mapper->GetPRGCopy(), mapper->GetPRGSize())); _stepCount = -1; @@ -23,9 +28,12 @@ Debugger::Debugger(shared_ptr console, shared_ptr cpu, shared_ptr< Debugger::~Debugger() { - if(Debugger::Instance == this) { - Debugger::Instance = nullptr; - } + Console::Pause(); + Debugger::Instance = nullptr; + Run(); + _breakLock.Acquire(); + _breakLock.Release(); + Console::Resume(); } void Debugger::AddBreakpoint(BreakpointType type, uint32_t address, bool isAbsoluteAddr) @@ -123,9 +131,20 @@ shared_ptr Debugger::GetMatchingBreakpoint(BreakpointType type, uint void Debugger::PrivateCheckBreakpoint(BreakpointType type, uint32_t addr) { + _breakLock.Acquire(); + //Check if a breakpoint has been hit and freeze execution if one has bool breakDone = false; if(type == BreakpointType::Execute) { + _lastInstruction = _memoryManager->DebugRead(addr); + if(_stepOut && _lastInstruction == 0x60) { + //RTS found, set StepCount to 2 to break on the following instruction + Step(2); + } else if(_stepOverAddr != -1 && addr == _stepOverAddr) { + Step(1); + } else if(_stepCycleCount != -1 && abs(_cpu->GetRelativeCycleCount() - _stepCycleCount) < 100 && _cpu->GetRelativeCycleCount() >= _stepCycleCount) { + Step(1); + } _disassembler->BuildCache(_mapper->ToAbsoluteAddress(addr), addr); breakDone = SleepUntilResume(); } @@ -135,6 +154,8 @@ void Debugger::PrivateCheckBreakpoint(BreakpointType type, uint32_t addr) Step(1); SleepUntilResume(); } + + _breakLock.Release(); } bool Debugger::SleepUntilResume() @@ -147,7 +168,9 @@ bool Debugger::SleepUntilResume() if(stepCount == 0) { //Break - _console->SendNotification(ConsoleNotificationType::CodeBreak); + APU::StopAudio(); + MessageManager::SendNotification(ConsoleNotificationType::CodeBreak); + _stepOverAddr = -1; while(stepCount == 0) { std::this_thread::sleep_for(std::chrono::duration(10)); stepCount = _stepCount.load(); @@ -157,15 +180,46 @@ bool Debugger::SleepUntilResume() return false; } -State Debugger::GetCPUState() +void Debugger::GetState(DebugState *state) { - return _cpu->GetState(); + state->CPU = _cpu->GetState(); + state->PPU = _ppu->GetState(); } void Debugger::Step(uint32_t count) { - //Run CPU for [count] cycles and before breaking again + //Run CPU for [count] INSTRUCTIONS and before breaking again + _stepOut = false; _stepCount = count; + _stepOverAddr = -1; + _stepCycleCount = -1; +} + +void Debugger::StepCycles(uint32_t count) +{ + //Run CPU for [count] CYCLES and before breaking again + _stepCycleCount = _cpu->GetRelativeCycleCount() + count; + Run(); +} + +void Debugger::StepOut() +{ + _stepOut = true; + _stepCount = -1; + _stepOverAddr = -1; + _stepCycleCount = -1; +} + +void Debugger::StepOver() +{ + if(_lastInstruction == 0x20 || _lastInstruction == 0x00) { + //We are on a JSR/BRK instruction, need to continue until the following instruction + _stepOverAddr = _cpu->GetState().PC + (_lastInstruction == 0x20 ? 3 : 1); + Run(); + } else { + //Except for JSR & BRK, StepOver behaves the same as StepTnto + Step(1); + } } void Debugger::Run() @@ -187,9 +241,12 @@ bool Debugger::IsCodeChanged() string Debugger::GenerateOutput() { + std::ostringstream output; vector memoryRanges = _mapper->GetPRGRanges(); - std::ostringstream output; + //RAM code viewer doesn't work well yet + //output << _disassembler->GetRAMCode(); + uint16_t memoryAddr = 0x8000; for(int i = 0, size = memoryRanges.size(); i < size; i += 2) { output << _disassembler->GetCode(memoryRanges[i], memoryRanges[i+1], memoryAddr); @@ -198,9 +255,9 @@ string Debugger::GenerateOutput() return output.str(); } -string Debugger::GetCode() +string* Debugger::GetCode() { - return _outputCache; + return &_outputCache; } uint8_t Debugger::GetMemoryValue(uint32_t addr) diff --git a/Core/Debugger.h b/Core/Debugger.h new file mode 100644 index 00000000..c9859d09 --- /dev/null +++ b/Core/Debugger.h @@ -0,0 +1,77 @@ +#pragma once + +#include "stdafx.h" +#include +using std::atomic; + +#include "CPU.h" +#include "PPU.h" +#include "Breakpoint.h" +#include "../Utilities/SimpleLock.h" + +class MemoryManager; +class Console; +class Disassembler; + +struct DebugState +{ + State CPU; + PPUDebugState PPU; +}; + +class Debugger +{ +private: + static Debugger* Instance; + + unique_ptr _disassembler; + shared_ptr _console; + shared_ptr _cpu; + shared_ptr _ppu; + shared_ptr _memoryManager; + shared_ptr _mapper; + vector> _readBreakpoints; + vector> _writeBreakpoints; + vector> _execBreakpoints; + + SimpleLock _bpLock; + SimpleLock _breakLock; + + string _outputCache; + atomic _stepCount; + atomic _stepCycleCount; + atomic _lastInstruction; + atomic _stepOut; + atomic _stepOverAddr; + +private: + void PrivateCheckBreakpoint(BreakpointType type, uint32_t addr); + bool SleepUntilResume(); + +public: + Debugger(shared_ptr console, shared_ptr cpu, shared_ptr ppu, shared_ptr memoryManager, shared_ptr mapper); + ~Debugger(); + + void AddBreakpoint(BreakpointType type, uint32_t address, bool isAbsoluteAddr); + void RemoveBreakpoint(shared_ptr breakpoint); + shared_ptr GetMatchingBreakpoint(BreakpointType type, uint32_t addr); + vector> GetBreakpoints(); + vector GetExecBreakpointAddresses(); + + void GetState(DebugState *state); + + void Step(uint32_t count = 1); + void StepCycles(uint32_t cycleCount = 1); + void StepOver(); + void StepOut(); + void Run(); + + bool IsCodeChanged(); + string GenerateOutput(); + string* GetCode(); + + uint8_t GetMemoryValue(uint32_t addr); + uint32_t GetRelativeAddress(uint32_t addr); + + static void CheckBreakpoint(BreakpointType type, uint32_t addr); +}; \ No newline at end of file diff --git a/Core/Disassembler.cpp b/Core/Disassembler.cpp index 643b865f..c3fab722 100644 --- a/Core/Disassembler.cpp +++ b/Core/Disassembler.cpp @@ -3,13 +3,18 @@ #include "DisassemblyInfo.h" #include "CPU.h" -Disassembler::Disassembler(uint8_t* prgROM, uint32_t prgSize) +Disassembler::Disassembler(uint8_t* internalRAM, uint8_t* prgROM, uint32_t prgSize) { + _internalRAM = internalRAM; _prgROM = prgROM; _prgSize = prgSize; for(uint32_t i = 0; i < prgSize; i++) { _disassembleCache.push_back(shared_ptr(nullptr)); } + for(uint32_t i = 0; i < 0x2000; i++) { + _disassembleMemoryCache.push_back(shared_ptr(nullptr)); + } + string opName[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F @@ -81,24 +86,74 @@ Disassembler::Disassembler(uint8_t* prgROM, uint32_t prgSize) } } +Disassembler::~Disassembler() +{ + if(_prgROM) { + delete[] _prgROM; + } +} + void Disassembler::BuildCache(uint32_t absoluteAddr, uint16_t memoryAddr) { - while(!_disassembleCache[absoluteAddr]) { - shared_ptr disInfo(new DisassemblyInfo(&_prgROM[absoluteAddr])); - _disassembleCache[absoluteAddr] = disInfo; - - uint8_t opCode = _prgROM[absoluteAddr]; - - if(opCode == 0x10 || opCode == 0x20 || opCode == 0x30 || opCode == 0x40 || opCode == 0x50 || opCode == 0x60 || opCode == 0x70 || opCode == 0x90 || opCode == 0xB0 || opCode == 0xD0 || opCode == 0xF0 || opCode == 0x4C || opCode == 0x6C) { - //Hit a jump/return instruction, can't assume that what follows is actual code, stop disassembling - break; + if(memoryAddr < 0x2000) { + memoryAddr = memoryAddr & 0x7FF; + if(!_disassembleMemoryCache[memoryAddr]) { + shared_ptr disInfo(new DisassemblyInfo(&_internalRAM[memoryAddr])); + _disassembleMemoryCache[memoryAddr] = disInfo; } + } else { + while(!_disassembleCache[absoluteAddr]) { + shared_ptr disInfo(new DisassemblyInfo(&_prgROM[absoluteAddr])); + _disassembleCache[absoluteAddr] = disInfo; - absoluteAddr += disInfo->GetSize(); - memoryAddr += disInfo->GetSize(); + uint8_t opCode = _prgROM[absoluteAddr]; + + if(opCode == 0x10 || opCode == 0x20 || opCode == 0x30 || opCode == 0x40 || opCode == 0x50 || opCode == 0x60 || opCode == 0x70 || opCode == 0x90 || opCode == 0xB0 || opCode == 0xD0 || opCode == 0xF0 || opCode == 0x4C || opCode == 0x6C) { + //Hit a jump/return instruction, can't assume that what follows is actual code, stop disassembling + break; + } + + absoluteAddr += disInfo->GetSize(); + memoryAddr += disInfo->GetSize(); + } } } +string Disassembler::GetRAMCode() +{ + std::ostringstream output; + + uint32_t addr = 0x0000; + uint32_t byteCount = 0; + while(addr < 0x2000) { + shared_ptr info; + if(info = _disassembleMemoryCache[addr&0x7FF]) { + if(byteCount > 0) { + output << "\n"; + byteCount = 0; + } + output << std::hex << std::uppercase << addr << ":" << info->ToString(addr) << "\n"; + addr += info->GetSize(); + } else { + if(byteCount >= 8) { + output << "\n"; + byteCount = 0; + } + if(byteCount == 0) { + output << std::hex << std::uppercase << addr << ":" << ".db"; + } + output << std::hex << " $" << std::setfill('0') << std::setw(2) << (short)_internalRAM[addr]; + + byteCount++; + addr++; + } + } + + output << "\n1FFF:--END OF INTERNAL RAM--\n"; + + return output.str(); +} + string Disassembler::GetCode(uint32_t startAddr, uint32_t endAddr, uint16_t &memoryAddr) { std::ostringstream output; @@ -109,31 +164,29 @@ string Disassembler::GetCode(uint32_t startAddr, uint32_t endAddr, uint16_t &mem shared_ptr info; if(info = _disassembleCache[addr]) { if(byteCount > 0) { - output << "\\par\n"; + output << "\n"; byteCount = 0; } - output << "{\\highlight1\n " << std::hex << std::uppercase << memoryAddr << ":} " << info->ToString(memoryAddr) << "\\par\n"; + output << std::hex << std::uppercase << memoryAddr << ":" << info->ToString(memoryAddr) << "\n"; addr += info->GetSize(); memoryAddr += info->GetSize(); } else { if(byteCount >= 8) { - output << "\\par\n"; + output << "\n"; byteCount = 0; } if(byteCount == 0) { - output << "{\\highlight1\n " << std::hex << std::uppercase << memoryAddr << ":} " << ".db"; + output << std::hex << std::uppercase << memoryAddr << ":" << ".db"; } output << std::hex << " $" << std::setfill('0') << std::setw(2) << (short)_prgROM[addr]; - + byteCount++; addr++; memoryAddr++; } } - - if(byteCount > 0) { - output << "\\par\n"; - } + + output << "\n"; return output.str(); } diff --git a/Core/Disassembler.h b/Core/Disassembler.h index c04e724a..2f1f0848 100644 --- a/Core/Disassembler.h +++ b/Core/Disassembler.h @@ -7,12 +7,16 @@ class Disassembler { private: vector> _disassembleCache; + vector> _disassembleMemoryCache; + uint8_t* _internalRAM; uint8_t* _prgROM; uint32_t _prgSize; public: - Disassembler(uint8_t* prgROM, uint32_t prgSize); + Disassembler(uint8_t* internalRAM, uint8_t* prgROM, uint32_t prgSize); + ~Disassembler(); void BuildCache(uint32_t absoluteAddr, uint16_t memoryAddr); + string GetRAMCode(); string GetCode(uint32_t startAddr, uint32_t endAddr, uint16_t &memoryAddr); }; diff --git a/Core/DisassemblyInfo.cpp b/Core/DisassemblyInfo.cpp index 86b2fa5c..11455832 100644 --- a/Core/DisassemblyInfo.cpp +++ b/Core/DisassemblyInfo.cpp @@ -22,7 +22,7 @@ void DisassemblyInfo::Initialize(uint32_t memoryAddr) } if(DisassemblyInfo::OPName[opCode].empty()) { - std::cout << "error"; + output << "invalid opcode"; } std::ostringstream nextByte; diff --git a/Core/GameClient.cpp b/Core/GameClient.cpp index 80d67e48..744ffdf0 100644 --- a/Core/GameClient.cpp +++ b/Core/GameClient.cpp @@ -1,20 +1,26 @@ #pragma once #include "stdafx.h" +#include +using std::thread; + +#include "MessageManager.h" #include "GameClient.h" #include "Console.h" +#include "../Utilities/Socket.h" +#include "ClientConnectionData.h" unique_ptr GameClient::Instance; GameClient::GameClient() { - Console::RegisterNotificationListener(this); + MessageManager::RegisterNotificationListener(this); } GameClient::~GameClient() { _stop = true; _clientThread->join(); - Console::UnregisterNotificationListener(this); + MessageManager::UnregisterNotificationListener(this); } bool GameClient::Connected() @@ -26,10 +32,10 @@ bool GameClient::Connected() } } -void GameClient::Connect(const char *host, u_short port) +void GameClient::Connect(shared_ptr connectionData) { Instance.reset(new GameClient()); - Instance->PrivateConnect(host, port); + Instance->PrivateConnect(connectionData); Instance->_clientThread.reset(new thread(&GameClient::Exec, Instance.get())); } @@ -38,15 +44,15 @@ void GameClient::Disconnect() Instance.reset(); } -void GameClient::PrivateConnect(const char *host, u_short port) +void GameClient::PrivateConnect(shared_ptr connectionData) { _stop = false; _socket.reset(new Socket()); - if(_socket->Connect(host, port)) { - _connection.reset(new GameClientConnection(_socket)); + if(_socket->Connect(connectionData->Host.c_str(), connectionData->Port)) { + _connection.reset(new GameClientConnection(_socket, connectionData)); _connected = true; } else { - Console::DisplayMessage(L"Could not connect to server."); + MessageManager::DisplayMessage(L"Net Play", L"Could not connect to server."); _connected = false; _socket.reset(); } diff --git a/Core/GameClient.h b/Core/GameClient.h index 8197434c..ff13c27e 100644 --- a/Core/GameClient.h +++ b/Core/GameClient.h @@ -1,8 +1,12 @@ #pragma once + #include "stdafx.h" #include "GameClientConnection.h" #include "INotificationListener.h" +class ClientConnectionData; +class thread; + class GameClient : public INotificationListener { private: @@ -14,7 +18,7 @@ private: unique_ptr _connection; bool _connected = false; - void PrivateConnect(const char *host, u_short port); + void PrivateConnect(shared_ptr connectionData); void Exec(); void PrivateDisconnect(); @@ -23,7 +27,7 @@ public: ~GameClient(); static bool Connected(); - static void Connect(const char *host, u_short port); + static void Connect(shared_ptr connectionData); static void Disconnect(); void ProcessNotification(ConsoleNotificationType type); diff --git a/Core/GameClientConnection.cpp b/Core/GameClientConnection.cpp index bbf55f36..ed9233d4 100644 --- a/Core/GameClientConnection.cpp +++ b/Core/GameClientConnection.cpp @@ -8,13 +8,15 @@ #include "SaveStateMessage.h" #include "Console.h" #include "ControlManager.h" +#include "VirtualController.h" +#include "ClientConnectionData.h" -GameClientConnection::GameClientConnection(shared_ptr socket) : GameConnection(socket) +GameClientConnection::GameClientConnection(shared_ptr socket, shared_ptr connectionData) : GameConnection(socket, connectionData) { _controlDevice = ControlManager::GetControlDevice(0); ControlManager::BackupControlDevices(); - Console::DisplayMessage(L"Connected to server."); + MessageManager::DisplayMessage(L"Net Play", L"Connected to server."); SendHandshake(); } @@ -23,12 +25,12 @@ GameClientConnection::~GameClientConnection() { _virtualControllers.clear(); ControlManager::RestoreControlDevices(); - Console::DisplayMessage(L"Connection to server lost."); + MessageManager::DisplayMessage(L"Net Play", L"Connection to server lost."); } void GameClientConnection::SendHandshake() { - SendNetMessage(HandShakeMessage()); + SendNetMessage(HandShakeMessage(_connectionData->PlayerName, _connectionData->AvatarData, _connectionData->AvatarSize)); } void GameClientConnection::InitializeVirtualControllers() @@ -49,7 +51,7 @@ void GameClientConnection::ProcessMessage(NetMessage* message) uint8_t state; GameInformationMessage* gameInfo; - switch(message->Type) { + switch(message->GetType()) { case MessageType::SaveState: if(_gameLoaded) { DisposeVirtualControllers(); @@ -65,23 +67,23 @@ void GameClientConnection::ProcessMessage(NetMessage* message) break; case MessageType::MovieData: if(_gameLoaded) { - port = ((MovieDataMessage*)message)->PortNumber; - state = ((MovieDataMessage*)message)->InputState; + port = ((MovieDataMessage*)message)->GetPortNumber(); + state = ((MovieDataMessage*)message)->GetInputState(); _virtualControllers[port]->PushState(state); } break; case MessageType::GameInformation: gameInfo = (GameInformationMessage*)message; - if(gameInfo->ControllerPort != _controllerPort) { - _controllerPort = gameInfo->ControllerPort; - Console::DisplayMessage(wstring(L"Connected as player ") + std::to_wstring(_controllerPort + 1)); + if(gameInfo->GetPort() != _controllerPort) { + _controllerPort = gameInfo->GetPort(); + MessageManager::DisplayMessage(wstring(L"Connected as player ") + std::to_wstring(_controllerPort + 1)); } DisposeVirtualControllers(); _gameLoaded = gameInfo->AttemptLoadGame(); - if(gameInfo->Paused) { + if(gameInfo->IsPaused()) { Console::SetFlags(EmulationFlags::Paused); } else { Console::ClearFlags(EmulationFlags::Paused); diff --git a/Core/GameClientConnection.h b/Core/GameClientConnection.h index b3a96bb8..c6b41941 100644 --- a/Core/GameClientConnection.h +++ b/Core/GameClientConnection.h @@ -1,7 +1,10 @@ #pragma once #include "stdafx.h" #include "GameConnection.h" -#include "VirtualController.h" +#include "IControlDevice.h" + +class ClientConnectionData; +class VirtualController; class GameClientConnection : public GameConnection { @@ -21,7 +24,7 @@ protected: void ProcessMessage(NetMessage* message); public: - GameClientConnection(shared_ptr socket); + GameClientConnection(shared_ptr socket, shared_ptr connectionData); ~GameClientConnection(); void SendInput(); diff --git a/Core/GameConnection.cpp b/Core/GameConnection.cpp index beaa0554..7d1eabeb 100644 --- a/Core/GameConnection.cpp +++ b/Core/GameConnection.cpp @@ -6,9 +6,11 @@ #include "MovieDataMessage.h" #include "GameInformationMessage.h" #include "SaveStateMessage.h" +#include "ClientConnectionData.h" -GameConnection::GameConnection(shared_ptr socket) +GameConnection::GameConnection(shared_ptr socket, shared_ptr connectionData) { + _connectionData = connectionData; _socket = socket; } @@ -48,11 +50,11 @@ NetMessage* GameConnection::ReadMessage() uint32_t messageLength; if(ExtractMessage(_messageBuffer, messageLength)) { switch((MessageType)_messageBuffer[0]) { - case MessageType::HandShake: return new HandShakeMessage(_messageBuffer + 1); - case MessageType::SaveState: return new SaveStateMessage(_messageBuffer + 1, messageLength - 1); - case MessageType::InputData: return new InputDataMessage(_messageBuffer + 1); - case MessageType::MovieData: return new MovieDataMessage(_messageBuffer + 1); - case MessageType::GameInformation: return new GameInformationMessage(_messageBuffer + 1); + case MessageType::HandShake: return new HandShakeMessage(_messageBuffer, messageLength); + case MessageType::SaveState: return new SaveStateMessage(_messageBuffer, messageLength); + case MessageType::InputData: return new InputDataMessage(_messageBuffer, messageLength); + case MessageType::MovieData: return new MovieDataMessage(_messageBuffer, messageLength); + case MessageType::GameInformation: return new GameInformationMessage(_messageBuffer, messageLength); } } return nullptr; @@ -75,6 +77,7 @@ void GameConnection::ProcessMessages() NetMessage* message; while(message = ReadMessage()) { //Loop until all messages have been processed + message->Initialize(); ProcessMessage(message); delete message; } diff --git a/Core/GameConnection.h b/Core/GameConnection.h index 7d8c920e..7e2493b4 100644 --- a/Core/GameConnection.h +++ b/Core/GameConnection.h @@ -1,13 +1,16 @@ #pragma once #include "stdafx.h" -#include "NetMessage.h" -#include "../Utilities/Socket.h" #include "../Utilities/SimpleLock.h" +class Socket; +class NetMessage; +class ClientConnectionData; + class GameConnection { protected: shared_ptr _socket; + shared_ptr _connectionData; char _readBuffer[0x40000]; char _messageBuffer[0x40000]; int _readPosition = 0; @@ -25,7 +28,7 @@ protected: void SendNetMessage(NetMessage &message); public: - GameConnection(shared_ptr socket); + GameConnection(shared_ptr socket, shared_ptr connectionData); bool ConnectionError(); diff --git a/Core/GameInformationMessage.h b/Core/GameInformationMessage.h index f2e92c48..2f9aa7e2 100644 --- a/Core/GameInformationMessage.h +++ b/Core/GameInformationMessage.h @@ -1,5 +1,6 @@ #pragma once #include "stdafx.h" +#include "MessageManager.h" #include "NetMessage.h" #include "Console.h" #include "ROMLoader.h" @@ -7,54 +8,90 @@ class GameInformationMessage : public NetMessage { -protected: - virtual uint32_t GetMessageLength() - { - return sizeof(ROMFilename) + sizeof(CRC32Hash) + sizeof(ControllerPort) + sizeof(Paused); - } +private: + wchar_t *_romFilename = nullptr; + uint32_t _romFilenameLength = 0; + uint32_t _crc32Hash = 0; + uint8_t _controllerPort = 0; + bool _paused = false; - virtual void ProtectedSend(Socket &socket) +protected: + virtual void ProtectedStreamState() { - socket.BufferedSend((char*)&ROMFilename, sizeof(ROMFilename)); - socket.BufferedSend((char*)&CRC32Hash, sizeof(CRC32Hash)); - socket.BufferedSend((char*)&ControllerPort, sizeof(ControllerPort)); - socket.BufferedSend((char*)&Paused, sizeof(Paused)); + StreamArray((void**)&_romFilename, _romFilenameLength); + Stream(_crc32Hash); + Stream(_controllerPort); + Stream(_paused); } public: - wchar_t ROMFilename[255]; - uint32_t CRC32Hash; - uint8_t ControllerPort; - bool Paused; - - GameInformationMessage(char *readBuffer) : NetMessage(MessageType::GameInformation) - { - memcpy((char*)ROMFilename, readBuffer, sizeof(ROMFilename)); - memcpy((char*)&CRC32Hash, readBuffer + sizeof(ROMFilename), sizeof(CRC32Hash)); - ControllerPort = readBuffer[sizeof(ROMFilename) + sizeof(CRC32Hash)]; - Paused = readBuffer[sizeof(ROMFilename) + sizeof(CRC32Hash) + sizeof(ControllerPort)] == 1; - } + GameInformationMessage(void* buffer, uint32_t length) : NetMessage(buffer, length) { } GameInformationMessage(wstring filepath, uint8_t port, bool paused) : NetMessage(MessageType::GameInformation) { - memset(ROMFilename, 0, sizeof(ROMFilename)); - wcscpy_s(ROMFilename, FolderUtilities::GetFilename(filepath, true).c_str()); - CRC32Hash = ROMLoader::GetCRC32(filepath); - ControllerPort = port; - Paused = paused; + CopyString(&_romFilename, _romFilenameLength, FolderUtilities::GetFilename(filepath, true)); + _crc32Hash = ROMLoader::GetCRC32(filepath); + _controllerPort = port; + _paused = paused; } - + bool AttemptLoadGame() { - wstring filename = ROMFilename; + wstring filename = _romFilename; if(filename.size() > 0) { - if(Console::AttemptLoadROM(filename, CRC32Hash)) { + if(AttemptLoadROM(filename, _crc32Hash)) { return true; } else { - Console::DisplayMessage(L"Could not find matching game ROM."); + MessageManager::DisplayMessage(L"Net Play", L"Could not find matching game ROM."); return false; } } return false; } + + uint8_t GetPort() + { + return _controllerPort; + } + + bool IsPaused() + { + return _paused; + } + + bool AttemptLoadROM(wstring filename, uint32_t crc32Hash) + { + if(!Console::GetROMPath().empty()) { + if(ROMLoader::GetCRC32(Console::GetROMPath()) == crc32Hash) { + //Current game matches, no need to do anything + return true; + } + } + + vector romFiles = FolderUtilities::GetFilesInFolder(L"D:\\Users\\Saitoh Hajime\\Desktop\\CPPApp\\NES\\Games", L"*.nes", true); + for(wstring zipFile : FolderUtilities::GetFilesInFolder(L"D:\\Users\\Saitoh Hajime\\Desktop\\CPPApp\\NES\\Games", L"*.zip", true)) { + romFiles.push_back(zipFile); + } + for(wstring romFile : romFiles) { + //Quick search by filename + if(FolderUtilities::GetFilename(romFile, true).compare(filename) == 0) { + if(ROMLoader::GetCRC32(romFile) == crc32Hash) { + //Matching ROM found + Console::LoadROM(romFile); + return true; + } + } + } + + for(wstring romFile : romFiles) { + //Slower search by CRC value + if(ROMLoader::GetCRC32(romFile) == crc32Hash) { + //Matching ROM found + Console::LoadROM(romFile); + return true; + } + } + + return false; + } }; \ No newline at end of file diff --git a/Core/GameServer.cpp b/Core/GameServer.cpp index 5d2cc83d..453873b8 100644 --- a/Core/GameServer.cpp +++ b/Core/GameServer.cpp @@ -1,10 +1,30 @@ #pragma once #include "stdafx.h" +#include +using std::thread; + +#include "MessageManager.h" #include "GameServer.h" #include "Console.h" +#include "../Utilities/Socket.h" unique_ptr GameServer::Instance; +GameServer::GameServer() +{ + ControlManager::RegisterBroadcaster(this); +} + +GameServer::~GameServer() +{ + _stop = true; + _serverThread->join(); + + Stop(); + + ControlManager::UnregisterBroadcaster(this); +} + void GameServer::AcceptConnections() { while(true) { @@ -35,18 +55,15 @@ void GameServer::UpdateConnections() } } -void GameServer::Start() +void GameServer::Exec() { - Console::DisplayMessage(L"Server started."); _listener.reset(new Socket()); - _listener->Bind(8888); + _listener->Bind(_port); _listener->Listen(10); _stop = false; _initialized = true; -} + MessageManager::DisplayMessage(L"Net Play" , L"Server started (Port: " + std::to_wstring(_port) + L")"); -void GameServer::Exec() -{ while(!_stop) { AcceptConnections(); UpdateConnections(); @@ -59,28 +76,13 @@ void GameServer::Stop() { _initialized = false; _listener.reset(); - Console::DisplayMessage(L"Server stopped."); + MessageManager::DisplayMessage(L"Net Play", L"Server stopped"); } -GameServer::GameServer() -{ - ControlManager::RegisterBroadcaster(this); - Console::RegisterNotificationListener(this); -} - -GameServer::~GameServer() -{ - _stop = true; - _serverThread->join(); - - ControlManager::UnregisterBroadcaster(this); - Console::UnregisterNotificationListener(this); -} - -void GameServer::StartServer() +void GameServer::StartServer(uint16_t port) { Instance.reset(new GameServer()); - Instance->Start(); + Instance->_port = port; Instance->_serverThread.reset(new thread(&GameServer::Exec, Instance.get())); } @@ -108,22 +110,4 @@ void GameServer::BroadcastInput(uint8_t inputData, uint8_t port) connection->SendMovieData(inputData, port); } } -} - -void GameServer::ProcessNotification(ConsoleNotificationType type) -{ - if(type == ConsoleNotificationType::StateLoaded) { - for(shared_ptr connection : _openConnections) { - if(!connection->ConnectionError()) { - connection->SendGameState(); - } - } - } else if(type == ConsoleNotificationType::GameLoaded) { - for(shared_ptr connection : _openConnections) { - if(!connection->ConnectionError()) { - connection->SendGameInformation(); - connection->SendGameState(); - } - } - } } \ No newline at end of file diff --git a/Core/GameServer.h b/Core/GameServer.h index f61bf7a8..f046760c 100644 --- a/Core/GameServer.h +++ b/Core/GameServer.h @@ -1,9 +1,12 @@ #pragma once #include "stdafx.h" +#include #include "GameServerConnection.h" #include "INotificationListener.h" -class GameServer : public IGameBroadcaster, public INotificationListener +using std::thread; + +class GameServer : public IGameBroadcaster { private: static unique_ptr Instance; @@ -11,13 +14,13 @@ private: atomic _stop; unique_ptr _listener; + uint16_t _port; list> _openConnections; bool _initialized = false; void AcceptConnections(); void UpdateConnections(); - void Start(); void Exec(); void Stop(); @@ -25,10 +28,9 @@ public: GameServer(); ~GameServer(); - static void StartServer(); + static void StartServer(uint16_t port); static void StopServer(); static bool Started(); virtual void BroadcastInput(uint8_t inputData, uint8_t port); - virtual void ProcessNotification(ConsoleNotificationType type); }; \ No newline at end of file diff --git a/Core/GameServerConnection.cpp b/Core/GameServerConnection.cpp index 23673a88..857f9bd8 100644 --- a/Core/GameServerConnection.cpp +++ b/Core/GameServerConnection.cpp @@ -1,5 +1,6 @@ #pragma once #include "stdafx.h" +#include "MessageManager.h" #include "GameServerConnection.h" #include "HandShakeMessage.h" #include "InputDataMessage.h" @@ -8,47 +9,30 @@ #include "SaveStateMessage.h" #include "Console.h" #include "ControlManager.h" +#include "ClientConnectionData.h" -void GameServerConnection::ProcessMessage(NetMessage* message) -{ - switch(message->Type) { - case MessageType::HandShake: - //Send the game's current state to the client and register the controller - if(((HandShakeMessage*)message)->IsValid()) { - SendGameInformation(); - SendGameState(); - } - break; - case MessageType::InputData: - uint8_t state = ((InputDataMessage*)message)->InputState; - if(_inputData.size() == 0 || state != _inputData.back()) { - _inputData.push_back(state); - } - break; - } -} - -GameServerConnection::GameServerConnection(shared_ptr socket, int controllerPort, IGameBroadcaster* gameBroadcaster) : GameConnection(socket) +GameServerConnection::GameServerConnection(shared_ptr socket, int controllerPort, IGameBroadcaster* gameBroadcaster) : GameConnection(socket, nullptr) { //Server-side connection _gameBroadcaster = gameBroadcaster; - _controllerPort = controllerPort; - Console::DisplayMessage(L"Player " + std::to_wstring(_controllerPort+1) + L" connected."); - ControlManager::BackupControlDevices(); - Console::RegisterNotificationListener(this); + MessageManager::RegisterNotificationListener(this); } GameServerConnection::~GameServerConnection() { - Console::DisplayMessage(L"Player " + std::to_wstring(_controllerPort+1) + L" disconnected."); + if(_connectionData) { + MessageManager::DisplayToast(L"Net Play", _connectionData->PlayerName + L" (Player " + std::to_wstring(_controllerPort + 1) + L") disconnected.", _connectionData->AvatarData, _connectionData->AvatarSize); + } else { + MessageManager::DisplayMessage(L"Net Play", L"Player " + std::to_wstring(_controllerPort + 1) + L" disconnected."); + } ControlManager::RestoreControlDevices(); - Console::UnregisterNotificationListener(this); + MessageManager::UnregisterNotificationListener(this); } void GameServerConnection::SendGameState() @@ -64,7 +48,7 @@ void GameServerConnection::SendGameState() char* buffer = new char[size]; state.read(buffer, size); - SendNetMessage(SaveStateMessage(buffer, size)); + SendNetMessage(SaveStateMessage(buffer, size, true)); delete[] buffer; } @@ -96,13 +80,37 @@ ButtonState GameServerConnection::GetButtonState() return state; } +void GameServerConnection::ProcessMessage(NetMessage* message) +{ + switch(message->GetType()) { + case MessageType::HandShake: + //Send the game's current state to the client and register the controller + if(((HandShakeMessage*)message)->IsValid()) { + _connectionData.reset(new ClientConnectionData("", 0, ((HandShakeMessage*)message)->GetPlayerName(), ((HandShakeMessage*)message)->GetAvatarData(), ((HandShakeMessage*)message)->GetAvatarSize())); + + MessageManager::DisplayToast(L"Net Play", _connectionData->PlayerName + L" (Player " + std::to_wstring(_controllerPort + 1) + L") connected.", _connectionData->AvatarData, _connectionData->AvatarSize); + SendGameInformation(); + SendGameState(); + } + break; + case MessageType::InputData: + uint8_t state = ((InputDataMessage*)message)->GetInputState(); + if(_inputData.size() == 0 || state != _inputData.back()) { + _inputData.push_back(state); + } + break; + } +} + void GameServerConnection::ProcessNotification(ConsoleNotificationType type) { switch(type) { case ConsoleNotificationType::GamePaused: SendGameInformation(); break; + case ConsoleNotificationType::GameLoaded: case ConsoleNotificationType::GameResumed: + case ConsoleNotificationType::GameReset: SendGameInformation(); SendGameState(); break; diff --git a/Core/HandShakeMessage.h b/Core/HandShakeMessage.h index 39e5e641..0c2ff805 100644 --- a/Core/HandShakeMessage.h +++ b/Core/HandShakeMessage.h @@ -5,34 +5,48 @@ class HandShakeMessage : public NetMessage { private: - const int CurrentVersion = 1; + const static int CurrentVersion = 1; + uint32_t _protocolVersion = CurrentVersion; + wchar_t *_playerName = nullptr; + uint32_t _playerNameLength = 0; + void* _avatarData = nullptr; + uint32_t _avatarSize = 0; protected: - virtual uint32_t GetMessageLength() + virtual void ProtectedStreamState() { - return sizeof(ProtocolVersion); - } - - virtual void ProtectedSend(Socket &socket) - { - socket.BufferedSend((char*)&ProtocolVersion, sizeof(ProtocolVersion)); + Stream(_protocolVersion); + StreamArray((void**)&_playerName, _playerNameLength); + StreamArray(&_avatarData, _avatarSize); } public: - uint32_t ProtocolVersion; - - HandShakeMessage(char *readBuffer) : NetMessage(MessageType::HandShake) + HandShakeMessage(void* buffer, uint32_t length) : NetMessage(buffer, length) { } + HandShakeMessage(wstring playerName, uint8_t* avatarData, uint32_t avatarSize) : NetMessage(MessageType::HandShake) { - ProtocolVersion = *(uint32_t*)readBuffer; + _protocolVersion = 1; + CopyString(&_playerName, _playerNameLength, playerName); + _avatarSize = avatarSize; + _avatarData = avatarData; + } + + wstring GetPlayerName() + { + return wstring(_playerName); } - HandShakeMessage() : NetMessage(MessageType::HandShake) + uint8_t* GetAvatarData() { - ProtocolVersion = 1; + return (uint8_t*)_avatarData; + } + + uint32_t GetAvatarSize() + { + return _avatarSize; } bool IsValid() { - return ProtocolVersion == CurrentVersion; + return _protocolVersion == CurrentVersion; } }; diff --git a/Core/IAudioDevice.h b/Core/IAudioDevice.h index 2d5a94b3..4e364bdf 100644 --- a/Core/IAudioDevice.h +++ b/Core/IAudioDevice.h @@ -6,4 +6,5 @@ class IAudioDevice { public: virtual void PlayBuffer(int16_t *soundBuffer, uint32_t bufferSize) = 0; + virtual void Pause() = 0; }; \ No newline at end of file diff --git a/Core/IMessageManager.h b/Core/IMessageManager.h index 2c0f0015..def8e31a 100644 --- a/Core/IMessageManager.h +++ b/Core/IMessageManager.h @@ -1,9 +1,118 @@ #pragma once #include "stdafx.h" +#include + +class ToastInfo; class IMessageManager { public: - virtual void DisplayMessage(wstring message) = 0; + virtual void DisplayMessage(wstring title, wstring message) = 0; + virtual void DisplayToast(shared_ptr toast) = 0; +}; + +class ToastInfo +{ +private: + wstring _title; + wstring _message; + uint8_t* _icon; + uint32_t _iconSize; + uint64_t _endTime; + uint64_t _startTime; + + uint8_t* ReadFile(wstring filename, uint32_t &fileSize) + { + ifstream file(filename, ios::in | ios::binary); + if(file) { + file.seekg(0, ios::end); + fileSize = (uint32_t)file.tellg(); + file.seekg(0, ios::beg); + + uint8_t* buffer = new uint8_t[fileSize]; + file.read((char*)buffer, fileSize); + return buffer; + } + return nullptr; + } + + uint64_t GetCurrentTime() + { + return std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); + } + +public: + ToastInfo(wstring title, wstring message, int displayDuration, wstring iconFile) + { + _title = title; + _message = message; + + _icon = ReadFile(iconFile, _iconSize); + + _startTime = GetCurrentTime(); + _endTime = _startTime + displayDuration; + } + + ToastInfo(wstring title, wstring message, int displayDuration, uint8_t* iconData, uint32_t iconSize) + { + _title = title; + _message = message; + + _iconSize = iconSize; + _icon = new uint8_t[iconSize]; + memcpy(_icon, iconData, iconSize); + + _startTime = GetCurrentTime(); + _endTime = _startTime + displayDuration; + } + + ~ToastInfo() + { + if(_icon) { + delete _icon; + } + } + + wstring GetToastTitle() + { + return _title; + } + + wstring GetToastMessage() + { + return _message; + } + + uint8_t* GetToastIcon() + { + return _icon; + } + + uint32_t GetIconSize() + { + return _iconSize; + } + + bool HasIcon() + { + return _iconSize > 0; + } + + float GetOpacity() + { + uint64_t currentTime = GetCurrentTime(); + if(currentTime - _startTime < 333) { + return (currentTime - _startTime) * 3.0f / 1000.0f; + } else if(_endTime - currentTime < 333) { + return (_endTime - currentTime) * 3.0f / 1000.0f; + } else { + return 1.0f; + } + } + + bool IsToastExpired() + { + return _endTime < GetCurrentTime(); + } }; \ No newline at end of file diff --git a/Core/InputDataMessage.h b/Core/InputDataMessage.h index 873b66f8..c36e09a9 100644 --- a/Core/InputDataMessage.h +++ b/Core/InputDataMessage.h @@ -4,27 +4,24 @@ class InputDataMessage : public NetMessage { +private: + uint8_t _inputState; protected: - virtual uint32_t GetMessageLength() + virtual void ProtectedStreamState() { - return sizeof(InputState); - } - - virtual void ProtectedSend(Socket &socket) - { - socket.BufferedSend((char*)&InputState, sizeof(InputState)); + Stream(_inputState); } public: - uint8_t InputState; - - InputDataMessage(char *readBuffer) : NetMessage(MessageType::InputData) - { - InputState = readBuffer[0]; - } + InputDataMessage(void* buffer, uint32_t length) : NetMessage(buffer, length) { } InputDataMessage(uint8_t inputState) : NetMessage(MessageType::InputData) { - InputState = inputState; + _inputState = inputState; + } + + uint8_t GetInputState() + { + return _inputState; } }; \ No newline at end of file diff --git a/Core/MMC1.h b/Core/MMC1.h index 724eb651..a851b462 100644 --- a/Core/MMC1.h +++ b/Core/MMC1.h @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "CPU.h" #include "BaseMapper.h" class MMC1 : public BaseMapper diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index bd41ce61..e46110c3 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -1,6 +1,6 @@ #pragma once #include "stdafx.h" -#include "Console.h" +#include "MessageManager.h" #include "MapperFactory.h" #include "ROMLoader.h" #include "AXROM.h" @@ -37,7 +37,7 @@ BaseMapper* MapperFactory::GetMapperFromID(uint8_t mapperID) case 71: return new UNROM(); //TODO: "It's largely a clone of UNROM, and Camerica games were initially emulated under iNES Mapper 002 before 071 was assigned." case 163: return new Nanjing(); case 189: return new MMC3_189(); - default: Console::DisplayMessage(L"Unsupported mapper, cannot load file."); + default: MessageManager::DisplayMessage(L"Error", L"Unsupported mapper, cannot load game."); } return nullptr; diff --git a/Core/MemoryManager.cpp b/Core/MemoryManager.cpp index e08fa336..0e98327d 100644 --- a/Core/MemoryManager.cpp +++ b/Core/MemoryManager.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "MemoryManager.h" +#include "BaseMapper.h" #include "PPU.h" #include "Debugger.h" @@ -93,6 +94,11 @@ void MemoryManager::RegisterIODevice(IMemoryHandler *handler) InitializeMemoryHandlers(_vramWriteHandlers, handler, ranges.GetVRAMWriteAddresses()); } +uint8_t* MemoryManager::GetInternalRAM() +{ + return _internalRAM; +} + uint8_t MemoryManager::DebugRead(uint16_t addr) { if(addr <= 0x1FFF) { diff --git a/Core/MemoryManager.h b/Core/MemoryManager.h index ad57ec1e..d6207ae7 100644 --- a/Core/MemoryManager.h +++ b/Core/MemoryManager.h @@ -2,10 +2,10 @@ #include "stdafx.h" #include "IMemoryHandler.h" -#include "ROMLoader.h" -#include "BaseMapper.h" #include "Snapshotable.h" +class BaseMapper; + class MemoryManager: public Snapshotable { private: @@ -47,6 +47,8 @@ class MemoryManager: public Snapshotable void RegisterIODevice(IMemoryHandler *handler); uint8_t DebugRead(uint16_t addr); + uint8_t* GetInternalRAM(); + uint8_t Read(uint16_t addr, bool forExecution = false); uint16_t ReadWord(uint16_t addr); void Write(uint16_t addr, uint8_t value); diff --git a/Core/MessageManager.cpp b/Core/MessageManager.cpp new file mode 100644 index 00000000..9dd7acd4 --- /dev/null +++ b/Core/MessageManager.cpp @@ -0,0 +1,46 @@ +#include "stdafx.h" + +#include "MessageManager.h" + +IMessageManager* MessageManager::_messageManager = nullptr; +list MessageManager::_notificationListeners; + +void MessageManager::RegisterMessageManager(IMessageManager* messageManager) +{ + MessageManager::_messageManager = messageManager; +} + +void MessageManager::DisplayMessage(wstring title, wstring message) +{ + std::wcout << message << std::endl; + if(MessageManager::_messageManager) { + MessageManager::_messageManager->DisplayMessage(title, message); + } +} + +void MessageManager::DisplayToast(wstring title, wstring message, uint8_t* iconData, uint32_t iconSize) +{ + if(MessageManager::_messageManager) { + MessageManager::_messageManager->DisplayToast(shared_ptr(new ToastInfo(title, message, 4000, iconData, iconSize))); + } +} +void MessageManager::RegisterNotificationListener(INotificationListener* notificationListener) +{ + MessageManager::_notificationListeners.push_back(notificationListener); + MessageManager::_notificationListeners.unique(); +} + +void MessageManager::UnregisterNotificationListener(INotificationListener* notificationListener) +{ + MessageManager::_notificationListeners.remove(notificationListener); +} + +void MessageManager::SendNotification(ConsoleNotificationType type) +{ + list listeners = MessageManager::_notificationListeners; + + //Iterate on a copy to prevent issues if a notification causes a listener to unregister itself + for(INotificationListener* notificationListener : listeners) { + notificationListener->ProcessNotification(type); + } +} \ No newline at end of file diff --git a/Core/MessageManager.h b/Core/MessageManager.h new file mode 100644 index 00000000..e5393944 --- /dev/null +++ b/Core/MessageManager.h @@ -0,0 +1,22 @@ +#pragma once + +#include "stdafx.h" + +#include "IMessageManager.h" +#include "INotificationListener.h" + +class MessageManager +{ +private: + static IMessageManager* _messageManager; + static list _notificationListeners; + +public: + static void RegisterMessageManager(IMessageManager* messageManager); + static void DisplayMessage(wstring title, wstring message = L""); + static void DisplayToast(wstring title, wstring message, uint8_t* iconData, uint32_t iconSize); + + static void RegisterNotificationListener(INotificationListener* notificationListener); + static void UnregisterNotificationListener(INotificationListener* notificationListener); + static void SendNotification(ConsoleNotificationType type); +}; \ No newline at end of file diff --git a/Core/Movie.cpp b/Core/Movie.cpp index 792181ee..4f831774 100644 --- a/Core/Movie.cpp +++ b/Core/Movie.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" +#include "MessageManager.h" #include "Movie.h" #include "Console.h" +#include "../Utilities/FolderUtilities.h" Movie* Movie::Instance = new Movie(); @@ -43,7 +45,7 @@ uint8_t Movie::GetState(uint8_t port) if(_readPosition[port] >= _data.DataSize[port]) { //End of movie file - Console::DisplayMessage(L"Movie ended."); + MessageManager::DisplayMessage(L"Movie ended."); _playing = false; } @@ -84,7 +86,7 @@ void Movie::StartRecording(wstring filename, bool reset) Console::Resume(); - Console::DisplayMessage(L"Recording..."); + MessageManager::DisplayMessage(L"Recording..."); } } @@ -116,7 +118,7 @@ void Movie::PlayMovie(wstring filename) } _playing = true; Console::Resume(); - Console::DisplayMessage(L"Playing movie: " + FolderUtilities::GetFilename(filename, true)); + MessageManager::DisplayMessage(L"Playing movie: " + FolderUtilities::GetFilename(filename, true)); } } diff --git a/Core/Movie.h b/Core/Movie.h index 383d952b..a1da2bc1 100644 --- a/Core/Movie.h +++ b/Core/Movie.h @@ -10,7 +10,7 @@ struct MovieData bool Save(ofstream &file, stringstream &startState) { - file.write("NMO", 3); + file.write("MMO", 3); SaveStateSize = (uint32_t)startState.tellp(); file.write((char*)&SaveStateSize, sizeof(uint32_t)); @@ -43,7 +43,7 @@ struct MovieData char header[3]; file.read((char*)&header, 3); - if(memcmp((char*)&header, "NMO", 3) != 0) { + if(memcmp((char*)&header, "MMO", 3) != 0) { //Invalid movie file return false; } diff --git a/Core/MovieDataMessage.h b/Core/MovieDataMessage.h index 2e2961ea..a1de03d0 100644 --- a/Core/MovieDataMessage.h +++ b/Core/MovieDataMessage.h @@ -4,31 +4,33 @@ class MovieDataMessage : public NetMessage { -protected: - virtual uint32_t GetMessageLength() - { - return sizeof(PortNumber) + sizeof(InputState); - } +private: + uint8_t _portNumber; + uint8_t _inputState; - virtual void ProtectedSend(Socket &socket) +protected: + virtual void ProtectedStreamState() { - socket.BufferedSend((char*)&PortNumber, sizeof(PortNumber)); - socket.BufferedSend((char*)&InputState, sizeof(InputState)); + Stream(_portNumber); + Stream(_inputState); } public: - uint8_t PortNumber; - uint8_t InputState; - - MovieDataMessage(char *readBuffer) : NetMessage(MessageType::MovieData) - { - PortNumber = readBuffer[0]; - InputState = readBuffer[1]; - } + MovieDataMessage(void* buffer, uint32_t length) : NetMessage(buffer, length) { } MovieDataMessage(uint8_t state, uint8_t port) : NetMessage(MessageType::MovieData) { - PortNumber = port; - InputState = state; + _portNumber = port; + _inputState = state; + } + + uint8_t GetPortNumber() + { + return _portNumber; + } + + uint8_t GetInputState() + { + return _inputState; } }; \ No newline at end of file diff --git a/Core/NetMessage.h b/Core/NetMessage.h index 1b1057e8..3fab52a3 100644 --- a/Core/NetMessage.h +++ b/Core/NetMessage.h @@ -5,24 +5,104 @@ class NetMessage { -public: - MessageType Type; +protected: + MessageType _type; + bool _sending; + vector _buffer; + uint32_t _position = 0; + vector _pointersToRelease; + + template + void Stream(T &value) + { + if(_sending) { + uint8_t* bytes = (uint8_t*)&value; + int typeSize = sizeof(T); + for(int i = 0; i < typeSize; i++) { + _buffer.push_back(bytes[i]); + } + } else { + value = *((T*)(&_buffer[0] + _position)); + _position += sizeof(T); + } + } + + void StreamArray(void** value, uint32_t &length) + { + if(_sending) { + Stream(length); + uint8_t* bytes = (uint8_t*)(*value); + for(uint32_t i = 0, len = length; i < len; i++) { + _buffer.push_back(bytes[i]); + _position++; + } + } else { + Stream(length); + if(*value == nullptr) { + *value = (void*)new uint8_t[length]; + _pointersToRelease.push_back(*value); + } + uint8_t* bytes = (uint8_t*)(*value); + for(uint32_t i = 0, len = length; i < len; i++) { + bytes[i] = _buffer[_position]; + _position++; + } + } + } + + void StreamState() + { + Stream(_type); + ProtectedStreamState(); + } NetMessage(MessageType type) { - Type = type; + _type = type; + _sending = true; + } + + NetMessage(void* buffer, uint32_t length) + { + _buffer.assign((uint8_t*)buffer, (uint8_t*)buffer + length); + _sending = false; + } + +public: + virtual ~NetMessage() + { + for(void *pointer : _pointersToRelease) { + delete[] pointer; + } + } + + void Initialize() + { + StreamState(); + } + + MessageType GetType() + { + return _type; } void Send(Socket &socket) { - uint32_t messageLength = GetMessageLength() + sizeof(Type); + StreamState(); + uint32_t messageLength = _buffer.size(); socket.BufferedSend((char*)&messageLength, sizeof(messageLength)); - socket.BufferedSend((char*)&Type, sizeof(Type)); - ProtectedSend(socket); + socket.BufferedSend((char*)&_buffer[0], messageLength); socket.SendBuffer(); } + void CopyString(wchar_t** dest, uint32_t &length, wstring src) + { + length = (src.length() + 1)*sizeof(wchar_t); + *dest = (wchar_t*)new uint8_t[length]; + memcpy(*dest, src.c_str(), length); + _pointersToRelease.push_back(*dest); + } + protected: - virtual uint32_t GetMessageLength() = 0; - virtual void ProtectedSend(Socket &socket) = 0; + virtual void ProtectedStreamState() = 0; }; diff --git a/Core/PPU.cpp b/Core/PPU.cpp index f7370229..c75379b5 100644 --- a/Core/PPU.cpp +++ b/Core/PPU.cpp @@ -52,9 +52,15 @@ void PPU::Reset() memset(_spriteRAM, 0xFF, 0x100); } -bool PPU::CheckFlag(PPUControlFlags flag) +PPUDebugState PPU::GetState() { - return false; + PPUDebugState state; + state.ControlFlags = _flags; + state.StatusFlags = _statusFlags; + state.State = _state; + state.Cycle = _cycle; + state.Scanline = _scanline; + return state; } void PPU::UpdateVideoRamAddr() @@ -293,13 +299,13 @@ void PPU::IncHorizontalScrolling() _state.VideoRamAddr = addr; } -//Take from http://wiki.nesdev.com/w/index.php/The_skinny_on_NES_scrolling#Tile_and_attribute_fetching +//Taken from http://wiki.nesdev.com/w/index.php/The_skinny_on_NES_scrolling#Tile_and_attribute_fetching uint16_t PPU::GetNameTableAddr() { return 0x2000 | (_state.VideoRamAddr & 0x0FFF); } -//Take from http://wiki.nesdev.com/w/index.php/The_skinny_on_NES_scrolling#Tile_and_attribute_fetching +//Taken from http://wiki.nesdev.com/w/index.php/The_skinny_on_NES_scrolling#Tile_and_attribute_fetching uint16_t PPU::GetAttributeAddr() { return 0x23C0 | (_state.VideoRamAddr & 0x0C00) | ((_state.VideoRamAddr >> 4) & 0x38) | ((_state.VideoRamAddr >> 2) & 0x07); diff --git a/Core/PPU.h b/Core/PPU.h index 97be3e27..0ade76d4 100644 --- a/Core/PPU.h +++ b/Core/PPU.h @@ -74,6 +74,15 @@ struct SpriteInfo bool BackgroundPriority; }; +struct PPUDebugState +{ + PPUControlFlags ControlFlags; + PPUStatusFlags StatusFlags; + PPUState State; + int32_t Scanline; + uint32_t Cycle; +}; + class PPU : public IMemoryHandler, public Snapshotable { private: @@ -120,7 +129,6 @@ class PPU : public IMemoryHandler, public Snapshotable void SetControlRegister(uint8_t value); void SetMaskRegister(uint8_t value); - bool CheckFlag(PPUControlFlags flag); bool IsRenderingEnabled(); @@ -172,6 +180,8 @@ class PPU : public IMemoryHandler, public Snapshotable void Reset(); + PPUDebugState GetState(); + void GetMemoryRanges(MemoryRanges &ranges) { ranges.AddHandler(MemoryType::RAM, MemoryOperation::Read, 0x2000, 0x3FFF); diff --git a/Core/SaveStateManager.cpp b/Core/SaveStateManager.cpp new file mode 100644 index 00000000..62079fd0 --- /dev/null +++ b/Core/SaveStateManager.cpp @@ -0,0 +1,57 @@ +#include "stdafx.h" + +#include "SaveStateManager.h" +#include "MessageManager.h" +#include "Console.h" +#include "../Utilities/FolderUtilities.h" + +wstring SaveStateManager::GetStateFilepath(int stateIndex) +{ + wstring folder = FolderUtilities::GetSaveStateFolder(); + wstring filename = FolderUtilities::GetFilename(Console::GetROMPath(), false) + L"_" + std::to_wstring(stateIndex) + L".mst"; + return FolderUtilities::CombinePath(folder, filename); +} + +uint64_t SaveStateManager::GetStateInfo(int stateIndex) +{ + wstring filepath = SaveStateManager::GetStateFilepath(stateIndex); + ifstream file(filepath, ios::in | ios::binary); + + if(file) { + file.close(); + return FolderUtilities::GetFileModificationTime(filepath); + } + return 0; +} + +void SaveStateManager::SaveState(int stateIndex) +{ + wstring filepath = SaveStateManager::GetStateFilepath(stateIndex); + ofstream file(filepath, ios::out | ios::binary); + + if(file) { + Console::Pause(); + Console::SaveState(file); + Console::Resume(); + file.close(); + MessageManager::DisplayMessage(L"Game States", L"State #" + std::to_wstring(stateIndex) + L" saved."); + } +} + +bool SaveStateManager::LoadState(int stateIndex) +{ + wstring filepath = SaveStateManager::GetStateFilepath(stateIndex); + ifstream file(filepath, ios::in | ios::binary); + + if(file) { + Console::Pause(); + Console::LoadState(file); + Console::Resume(); + file.close(); + MessageManager::DisplayMessage(L"Game States", L"State #" + std::to_wstring(stateIndex) + L" loaded."); + return true; + } + + MessageManager::DisplayMessage(L"Game States", L"Slot is empty."); + return false; +} \ No newline at end of file diff --git a/Core/SaveStateManager.h b/Core/SaveStateManager.h new file mode 100644 index 00000000..99f01c37 --- /dev/null +++ b/Core/SaveStateManager.h @@ -0,0 +1,15 @@ +#pragma once + +#include "stdafx.h" + +class SaveStateManager +{ +private: + static wstring SaveStateManager::GetStateFilepath(int stateIndex); + +public: + static uint64_t SaveStateManager::GetStateInfo(int stateIndex); + static void SaveStateManager::SaveState(int stateIndex); + static bool SaveStateManager::LoadState(int stateIndex); + +}; \ No newline at end of file diff --git a/Core/SaveStateMessage.h b/Core/SaveStateMessage.h index 610db2f4..a5ee1eb1 100644 --- a/Core/SaveStateMessage.h +++ b/Core/SaveStateMessage.h @@ -6,33 +6,24 @@ class SaveStateMessage : public NetMessage { private: - char* _stateData; + void* _stateData; uint32_t _dataSize; protected: - virtual uint32_t GetMessageLength() + virtual void ProtectedStreamState() { - return _dataSize; - } - - virtual void ProtectedSend(Socket &socket) - { - socket.BufferedSend(_stateData, _dataSize); + StreamArray(&_stateData, _dataSize); } public: - SaveStateMessage(char *readBuffer, uint32_t bufferLength) : NetMessage(MessageType::SaveState) - { - _stateData = new char[bufferLength]; - _dataSize = bufferLength; - memcpy(_stateData, readBuffer, bufferLength); + SaveStateMessage(void* buffer, uint32_t length) : NetMessage(buffer, length) { } + + SaveStateMessage(void* stateData, uint32_t dataSize, bool forSend) : NetMessage(MessageType::SaveState) + { + _stateData = stateData; + _dataSize = dataSize; } - - ~SaveStateMessage() - { - delete[] _stateData; - } - + void LoadState() { Console::LoadState((uint8_t*)_stateData, _dataSize); diff --git a/Core/Snapshotable.h b/Core/Snapshotable.h index 805645b4..e4f0a304 100644 --- a/Core/Snapshotable.h +++ b/Core/Snapshotable.h @@ -37,7 +37,7 @@ class Snapshotable _stream[_position++] = bytes[i]; } } else { - for(uint32_t i = 0; i < length*typeSize; i++) { + for(uint32_t i = 0, len = length*typeSize; i < len; i++) { ((uint8_t*)value)[i] = _stream[_position]; _position++; } diff --git a/Core/VirtualController.h b/Core/VirtualController.h index a0f9473d..ebf9e5d8 100644 --- a/Core/VirtualController.h +++ b/Core/VirtualController.h @@ -1,6 +1,9 @@ #pragma once #include "stdafx.h" +#include +using std::atomic; + #include "IControlDevice.h" #include "../Utilities/SimpleLock.h" diff --git a/Core/stdafx.h b/Core/stdafx.h index 209a193b..26d6a404 100644 --- a/Core/stdafx.h +++ b/Core/stdafx.h @@ -14,12 +14,11 @@ #include #include #include -#include #include #include #include -#include #include +#include using std::vector; using std::shared_ptr; @@ -32,9 +31,8 @@ using std::stringstream; using std::ofstream; using std::wstring; using std::exception; -using std::atomic_flag; -using std::atomic; using std::list; using std::max; -using std::thread; -using std::string; \ No newline at end of file +using std::string; +using std::atomic_flag; +using std::atomic; diff --git a/GUI.NET/App.config b/GUI.NET/App.config new file mode 100644 index 00000000..8e156463 --- /dev/null +++ b/GUI.NET/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/GUI.NET/ConfigManager/ConfigManager.cs b/GUI.NET/ConfigManager/ConfigManager.cs new file mode 100644 index 00000000..37e583ef --- /dev/null +++ b/GUI.NET/ConfigManager/ConfigManager.cs @@ -0,0 +1,205 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; +using System.Xml.Serialization; +using System.Drawing; +using System.Drawing.Imaging; +using System.Drawing.Drawing2D; + +namespace Mesen.GUI +{ + class ConfigManager + { + private static Configuration _config; + private static Configuration _dirtyConfig; + + private static void LoadConfig() + { + if(_config == null) { + if(File.Exists(ConfigFile)) { + _config = Configuration.Deserialize(ConfigFile); + _dirtyConfig = Configuration.Deserialize(ConfigFile); + } else { + //Create new config file and save it to disk + _config = new Configuration(); + _dirtyConfig = new Configuration(); + SaveConfig(); + } + } + } + + private static void SaveConfig() + { + _config.Serialize(ConfigFile); + } + + private static string ConfigFile + { + get + { + string configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.Create), "Mesen"); + if(!Directory.Exists(configPath)) { + Directory.CreateDirectory(configPath); + } + + return Path.Combine(configPath, "settings.xml"); + } + } + + public static Configuration Config + { + get + { + LoadConfig(); + return _dirtyConfig; + } + } + + public static void ApplyChanges() + { + _config = _dirtyConfig.Clone(); + SaveConfig(); + } + + public static void RejectChanges() + { + _dirtyConfig = _config.Clone(); + } + } + + public class PlayerProfile + { + public string PlayerName = "NewPlayer"; + public byte[] PlayerAvatar; + + public PlayerProfile() + { + SetAvatar(Properties.Resources.MesenLogo); + } + + + public void SetAvatar(Image image) + { + PlayerAvatar = image.ResizeImage(64, 64).ToByteArray(ImageFormat.Bmp); + } + + public void SetAvatar(string filename) + { + PlayerAvatar = File.ReadAllBytes(filename); + } + + public Image GetAvatarImage() + { + return Image.FromStream(new MemoryStream(PlayerAvatar)); + } + } + + public class ClientConnectionInfo + { + public string Host = "localhost"; + public UInt16 Port = 8888; + } + + public class ServerInfo + { + public string Name = "Default"; + public UInt16 Port = 8888; + public string Password = null; + public int MaxPlayers = 4; + public bool AllowSpectators = true; + public bool PublicServer = false; + } + + public class Configuration + { + private const int MaxRecentFiles = 10; + + public PlayerProfile Profile; + public ClientConnectionInfo ClientConnectionInfo; + public ServerInfo ServerInfo; + public List RecentFiles; + + public Configuration() + { + Profile = new PlayerProfile(); + ClientConnectionInfo = new ClientConnectionInfo(); + ServerInfo = new ServerInfo(); + RecentFiles = new List(); + } + + public void AddRecentFile(string filepath) + { + if(RecentFiles.Contains(filepath)) { + RecentFiles.Remove(filepath); + } + RecentFiles.Insert(0, filepath); + if(RecentFiles.Count > Configuration.MaxRecentFiles) { + RecentFiles.RemoveAt(Configuration.MaxRecentFiles); + } + ConfigManager.ApplyChanges(); + } + + public static Configuration Deserialize(string configFile) + { + XmlSerializer xmlSerializer = new XmlSerializer(typeof(Configuration)); + using(TextReader textReader = new StreamReader(configFile)) { + return (Configuration)xmlSerializer.Deserialize(textReader); + } + } + + public void Serialize(string configFile) + { + XmlSerializer xmlSerializer = new XmlSerializer(typeof(Configuration)); + using(TextWriter textWriter = new StreamWriter(configFile)) { + xmlSerializer.Serialize(textWriter, this); + } + } + + public Configuration Clone() + { + XmlSerializer xmlSerializer = new XmlSerializer(typeof(Configuration)); + StringWriter stringWriter = new StringWriter(); + xmlSerializer.Serialize(stringWriter, this); + + StringReader stringReader = new StringReader(stringWriter.ToString()); + return (Configuration)xmlSerializer.Deserialize(stringReader); + } + } + + public static class ImageExtensions + { + public static byte[] ToByteArray(this Image image, ImageFormat format) + { + using(MemoryStream ms = new MemoryStream()) { + image.Save(ms, format); + return ms.ToArray(); + } + } + + public static Image ResizeImage(this Image image, int width, int height) + { + var destRect = new Rectangle(0, 0, width, height); + var destImage = new Bitmap(width, height); + + destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution); + + using(var graphics = Graphics.FromImage(destImage)) { + graphics.CompositingMode = CompositingMode.SourceCopy; + graphics.CompositingQuality = CompositingQuality.HighQuality; + graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; + graphics.SmoothingMode = SmoothingMode.HighQuality; + graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; + + using(var wrapMode = new ImageAttributes()) { + wrapMode.SetWrapMode(WrapMode.TileFlipXY); + graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode); + } + } + + return destImage; + } + } +} diff --git a/GUI.NET/Controls/DXViewer.Designer.cs b/GUI.NET/Controls/DXViewer.Designer.cs new file mode 100644 index 00000000..e26f9b2a --- /dev/null +++ b/GUI.NET/Controls/DXViewer.Designer.cs @@ -0,0 +1,36 @@ +namespace Mesen.GUI.Controls +{ + partial class DXViewer + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/GUI.NET/Controls/DXViewer.cs b/GUI.NET/Controls/DXViewer.cs new file mode 100644 index 00000000..b6d082b1 --- /dev/null +++ b/GUI.NET/Controls/DXViewer.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Mesen.GUI.Controls +{ + public partial class DXViewer : UserControl + { + public DXViewer() + { + InitializeComponent(); + } + } +} diff --git a/GUI.NET/Debugger/Controls/ctrlConsoleStatus.Designer.cs b/GUI.NET/Debugger/Controls/ctrlConsoleStatus.Designer.cs new file mode 100644 index 00000000..862420dc --- /dev/null +++ b/GUI.NET/Debugger/Controls/ctrlConsoleStatus.Designer.cs @@ -0,0 +1,1119 @@ +namespace Mesen.GUI.Debugger +{ + partial class ctrlConsoleStatus + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.grpPPUStatus = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel8 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel7 = new System.Windows.Forms.TableLayoutPanel(); + this.lblVRAMAddr = new System.Windows.Forms.Label(); + this.lblCycle = new System.Windows.Forms.Label(); + this.txtCycle = new System.Windows.Forms.TextBox(); + this.lblScanline = new System.Windows.Forms.Label(); + this.txtScanline = new System.Windows.Forms.TextBox(); + this.txtVRAMAddr = new System.Windows.Forms.TextBox(); + this.chkVerticalBlank = new System.Windows.Forms.CheckBox(); + this.chkSprite0Hit = new System.Windows.Forms.CheckBox(); + this.chkSpriteOverflow = new System.Windows.Forms.CheckBox(); + this.grpControlMask = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel9 = new System.Windows.Forms.TableLayoutPanel(); + this.chkDrawLeftSpr = new System.Windows.Forms.CheckBox(); + this.flowLayoutPanel7 = new System.Windows.Forms.FlowLayoutPanel(); + this.lblSprAddr = new System.Windows.Forms.Label(); + this.txtSprAddr = new System.Windows.Forms.TextBox(); + this.chkSpritesEnabled = new System.Windows.Forms.CheckBox(); + this.chkBGEnabled = new System.Windows.Forms.CheckBox(); + this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel(); + this.lblBGAddr = new System.Windows.Forms.Label(); + this.txtBGAddr = new System.Windows.Forms.TextBox(); + this.chkDrawLeftBG = new System.Windows.Forms.CheckBox(); + this.chkGrayscale = new System.Windows.Forms.CheckBox(); + this.chkIntensifyRed = new System.Windows.Forms.CheckBox(); + this.chkIntensifyGreen = new System.Windows.Forms.CheckBox(); + this.chkVerticalWrite = new System.Windows.Forms.CheckBox(); + this.chkNMIOnBlank = new System.Windows.Forms.CheckBox(); + this.chkLargeSprites = new System.Windows.Forms.CheckBox(); + this.flowLayoutPanel5 = new System.Windows.Forms.FlowLayoutPanel(); + this.lblNTAddr = new System.Windows.Forms.Label(); + this.txtNTAddr = new System.Windows.Forms.TextBox(); + this.chkIntensifyBlue = new System.Windows.Forms.CheckBox(); + this.grpCPUStatus = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.grpIRQ = new System.Windows.Forms.GroupBox(); + this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); + this.chkExternal = new System.Windows.Forms.CheckBox(); + this.chkFrameCounter = new System.Windows.Forms.CheckBox(); + this.chkDMC = new System.Windows.Forms.CheckBox(); + this.chkNMI = new System.Windows.Forms.CheckBox(); + this.grpFlags = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + this.lblStatus = new System.Windows.Forms.Label(); + this.txtStatus = new System.Windows.Forms.TextBox(); + this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); + this.chkNegative = new System.Windows.Forms.CheckBox(); + this.chkOverflow = new System.Windows.Forms.CheckBox(); + this.chkReserved = new System.Windows.Forms.CheckBox(); + this.chkBreak = new System.Windows.Forms.CheckBox(); + this.chkDecimal = new System.Windows.Forms.CheckBox(); + this.chkInterrupt = new System.Windows.Forms.CheckBox(); + this.chkZero = new System.Windows.Forms.CheckBox(); + this.chkCarry = new System.Windows.Forms.CheckBox(); + this.grpStack = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); + this.lblSP = new System.Windows.Forms.Label(); + this.txtSP = new System.Windows.Forms.TextBox(); + this.lstStack = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.lblA = new System.Windows.Forms.Label(); + this.txtA = new System.Windows.Forms.TextBox(); + this.lblX = new System.Windows.Forms.Label(); + this.txtX = new System.Windows.Forms.TextBox(); + this.lblY = new System.Windows.Forms.Label(); + this.txtY = new System.Windows.Forms.TextBox(); + this.lblPC = new System.Windows.Forms.Label(); + this.txtPC = new System.Windows.Forms.TextBox(); + this.tableLayoutPanel2.SuspendLayout(); + this.grpPPUStatus.SuspendLayout(); + this.tableLayoutPanel8.SuspendLayout(); + this.tableLayoutPanel7.SuspendLayout(); + this.grpControlMask.SuspendLayout(); + this.tableLayoutPanel9.SuspendLayout(); + this.flowLayoutPanel7.SuspendLayout(); + this.flowLayoutPanel6.SuspendLayout(); + this.flowLayoutPanel5.SuspendLayout(); + this.grpCPUStatus.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + this.grpIRQ.SuspendLayout(); + this.flowLayoutPanel3.SuspendLayout(); + this.grpFlags.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); + this.flowLayoutPanel2.SuspendLayout(); + this.tableLayoutPanel5.SuspendLayout(); + this.grpStack.SuspendLayout(); + this.tableLayoutPanel6.SuspendLayout(); + this.flowLayoutPanel4.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 1; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Controls.Add(this.grpPPUStatus, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.grpCPUStatus, 0, 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 = 2; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(470, 362); + this.tableLayoutPanel2.TabIndex = 2; + // + // grpPPUStatus + // + this.grpPPUStatus.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.grpPPUStatus.Controls.Add(this.tableLayoutPanel8); + this.grpPPUStatus.Location = new System.Drawing.Point(3, 180); + this.grpPPUStatus.Name = "grpPPUStatus"; + this.grpPPUStatus.Size = new System.Drawing.Size(464, 179); + this.grpPPUStatus.TabIndex = 2; + this.grpPPUStatus.TabStop = false; + this.grpPPUStatus.Text = "PPU Status"; + // + // tableLayoutPanel8 + // + this.tableLayoutPanel8.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.tableLayoutPanel8.ColumnCount = 2; + this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 44.25163F)); + this.tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 55.74837F)); + this.tableLayoutPanel8.Controls.Add(this.tableLayoutPanel7, 0, 0); + this.tableLayoutPanel8.Controls.Add(this.grpControlMask, 1, 0); + this.tableLayoutPanel8.Location = new System.Drawing.Point(6, 19); + this.tableLayoutPanel8.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel8.Name = "tableLayoutPanel8"; + this.tableLayoutPanel8.RowCount = 1; + this.tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel8.Size = new System.Drawing.Size(455, 157); + this.tableLayoutPanel8.TabIndex = 1; + // + // tableLayoutPanel7 + // + this.tableLayoutPanel7.ColumnCount = 2; + this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + 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.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel7.Controls.Add(this.lblVRAMAddr, 0, 2); + this.tableLayoutPanel7.Controls.Add(this.lblCycle, 0, 0); + this.tableLayoutPanel7.Controls.Add(this.txtCycle, 1, 0); + this.tableLayoutPanel7.Controls.Add(this.txtVRAMAddr, 1, 2); + this.tableLayoutPanel7.Controls.Add(this.chkVerticalBlank, 0, 3); + this.tableLayoutPanel7.Controls.Add(this.chkSprite0Hit, 0, 4); + this.tableLayoutPanel7.Controls.Add(this.chkSpriteOverflow, 0, 5); + this.tableLayoutPanel7.Controls.Add(this.lblScanline, 0, 1); + this.tableLayoutPanel7.Controls.Add(this.txtScanline, 1, 1); + this.tableLayoutPanel7.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanel7.Name = "tableLayoutPanel7"; + this.tableLayoutPanel7.RowCount = 6; + 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()); + 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()); + this.tableLayoutPanel7.Size = new System.Drawing.Size(195, 145); + this.tableLayoutPanel7.TabIndex = 0; + // + // lblVRAMAddr + // + this.lblVRAMAddr.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblVRAMAddr.AutoSize = true; + this.lblVRAMAddr.Location = new System.Drawing.Point(0, 58); + this.lblVRAMAddr.Margin = new System.Windows.Forms.Padding(0); + this.lblVRAMAddr.Name = "lblVRAMAddr"; + this.lblVRAMAddr.Size = new System.Drawing.Size(66, 13); + this.lblVRAMAddr.TabIndex = 5; + this.lblVRAMAddr.Text = "VRAM Addr:"; + this.lblVRAMAddr.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblCycle + // + this.lblCycle.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblCycle.AutoSize = true; + this.lblCycle.Location = new System.Drawing.Point(0, 6); + this.lblCycle.Margin = new System.Windows.Forms.Padding(0); + this.lblCycle.Name = "lblCycle"; + this.lblCycle.Size = new System.Drawing.Size(36, 13); + this.lblCycle.TabIndex = 1; + this.lblCycle.Text = "Cycle:"; + this.lblCycle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtCycle + // + this.txtCycle.Location = new System.Drawing.Point(69, 3); + this.txtCycle.Name = "txtCycle"; + this.txtCycle.Size = new System.Drawing.Size(58, 20); + this.txtCycle.TabIndex = 2; + // + // lblScanline + // + this.lblScanline.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblScanline.AutoSize = true; + this.lblScanline.Location = new System.Drawing.Point(0, 32); + this.lblScanline.Margin = new System.Windows.Forms.Padding(0); + this.lblScanline.Name = "lblScanline"; + this.lblScanline.Size = new System.Drawing.Size(51, 13); + this.lblScanline.TabIndex = 3; + this.lblScanline.Text = "Scanline:"; + this.lblScanline.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtScanline + // + this.txtScanline.Location = new System.Drawing.Point(69, 29); + this.txtScanline.Name = "txtScanline"; + this.txtScanline.Size = new System.Drawing.Size(58, 20); + this.txtScanline.TabIndex = 4; + // + // txtVRAMAddr + // + this.txtVRAMAddr.Location = new System.Drawing.Point(69, 55); + this.txtVRAMAddr.Name = "txtVRAMAddr"; + this.txtVRAMAddr.Size = new System.Drawing.Size(58, 20); + this.txtVRAMAddr.TabIndex = 6; + // + // chkVerticalBlank + // + this.chkVerticalBlank.AutoSize = true; + this.tableLayoutPanel7.SetColumnSpan(this.chkVerticalBlank, 2); + this.chkVerticalBlank.Location = new System.Drawing.Point(0, 78); + this.chkVerticalBlank.Margin = new System.Windows.Forms.Padding(0); + this.chkVerticalBlank.Name = "chkVerticalBlank"; + this.chkVerticalBlank.Size = new System.Drawing.Size(91, 17); + this.chkVerticalBlank.TabIndex = 7; + this.chkVerticalBlank.Text = "Vertical Blank"; + this.chkVerticalBlank.UseVisualStyleBackColor = true; + // + // chkSprite0Hit + // + this.chkSprite0Hit.AutoSize = true; + this.tableLayoutPanel7.SetColumnSpan(this.chkSprite0Hit, 2); + this.chkSprite0Hit.Location = new System.Drawing.Point(0, 95); + this.chkSprite0Hit.Margin = new System.Windows.Forms.Padding(0); + this.chkSprite0Hit.Name = "chkSprite0Hit"; + this.chkSprite0Hit.Size = new System.Drawing.Size(78, 17); + this.chkSprite0Hit.TabIndex = 9; + this.chkSprite0Hit.Text = "Sprite 0 Hit"; + this.chkSprite0Hit.UseVisualStyleBackColor = true; + // + // chkSpriteOverflow + // + this.chkSpriteOverflow.AutoSize = true; + this.tableLayoutPanel7.SetColumnSpan(this.chkSpriteOverflow, 2); + this.chkSpriteOverflow.Location = new System.Drawing.Point(0, 112); + this.chkSpriteOverflow.Margin = new System.Windows.Forms.Padding(0); + this.chkSpriteOverflow.Name = "chkSpriteOverflow"; + this.chkSpriteOverflow.Size = new System.Drawing.Size(98, 17); + this.chkSpriteOverflow.TabIndex = 8; + this.chkSpriteOverflow.Text = "Sprite Overflow"; + this.chkSpriteOverflow.UseVisualStyleBackColor = true; + // + // grpControlMask + // + this.grpControlMask.Controls.Add(this.tableLayoutPanel9); + this.grpControlMask.Location = new System.Drawing.Point(204, 3); + this.grpControlMask.Name = "grpControlMask"; + this.grpControlMask.Size = new System.Drawing.Size(245, 151); + this.grpControlMask.TabIndex = 1; + this.grpControlMask.TabStop = false; + this.grpControlMask.Text = "Control && Mask"; + // + // tableLayoutPanel9 + // + this.tableLayoutPanel9.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.tableLayoutPanel9.ColumnCount = 2; + this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel9.Controls.Add(this.chkDrawLeftSpr, 0, 6); + this.tableLayoutPanel9.Controls.Add(this.flowLayoutPanel7, 0, 2); + this.tableLayoutPanel9.Controls.Add(this.chkSpritesEnabled, 0, 4); + this.tableLayoutPanel9.Controls.Add(this.chkBGEnabled, 0, 3); + this.tableLayoutPanel9.Controls.Add(this.flowLayoutPanel6, 0, 1); + this.tableLayoutPanel9.Controls.Add(this.chkDrawLeftBG, 0, 5); + this.tableLayoutPanel9.Controls.Add(this.chkGrayscale, 1, 3); + this.tableLayoutPanel9.Controls.Add(this.chkIntensifyRed, 1, 4); + this.tableLayoutPanel9.Controls.Add(this.chkIntensifyGreen, 1, 5); + this.tableLayoutPanel9.Controls.Add(this.chkVerticalWrite, 1, 0); + this.tableLayoutPanel9.Controls.Add(this.chkNMIOnBlank, 1, 1); + this.tableLayoutPanel9.Controls.Add(this.chkLargeSprites, 1, 2); + this.tableLayoutPanel9.Controls.Add(this.flowLayoutPanel5, 0, 0); + this.tableLayoutPanel9.Controls.Add(this.chkIntensifyBlue, 1, 6); + this.tableLayoutPanel9.Location = new System.Drawing.Point(6, 19); + this.tableLayoutPanel9.Name = "tableLayoutPanel9"; + this.tableLayoutPanel9.RowCount = 7; + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel9.Size = new System.Drawing.Size(233, 126); + this.tableLayoutPanel9.TabIndex = 1; + // + // chkDrawLeftSpr + // + this.chkDrawLeftSpr.AutoSize = true; + this.chkDrawLeftSpr.Location = new System.Drawing.Point(0, 112); + this.chkDrawLeftSpr.Margin = new System.Windows.Forms.Padding(0); + this.chkDrawLeftSpr.Name = "chkDrawLeftSpr"; + this.chkDrawLeftSpr.Size = new System.Drawing.Size(113, 17); + this.chkDrawLeftSpr.TabIndex = 23; + this.chkDrawLeftSpr.Text = "Draw left Spr (8px)"; + this.chkDrawLeftSpr.UseVisualStyleBackColor = true; + // + // flowLayoutPanel7 + // + this.flowLayoutPanel7.Controls.Add(this.lblSprAddr); + this.flowLayoutPanel7.Controls.Add(this.txtSprAddr); + this.flowLayoutPanel7.Location = new System.Drawing.Point(0, 41); + this.flowLayoutPanel7.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel7.Name = "flowLayoutPanel7"; + this.flowLayoutPanel7.Size = new System.Drawing.Size(116, 20); + this.flowLayoutPanel7.TabIndex = 22; + // + // lblSprAddr + // + this.lblSprAddr.AutoSize = true; + this.lblSprAddr.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblSprAddr.Location = new System.Drawing.Point(0, 0); + this.lblSprAddr.Margin = new System.Windows.Forms.Padding(0); + this.lblSprAddr.Name = "lblSprAddr"; + this.lblSprAddr.Size = new System.Drawing.Size(51, 20); + this.lblSprAddr.TabIndex = 0; + this.lblSprAddr.Text = "Spr Addr:"; + this.lblSprAddr.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtSprAddr + // + this.txtSprAddr.Location = new System.Drawing.Point(51, 0); + this.txtSprAddr.Margin = new System.Windows.Forms.Padding(0); + this.txtSprAddr.Name = "txtSprAddr"; + this.txtSprAddr.Size = new System.Drawing.Size(50, 20); + this.txtSprAddr.TabIndex = 1; + // + // chkSpritesEnabled + // + this.chkSpritesEnabled.AutoSize = true; + this.chkSpritesEnabled.Location = new System.Drawing.Point(0, 78); + this.chkSpritesEnabled.Margin = new System.Windows.Forms.Padding(0); + this.chkSpritesEnabled.Name = "chkSpritesEnabled"; + this.chkSpritesEnabled.Size = new System.Drawing.Size(100, 17); + this.chkSpritesEnabled.TabIndex = 8; + this.chkSpritesEnabled.Text = "Sprites Enabled"; + this.chkSpritesEnabled.UseVisualStyleBackColor = true; + // + // chkBGEnabled + // + this.chkBGEnabled.AutoSize = true; + this.chkBGEnabled.Location = new System.Drawing.Point(0, 61); + this.chkBGEnabled.Margin = new System.Windows.Forms.Padding(0); + this.chkBGEnabled.Name = "chkBGEnabled"; + this.chkBGEnabled.Size = new System.Drawing.Size(83, 17); + this.chkBGEnabled.TabIndex = 7; + this.chkBGEnabled.Text = "BG Enabled"; + this.chkBGEnabled.UseVisualStyleBackColor = true; + // + // flowLayoutPanel6 + // + this.flowLayoutPanel6.Controls.Add(this.lblBGAddr); + this.flowLayoutPanel6.Controls.Add(this.txtBGAddr); + this.flowLayoutPanel6.Location = new System.Drawing.Point(0, 21); + this.flowLayoutPanel6.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel6.Name = "flowLayoutPanel6"; + this.flowLayoutPanel6.Size = new System.Drawing.Size(116, 20); + this.flowLayoutPanel6.TabIndex = 21; + // + // lblBGAddr + // + this.lblBGAddr.AutoSize = true; + this.lblBGAddr.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblBGAddr.Location = new System.Drawing.Point(0, 0); + this.lblBGAddr.Margin = new System.Windows.Forms.Padding(0); + this.lblBGAddr.Name = "lblBGAddr"; + this.lblBGAddr.Size = new System.Drawing.Size(50, 20); + this.lblBGAddr.TabIndex = 0; + this.lblBGAddr.Text = "BG Addr:"; + this.lblBGAddr.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtBGAddr + // + this.txtBGAddr.Location = new System.Drawing.Point(51, 0); + this.txtBGAddr.Margin = new System.Windows.Forms.Padding(1, 0, 0, 0); + this.txtBGAddr.Name = "txtBGAddr"; + this.txtBGAddr.Size = new System.Drawing.Size(50, 20); + this.txtBGAddr.TabIndex = 1; + // + // chkDrawLeftBG + // + this.chkDrawLeftBG.AutoSize = true; + this.chkDrawLeftBG.Location = new System.Drawing.Point(0, 95); + this.chkDrawLeftBG.Margin = new System.Windows.Forms.Padding(0); + this.chkDrawLeftBG.Name = "chkDrawLeftBG"; + this.chkDrawLeftBG.Size = new System.Drawing.Size(112, 17); + this.chkDrawLeftBG.TabIndex = 13; + this.chkDrawLeftBG.Text = "Draw left BG (8px)"; + this.chkDrawLeftBG.UseVisualStyleBackColor = true; + // + // chkGrayscale + // + this.chkGrayscale.AutoSize = true; + this.chkGrayscale.Location = new System.Drawing.Point(116, 61); + this.chkGrayscale.Margin = new System.Windows.Forms.Padding(0); + this.chkGrayscale.Name = "chkGrayscale"; + this.chkGrayscale.Size = new System.Drawing.Size(73, 17); + this.chkGrayscale.TabIndex = 12; + this.chkGrayscale.Text = "Grayscale"; + this.chkGrayscale.UseVisualStyleBackColor = true; + // + // chkIntensifyRed + // + this.chkIntensifyRed.AutoSize = true; + this.chkIntensifyRed.Location = new System.Drawing.Point(116, 78); + this.chkIntensifyRed.Margin = new System.Windows.Forms.Padding(0); + this.chkIntensifyRed.Name = "chkIntensifyRed"; + this.chkIntensifyRed.Size = new System.Drawing.Size(88, 17); + this.chkIntensifyRed.TabIndex = 16; + this.chkIntensifyRed.Text = "Intensify Red"; + this.chkIntensifyRed.UseVisualStyleBackColor = true; + // + // chkIntensifyGreen + // + this.chkIntensifyGreen.AutoSize = true; + this.chkIntensifyGreen.Location = new System.Drawing.Point(116, 95); + this.chkIntensifyGreen.Margin = new System.Windows.Forms.Padding(0); + this.chkIntensifyGreen.Name = "chkIntensifyGreen"; + this.chkIntensifyGreen.Size = new System.Drawing.Size(97, 17); + this.chkIntensifyGreen.TabIndex = 14; + this.chkIntensifyGreen.Text = "Intensify Green"; + this.chkIntensifyGreen.UseVisualStyleBackColor = true; + // + // chkVerticalWrite + // + this.chkVerticalWrite.AutoSize = true; + this.chkVerticalWrite.Location = new System.Drawing.Point(116, 0); + this.chkVerticalWrite.Margin = new System.Windows.Forms.Padding(0); + this.chkVerticalWrite.Name = "chkVerticalWrite"; + this.chkVerticalWrite.Size = new System.Drawing.Size(89, 17); + this.chkVerticalWrite.TabIndex = 17; + this.chkVerticalWrite.Text = "Vertical Write"; + this.chkVerticalWrite.UseVisualStyleBackColor = true; + // + // chkNMIOnBlank + // + this.chkNMIOnBlank.AutoSize = true; + this.chkNMIOnBlank.Location = new System.Drawing.Point(116, 21); + this.chkNMIOnBlank.Margin = new System.Windows.Forms.Padding(0); + this.chkNMIOnBlank.Name = "chkNMIOnBlank"; + this.chkNMIOnBlank.Size = new System.Drawing.Size(97, 17); + this.chkNMIOnBlank.TabIndex = 18; + this.chkNMIOnBlank.Text = "NMI on vBlank"; + this.chkNMIOnBlank.UseVisualStyleBackColor = true; + // + // chkLargeSprites + // + this.chkLargeSprites.AutoSize = true; + this.chkLargeSprites.Location = new System.Drawing.Point(116, 41); + this.chkLargeSprites.Margin = new System.Windows.Forms.Padding(0); + this.chkLargeSprites.Name = "chkLargeSprites"; + this.chkLargeSprites.Size = new System.Drawing.Size(88, 17); + this.chkLargeSprites.TabIndex = 19; + this.chkLargeSprites.Text = "Large Sprites"; + this.chkLargeSprites.UseVisualStyleBackColor = true; + // + // flowLayoutPanel5 + // + this.flowLayoutPanel5.Controls.Add(this.lblNTAddr); + this.flowLayoutPanel5.Controls.Add(this.txtNTAddr); + this.flowLayoutPanel5.Location = new System.Drawing.Point(0, 0); + this.flowLayoutPanel5.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel5.Name = "flowLayoutPanel5"; + this.flowLayoutPanel5.Size = new System.Drawing.Size(116, 21); + this.flowLayoutPanel5.TabIndex = 20; + // + // lblNTAddr + // + this.lblNTAddr.AutoSize = true; + this.lblNTAddr.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblNTAddr.Location = new System.Drawing.Point(0, 0); + this.lblNTAddr.Margin = new System.Windows.Forms.Padding(0); + this.lblNTAddr.Name = "lblNTAddr"; + this.lblNTAddr.Size = new System.Drawing.Size(50, 20); + this.lblNTAddr.TabIndex = 0; + this.lblNTAddr.Text = "NT Addr:"; + this.lblNTAddr.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtNTAddr + // + this.txtNTAddr.Location = new System.Drawing.Point(51, 0); + this.txtNTAddr.Margin = new System.Windows.Forms.Padding(1, 0, 0, 0); + this.txtNTAddr.Name = "txtNTAddr"; + this.txtNTAddr.Size = new System.Drawing.Size(50, 20); + this.txtNTAddr.TabIndex = 1; + // + // chkIntensifyBlue + // + this.chkIntensifyBlue.AutoSize = true; + this.chkIntensifyBlue.Location = new System.Drawing.Point(116, 112); + this.chkIntensifyBlue.Margin = new System.Windows.Forms.Padding(0); + this.chkIntensifyBlue.Name = "chkIntensifyBlue"; + this.chkIntensifyBlue.Size = new System.Drawing.Size(89, 17); + this.chkIntensifyBlue.TabIndex = 24; + this.chkIntensifyBlue.Text = "Intensify Blue"; + this.chkIntensifyBlue.UseVisualStyleBackColor = true; + // + // grpCPUStatus + // + this.grpCPUStatus.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.grpCPUStatus.Controls.Add(this.tableLayoutPanel3); + this.grpCPUStatus.Location = new System.Drawing.Point(3, 3); + this.grpCPUStatus.Name = "grpCPUStatus"; + this.grpCPUStatus.Size = new System.Drawing.Size(464, 171); + this.grpCPUStatus.TabIndex = 0; + this.grpCPUStatus.TabStop = false; + this.grpCPUStatus.Text = "CPU Status"; + // + // tableLayoutPanel3 + // + this.tableLayoutPanel3.ColumnCount = 2; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel3.Controls.Add(this.grpIRQ, 0, 2); + this.tableLayoutPanel3.Controls.Add(this.grpFlags, 0, 1); + this.tableLayoutPanel3.Controls.Add(this.grpStack, 1, 0); + this.tableLayoutPanel3.Controls.Add(this.flowLayoutPanel1, 0, 0); + this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 16); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.RowCount = 3; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Size = new System.Drawing.Size(458, 152); + this.tableLayoutPanel3.TabIndex = 0; + // + // grpIRQ + // + this.grpIRQ.Controls.Add(this.flowLayoutPanel3); + this.grpIRQ.Location = new System.Drawing.Point(3, 108); + this.grpIRQ.Name = "grpIRQ"; + this.grpIRQ.Size = new System.Drawing.Size(348, 41); + this.grpIRQ.TabIndex = 4; + this.grpIRQ.TabStop = false; + this.grpIRQ.Text = "IRQs"; + // + // flowLayoutPanel3 + // + this.flowLayoutPanel3.Controls.Add(this.chkExternal); + this.flowLayoutPanel3.Controls.Add(this.chkFrameCounter); + this.flowLayoutPanel3.Controls.Add(this.chkDMC); + this.flowLayoutPanel3.Controls.Add(this.chkNMI); + this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel3.Location = new System.Drawing.Point(3, 16); + this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel3.Name = "flowLayoutPanel3"; + this.flowLayoutPanel3.Size = new System.Drawing.Size(342, 22); + this.flowLayoutPanel3.TabIndex = 4; + // + // chkExternal + // + this.chkExternal.AutoSize = true; + this.chkExternal.Location = new System.Drawing.Point(0, 0); + this.chkExternal.Margin = new System.Windows.Forms.Padding(0); + this.chkExternal.Name = "chkExternal"; + this.chkExternal.Size = new System.Drawing.Size(64, 17); + this.chkExternal.TabIndex = 1; + this.chkExternal.Text = "External"; + this.chkExternal.UseVisualStyleBackColor = true; + // + // chkFrameCounter + // + this.chkFrameCounter.AutoSize = true; + this.chkFrameCounter.Location = new System.Drawing.Point(64, 0); + this.chkFrameCounter.Margin = new System.Windows.Forms.Padding(0); + this.chkFrameCounter.Name = "chkFrameCounter"; + this.chkFrameCounter.Size = new System.Drawing.Size(95, 17); + this.chkFrameCounter.TabIndex = 2; + this.chkFrameCounter.Text = "Frame Counter"; + this.chkFrameCounter.UseVisualStyleBackColor = true; + // + // chkDMC + // + this.chkDMC.AutoSize = true; + this.chkDMC.Location = new System.Drawing.Point(159, 0); + this.chkDMC.Margin = new System.Windows.Forms.Padding(0); + this.chkDMC.Name = "chkDMC"; + this.chkDMC.Size = new System.Drawing.Size(50, 17); + this.chkDMC.TabIndex = 3; + this.chkDMC.Text = "DMC"; + this.chkDMC.UseVisualStyleBackColor = true; + // + // chkNMI + // + this.chkNMI.AutoSize = true; + this.chkNMI.Location = new System.Drawing.Point(209, 0); + this.chkNMI.Margin = new System.Windows.Forms.Padding(0); + this.chkNMI.Name = "chkNMI"; + this.chkNMI.Size = new System.Drawing.Size(46, 17); + this.chkNMI.TabIndex = 4; + this.chkNMI.Text = "NMI"; + this.chkNMI.UseVisualStyleBackColor = true; + // + // grpFlags + // + this.grpFlags.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.grpFlags.Controls.Add(this.tableLayoutPanel4); + this.grpFlags.Location = new System.Drawing.Point(3, 30); + this.grpFlags.Name = "grpFlags"; + this.grpFlags.Size = new System.Drawing.Size(353, 72); + this.grpFlags.TabIndex = 3; + this.grpFlags.TabStop = false; + this.grpFlags.Text = "Flags"; + // + // tableLayoutPanel4 + // + this.tableLayoutPanel4.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.tableLayoutPanel4.ColumnCount = 1; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Controls.Add(this.flowLayoutPanel2, 0, 0); + this.tableLayoutPanel4.Controls.Add(this.tableLayoutPanel5, 0, 1); + this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 16); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + this.tableLayoutPanel4.RowCount = 2; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.Size = new System.Drawing.Size(347, 53); + this.tableLayoutPanel4.TabIndex = 0; + // + // flowLayoutPanel2 + // + this.flowLayoutPanel2.Controls.Add(this.lblStatus); + this.flowLayoutPanel2.Controls.Add(this.txtStatus); + 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(347, 21); + this.flowLayoutPanel2.TabIndex = 3; + // + // lblStatus + // + this.lblStatus.AutoSize = true; + this.lblStatus.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblStatus.Location = new System.Drawing.Point(0, 0); + this.lblStatus.Margin = new System.Windows.Forms.Padding(0); + this.lblStatus.Name = "lblStatus"; + this.lblStatus.Size = new System.Drawing.Size(40, 20); + this.lblStatus.TabIndex = 0; + this.lblStatus.Text = "Status:"; + this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtStatus + // + this.txtStatus.Location = new System.Drawing.Point(40, 0); + this.txtStatus.Margin = new System.Windows.Forms.Padding(0); + this.txtStatus.Name = "txtStatus"; + this.txtStatus.Size = new System.Drawing.Size(27, 20); + this.txtStatus.TabIndex = 1; + // + // tableLayoutPanel5 + // + this.tableLayoutPanel5.ColumnCount = 4; + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel5.Controls.Add(this.chkNegative, 3, 1); + this.tableLayoutPanel5.Controls.Add(this.chkOverflow, 2, 1); + this.tableLayoutPanel5.Controls.Add(this.chkReserved, 1, 1); + this.tableLayoutPanel5.Controls.Add(this.chkBreak, 0, 1); + this.tableLayoutPanel5.Controls.Add(this.chkDecimal, 3, 0); + this.tableLayoutPanel5.Controls.Add(this.chkInterrupt, 2, 0); + this.tableLayoutPanel5.Controls.Add(this.chkZero, 1, 0); + this.tableLayoutPanel5.Controls.Add(this.chkCarry, 0, 0); + this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel5.Location = new System.Drawing.Point(0, 21); + this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel5.Name = "tableLayoutPanel5"; + this.tableLayoutPanel5.RowCount = 2; + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel5.Size = new System.Drawing.Size(347, 48); + this.tableLayoutPanel5.TabIndex = 4; + // + // chkNegative + // + this.chkNegative.AutoSize = true; + this.chkNegative.Location = new System.Drawing.Point(258, 17); + this.chkNegative.Margin = new System.Windows.Forms.Padding(0); + this.chkNegative.Name = "chkNegative"; + this.chkNegative.Size = new System.Drawing.Size(69, 17); + this.chkNegative.TabIndex = 7; + this.chkNegative.Text = "Negative"; + this.chkNegative.UseVisualStyleBackColor = true; + // + // chkOverflow + // + this.chkOverflow.AutoSize = true; + this.chkOverflow.Location = new System.Drawing.Point(172, 17); + this.chkOverflow.Margin = new System.Windows.Forms.Padding(0); + this.chkOverflow.Name = "chkOverflow"; + this.chkOverflow.Size = new System.Drawing.Size(68, 17); + this.chkOverflow.TabIndex = 6; + this.chkOverflow.Text = "Overflow"; + this.chkOverflow.UseVisualStyleBackColor = true; + // + // chkReserved + // + this.chkReserved.AutoSize = true; + this.chkReserved.Location = new System.Drawing.Point(86, 17); + this.chkReserved.Margin = new System.Windows.Forms.Padding(0); + this.chkReserved.Name = "chkReserved"; + this.chkReserved.Size = new System.Drawing.Size(72, 17); + this.chkReserved.TabIndex = 5; + this.chkReserved.Text = "Reserved"; + this.chkReserved.UseVisualStyleBackColor = true; + // + // chkBreak + // + this.chkBreak.AutoSize = true; + this.chkBreak.Location = new System.Drawing.Point(0, 17); + this.chkBreak.Margin = new System.Windows.Forms.Padding(0); + this.chkBreak.Name = "chkBreak"; + this.chkBreak.Size = new System.Drawing.Size(54, 17); + this.chkBreak.TabIndex = 4; + this.chkBreak.Text = "Break"; + this.chkBreak.UseVisualStyleBackColor = true; + // + // chkDecimal + // + this.chkDecimal.AutoSize = true; + this.chkDecimal.Location = new System.Drawing.Point(258, 0); + this.chkDecimal.Margin = new System.Windows.Forms.Padding(0); + this.chkDecimal.Name = "chkDecimal"; + this.chkDecimal.Size = new System.Drawing.Size(64, 17); + this.chkDecimal.TabIndex = 3; + this.chkDecimal.Text = "Decimal"; + this.chkDecimal.UseVisualStyleBackColor = true; + // + // chkInterrupt + // + this.chkInterrupt.AutoSize = true; + this.chkInterrupt.Location = new System.Drawing.Point(172, 0); + this.chkInterrupt.Margin = new System.Windows.Forms.Padding(0); + this.chkInterrupt.Name = "chkInterrupt"; + this.chkInterrupt.Size = new System.Drawing.Size(65, 17); + this.chkInterrupt.TabIndex = 2; + this.chkInterrupt.Text = "Interrupt"; + this.chkInterrupt.UseVisualStyleBackColor = true; + // + // chkZero + // + this.chkZero.AutoSize = true; + this.chkZero.Location = new System.Drawing.Point(86, 0); + this.chkZero.Margin = new System.Windows.Forms.Padding(0); + this.chkZero.Name = "chkZero"; + this.chkZero.Size = new System.Drawing.Size(48, 17); + this.chkZero.TabIndex = 1; + this.chkZero.Text = "Zero"; + this.chkZero.UseVisualStyleBackColor = true; + // + // chkCarry + // + this.chkCarry.AutoSize = true; + this.chkCarry.Location = new System.Drawing.Point(0, 0); + this.chkCarry.Margin = new System.Windows.Forms.Padding(0); + this.chkCarry.Name = "chkCarry"; + this.chkCarry.Size = new System.Drawing.Size(50, 17); + this.chkCarry.TabIndex = 0; + this.chkCarry.Text = "Carry"; + this.chkCarry.UseVisualStyleBackColor = true; + // + // grpStack + // + this.grpStack.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.grpStack.Controls.Add(this.tableLayoutPanel6); + this.grpStack.Location = new System.Drawing.Point(362, 3); + this.grpStack.Name = "grpStack"; + this.tableLayoutPanel3.SetRowSpan(this.grpStack, 3); + this.grpStack.Size = new System.Drawing.Size(93, 146); + this.grpStack.TabIndex = 1; + this.grpStack.TabStop = false; + this.grpStack.Text = "Stack"; + // + // tableLayoutPanel6 + // + this.tableLayoutPanel6.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.tableLayoutPanel6.ColumnCount = 1; + this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel6.Controls.Add(this.flowLayoutPanel4, 0, 0); + this.tableLayoutPanel6.Controls.Add(this.lstStack, 0, 1); + this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 16); + this.tableLayoutPanel6.Name = "tableLayoutPanel6"; + this.tableLayoutPanel6.RowCount = 2; + this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel6.Size = new System.Drawing.Size(87, 124); + this.tableLayoutPanel6.TabIndex = 1; + // + // flowLayoutPanel4 + // + this.flowLayoutPanel4.Controls.Add(this.lblSP); + this.flowLayoutPanel4.Controls.Add(this.txtSP); + this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel4.Location = new System.Drawing.Point(0, 0); + this.flowLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel4.Name = "flowLayoutPanel4"; + this.flowLayoutPanel4.Size = new System.Drawing.Size(87, 21); + this.flowLayoutPanel4.TabIndex = 3; + // + // lblSP + // + this.lblSP.AutoSize = true; + this.lblSP.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblSP.Location = new System.Drawing.Point(0, 0); + this.lblSP.Margin = new System.Windows.Forms.Padding(0); + this.lblSP.Name = "lblSP"; + this.lblSP.Size = new System.Drawing.Size(24, 20); + this.lblSP.TabIndex = 0; + this.lblSP.Text = "SP:"; + this.lblSP.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtSP + // + this.txtSP.Location = new System.Drawing.Point(24, 0); + this.txtSP.Margin = new System.Windows.Forms.Padding(0); + this.txtSP.Name = "txtSP"; + this.txtSP.Size = new System.Drawing.Size(49, 20); + this.txtSP.TabIndex = 1; + // + // lstStack + // + this.lstStack.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.lstStack.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1}); + this.lstStack.FullRowSelect = true; + this.lstStack.GridLines = true; + this.lstStack.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.lstStack.Location = new System.Drawing.Point(3, 24); + this.lstStack.Name = "lstStack"; + this.lstStack.Size = new System.Drawing.Size(81, 97); + this.lstStack.TabIndex = 4; + this.lstStack.UseCompatibleStateImageBehavior = false; + this.lstStack.View = System.Windows.Forms.View.Details; + // + // columnHeader1 + // + this.columnHeader1.Text = "Value"; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Controls.Add(this.lblA); + this.flowLayoutPanel1.Controls.Add(this.txtA); + this.flowLayoutPanel1.Controls.Add(this.lblX); + this.flowLayoutPanel1.Controls.Add(this.txtX); + this.flowLayoutPanel1.Controls.Add(this.lblY); + this.flowLayoutPanel1.Controls.Add(this.txtY); + this.flowLayoutPanel1.Controls.Add(this.lblPC); + this.flowLayoutPanel1.Controls.Add(this.txtPC); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(353, 21); + this.flowLayoutPanel1.TabIndex = 2; + // + // lblA + // + this.lblA.AutoSize = true; + this.lblA.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblA.Location = new System.Drawing.Point(0, 0); + this.lblA.Margin = new System.Windows.Forms.Padding(0); + this.lblA.Name = "lblA"; + this.lblA.Size = new System.Drawing.Size(17, 20); + this.lblA.TabIndex = 0; + this.lblA.Text = "A:"; + this.lblA.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtA + // + this.txtA.Location = new System.Drawing.Point(17, 0); + this.txtA.Margin = new System.Windows.Forms.Padding(0); + this.txtA.Name = "txtA"; + this.txtA.Size = new System.Drawing.Size(27, 20); + this.txtA.TabIndex = 1; + // + // lblX + // + this.lblX.AutoSize = true; + this.lblX.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblX.Location = new System.Drawing.Point(44, 0); + this.lblX.Margin = new System.Windows.Forms.Padding(0); + this.lblX.Name = "lblX"; + this.lblX.Size = new System.Drawing.Size(17, 20); + this.lblX.TabIndex = 2; + this.lblX.Text = "X:"; + this.lblX.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtX + // + this.txtX.Location = new System.Drawing.Point(61, 0); + this.txtX.Margin = new System.Windows.Forms.Padding(0); + this.txtX.Name = "txtX"; + this.txtX.Size = new System.Drawing.Size(27, 20); + this.txtX.TabIndex = 3; + // + // lblY + // + this.lblY.AutoSize = true; + this.lblY.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblY.Location = new System.Drawing.Point(88, 0); + this.lblY.Margin = new System.Windows.Forms.Padding(0); + this.lblY.Name = "lblY"; + this.lblY.Size = new System.Drawing.Size(17, 20); + this.lblY.TabIndex = 4; + this.lblY.Text = "Y:"; + this.lblY.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtY + // + this.txtY.Location = new System.Drawing.Point(105, 0); + this.txtY.Margin = new System.Windows.Forms.Padding(0); + this.txtY.Name = "txtY"; + this.txtY.Size = new System.Drawing.Size(27, 20); + this.txtY.TabIndex = 5; + // + // lblPC + // + this.lblPC.AutoSize = true; + this.lblPC.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblPC.Location = new System.Drawing.Point(132, 0); + this.lblPC.Margin = new System.Windows.Forms.Padding(0); + this.lblPC.Name = "lblPC"; + this.lblPC.Size = new System.Drawing.Size(24, 20); + this.lblPC.TabIndex = 6; + this.lblPC.Text = "PC:"; + this.lblPC.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtPC + // + this.txtPC.Location = new System.Drawing.Point(156, 0); + this.txtPC.Margin = new System.Windows.Forms.Padding(0); + this.txtPC.Name = "txtPC"; + this.txtPC.Size = new System.Drawing.Size(42, 20); + this.txtPC.TabIndex = 7; + // + // ctrlConsoleStatus + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tableLayoutPanel2); + this.Name = "ctrlConsoleStatus"; + this.Size = new System.Drawing.Size(470, 362); + this.tableLayoutPanel2.ResumeLayout(false); + this.grpPPUStatus.ResumeLayout(false); + this.tableLayoutPanel8.ResumeLayout(false); + this.tableLayoutPanel7.ResumeLayout(false); + this.tableLayoutPanel7.PerformLayout(); + this.grpControlMask.ResumeLayout(false); + this.tableLayoutPanel9.ResumeLayout(false); + this.tableLayoutPanel9.PerformLayout(); + this.flowLayoutPanel7.ResumeLayout(false); + this.flowLayoutPanel7.PerformLayout(); + this.flowLayoutPanel6.ResumeLayout(false); + this.flowLayoutPanel6.PerformLayout(); + this.flowLayoutPanel5.ResumeLayout(false); + this.flowLayoutPanel5.PerformLayout(); + this.grpCPUStatus.ResumeLayout(false); + this.tableLayoutPanel3.ResumeLayout(false); + this.grpIRQ.ResumeLayout(false); + this.flowLayoutPanel3.ResumeLayout(false); + this.flowLayoutPanel3.PerformLayout(); + this.grpFlags.ResumeLayout(false); + this.tableLayoutPanel4.ResumeLayout(false); + this.flowLayoutPanel2.ResumeLayout(false); + this.flowLayoutPanel2.PerformLayout(); + this.tableLayoutPanel5.ResumeLayout(false); + this.tableLayoutPanel5.PerformLayout(); + this.grpStack.ResumeLayout(false); + this.tableLayoutPanel6.ResumeLayout(false); + this.flowLayoutPanel4.ResumeLayout(false); + this.flowLayoutPanel4.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.GroupBox grpPPUStatus; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel8; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel7; + private System.Windows.Forms.Label lblVRAMAddr; + private System.Windows.Forms.Label lblCycle; + private System.Windows.Forms.TextBox txtCycle; + private System.Windows.Forms.Label lblScanline; + private System.Windows.Forms.TextBox txtScanline; + private System.Windows.Forms.TextBox txtVRAMAddr; + private System.Windows.Forms.CheckBox chkVerticalBlank; + private System.Windows.Forms.CheckBox chkSprite0Hit; + private System.Windows.Forms.CheckBox chkSpriteOverflow; + private System.Windows.Forms.GroupBox grpControlMask; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel9; + private System.Windows.Forms.CheckBox chkDrawLeftSpr; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel7; + private System.Windows.Forms.Label lblSprAddr; + private System.Windows.Forms.TextBox txtSprAddr; + private System.Windows.Forms.CheckBox chkSpritesEnabled; + private System.Windows.Forms.CheckBox chkBGEnabled; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel6; + private System.Windows.Forms.Label lblBGAddr; + private System.Windows.Forms.TextBox txtBGAddr; + private System.Windows.Forms.CheckBox chkDrawLeftBG; + private System.Windows.Forms.CheckBox chkGrayscale; + private System.Windows.Forms.CheckBox chkIntensifyRed; + private System.Windows.Forms.CheckBox chkIntensifyGreen; + private System.Windows.Forms.CheckBox chkVerticalWrite; + private System.Windows.Forms.CheckBox chkNMIOnBlank; + private System.Windows.Forms.CheckBox chkLargeSprites; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel5; + private System.Windows.Forms.Label lblNTAddr; + private System.Windows.Forms.TextBox txtNTAddr; + private System.Windows.Forms.CheckBox chkIntensifyBlue; + private System.Windows.Forms.GroupBox grpCPUStatus; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private System.Windows.Forms.GroupBox grpIRQ; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; + private System.Windows.Forms.CheckBox chkExternal; + private System.Windows.Forms.CheckBox chkFrameCounter; + private System.Windows.Forms.CheckBox chkDMC; + private System.Windows.Forms.CheckBox chkNMI; + private System.Windows.Forms.GroupBox grpFlags; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + private System.Windows.Forms.Label lblStatus; + private System.Windows.Forms.TextBox txtStatus; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; + private System.Windows.Forms.CheckBox chkNegative; + private System.Windows.Forms.CheckBox chkOverflow; + private System.Windows.Forms.CheckBox chkReserved; + private System.Windows.Forms.CheckBox chkBreak; + private System.Windows.Forms.CheckBox chkDecimal; + private System.Windows.Forms.CheckBox chkInterrupt; + private System.Windows.Forms.CheckBox chkZero; + private System.Windows.Forms.CheckBox chkCarry; + private System.Windows.Forms.GroupBox grpStack; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel6; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4; + private System.Windows.Forms.Label lblSP; + private System.Windows.Forms.TextBox txtSP; + private System.Windows.Forms.ListView lstStack; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Label lblA; + private System.Windows.Forms.TextBox txtA; + private System.Windows.Forms.Label lblX; + private System.Windows.Forms.TextBox txtX; + private System.Windows.Forms.Label lblY; + private System.Windows.Forms.TextBox txtY; + private System.Windows.Forms.Label lblPC; + private System.Windows.Forms.TextBox txtPC; + private System.Windows.Forms.ColumnHeader columnHeader1; + } +} diff --git a/GUI.NET/Debugger/Controls/ctrlConsoleStatus.cs b/GUI.NET/Debugger/Controls/ctrlConsoleStatus.cs new file mode 100644 index 00000000..a3af3a8a --- /dev/null +++ b/GUI.NET/Debugger/Controls/ctrlConsoleStatus.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Runtime.InteropServices; + +namespace Mesen.GUI.Debugger +{ + public partial class ctrlConsoleStatus : UserControl + { + public ctrlConsoleStatus() + { + InitializeComponent(); + } + + private void UpdateCPUStatus(ref DebugState state) + { + txtA.Text = state.CPU.A.ToString("x").ToUpper(); + txtX.Text = state.CPU.X.ToString("x").ToUpper(); + txtY.Text = state.CPU.Y.ToString("x").ToUpper(); + txtPC.Text = state.CPU.PC.ToString("x").ToUpper(); + txtSP.Text = state.CPU.SP.ToString("x").ToUpper(); + txtStatus.Text = state.CPU.PS.ToString("x").ToUpper(); + + PSFlags flags = (PSFlags)state.CPU.PS; + chkBreak.Checked = flags.HasFlag(PSFlags.Break); + chkCarry.Checked = flags.HasFlag(PSFlags.Carry); + chkDecimal.Checked = flags.HasFlag(PSFlags.Decimal); + chkInterrupt.Checked = flags.HasFlag(PSFlags.Interrupt); + chkNegative.Checked = flags.HasFlag(PSFlags.Negative); + chkOverflow.Checked = flags.HasFlag(PSFlags.Overflow); + chkReserved.Checked = flags.HasFlag(PSFlags.Reserved); + chkZero.Checked = flags.HasFlag(PSFlags.Zero); + + chkExternal.Checked = state.CPU.IRQFlag.HasFlag(IRQSource.External); + chkFrameCounter.Checked = state.CPU.IRQFlag.HasFlag(IRQSource.FrameCounter); + chkDMC.Checked = state.CPU.IRQFlag.HasFlag(IRQSource.DMC); + + chkNMI.Checked = state.CPU.NMIFlag; + } + + private void UpdatePPUStatus(ref DebugState state) + { + chkVerticalBlank.Checked = Convert.ToBoolean(state.PPU.StatusFlags.VerticalBlank); + chkSprite0Hit.Checked = Convert.ToBoolean(state.PPU.StatusFlags.Sprite0Hit); + chkSpriteOverflow.Checked = Convert.ToBoolean(state.PPU.StatusFlags.SpriteOverflow); + + chkBGEnabled.Checked = Convert.ToBoolean(state.PPU.ControlFlags.BackgroundEnabled); + chkSpritesEnabled.Checked = Convert.ToBoolean(state.PPU.ControlFlags.SpritesEnabled); + chkDrawLeftBG.Checked = Convert.ToBoolean(state.PPU.ControlFlags.BackgroundMask); + chkDrawLeftSpr.Checked = Convert.ToBoolean(state.PPU.ControlFlags.SpriteMask); + chkVerticalWrite.Checked = Convert.ToBoolean(state.PPU.ControlFlags.VerticalWrite); + chkNMIOnBlank.Checked = Convert.ToBoolean(state.PPU.ControlFlags.VBlank); + chkLargeSprites.Checked = Convert.ToBoolean(state.PPU.ControlFlags.LargeSprites); + chkGrayscale.Checked = Convert.ToBoolean(state.PPU.ControlFlags.Grayscale); + chkIntensifyRed.Checked = Convert.ToBoolean(state.PPU.ControlFlags.IntensifyRed); + chkIntensifyGreen.Checked = Convert.ToBoolean(state.PPU.ControlFlags.IntensifyGreen); + chkIntensifyBlue.Checked = Convert.ToBoolean(state.PPU.ControlFlags.IntensifyBlue); + + txtBGAddr.Text = state.PPU.ControlFlags.BackgroundPatternAddr.ToString("x").ToUpper(); + txtSprAddr.Text = state.PPU.ControlFlags.SpritePatternAddr.ToString("x").ToUpper(); + + txtVRAMAddr.Text = state.PPU.State.VideoRamAddr.ToString("x").ToUpper(); + txtCycle.Text = state.PPU.Cycle.ToString(); + txtScanline.Text = state.PPU.Scanline.ToString(); + txtNTAddr.Text = (0x2000 | (state.PPU.State.VideoRamAddr & 0x0FFF)).ToString("x").ToUpper(); + } + + private void UpdateStack(UInt16 stackPointer) + { + lstStack.Items.Clear(); + for(UInt32 i = (UInt32)0x100 + stackPointer; i < 0x200; i++) { + lstStack.Items.Add("$" + InteropEmu.DebugGetMemoryValue(i).ToString("x").ToUpper()); + } + } + + public void UpdateStatus(ref DebugState state) + { + UpdateCPUStatus(ref state); + UpdatePPUStatus(ref state); + UpdateStack(state.CPU.SP); + } + } +} diff --git a/GUI.NET/Debugger/Controls/ctrlConsoleStatus.resx b/GUI.NET/Debugger/Controls/ctrlConsoleStatus.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/GUI.NET/Debugger/Controls/ctrlConsoleStatus.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs new file mode 100644 index 00000000..b4dd4fa0 --- /dev/null +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.Designer.cs @@ -0,0 +1,206 @@ +namespace Mesen.GUI.Debugger +{ + partial class ctrlDebuggerCode + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.tableLayoutPanel11 = new System.Windows.Forms.TableLayoutPanel(); + this.txtCode = new Mesen.GUI.Debugger.ctrlSyncTextBox(); + this.contextMenuCode = new System.Windows.Forms.ContextMenuStrip(this.components); + this.mnuShowNextStatement = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuSetNextStatement = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuShowOnlyDisassembledCode = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuGoToLocation = new System.Windows.Forms.ToolStripMenuItem(); + this.panel1 = new System.Windows.Forms.Panel(); + this.txtCodeMargin = new Mesen.GUI.Debugger.ctrlSyncTextBox(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.mnuAddToWatch = new System.Windows.Forms.ToolStripMenuItem(); + this.tableLayoutPanel11.SuspendLayout(); + this.contextMenuCode.SuspendLayout(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel11 + // + this.tableLayoutPanel11.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; + this.tableLayoutPanel11.ColumnCount = 2; + this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 74F)); + this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel11.Controls.Add(this.txtCode, 1, 0); + this.tableLayoutPanel11.Controls.Add(this.panel1, 0, 0); + this.tableLayoutPanel11.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel11.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel11.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel11.Name = "tableLayoutPanel11"; + this.tableLayoutPanel11.RowCount = 1; + this.tableLayoutPanel11.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel11.Size = new System.Drawing.Size(379, 218); + this.tableLayoutPanel11.TabIndex = 3; + // + // txtCode + // + this.txtCode.BackColor = System.Drawing.Color.White; + this.txtCode.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txtCode.ContextMenuStrip = this.contextMenuCode; + this.txtCode.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtCode.Font = new System.Drawing.Font("Consolas", 11F); + this.txtCode.Location = new System.Drawing.Point(76, 1); + this.txtCode.Margin = new System.Windows.Forms.Padding(0); + this.txtCode.Name = "txtCode"; + this.txtCode.ReadOnly = true; + this.txtCode.Size = new System.Drawing.Size(302, 216); + this.txtCode.SyncedTextbox = null; + this.txtCode.TabIndex = 0; + this.txtCode.Text = ""; + this.txtCode.MouseMove += new System.Windows.Forms.MouseEventHandler(this.txtCode_MouseMove); + this.txtCode.MouseUp += new System.Windows.Forms.MouseEventHandler(this.txtCode_MouseUp); + // + // contextMenuCode + // + this.contextMenuCode.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuShowNextStatement, + this.mnuSetNextStatement, + this.toolStripMenuItem1, + this.mnuShowOnlyDisassembledCode, + this.toolStripMenuItem2, + this.mnuGoToLocation, + this.mnuAddToWatch}); + this.contextMenuCode.Name = "contextMenuWatch"; + this.contextMenuCode.Size = new System.Drawing.Size(259, 148); + this.contextMenuCode.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuCode_Opening); + // + // mnuShowNextStatement + // + this.mnuShowNextStatement.Name = "mnuShowNextStatement"; + this.mnuShowNextStatement.ShortcutKeyDisplayString = "Alt+*"; + this.mnuShowNextStatement.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.Multiply))); + this.mnuShowNextStatement.Size = new System.Drawing.Size(258, 22); + this.mnuShowNextStatement.Text = "Show Next Statement"; + this.mnuShowNextStatement.Click += new System.EventHandler(this.mnuShowNextStatement_Click); + // + // mnuSetNextStatement + // + this.mnuSetNextStatement.Name = "mnuSetNextStatement"; + this.mnuSetNextStatement.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.F10))); + this.mnuSetNextStatement.Size = new System.Drawing.Size(258, 22); + this.mnuSetNextStatement.Text = "Set Next Statement"; + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(255, 6); + // + // mnuShowOnlyDisassembledCode + // + this.mnuShowOnlyDisassembledCode.Checked = true; + this.mnuShowOnlyDisassembledCode.CheckOnClick = true; + this.mnuShowOnlyDisassembledCode.CheckState = System.Windows.Forms.CheckState.Checked; + this.mnuShowOnlyDisassembledCode.Name = "mnuShowOnlyDisassembledCode"; + this.mnuShowOnlyDisassembledCode.Size = new System.Drawing.Size(258, 22); + this.mnuShowOnlyDisassembledCode.Text = "Show Only Disassembled Code"; + this.mnuShowOnlyDisassembledCode.Click += new System.EventHandler(this.mnuShowOnlyDisassembledCode_Click); + // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(255, 6); + // + // mnuGoToLocation + // + this.mnuGoToLocation.Name = "mnuGoToLocation"; + this.mnuGoToLocation.Size = new System.Drawing.Size(258, 22); + this.mnuGoToLocation.Text = "Go To Location"; + this.mnuGoToLocation.Click += new System.EventHandler(this.mnuGoToLocation_Click); + // + // panel1 + // + this.panel1.Controls.Add(this.txtCodeMargin); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(1, 1); + this.panel1.Margin = new System.Windows.Forms.Padding(0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(74, 216); + this.panel1.TabIndex = 1; + // + // txtCodeMargin + // + this.txtCodeMargin.BackColor = System.Drawing.Color.WhiteSmoke; + this.txtCodeMargin.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txtCodeMargin.Dock = System.Windows.Forms.DockStyle.Left; + this.txtCodeMargin.Font = new System.Drawing.Font("Consolas", 11F); + this.txtCodeMargin.Location = new System.Drawing.Point(0, 0); + this.txtCodeMargin.Margin = new System.Windows.Forms.Padding(0); + this.txtCodeMargin.Name = "txtCodeMargin"; + this.txtCodeMargin.ReadOnly = true; + this.txtCodeMargin.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedVertical; + this.txtCodeMargin.Size = new System.Drawing.Size(90, 216); + this.txtCodeMargin.SyncedTextbox = null; + this.txtCodeMargin.TabIndex = 1; + this.txtCodeMargin.Text = ""; + this.txtCodeMargin.Enter += new System.EventHandler(this.txtCodeMargin_Enter); + // + // mnuAddToWatch + // + this.mnuAddToWatch.Name = "mnuAddToWatch"; + this.mnuAddToWatch.Size = new System.Drawing.Size(258, 22); + this.mnuAddToWatch.Text = "Add to Watch"; + this.mnuAddToWatch.Click += new System.EventHandler(this.mnuAddToWatch_Click); + // + // ctrlDebuggerCode + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tableLayoutPanel11); + this.Name = "ctrlDebuggerCode"; + this.Size = new System.Drawing.Size(379, 218); + this.tableLayoutPanel11.ResumeLayout(false); + this.contextMenuCode.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel11; + private ctrlSyncTextBox txtCode; + private System.Windows.Forms.Panel panel1; + private ctrlSyncTextBox txtCodeMargin; + private System.Windows.Forms.ToolTip toolTip; + private System.Windows.Forms.ContextMenuStrip contextMenuCode; + private System.Windows.Forms.ToolStripMenuItem mnuShowNextStatement; + private System.Windows.Forms.ToolStripMenuItem mnuSetNextStatement; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem mnuShowOnlyDisassembledCode; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; + private System.Windows.Forms.ToolStripMenuItem mnuGoToLocation; + private System.Windows.Forms.ToolStripMenuItem mnuAddToWatch; + } +} diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs new file mode 100644 index 00000000..ec99d11f --- /dev/null +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs @@ -0,0 +1,292 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Mesen.GUI.Debugger +{ + public partial class ctrlDebuggerCode : UserControl + { + public delegate void WatchAddedEventHandler(WatchAddedEventArgs args); + public event WatchAddedEventHandler OnWatchAdded; + + public ctrlDebuggerCode() + { + InitializeComponent(); + + txtCode.SyncedTextbox = txtCodeMargin; + } + + private string _code; + private bool _codeChanged; + public string Code + { + get { return _code; } + set + { + if(value != _code) { + _codeChanged = true; + _code = value; + } + } + } + + private UInt32? _currentActiveAddress = null; + public void SelectActiveAddress(UInt32 address) + { + txtCode.BeginUpdate(); + txtCodeMargin.BeginUpdate(); + + if(!UpdateCode()) { + RemoveActiveHighlight(); + } + + int lineIndex = GetAddressLine(address); + if(lineIndex >= 0) { + if(!IsLineVisible(lineIndex)) { + //Scroll active line to middle of viewport if it wasn't already visible + ScrollToLine(lineIndex); + } + //Set line background to yellow + HighlightLine(lineIndex, Color.Yellow, Color.Black); + } + txtCode.EndUpdate(); + txtCodeMargin.EndUpdate(); + + _currentActiveAddress = address; + } + + public void RemoveActiveHighlight() + { + //Didn't update code, need to remove previous highlighting + if(_currentActiveAddress.HasValue) { + int lineIndex = GetAddressLine(_currentActiveAddress.Value); + if(lineIndex != -1) { + HighlightLine(lineIndex, Color.White, Color.Black); + } + } + } + + public int GetCurrentLine() + { + int cursorPos = txtCode.GetFirstCharIndexOfCurrentLine(); + return txtCode.GetLineFromCharIndex(cursorPos); + } + + public string GetWordUnderLocation(Point position) + { + int charIndex = txtCode.GetCharIndexFromPosition(position); + + if(txtCode.Text.Length > charIndex) { + List wordDelimiters = new List(new char[] { ' ', '\r', '\n', ',' }); + if(wordDelimiters.Contains(txtCode.Text[charIndex])) { + return string.Empty; + } else { + int endIndex = txtCode.Text.IndexOfAny(wordDelimiters.ToArray(), charIndex); + int startIndex = txtCode.Text.LastIndexOfAny(wordDelimiters.ToArray(), charIndex); + return txtCode.Text.Substring(startIndex + 1, endIndex - startIndex - 1); + } + } else { + return string.Empty; + } + } + + private int GetLineCount() + { + return (int)((float)txtCodeMargin.Height / (txtCodeMargin.Font.GetHeight() + 1)) - 1; + } + + private void ScrollToAddress(UInt32 address) + { + int lineIndex = GetAddressLine(address); + if(lineIndex != -1 && !IsLineVisible(lineIndex)) { + ScrollToLine(lineIndex); + } + } + + private void ScrollToLine(int lineIndex) + { + lineIndex = Math.Max(0, lineIndex - GetLineCount()/2); + txtCodeMargin.SelectionStart = txtCodeMargin.GetFirstCharIndexFromLine(lineIndex); + txtCodeMargin.ScrollToCaret(); + txtCode.SelectionStart = txtCode.GetFirstCharIndexFromLine(lineIndex); + txtCode.ScrollToCaret(); + } + + private bool IsLineVisible(int lineIndex) + { + int firstLine = txtCodeMargin.GetLineFromCharIndex(txtCodeMargin.GetCharIndexFromPosition(new Point(0, 0))); + return lineIndex >= firstLine && lineIndex <= firstLine+GetLineCount(); + } + + public bool UpdateCode(bool forceUpdate = false) + { + if(_codeChanged || forceUpdate) { + StringBuilder lineNumbers = new StringBuilder(); + StringBuilder codeString = new StringBuilder(); + bool diassembledCodeOnly = mnuShowOnlyDisassembledCode.Checked; + bool skippingCode = false; + foreach(string line in _code.Split('\n')) { + string[] lineParts = line.Split(':'); + if(skippingCode && (lineParts.Length != 2 || lineParts[1][0] != '.')) { + lineNumbers.AppendLine(" .. "); + codeString.AppendLine("[code not disassembled]"); + + UInt32 previousAddress = lineParts[0].Length > 0 ? ParseHexAddress(lineParts[0])-1 : 0xFFFF; + lineNumbers.AppendLine(previousAddress.ToString("x").ToUpper()); + codeString.AppendLine("[code not disassembled]"); + + skippingCode = false; + } + + if(lineParts.Length == 2) { + if(diassembledCodeOnly && lineParts[1][0] == '.') { + if(!skippingCode) { + lineNumbers.AppendLine(lineParts[0]); + codeString.AppendLine("[code not disassembled]"); + skippingCode = true; + } + } else { + lineNumbers.AppendLine(lineParts[0]); + codeString.AppendLine(lineParts[1]); + } + } + } + txtCode.Text = codeString.ToString(); + txtCodeMargin.Text = lineNumbers.ToString(); + txtCodeMargin.SelectAll(); + txtCodeMargin.SelectionAlignment = HorizontalAlignment.Right; + txtCodeMargin.SelectionLength = 0; + _codeChanged = false; + return true; + } + return false; + } + + private int GetAddressLine(UInt32 address) + { + int attempts = 8; + do { + int pos = txtCodeMargin.Text.IndexOf(address.ToString("x"), StringComparison.InvariantCultureIgnoreCase); + if(pos >= 0) { + return txtCodeMargin.GetLineFromCharIndex(pos); + } + address--; + attempts--; + } while(attempts > 0); + return -1; + } + + private UInt32 ParseHexAddress(string hexAddress) + { + return UInt32.Parse(hexAddress, System.Globalization.NumberStyles.AllowHexSpecifier); + } + + private UInt32 GetLineAddress(int lineIndex) + { + int lineStartIndex = txtCodeMargin.GetFirstCharIndexFromLine(lineIndex); + txtCodeMargin.SelectionStart = lineStartIndex + 3; + txtCodeMargin.SelectionLength = 4; + return ParseHexAddress(txtCodeMargin.SelectedText); + } + + public void HighlightLine(int lineIndex, Color bgColor, Color fgColor) + { + int lineStartIndex = txtCodeMargin.GetFirstCharIndexFromLine(lineIndex); + txtCodeMargin.SelectionStart = lineStartIndex; + txtCodeMargin.SelectionLength = 4; + txtCodeMargin.SelectionBackColor = bgColor; + txtCodeMargin.SelectionColor = fgColor; + txtCodeMargin.SelectionLength = 0; + + lineStartIndex = txtCode.GetFirstCharIndexFromLine(lineIndex); + txtCode.SelectionStart = lineStartIndex; + txtCode.SelectionLength = txtCode.GetFirstCharIndexFromLine(lineIndex+1) - lineStartIndex; + txtCode.SelectionBackColor = bgColor; + txtCode.SelectionColor = fgColor; + txtCode.SelectionLength = 0; + } + + #region Events + private Point _previousLocation; + private void txtCode_MouseMove(object sender, MouseEventArgs e) + { + if(_previousLocation != e.Location) { + string word = GetWordUnderLocation(e.Location); + if(word.StartsWith("$")) { + UInt32 address = UInt32.Parse(word.Substring(1), System.Globalization.NumberStyles.AllowHexSpecifier); + Byte memoryValue = InteropEmu.DebugGetMemoryValue(address); + string valueText = "$" + memoryValue.ToString("x").ToUpper(); + toolTip.Show(valueText, txtCode, e.Location.X + 5, e.Location.Y + 5, 3000); + } + _previousLocation = e.Location; + } + } + + UInt32 _lastClickedAddress = UInt32.MaxValue; + private void txtCode_MouseUp(object sender, MouseEventArgs e) + { + string word = GetWordUnderLocation(e.Location); + if(word.StartsWith("$")) { + _lastClickedAddress = UInt32.Parse(word.Substring(1), System.Globalization.NumberStyles.AllowHexSpecifier); + mnuGoToLocation.Enabled = true; + mnuGoToLocation.Text = "Go to Location (" + word + ")"; + + mnuAddToWatch.Enabled = true; + mnuAddToWatch.Text = "Add to Watch (" + word + ")"; + } else { + mnuGoToLocation.Enabled = false; + mnuGoToLocation.Text = "Go to Location"; + mnuAddToWatch.Enabled = false; + mnuAddToWatch.Text = "Add to Watch"; + } + } + + private void txtCodeMargin_Enter(object sender, EventArgs e) + { + txtCode.Focus(); + } + + #region Context Menu + private void contextMenuCode_Opening(object sender, CancelEventArgs e) + { + mnuShowNextStatement.Enabled = _currentActiveAddress.HasValue; + mnuSetNextStatement.Enabled = false; + } + + private void mnuShowNextStatement_Click(object sender, EventArgs e) + { + ScrollToAddress(_currentActiveAddress.Value); + } + + private void mnuShowOnlyDisassembledCode_Click(object sender, EventArgs e) + { + UpdateCode(true); + } + + private void mnuGoToLocation_Click(object sender, EventArgs e) + { + ScrollToAddress(_lastClickedAddress); + } + + private void mnuAddToWatch_Click(object sender, EventArgs e) + { + if(this.OnWatchAdded != null) { + this.OnWatchAdded(new WatchAddedEventArgs() { Address = _lastClickedAddress}); + } + } + #endregion + + #endregion + } + + public class WatchAddedEventArgs : EventArgs + { + public UInt32 Address { get; set; } + } +} diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.resx b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.resx new file mode 100644 index 00000000..9810bbc2 --- /dev/null +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 143, 24 + + + 17, 17 + + \ No newline at end of file diff --git a/GUI.NET/Debugger/Controls/ctrlSyncTextBox.cs b/GUI.NET/Debugger/Controls/ctrlSyncTextBox.cs new file mode 100644 index 00000000..fe963d49 --- /dev/null +++ b/GUI.NET/Debugger/Controls/ctrlSyncTextBox.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Runtime.InteropServices; + +namespace Mesen.GUI.Debugger +{ + class ctrlSyncTextBox : RichTextBox + { + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp); + + private const int WM_MOUSEWHEEL = 0x20A; + private const int WM_VSCROLL = 0x115; + private const int WM_USER = 0x0400; + private const int EM_SETEVENTMASK = (WM_USER + 69); + private const int WM_SETREDRAW = 0x0b; + private IntPtr OldEventMask; + + private Timer _syncTimer; + private RichTextBox _syncedTextbox; + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public RichTextBox SyncedTextbox + { + get + { + return _syncedTextbox; + } + set + { + if(_syncedTextbox == null) { + _syncedTextbox = value; + if(!DesignMode && value != null && _syncTimer == null) { + CreateTimer(); + } + } + } + } + + public void BeginUpdate() + { + SendMessage(Handle, WM_SETREDRAW, IntPtr.Zero, IntPtr.Zero); + OldEventMask = (IntPtr)SendMessage(Handle, EM_SETEVENTMASK, IntPtr.Zero, IntPtr.Zero); + } + + public void EndUpdate() + { + SendMessage(Handle, WM_SETREDRAW, (IntPtr)1, IntPtr.Zero); + SendMessage(Handle, EM_SETEVENTMASK, IntPtr.Zero, OldEventMask); + } + + private void CreateTimer() + { + _syncTimer = new Timer(); + _syncTimer.Interval = 50; + _syncTimer.Enabled = true; + _syncTimer.Tick += (object sender, EventArgs e) => { + int line1 = SyncedTextbox.GetLineFromCharIndex(SyncedTextbox.GetCharIndexFromPosition(new Point(0, 0))); + int line2 = GetLineFromCharIndex(GetCharIndexFromPosition(new Point(0, 0))); + if(line1 != line2) { + int selectionStart = SyncedTextbox.GetFirstCharIndexFromLine(line2); + if(selectionStart >= 0) { + SyncedTextbox.SelectionStart = selectionStart; + SyncedTextbox.ScrollToCaret(); + } + } + }; + _syncTimer.Start(); + } + + protected override void WndProc(ref Message m) + { + if(m.Msg == WM_VSCROLL && SyncedTextbox != null && SyncedTextbox.IsHandleCreated) { + SendMessage(SyncedTextbox.Handle, m.Msg, m.WParam, m.LParam); + } + if(m.Msg == WM_MOUSEWHEEL) { + //Disable smooth scrolling by replacing the WM_MOUSEWHEEL event by regular VM_VSCROLL events + int scrollLines = SystemInformation.MouseWheelScrollLines; + for(int i = 0; i < scrollLines; i++) { + if((int)m.WParam > 0) { + SendMessage(Handle, WM_VSCROLL, (IntPtr)0, IntPtr.Zero); + } else { + SendMessage(Handle, WM_VSCROLL, (IntPtr)1, IntPtr.Zero); + } + } + return; + } else { + base.WndProc(ref m); + } + } + + protected override void Dispose(bool disposing) + { + if(disposing) { + if(_syncTimer != null) { + _syncTimer.Stop(); + _syncTimer = null; + } + } + base.Dispose(disposing); + } + } +} diff --git a/GUI.NET/Debugger/Controls/ctrlWatch.Designer.cs b/GUI.NET/Debugger/Controls/ctrlWatch.Designer.cs new file mode 100644 index 00000000..5349bfd3 --- /dev/null +++ b/GUI.NET/Debugger/Controls/ctrlWatch.Designer.cs @@ -0,0 +1,126 @@ +namespace Mesen.GUI.Debugger +{ + partial class ctrlWatch + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(""); + this.lstWatch = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.contextMenuWatch = new System.Windows.Forms.ContextMenuStrip(this.components); + this.mnuRemoveWatch = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuHexDisplay = new System.Windows.Forms.ToolStripMenuItem(); + this.colLastColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.contextMenuWatch.SuspendLayout(); + this.SuspendLayout(); + // + // lstWatch + // + this.lstWatch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2, + this.colLastColumn}); + this.lstWatch.ContextMenuStrip = this.contextMenuWatch; + this.lstWatch.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstWatch.FullRowSelect = true; + this.lstWatch.GridLines = true; + this.lstWatch.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.lstWatch.Items.AddRange(new System.Windows.Forms.ListViewItem[] { + listViewItem1}); + this.lstWatch.LabelEdit = true; + this.lstWatch.Location = new System.Drawing.Point(0, 0); + this.lstWatch.Name = "lstWatch"; + this.lstWatch.Size = new System.Drawing.Size(378, 112); + this.lstWatch.TabIndex = 6; + this.lstWatch.UseCompatibleStateImageBehavior = false; + this.lstWatch.View = System.Windows.Forms.View.Details; + this.lstWatch.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.lstWatch_AfterLabelEdit); + this.lstWatch.SelectedIndexChanged += new System.EventHandler(this.lstWatch_SelectedIndexChanged); + // + // columnHeader1 + // + this.columnHeader1.Text = "Address"; + // + // columnHeader2 + // + this.columnHeader2.Text = "Value"; + this.columnHeader2.Width = 100; + // + // contextMenuWatch + // + this.contextMenuWatch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuRemoveWatch, + this.mnuHexDisplay}); + this.contextMenuWatch.Name = "contextMenuWatch"; + this.contextMenuWatch.Size = new System.Drawing.Size(184, 48); + // + // mnuRemoveWatch + // + this.mnuRemoveWatch.Name = "mnuRemoveWatch"; + this.mnuRemoveWatch.ShortcutKeys = System.Windows.Forms.Keys.Delete; + this.mnuRemoveWatch.Size = new System.Drawing.Size(183, 22); + this.mnuRemoveWatch.Text = "Remove"; + this.mnuRemoveWatch.Click += new System.EventHandler(this.mnuRemoveWatch_Click); + // + // mnuHexDisplay + // + this.mnuHexDisplay.Checked = true; + this.mnuHexDisplay.CheckOnClick = true; + this.mnuHexDisplay.CheckState = System.Windows.Forms.CheckState.Checked; + this.mnuHexDisplay.Name = "mnuHexDisplay"; + this.mnuHexDisplay.Size = new System.Drawing.Size(183, 22); + this.mnuHexDisplay.Text = "Hexadecimal Display"; + this.mnuHexDisplay.Click += new System.EventHandler(this.mnuHexDisplay_Click); + // + // colLastColumn + // + this.colLastColumn.Text = ""; + // + // ctrlWatch + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lstWatch); + this.Name = "ctrlWatch"; + this.Size = new System.Drawing.Size(378, 112); + this.contextMenuWatch.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ListView lstWatch; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.ColumnHeader columnHeader2; + private System.Windows.Forms.ContextMenuStrip contextMenuWatch; + private System.Windows.Forms.ToolStripMenuItem mnuRemoveWatch; + private System.Windows.Forms.ToolStripMenuItem mnuHexDisplay; + private System.Windows.Forms.ColumnHeader colLastColumn; + } +} diff --git a/GUI.NET/Debugger/Controls/ctrlWatch.cs b/GUI.NET/Debugger/Controls/ctrlWatch.cs new file mode 100644 index 00000000..cec49b94 --- /dev/null +++ b/GUI.NET/Debugger/Controls/ctrlWatch.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Mesen.GUI.Debugger +{ + public partial class ctrlWatch : UserControl + { + public ctrlWatch() + { + InitializeComponent(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + AdjustColumnWidth(); + } + + private void lstWatch_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) + { + if(e.ColumnIndex == 2) { + e.Cancel = true; + } + AdjustColumnWidth(); + } + + void lstWatch_ColumnWidthChanged(object sender, ColumnWidthChangedEventArgs e) + { + AdjustColumnWidth(); + } + + private void AdjustColumnWidth() + { + lstWatch.ColumnWidthChanging -= lstWatch_ColumnWidthChanging; + lstWatch.ColumnWidthChanged -= lstWatch_ColumnWidthChanged; + + //Force watch values to take the full width of the list + int totalWidth = lstWatch.Columns[0].Width + lstWatch.Columns[1].Width; + lstWatch.Columns[2].Width = lstWatch.ClientSize.Width - totalWidth; + + lstWatch.ColumnWidthChanging += lstWatch_ColumnWidthChanging; + lstWatch.ColumnWidthChanged += lstWatch_ColumnWidthChanged; + } + + public void UpdateWatch() + { + lstWatch.SelectedIndices.Clear(); + + //Remove empty items + for(int i = lstWatch.Items.Count - 1; i >= 0; i--) { + if(string.IsNullOrWhiteSpace(lstWatch.Items[i].Text)) { + lstWatch.Items.RemoveAt(i); + } + } + lstWatch.Items.Add(""); + + ListViewItem lastItem = lstWatch.Items[lstWatch.Items.Count - 1]; + foreach(ListViewItem item in lstWatch.Items) { + item.UseItemStyleForSubItems = false; + if(item != lastItem) { + string previousValue = null; + if(item.SubItems.Count > 1) { + previousValue = item.SubItems[1].Text; + item.SubItems.RemoveAt(1); + } + item.SubItems[0].Text = item.SubItems[0].Text.ToUpper(); + + string newValue; + Byte memoryValue = InteropEmu.DebugGetMemoryValue((UInt32)item.Tag); + if(mnuHexDisplay.Checked) { + newValue = "$" + memoryValue.ToString("x").ToUpper(); + } else { + newValue = memoryValue.ToString(); + } + item.SubItems.Add(newValue); + item.SubItems[1].ForeColor = newValue != previousValue ? Color.Red : Color.Black; + } + } + AdjustColumnWidth(); + } + + public void AddWatch(UInt32 address) + { + ListViewItem item = lstWatch.Items.Insert(lstWatch.Items.Count - 1, "$" + address.ToString("x")); + item.Tag = address; + UpdateWatch(); + } + + private void lstWatch_AfterLabelEdit(object sender, LabelEditEventArgs e) + { + e.CancelEdit = true; + + if(e.Label != null) { + ListViewItem item = lstWatch.Items[e.Item]; + item.Text = e.Label; + if(!string.IsNullOrWhiteSpace(item.Text)) { + if(!item.Text.StartsWith("$")) { + item.Text = "$" + item.Text; + } + + UInt32 address; + if(UInt32.TryParse(item.Text.Substring(1), System.Globalization.NumberStyles.AllowHexSpecifier, null, out address)) { + lstWatch.Items[e.Item].Tag = address; + } else { + item.Text = string.Empty; + } + } + UpdateWatch(); + } + } + + private void mnuRemoveWatch_Click(object sender, EventArgs e) + { + if(lstWatch.SelectedItems.Count >= 1) { + var itemsToRemove = new List(); + foreach(ListViewItem item in lstWatch.SelectedItems) { + itemsToRemove.Add(item); + } + foreach(ListViewItem item in itemsToRemove) { + lstWatch.Items.Remove(item); + } + UpdateWatch(); + } + } + + private void mnuHexDisplay_Click(object sender, EventArgs e) + { + UpdateWatch(); + } + + private void lstWatch_SelectedIndexChanged(object sender, EventArgs e) + { + mnuRemoveWatch.Enabled = lstWatch.SelectedItems.Count >= 1; + } + } +} diff --git a/GUI.NET/Debugger/Controls/ctrlWatch.resx b/GUI.NET/Debugger/Controls/ctrlWatch.resx new file mode 100644 index 00000000..865fe763 --- /dev/null +++ b/GUI.NET/Debugger/Controls/ctrlWatch.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/GUI.NET/Debugger/frmDebugger.Designer.cs b/GUI.NET/Debugger/frmDebugger.Designer.cs new file mode 100644 index 00000000..2c2ff4b9 --- /dev/null +++ b/GUI.NET/Debugger/frmDebugger.Designer.cs @@ -0,0 +1,522 @@ +namespace Mesen.GUI.Debugger +{ + partial class frmDebugger + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + if(_notifListener != null) { + _notifListener.Dispose(); + _notifListener = null; + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmDebugger)); + this.splitContainer = new System.Windows.Forms.SplitContainer(); + this.tlpTop = new System.Windows.Forms.TableLayoutPanel(); + this.contextMenuCode = new System.Windows.Forms.ContextMenuStrip(this.components); + this.mnuShowNextStatement = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuSetNextStatement = new System.Windows.Forms.ToolStripMenuItem(); + this.tableLayoutPanel10 = new System.Windows.Forms.TableLayoutPanel(); + this.grpBreakpoints = new System.Windows.Forms.GroupBox(); + this.lstBreakpoints = new System.Windows.Forms.ListView(); + this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.contextMenuBreakpoints = new System.Windows.Forms.ContextMenuStrip(this.components); + this.mnuRemoveBreakpoint = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuDisableBreakpoint = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuAddBreakpoint = new System.Windows.Forms.ToolStripMenuItem(); + this.grpWatch = new System.Windows.Forms.GroupBox(); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuContinue = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuBreak = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuStepInto = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuStepOver = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuStepOut = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuToggleBreakpoint = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuRunOneFrame = new System.Windows.Forms.ToolStripMenuItem(); + this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuFind = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuFindNext = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuFindPrev = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuGoTo = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuClose = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuView = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuSplitView = new System.Windows.Forms.ToolStripMenuItem(); + this.ctrlDebuggerCode = new Mesen.GUI.Debugger.ctrlDebuggerCode(); + this.ctrlConsoleStatus = new Mesen.GUI.Debugger.ctrlConsoleStatus(); + this.ctrlDebuggerCodeSplit = new Mesen.GUI.Debugger.ctrlDebuggerCode(); + this.ctrlWatch = new Mesen.GUI.Debugger.ctrlWatch(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); + this.splitContainer.Panel1.SuspendLayout(); + this.splitContainer.Panel2.SuspendLayout(); + this.splitContainer.SuspendLayout(); + this.tlpTop.SuspendLayout(); + this.contextMenuCode.SuspendLayout(); + this.tableLayoutPanel10.SuspendLayout(); + this.grpBreakpoints.SuspendLayout(); + this.contextMenuBreakpoints.SuspendLayout(); + this.grpWatch.SuspendLayout(); + this.menuStrip.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer + // + this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.splitContainer.Location = new System.Drawing.Point(0, 24); + this.splitContainer.Name = "splitContainer"; + this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer.Panel1 + // + this.splitContainer.Panel1.Controls.Add(this.tlpTop); + this.splitContainer.Panel1MinSize = 375; + // + // splitContainer.Panel2 + // + this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel10); + this.splitContainer.Panel2MinSize = 50; + this.splitContainer.Size = new System.Drawing.Size(984, 588); + this.splitContainer.SplitterDistance = 422; + this.splitContainer.TabIndex = 1; + // + // tlpTop + // + this.tlpTop.ColumnCount = 3; + this.tlpTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tlpTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tlpTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tlpTop.Controls.Add(this.ctrlDebuggerCode, 0, 0); + this.tlpTop.Controls.Add(this.ctrlConsoleStatus, 2, 0); + this.tlpTop.Controls.Add(this.ctrlDebuggerCodeSplit, 1, 0); + this.tlpTop.Dock = System.Windows.Forms.DockStyle.Fill; + this.tlpTop.Location = new System.Drawing.Point(0, 0); + this.tlpTop.Name = "tlpTop"; + this.tlpTop.RowCount = 1; + this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tlpTop.Size = new System.Drawing.Size(984, 422); + this.tlpTop.TabIndex = 2; + // + // contextMenuCode + // + this.contextMenuCode.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuShowNextStatement, + this.mnuSetNextStatement}); + this.contextMenuCode.Name = "contextMenuWatch"; + this.contextMenuCode.Size = new System.Drawing.Size(259, 48); + // + // mnuShowNextStatement + // + this.mnuShowNextStatement.Name = "mnuShowNextStatement"; + this.mnuShowNextStatement.ShortcutKeyDisplayString = "Alt+*"; + this.mnuShowNextStatement.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.Multiply))); + this.mnuShowNextStatement.Size = new System.Drawing.Size(258, 22); + this.mnuShowNextStatement.Text = "Show Next Statement"; + // + // mnuSetNextStatement + // + this.mnuSetNextStatement.Name = "mnuSetNextStatement"; + this.mnuSetNextStatement.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.F10))); + this.mnuSetNextStatement.Size = new System.Drawing.Size(258, 22); + this.mnuSetNextStatement.Text = "Set Next Statement"; + // + // tableLayoutPanel10 + // + this.tableLayoutPanel10.ColumnCount = 2; + this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel10.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel10.Controls.Add(this.grpBreakpoints, 0, 0); + this.tableLayoutPanel10.Controls.Add(this.grpWatch, 0, 0); + this.tableLayoutPanel10.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel10.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel10.Name = "tableLayoutPanel10"; + this.tableLayoutPanel10.RowCount = 1; + this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 195F)); + this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 195F)); + this.tableLayoutPanel10.Size = new System.Drawing.Size(984, 162); + this.tableLayoutPanel10.TabIndex = 0; + // + // grpBreakpoints + // + this.grpBreakpoints.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.grpBreakpoints.Controls.Add(this.lstBreakpoints); + this.grpBreakpoints.Location = new System.Drawing.Point(495, 3); + this.grpBreakpoints.Name = "grpBreakpoints"; + this.grpBreakpoints.Size = new System.Drawing.Size(486, 156); + this.grpBreakpoints.TabIndex = 3; + this.grpBreakpoints.TabStop = false; + this.grpBreakpoints.Text = "Breakpoints"; + // + // lstBreakpoints + // + this.lstBreakpoints.CheckBoxes = true; + this.lstBreakpoints.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader3, + this.columnHeader4}); + this.lstBreakpoints.ContextMenuStrip = this.contextMenuBreakpoints; + this.lstBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstBreakpoints.FullRowSelect = true; + this.lstBreakpoints.GridLines = true; + this.lstBreakpoints.LabelEdit = true; + this.lstBreakpoints.Location = new System.Drawing.Point(3, 16); + this.lstBreakpoints.Name = "lstBreakpoints"; + this.lstBreakpoints.Size = new System.Drawing.Size(480, 137); + this.lstBreakpoints.TabIndex = 5; + this.lstBreakpoints.UseCompatibleStateImageBehavior = false; + this.lstBreakpoints.View = System.Windows.Forms.View.Details; + // + // columnHeader3 + // + this.columnHeader3.Text = "Address"; + this.columnHeader3.Width = 59; + // + // columnHeader4 + // + this.columnHeader4.Text = "Breakpoint Type"; + this.columnHeader4.Width = 100; + // + // contextMenuBreakpoints + // + this.contextMenuBreakpoints.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuRemoveBreakpoint, + this.mnuDisableBreakpoint, + this.mnuAddBreakpoint}); + this.contextMenuBreakpoints.Name = "contextMenuWatch"; + this.contextMenuBreakpoints.Size = new System.Drawing.Size(173, 70); + // + // mnuRemoveBreakpoint + // + this.mnuRemoveBreakpoint.Name = "mnuRemoveBreakpoint"; + this.mnuRemoveBreakpoint.Size = new System.Drawing.Size(172, 22); + this.mnuRemoveBreakpoint.Text = "Remove"; + // + // mnuDisableBreakpoint + // + this.mnuDisableBreakpoint.Name = "mnuDisableBreakpoint"; + this.mnuDisableBreakpoint.Size = new System.Drawing.Size(172, 22); + this.mnuDisableBreakpoint.Text = "Disable Breakpoint"; + // + // mnuAddBreakpoint + // + this.mnuAddBreakpoint.Name = "mnuAddBreakpoint"; + this.mnuAddBreakpoint.Size = new System.Drawing.Size(172, 22); + this.mnuAddBreakpoint.Text = "Add..."; + // + // grpWatch + // + this.grpWatch.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.grpWatch.Controls.Add(this.ctrlWatch); + this.grpWatch.Location = new System.Drawing.Point(3, 3); + this.grpWatch.Name = "grpWatch"; + this.grpWatch.Size = new System.Drawing.Size(486, 156); + this.grpWatch.TabIndex = 2; + this.grpWatch.TabStop = false; + this.grpWatch.Text = "Watch"; + // + // menuStrip + // + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.mnuView, + this.debugToolStripMenuItem, + this.searchToolStripMenuItem}); + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Size = new System.Drawing.Size(984, 24); + this.menuStrip.TabIndex = 2; + this.menuStrip.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuClose}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // debugToolStripMenuItem + // + this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuContinue, + this.mnuBreak, + this.mnuStepInto, + this.mnuStepOver, + this.mnuStepOut, + this.toolStripMenuItem1, + this.mnuToggleBreakpoint, + this.toolStripMenuItem2, + this.mnuRunOneFrame}); + this.debugToolStripMenuItem.Name = "debugToolStripMenuItem"; + this.debugToolStripMenuItem.Size = new System.Drawing.Size(54, 20); + this.debugToolStripMenuItem.Text = "Debug"; + // + // mnuContinue + // + this.mnuContinue.Name = "mnuContinue"; + this.mnuContinue.ShortcutKeys = System.Windows.Forms.Keys.F5; + this.mnuContinue.Size = new System.Drawing.Size(190, 22); + this.mnuContinue.Text = "Continue"; + this.mnuContinue.Click += new System.EventHandler(this.mnuContinue_Click); + // + // mnuBreak + // + this.mnuBreak.Name = "mnuBreak"; + this.mnuBreak.ShortcutKeyDisplayString = "Ctrl+Alt+Break"; + this.mnuBreak.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) + | System.Windows.Forms.Keys.Cancel))); + this.mnuBreak.Size = new System.Drawing.Size(190, 22); + this.mnuBreak.Text = "Break"; + this.mnuBreak.Click += new System.EventHandler(this.mnuBreak_Click); + // + // mnuStepInto + // + this.mnuStepInto.Name = "mnuStepInto"; + this.mnuStepInto.ShortcutKeys = System.Windows.Forms.Keys.F11; + this.mnuStepInto.Size = new System.Drawing.Size(190, 22); + this.mnuStepInto.Text = "Step Into"; + this.mnuStepInto.Click += new System.EventHandler(this.mnuStepInto_Click); + // + // mnuStepOver + // + this.mnuStepOver.Name = "mnuStepOver"; + this.mnuStepOver.ShortcutKeys = System.Windows.Forms.Keys.F10; + this.mnuStepOver.Size = new System.Drawing.Size(190, 22); + this.mnuStepOver.Text = "Step Over"; + this.mnuStepOver.Click += new System.EventHandler(this.mnuStepOver_Click); + // + // mnuStepOut + // + this.mnuStepOut.Name = "mnuStepOut"; + this.mnuStepOut.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F11))); + this.mnuStepOut.Size = new System.Drawing.Size(190, 22); + this.mnuStepOut.Text = "Step Out"; + this.mnuStepOut.Click += new System.EventHandler(this.mnuStepOut_Click); + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(187, 6); + // + // mnuToggleBreakpoint + // + this.mnuToggleBreakpoint.Name = "mnuToggleBreakpoint"; + this.mnuToggleBreakpoint.ShortcutKeys = System.Windows.Forms.Keys.F9; + this.mnuToggleBreakpoint.Size = new System.Drawing.Size(190, 22); + this.mnuToggleBreakpoint.Text = "Toggle Breakpoint"; + this.mnuToggleBreakpoint.Click += new System.EventHandler(this.mnuToggleBreakpoint_Click); + // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(187, 6); + // + // mnuRunOneFrame + // + this.mnuRunOneFrame.Name = "mnuRunOneFrame"; + this.mnuRunOneFrame.ShortcutKeys = System.Windows.Forms.Keys.F12; + this.mnuRunOneFrame.Size = new System.Drawing.Size(190, 22); + this.mnuRunOneFrame.Text = "Run one frame"; + this.mnuRunOneFrame.Click += new System.EventHandler(this.mnuRunOneFrame_Click); + // + // searchToolStripMenuItem + // + this.searchToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuFind, + this.mnuFindNext, + this.mnuFindPrev, + this.mnuGoTo}); + this.searchToolStripMenuItem.Name = "searchToolStripMenuItem"; + this.searchToolStripMenuItem.Size = new System.Drawing.Size(54, 20); + this.searchToolStripMenuItem.Text = "Search"; + // + // mnuFind + // + this.mnuFind.Name = "mnuFind"; + this.mnuFind.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); + this.mnuFind.Size = new System.Drawing.Size(196, 22); + this.mnuFind.Text = "Find..."; + this.mnuFind.Click += new System.EventHandler(this.mnuFind_Click); + // + // mnuFindNext + // + this.mnuFindNext.Name = "mnuFindNext"; + this.mnuFindNext.ShortcutKeys = System.Windows.Forms.Keys.F3; + this.mnuFindNext.Size = new System.Drawing.Size(196, 22); + this.mnuFindNext.Text = "Find Next"; + // + // mnuFindPrev + // + this.mnuFindPrev.Name = "mnuFindPrev"; + this.mnuFindPrev.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F3))); + this.mnuFindPrev.Size = new System.Drawing.Size(196, 22); + this.mnuFindPrev.Text = "Find Previous"; + // + // mnuGoTo + // + this.mnuGoTo.Name = "mnuGoTo"; + this.mnuGoTo.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G))); + this.mnuGoTo.Size = new System.Drawing.Size(196, 22); + this.mnuGoTo.Text = "Go to..."; + // + // mnuClose + // + this.mnuClose.Name = "mnuClose"; + this.mnuClose.Size = new System.Drawing.Size(103, 22); + this.mnuClose.Text = "Close"; + // + // mnuView + // + this.mnuView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuSplitView}); + this.mnuView.Name = "mnuView"; + this.mnuView.Size = new System.Drawing.Size(44, 20); + this.mnuView.Text = "View"; + // + // mnuSplitView + // + this.mnuSplitView.CheckOnClick = true; + this.mnuSplitView.Name = "mnuSplitView"; + this.mnuSplitView.Size = new System.Drawing.Size(125, 22); + this.mnuSplitView.Text = "Split View"; + this.mnuSplitView.Click += new System.EventHandler(this.mnuSplitView_Click); + // + // ctrlDebuggerCode + // + this.ctrlDebuggerCode.ContextMenuStrip = this.contextMenuCode; + this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill; + this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3); + this.ctrlDebuggerCode.Name = "ctrlDebuggerCode"; + this.ctrlDebuggerCode.Size = new System.Drawing.Size(270, 416); + this.ctrlDebuggerCode.TabIndex = 2; + this.ctrlDebuggerCode.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.WatchAddedEventHandler(this.ctrlDebuggerCode_OnWatchAdded); + // + // ctrlConsoleStatus + // + this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Top; + this.ctrlConsoleStatus.Location = new System.Drawing.Point(552, 0); + this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0); + this.ctrlConsoleStatus.Name = "ctrlConsoleStatus"; + this.ctrlConsoleStatus.Size = new System.Drawing.Size(432, 362); + this.ctrlConsoleStatus.TabIndex = 3; + // + // ctrlDebuggerCodeSplit + // + this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill; + this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(279, 3); + this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit"; + this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(270, 416); + this.ctrlDebuggerCodeSplit.TabIndex = 4; + // + // ctrlWatch + // + this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill; + this.ctrlWatch.Location = new System.Drawing.Point(3, 16); + this.ctrlWatch.Name = "ctrlWatch"; + this.ctrlWatch.Size = new System.Drawing.Size(480, 137); + this.ctrlWatch.TabIndex = 0; + // + // frmDebugger + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(984, 612); + this.Controls.Add(this.splitContainer); + this.Controls.Add(this.menuStrip); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MainMenuStrip = this.menuStrip; + this.MinimumSize = new System.Drawing.Size(1000, 650); + this.Name = "frmDebugger"; + this.Text = "Debugger"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmDebugger_FormClosed); + this.splitContainer.Panel1.ResumeLayout(false); + this.splitContainer.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); + this.splitContainer.ResumeLayout(false); + this.tlpTop.ResumeLayout(false); + this.contextMenuCode.ResumeLayout(false); + this.tableLayoutPanel10.ResumeLayout(false); + this.grpBreakpoints.ResumeLayout(false); + this.contextMenuBreakpoints.ResumeLayout(false); + this.grpWatch.ResumeLayout(false); + this.menuStrip.ResumeLayout(false); + this.menuStrip.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.SplitContainer splitContainer; + private System.Windows.Forms.TableLayoutPanel tlpTop; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel10; + private System.Windows.Forms.GroupBox grpBreakpoints; + private System.Windows.Forms.ListView lstBreakpoints; + private System.Windows.Forms.GroupBox grpWatch; + private System.Windows.Forms.MenuStrip menuStrip; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip contextMenuBreakpoints; + private System.Windows.Forms.ToolStripMenuItem mnuRemoveBreakpoint; + private System.Windows.Forms.ToolStripMenuItem mnuDisableBreakpoint; + private System.Windows.Forms.ToolStripMenuItem mnuAddBreakpoint; + private System.Windows.Forms.ToolStripMenuItem mnuContinue; + private System.Windows.Forms.ToolStripMenuItem mnuBreak; + private System.Windows.Forms.ToolStripMenuItem mnuStepInto; + private System.Windows.Forms.ToolStripMenuItem mnuStepOver; + private System.Windows.Forms.ToolStripMenuItem mnuStepOut; + private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem mnuFind; + private System.Windows.Forms.ToolStripMenuItem mnuFindNext; + private System.Windows.Forms.ToolStripMenuItem mnuFindPrev; + private System.Windows.Forms.ToolStripMenuItem mnuGoTo; + private System.Windows.Forms.ColumnHeader columnHeader3; + private System.Windows.Forms.ColumnHeader columnHeader4; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem mnuToggleBreakpoint; + private ctrlDebuggerCode ctrlDebuggerCode; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; + private System.Windows.Forms.ToolStripMenuItem mnuRunOneFrame; + private System.Windows.Forms.ContextMenuStrip contextMenuCode; + private System.Windows.Forms.ToolStripMenuItem mnuShowNextStatement; + private System.Windows.Forms.ToolStripMenuItem mnuSetNextStatement; + private ctrlWatch ctrlWatch; + private ctrlConsoleStatus ctrlConsoleStatus; + private System.Windows.Forms.ToolStripMenuItem mnuClose; + private ctrlDebuggerCode ctrlDebuggerCodeSplit; + private System.Windows.Forms.ToolStripMenuItem mnuView; + private System.Windows.Forms.ToolStripMenuItem mnuSplitView; + } +} \ No newline at end of file diff --git a/GUI.NET/Debugger/frmDebugger.cs b/GUI.NET/Debugger/frmDebugger.cs new file mode 100644 index 00000000..11b16692 --- /dev/null +++ b/GUI.NET/Debugger/frmDebugger.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Drawing.Text; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Mesen.GUI.Debugger +{ + public partial class frmDebugger : Form + { + InteropEmu.NotificationListener _notifListener; + + public frmDebugger() + { + InitializeComponent(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + _notifListener = new InteropEmu.NotificationListener(); + _notifListener.OnNotification += _notifListener_OnNotification; + + InteropEmu.DebugInitialize(); + InteropEmu.DebugStep(1); + } + + void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e) + { + if(e.NotificationType == InteropEmu.ConsoleNotificationType.CodeBreak) { + this.BeginInvoke((MethodInvoker)(() => UpdateDebugger())); + } + } + + private bool UpdateSplitView() + { + if(mnuSplitView.Checked) { + tlpTop.ColumnStyles[1].SizeType = SizeType.Percent; + tlpTop.ColumnStyles[1].Width = 50f; + this.MinimumSize = new Size(1250, 650); + } else { + tlpTop.ColumnStyles[1].SizeType = SizeType.Absolute; + tlpTop.ColumnStyles[1].Width = 0f; + this.MinimumSize = new Size(1000, 650); + } + return mnuSplitView.Checked; + } + + private void UpdateDebugger() + { + if(InteropEmu.DebugIsCodeChanged()) { + string code = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(InteropEmu.DebugGetCode()); + ctrlDebuggerCode.Code = code; + ctrlDebuggerCodeSplit.Code = code; + } + + DebugState state = new DebugState(); + InteropEmu.DebugGetState(ref state); + + if(UpdateSplitView()) { + ctrlDebuggerCodeSplit.UpdateCode(true); + } + + ctrlDebuggerCode.SelectActiveAddress(state.CPU.PC); + ctrlConsoleStatus.UpdateStatus(ref state); + ctrlWatch.UpdateWatch(); + } + + private void ToggleBreakpoint() + { + this.ctrlDebuggerCode.HighlightLine(this.ctrlDebuggerCode.GetCurrentLine(), Color.FromArgb(158, 84, 94), Color.White); + + //this.AddBreakpoint(this.GetLineAddress(lineIndex)); + } + + private void mnuContinue_Click(object sender, EventArgs e) + { + InteropEmu.DebugRun(); + this.ctrlDebuggerCode.RemoveActiveHighlight(); + } + + private void frmDebugger_FormClosed(object sender, FormClosedEventArgs e) + { + InteropEmu.DebugRelease(); + } + + private void mnuToggleBreakpoint_Click(object sender, EventArgs e) + { + ToggleBreakpoint(); + } + + private void mnuBreak_Click(object sender, EventArgs e) + { + InteropEmu.DebugStep(1); + } + + private void mnuStepInto_Click(object sender, EventArgs e) + { + InteropEmu.DebugStep(1); + } + + private void mnuStepOut_Click(object sender, EventArgs e) + { + InteropEmu.DebugStepOut(); + } + + private void mnuStepOver_Click(object sender, EventArgs e) + { + InteropEmu.DebugStepOver(); + } + + private void mnuRunOneFrame_Click(object sender, EventArgs e) + { + InteropEmu.DebugStepCycles(29780); + } + + private void ctrlDebuggerCode_OnWatchAdded(WatchAddedEventArgs args) + { + this.ctrlWatch.AddWatch(args.Address); + } + + private void mnuFind_Click(object sender, EventArgs e) + { + + } + + private void mnuSplitView_Click(object sender, EventArgs e) + { + UpdateDebugger(); + } + } +} diff --git a/GUI.NET/Debugger/frmDebugger.resx b/GUI.NET/Debugger/frmDebugger.resx new file mode 100644 index 00000000..8f769556 --- /dev/null +++ b/GUI.NET/Debugger/frmDebugger.resx @@ -0,0 +1,418 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 561, 17 + + + 373, 17 + + + 107, 17 + + + + + AAABAAMAEBAAAAAAGABoAwAANgAAACAgAAAAABgAqAwAAJ4DAABAQAAAAAAYACgyAABGEAAAKAAAABAA + AAAgAAAAAQAYAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAANPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT0/////////////////////////7+/v7+/v///////////////////////9PT09PT + 0////////////+np6cHBwaamppubm5qamqWlpb6+vuTk5P///////////9PT09PT0/////j4+Ly8vJqa + mpqamq2trb6+vr6+vq6urpubm5qamrW1tfT09P///9PT09PT0/b29qqqqpqamry8vPDw8Pz8/Ofn5+fn + 5/z8/PPz88PDw5ubm6WlpfLy8tPT09PT07a2tpqamtbW1v///+Li4qKiopqampqamqKiouLi4v///9/f + 35ubm7Ozs9PT09PT06WlpcPDw/////T09J6enp6enqmpqZqampqamp6envT09P///8XFxaWlpdPT09PT + 0/f5/f7+/////9jY2JqamsTExO3t7ZqampqampqamtjY2P////7+//f5/dPT09PT0xxv/22i/////93d + 3ZqamsbGxu/v75qampqampqamt3d3f///2mg/xxv/9PT09PT00CG/wRg/67L//v7+6mpqbq6uuHh4Zqa + mpqamqmpqfv7+5e9/wFf/0eL/9PT09PT093q/xtv/wJf/2mg/9ji9b29vaCgoKCgoL29vc/d9FeV/wBe + /yh3/+jw/9PT09PT0////+Pt/0SJ/wBe/wJf/zR//1uX/1qX/zF8/wFf/wBe/1eV/+70/////9PT09PT + 0////////////7zU/1yY/x1w/wFf/wFf/x9x/2Kc/8jc/////////////9PT09PT0/////////////// + //////////z9//z9/////////////////////////9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT0///AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAIAAAAEAAAAABABgAAAAAAAAMAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /Pz84eHhycnJtra2qqqqpKSkpKSkqqqqtra2x8fH3t7e+fn5//////////////////////////////// + ////09PT09PT////////////////////////////7u7uwcHBn5+fmpqampqampqampqampqampqampqa + mpqampqampqanJycubm54+Pj////////////////////////////09PT09PT//////////////////// + 8/Pzvb29m5ubmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqasLCw6Ojo + ////////////////////09PT09PT////////////////2NjYn5+fmpqampqampqampqampqampqapqam + tbW1vb29vb29tbW1p6enmpqampqampqampqampqampqam5ubxcXF/Pz8////////////09PT09PT//// + /////f39wcHBmpqampqampqampqampqarKys1NTU8/Pz////////////////////////9vb22tratbW1 + mpqampqampqampqampqasLCw9vb2////////09PT09PT/////f39ubm5mpqampqampqampqaqqqq4eHh + ////////////////////////////////////////////////7e3tt7e3mpqampqampqampqaq6ur9/f3 + ////09PT09PT////wcHBmpqampqampqampqayMjI/Pz8////////////7e3txMTEqqqqnZ2dnZ2dqqqq + xMTE7e3t////////////////29vbn5+fmpqampqampqatLS0/v7+09PT09PT3t7empqampqampqanJyc + 3Nzc/////////////f39xsbGm5ubmpqampqampqampqampqampqam5ubxsbG/f39////////////7Ozs + o6Ojmpqampqampqa1tbW09PT09PTrKysmpqampqampqa3d3d/////////////v7+u7u7mpqampqampqa + mpqampqampqampqampqampqampqau7u7/v7+////////////6urqnZ2dmpqampqaqqqq09PT09PTnZ2d + mpqampqawcHB////////////////1dXVmpqampqampqampqampqampqampqampqampqampqampqampqa + 1dXV////////////////xcXFmpqampqanZ2d09PT09PTz8/Pm5ubqKio8/Pz/////////////v7+pKSk + mpqampqampqavLy819fXpaWlmpqampqampqampqampqampqapaWl/v7+////////////8/PzqKiom5ub + 0NDQ09PT09PT/////Pz8/v7+////////////////6+vrmpqampqampqanp6e/f39////19fXmpqampqa + mpqampqampqampqampqa6+vr/////////////////v7+/Pz8////09PT09PT////+Pr//v7///////// + ////////3t7empqampqampqaoqKi////////3d3dmpqampqampqampqampqampqampqa3t7e//////// + /////////v7/+Pr/////09PT09PTiLP/BWD/JXT/4ez/////////////4uLimpqampqampqaoqKi//// + ////3d3dmpqampqampqampqampqampqampqa4uLi////////////4ez/JXT/BWD/ibP/09PT09PTCmT/ + AF7/AF7/b6P/////////////9vb2m5ubmpqampqaoqKi////////3d3dmpqampqampqampqampqampqa + m5ub9vb2////////////Y5z/AF7/AF7/CmT/09PT09PTKnj/AF7/AF7/B2L/zN7/////////////ubm5 + mpqampqaoqKi////////3d3dmpqampqampqampqampqampqauLi4////////////qsj/AV//AF7/AF7/ + Lnr/09PT09PTmr7/AF7/AF7/AF7/F2z/0eH/////////8PDwn5+fmpqam5ub8fHx////yMjImpqampqa + mpqampqampqan5+f8PDw////////qMf/BmH/AF7/AF7/AF7/rcv/09PT09PT/f3/Qof/AF7/AF7/AF7/ + DWb/pcX/////////5eXloKCgmpqaoaGhsbGxmpqampqampqampqampqaoKCg5eXl////+fv/dqf/AV// + AF7/AF7/AF7/ZJz/////09PT09PT////7PL/Knj/AF7/AF7/AF7/AF7/Soz/0uL/////8fHxurq6m5ub + mpqampqampqampqam5uburq68fHx////tM//KXf/AF7/AF7/AF7/AF7/UI//+vz/////09PT09PT//// + ////6vH/OIH/AF7/AF7/AF7/AF7/AV//RYn/osP/6vH/9PT02trazs7Ozs7O2tra9PT04uz/k7r/L3v/ + AF7/AF7/AF7/AF7/AF7/ZJz/+vz/////////09PT09PT////////////+Pr/bqP/Al//AF7/AF7/AF7/ + AF7/AF7/AV7/InP/Ror/WJX/WZX/RYn/HnD/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ncH///////////// + ////09PT09PT////////////////////xtr/OIH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al//WZb/4u3/////////////////////09PT09PT//////////////////// + ////////utP/UJD/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ZZ3/1OP///////// + ////////////////////09PT09PT////////////////////////////////////8PX/rMr/cqX/R4r/ + Knj/G27/G27/Knj/SYv/d6n/ttD/9vn/////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAQAAAAIAAAAABABgAAAAAAAAwAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////////////////////////////////////////+vr66Ojo2dnZzc3NxMTE + v7+/vLy8vLy8v7+/xcXFzc3N2NjY5ubm+Pj4//////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////////////////////////////////////////////+fn53d3dwsLCqqqqmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqapaWlvLy81dXV8vLy//////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + /////////////////////////////////////////////////////////////////Pz83Nzct7e3nJyc + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaq6urzc3N8/Pz//////////////////////////////////////////////////////////////// + ////09PT09PT////////////////////////////////////////////////////////////9fX1ysrK + oqKimpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqam5ubtra24uLi//////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + 9vb2xcXFnZ2dmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqara2t4ODg//////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////f39z8/Pn5+fmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + sbGx6+vr////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////6Ojoqqqqmpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqam5ubxsbG+/v7////////////////////////////////////09PT09PT//// + /////////////////////////////f39ysrKm5ubmpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqaoqKirq6utbW1uLi4uLi4tbW1rq6uo6Ojmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqaqKio6urq//////////////////////////// + ////09PT09PT////////////////////////////9fX1sbGxmpqampqampqampqampqampqampqampqa + mpqampqampqampqampqanJyctLS0z8/P5eXl+fn5////////////////////////////////+/v76enp + 1NTUvLy8oaGhmpqampqampqampqampqampqampqampqampqampqampqampqampqanJyc1tbW//////// + ////////////////////09PT09PT////////////////////////6+vrpKSkmpqampqampqampqampqa + mpqampqampqampqampqampqampqasrKy2NjY+fn5//////////////////////////////////////// + /////////////////////////v7+5eXlwsLCn5+fmpqampqampqampqampqampqampqampqampqampqa + mpqampqaxcXF/v7+////////////////////09PT09PT////////////////////5OTkn5+fmpqampqa + mpqampqampqampqampqampqampqampqam5ubvr6+7Ozs//////////////////////////////////// + ////////////////////////////////////////////////////+vr61NTUpqammpqampqampqampqa + mpqampqampqampqampqampqampqavb29/v7+////////////////09PT09PT////////////////4+Pj + nZ2dmpqampqampqampqampqampqampqampqampqampqauLi47+/v//////////////////////////// + /////////////////////////////////////////////////////////////////////////////f39 + 1dXVoqKimpqampqampqampqampqampqampqampqampqampqavb29/v7+////////////09PT09PT//// + ////////6OjonZ2dmpqampqampqampqampqampqampqampqampqapaWl4eHh//////////////////// + ////////////////////////+/v76enp3d3d19fX19fX3d3d6enp+/v7//////////////////////// + ////////////////////+fn5w8PDmpqampqampqampqampqampqampqampqampqampqaxsbG//////// + ////09PT09PT////////8vLyoaGhmpqampqampqampqampqampqampqampqampqavr6++fn5//////// + ////////////////////////////9vb20NDQsLCwm5ubmpqampqampqampqampqampqam5ubsLCw0NDQ + 9vb2////////////////////////////////////////5OTkpKSkmpqampqampqampqampqampqampqa + mpqampqa29vb////////09PT09PT/////f39rq6umpqampqampqampqampqampqampqampqanJyc19fX + ////////////////////////////////////9/f3xMTEnZ2dmpqampqampqampqampqampqampqampqa + mpqampqampqampqanZ2dxMTE9/f3////////////////////////////////////9vb2sbGxmpqampqa + mpqampqampqampqampqampqan5+f8/Pz////09PT09PT////zMzMmpqampqampqampqampqampqampqa + mpqaoKCg5ubm////////////////////////////////////39/foqKimpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqaoqKi39/f//////////////////////////////// + /////Pz8urq6mpqampqampqampqampqampqampqampqau7u7////09PT09PT8/PznZ2dmpqampqampqa + mpqampqampqampqaoaGh7Ozs////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqazMzM//////////// + /////////////////////////f39urq6mpqampqampqampqampqampqampqampqa7Ozs09PT09PTx8fH + mpqampqampqampqampqampqampqanp6e6urq////////////////////////////////////ysrKmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaysrK/////////////////////////////////////Pz8sLCwmpqampqampqampqampqampqampqa + w8PD09PT09PTpaWlmpqampqampqampqampqampqampqa3t7e//////////////////////////////// + ////2dnZmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqa2dnZ////////////////////////////////////8/Pzn5+fmpqampqa + mpqampqampqampqapaWl09PT09PTm5ubmpqampqampqampqampqampqav7+///////////////////// + ////////////////8/Pznp6empqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqan5+f8/Pz//////////////////////////////// + ////zc3Nmpqampqampqampqampqampqam5ub09PT09PTrKysmpqampqampqampqampqam5ub8vLy//// + ////////////////////////////////vb29mpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29//////////////// + ////////////////////8/PzmpqampqampqampqampqampqarKys09PT09PT39/fmpqampqampqampqa + mpqawsLC////////////////////////////////////8fHxmpqampqampqampqampqampqampqampqa + mpqasLCwxcXFrq6umpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqam5ub + 8fHx////////////////////////////////////wsLCmpqampqampqampqampqa39/f09PT09PT//// + 3d3dqKiompqaoKCgysrK/f39////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqazs7O////////////yMjImpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqazMzM/////////////////////////////////////f39ysrKoKCgmpqaqKio3d3d + ////09PT09PT////////////+/v7/v7+////////////////////////////////////////////r6+v + mpqampqampqampqampqampqampqaqqqq/////////////////f39paWlmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqar6+v//////////////////////////////////////////// + /v7++/v7////////////09PT09PT//////////////////////////////////////////////////// + /////////f39nJycmpqampqampqampqampqampqampqavb29////////////////////uLi4mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqanJyc/v7+//////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////9PT0mpqampqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa9PT0//////// + ////////////////////////////////////////////////////09PT09PT////////////+vz//f7/ + ////////////////////////////////////////7+/vmpqampqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqa7u7u/////////////////////////////////////////f7/+vz/////////////09PT09PT//// + rMn/J3X/Al7/FGn/fKr/+/z/////////////////////////////////8/Pzmpqampqampqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqa8/Pz////////////////////////////////+/z/e6r/FGn/Al7/KHX/rMn/ + ////09PT09PTsMv/AV7/AF7/AF7/AF7/AF7/aJ7//////////////////////////////////Pz8m5ub + mpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqam5ub/f39////////////////////////////////aJ7/AF7/ + AF7/AF7/AF7/Al//sMz/09PT09PTMHv/AF7/AF7/AF7/AF7/AF7/A1//4+3///////////////////// + ////////////rKysmpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqarKys//////////////////////////// + ////3+r/Al7/AF7/AF7/AF7/AF7/AF7/MHv/09PT09PTBGD/AF7/AF7/AF7/AF7/AF7/AF7/hbD///// + ////////////////////////////x8fHmpqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqax8fH//////////// + ////////////////////YZr/AF7/AF7/AF7/AF7/AF7/AF7/BGD/09PT09PTHm//AF7/AF7/AF7/AF7/ + AF7/AF7/D2b/4uz/////////////////////////////7Ozsmpqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + 7Ozs////////////////////////////rcr/AV7/AF7/AF7/AF7/AF7/AF7/AF7/HnD/09PT09PTaZ// + AF7/AF7/AF7/AF7/AF7/AF7/AF7/OoH/+Pr/////////////////////////////tbW1mpqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqatbW1////////////////////////////zN7/DGX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + dKX/09PT09PTz+D/AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH//P3///////////////////////// + 7e3tm5ubmpqampqampqampqampqauLi4////////////////////srKympqampqampqampqampqampqa + mpqampqampqampqampqampqanJyc7e3t////////////////////////0OD/FGn/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/CWP/4+z/09PT09PT////VJH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH/+fv///// + ////////////////////zs7OmpqampqampqampqampqanZ2d8vLy////////////7e3tm5ubmpqampqa + mpqampqampqampqampqampqampqampqampqampqazs7O////////////////////////wtf/EWj/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/gK3/////09PT09PT////4ez/Dmb/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/PYP/6fD//////////////////////v7+vb29mpqampqampqampqampqaqKio4+Pj+fn54ODg + paWlmpqampqampqampqampqampqampqampqampqampqampqampqavLy8/v7+//////////////////// + nL//B2L/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/NH3/+vv/////09PT09PT////////pcX/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/G27/vtX//////////////////////f39vb29mpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29/f39//////// + ////////8fb/Xpj/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/3+r/////////09PT09PT//// + ////////c6T/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Al//bKD/8fb///////////////////// + 0NDQnJycmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqanJyc0NDQ + ////////////////////ttD/H3D/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CmT/xtr///////// + ////09PT09PT/////////////f3/WZX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/GGz/mL3/ + +/z/////////////////7u7utra2mpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqatra27u7u////////////////2OX/T47/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/ + utL/////////////////09PT09PT////////////////+vz/WZT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/InL/lbr/9Pj/////////////////6urqwsLCoqKimpqampqampqampqampqampqa + mpqampqaoqKiwsLC6urq////////////////0+L/XZf/BGD/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/DWX/vdT/////////////////////09PT09PT/////////////////////P3/bqL/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/EGf/Z53/wdb//P3//////////////v7+7e3t2tra + zs7OyMjIyMjIzs7O2tra7e3t/v7+////////////8PX/oMH/P4T/AV7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/HG7/z9//////////////////////////09PT09PT//////////////////// + ////////mL3/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/WJT/lrv/ + ytz/9fn/////////////////////////////////8fb/wdb/iLL/RIj/B2L/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/PYP/5+//////////////////////////////09PT09PT//// + ////////////////////////////zN7/JnT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al7/Gm3/NH3/Ron/To7/T47/R4n/NH3/GGz/AV3/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/A1//fKv/+/z///////////////////////////// + ////09PT09PT////////////////////////////////////9Pj/cKP/Al//AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Knf/x9r///////////////////// + ////////////////////09PT09PT////////////////////////////////////////////zd7/PIP/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Dmb/ibP/+fv///////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////////v7/sc3/MXz/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/cKP/6fH/ + ////////////////////////////////////////////////////09PT09PT//////////////////// + /////////////////////////////////////v//uNH/Sov/Al7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/ + e6r/5+//////////////////////////////////////////////////////////////09PT09PT//// + ////////////////////////////////////////////////////////////////4Or/hLD/LXj/AV7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + BmH/TI3/qcf/9/r///////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////3en/l7z/V5P/HW//AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + A17/KXb/Zp3/q8n/7/X///////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + /////////////////////////////////////////v//7PL/wtf/n8H/g6//bqL/YJn/WZT/WJT/X5n/ + bqL/hLD/osP/x9r/8fb///////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PTAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + + \ No newline at end of file diff --git a/GUI.NET/Forms/BaseConfigForm.cs b/GUI.NET/Forms/BaseConfigForm.cs new file mode 100644 index 00000000..9b639ef9 --- /dev/null +++ b/GUI.NET/Forms/BaseConfigForm.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Mesen.GUI.Forms +{ + public class BaseConfigForm : Form + { + protected override void OnFormClosed(FormClosedEventArgs e) + { + if(this.DialogResult == System.Windows.Forms.DialogResult.OK) { + UpdateConfig(); + ConfigManager.ApplyChanges(); + } else { + ConfigManager.RejectChanges(); + } + base.OnFormClosed(e); + } + + protected virtual void UpdateConfig() + { + } + } +} diff --git a/GUI.NET/Forms/Config/frmVideoConfig.Designer.cs b/GUI.NET/Forms/Config/frmVideoConfig.Designer.cs new file mode 100644 index 00000000..c9ec72a6 --- /dev/null +++ b/GUI.NET/Forms/Config/frmVideoConfig.Designer.cs @@ -0,0 +1,177 @@ +namespace Mesen.GUI.Forms.Config +{ + partial class frmVideoConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmVideoConfig)); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.txtPort = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.lblHost = new System.Windows.Forms.Label(); + this.lblPort = new System.Windows.Forms.Label(); + this.txtHost = new System.Windows.Forms.TextBox(); + this.chkSpectator = new System.Windows.Forms.CheckBox(); + this.tableLayoutPanel1.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.txtPort, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.lblHost, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.lblPort, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.txtHost, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.chkSpectator, 0, 2); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + 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.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(284, 262); + this.tableLayoutPanel1.TabIndex = 1; + // + // txtPort + // + this.txtPort.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtPort.Location = new System.Drawing.Point(41, 29); + this.txtPort.Name = "txtPort"; + this.txtPort.Size = new System.Drawing.Size(240, 20); + this.txtPort.TabIndex = 6; + this.txtPort.Text = "8888"; + // + // flowLayoutPanel1 + // + this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 2); + this.flowLayoutPanel1.Controls.Add(this.btnCancel); + this.flowLayoutPanel1.Controls.Add(this.btnOK); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 233); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(284, 29); + this.flowLayoutPanel1.TabIndex = 2; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(206, 3); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 0; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // btnOK + // + this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnOK.Location = new System.Drawing.Point(125, 3); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 1; + this.btnOK.Text = "Connect"; + this.btnOK.UseVisualStyleBackColor = true; + // + // lblHost + // + this.lblHost.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblHost.AutoSize = true; + this.lblHost.Location = new System.Drawing.Point(3, 6); + this.lblHost.Name = "lblHost"; + this.lblHost.Size = new System.Drawing.Size(32, 13); + this.lblHost.TabIndex = 3; + this.lblHost.Text = "Host:"; + // + // lblPort + // + this.lblPort.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblPort.AutoSize = true; + this.lblPort.Location = new System.Drawing.Point(3, 32); + this.lblPort.Name = "lblPort"; + this.lblPort.Size = new System.Drawing.Size(29, 13); + this.lblPort.TabIndex = 4; + this.lblPort.Text = "Port:"; + // + // txtHost + // + this.txtHost.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtHost.Location = new System.Drawing.Point(41, 3); + this.txtHost.Name = "txtHost"; + this.txtHost.Size = new System.Drawing.Size(240, 20); + this.txtHost.TabIndex = 5; + this.txtHost.Text = "127.0.0.1"; + // + // chkSpectator + // + this.chkSpectator.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.chkSpectator, 2); + this.chkSpectator.Enabled = false; + this.chkSpectator.Location = new System.Drawing.Point(3, 55); + this.chkSpectator.Name = "chkSpectator"; + this.chkSpectator.Size = new System.Drawing.Size(106, 17); + this.chkSpectator.TabIndex = 7; + this.chkSpectator.Text = "Join as spectator"; + this.chkSpectator.UseVisualStyleBackColor = true; + // + // frmVideoConfig + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 262); + this.Controls.Add(this.tableLayoutPanel1); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "frmVideoConfig"; + this.Text = "Video Options"; + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.TextBox txtPort; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Label lblHost; + private System.Windows.Forms.Label lblPort; + private System.Windows.Forms.TextBox txtHost; + private System.Windows.Forms.CheckBox chkSpectator; + } +} \ No newline at end of file diff --git a/GUI.NET/Forms/Config/frmVideoConfig.cs b/GUI.NET/Forms/Config/frmVideoConfig.cs new file mode 100644 index 00000000..a1ca9cde --- /dev/null +++ b/GUI.NET/Forms/Config/frmVideoConfig.cs @@ -0,0 +1,20 @@ +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 frmVideoConfig : Form + { + public frmVideoConfig() + { + InitializeComponent(); + } + } +} diff --git a/GUI.NET/Forms/Config/frmVideoConfig.resx b/GUI.NET/Forms/Config/frmVideoConfig.resx new file mode 100644 index 00000000..f7d049ce --- /dev/null +++ b/GUI.NET/Forms/Config/frmVideoConfig.resx @@ -0,0 +1,409 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAMAEBAAAAAAGABoAwAANgAAACAgAAAAABgAqAwAAJ4DAABAQAAAAAAYACgyAABGEAAAKAAAABAA + AAAgAAAAAQAYAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAANPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT0/////////////////////////7+/v7+/v///////////////////////9PT09PT + 0////////////+np6cHBwaamppubm5qamqWlpb6+vuTk5P///////////9PT09PT0/////j4+Ly8vJqa + mpqamq2trb6+vr6+vq6urpubm5qamrW1tfT09P///9PT09PT0/b29qqqqpqamry8vPDw8Pz8/Ofn5+fn + 5/z8/PPz88PDw5ubm6WlpfLy8tPT09PT07a2tpqamtbW1v///+Li4qKiopqampqamqKiouLi4v///9/f + 35ubm7Ozs9PT09PT06WlpcPDw/////T09J6enp6enqmpqZqampqamp6envT09P///8XFxaWlpdPT09PT + 0/f5/f7+/////9jY2JqamsTExO3t7ZqampqampqamtjY2P////7+//f5/dPT09PT0xxv/22i/////93d + 3ZqamsbGxu/v75qampqampqamt3d3f///2mg/xxv/9PT09PT00CG/wRg/67L//v7+6mpqbq6uuHh4Zqa + mpqamqmpqfv7+5e9/wFf/0eL/9PT09PT093q/xtv/wJf/2mg/9ji9b29vaCgoKCgoL29vc/d9FeV/wBe + /yh3/+jw/9PT09PT0////+Pt/0SJ/wBe/wJf/zR//1uX/1qX/zF8/wFf/wBe/1eV/+70/////9PT09PT + 0////////////7zU/1yY/x1w/wFf/wFf/x9x/2Kc/8jc/////////////9PT09PT0/////////////// + //////////z9//z9/////////////////////////9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT0///AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAIAAAAEAAAAABABgAAAAAAAAMAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /Pz84eHhycnJtra2qqqqpKSkpKSkqqqqtra2x8fH3t7e+fn5//////////////////////////////// + ////09PT09PT////////////////////////////7u7uwcHBn5+fmpqampqampqampqampqampqampqa + mpqampqampqanJycubm54+Pj////////////////////////////09PT09PT//////////////////// + 8/Pzvb29m5ubmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqasLCw6Ojo + ////////////////////09PT09PT////////////////2NjYn5+fmpqampqampqampqampqampqapqam + tbW1vb29vb29tbW1p6enmpqampqampqampqampqampqam5ubxcXF/Pz8////////////09PT09PT//// + /////f39wcHBmpqampqampqampqampqarKys1NTU8/Pz////////////////////////9vb22tratbW1 + mpqampqampqampqampqasLCw9vb2////////09PT09PT/////f39ubm5mpqampqampqampqaqqqq4eHh + ////////////////////////////////////////////////7e3tt7e3mpqampqampqampqaq6ur9/f3 + ////09PT09PT////wcHBmpqampqampqampqayMjI/Pz8////////////7e3txMTEqqqqnZ2dnZ2dqqqq + xMTE7e3t////////////////29vbn5+fmpqampqampqatLS0/v7+09PT09PT3t7empqampqampqanJyc + 3Nzc/////////////f39xsbGm5ubmpqampqampqampqampqampqam5ubxsbG/f39////////////7Ozs + o6Ojmpqampqampqa1tbW09PT09PTrKysmpqampqampqa3d3d/////////////v7+u7u7mpqampqampqa + mpqampqampqampqampqampqampqau7u7/v7+////////////6urqnZ2dmpqampqaqqqq09PT09PTnZ2d + mpqampqawcHB////////////////1dXVmpqampqampqampqampqampqampqampqampqampqampqampqa + 1dXV////////////////xcXFmpqampqanZ2d09PT09PTz8/Pm5ubqKio8/Pz/////////////v7+pKSk + mpqampqampqavLy819fXpaWlmpqampqampqampqampqampqapaWl/v7+////////////8/PzqKiom5ub + 0NDQ09PT09PT/////Pz8/v7+////////////////6+vrmpqampqampqanp6e/f39////19fXmpqampqa + mpqampqampqampqampqa6+vr/////////////////v7+/Pz8////09PT09PT////+Pr//v7///////// + ////////3t7empqampqampqaoqKi////////3d3dmpqampqampqampqampqampqampqa3t7e//////// + /////////v7/+Pr/////09PT09PTiLP/BWD/JXT/4ez/////////////4uLimpqampqampqaoqKi//// + ////3d3dmpqampqampqampqampqampqampqa4uLi////////////4ez/JXT/BWD/ibP/09PT09PTCmT/ + AF7/AF7/b6P/////////////9vb2m5ubmpqampqaoqKi////////3d3dmpqampqampqampqampqampqa + m5ub9vb2////////////Y5z/AF7/AF7/CmT/09PT09PTKnj/AF7/AF7/B2L/zN7/////////////ubm5 + mpqampqaoqKi////////3d3dmpqampqampqampqampqampqauLi4////////////qsj/AV//AF7/AF7/ + Lnr/09PT09PTmr7/AF7/AF7/AF7/F2z/0eH/////////8PDwn5+fmpqam5ub8fHx////yMjImpqampqa + mpqampqampqan5+f8PDw////////qMf/BmH/AF7/AF7/AF7/rcv/09PT09PT/f3/Qof/AF7/AF7/AF7/ + DWb/pcX/////////5eXloKCgmpqaoaGhsbGxmpqampqampqampqampqaoKCg5eXl////+fv/dqf/AV// + AF7/AF7/AF7/ZJz/////09PT09PT////7PL/Knj/AF7/AF7/AF7/AF7/Soz/0uL/////8fHxurq6m5ub + mpqampqampqampqam5uburq68fHx////tM//KXf/AF7/AF7/AF7/AF7/UI//+vz/////09PT09PT//// + ////6vH/OIH/AF7/AF7/AF7/AF7/AV//RYn/osP/6vH/9PT02trazs7Ozs7O2tra9PT04uz/k7r/L3v/ + AF7/AF7/AF7/AF7/AF7/ZJz/+vz/////////09PT09PT////////////+Pr/bqP/Al//AF7/AF7/AF7/ + AF7/AF7/AV7/InP/Ror/WJX/WZX/RYn/HnD/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ncH///////////// + ////09PT09PT////////////////////xtr/OIH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al//WZb/4u3/////////////////////09PT09PT//////////////////// + ////////utP/UJD/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ZZ3/1OP///////// + ////////////////////09PT09PT////////////////////////////////////8PX/rMr/cqX/R4r/ + Knj/G27/G27/Knj/SYv/d6n/ttD/9vn/////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAQAAAAIAAAAABABgAAAAAAAAwAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////////////////////////////////////////+vr66Ojo2dnZzc3NxMTE + v7+/vLy8vLy8v7+/xcXFzc3N2NjY5ubm+Pj4//////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////////////////////////////////////////////+fn53d3dwsLCqqqqmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqapaWlvLy81dXV8vLy//////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + /////////////////////////////////////////////////////////////////Pz83Nzct7e3nJyc + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaq6urzc3N8/Pz//////////////////////////////////////////////////////////////// + ////09PT09PT////////////////////////////////////////////////////////////9fX1ysrK + oqKimpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqam5ubtra24uLi//////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + 9vb2xcXFnZ2dmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqara2t4ODg//////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////f39z8/Pn5+fmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + sbGx6+vr////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////6Ojoqqqqmpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqam5ubxsbG+/v7////////////////////////////////////09PT09PT//// + /////////////////////////////f39ysrKm5ubmpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqaoqKirq6utbW1uLi4uLi4tbW1rq6uo6Ojmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqaqKio6urq//////////////////////////// + ////09PT09PT////////////////////////////9fX1sbGxmpqampqampqampqampqampqampqampqa + mpqampqampqampqampqanJyctLS0z8/P5eXl+fn5////////////////////////////////+/v76enp + 1NTUvLy8oaGhmpqampqampqampqampqampqampqampqampqampqampqampqampqanJyc1tbW//////// + ////////////////////09PT09PT////////////////////////6+vrpKSkmpqampqampqampqampqa + mpqampqampqampqampqampqampqasrKy2NjY+fn5//////////////////////////////////////// + /////////////////////////v7+5eXlwsLCn5+fmpqampqampqampqampqampqampqampqampqampqa + mpqampqaxcXF/v7+////////////////////09PT09PT////////////////////5OTkn5+fmpqampqa + mpqampqampqampqampqampqampqampqam5ubvr6+7Ozs//////////////////////////////////// + ////////////////////////////////////////////////////+vr61NTUpqammpqampqampqampqa + mpqampqampqampqampqampqampqavb29/v7+////////////////09PT09PT////////////////4+Pj + nZ2dmpqampqampqampqampqampqampqampqampqampqauLi47+/v//////////////////////////// + /////////////////////////////////////////////////////////////////////////////f39 + 1dXVoqKimpqampqampqampqampqampqampqampqampqampqavb29/v7+////////////09PT09PT//// + ////////6OjonZ2dmpqampqampqampqampqampqampqampqampqapaWl4eHh//////////////////// + ////////////////////////+/v76enp3d3d19fX19fX3d3d6enp+/v7//////////////////////// + ////////////////////+fn5w8PDmpqampqampqampqampqampqampqampqampqampqaxsbG//////// + ////09PT09PT////////8vLyoaGhmpqampqampqampqampqampqampqampqampqavr6++fn5//////// + ////////////////////////////9vb20NDQsLCwm5ubmpqampqampqampqampqampqam5ubsLCw0NDQ + 9vb2////////////////////////////////////////5OTkpKSkmpqampqampqampqampqampqampqa + mpqampqa29vb////////09PT09PT/////f39rq6umpqampqampqampqampqampqampqampqanJyc19fX + ////////////////////////////////////9/f3xMTEnZ2dmpqampqampqampqampqampqampqampqa + mpqampqampqampqanZ2dxMTE9/f3////////////////////////////////////9vb2sbGxmpqampqa + mpqampqampqampqampqampqan5+f8/Pz////09PT09PT////zMzMmpqampqampqampqampqampqampqa + mpqaoKCg5ubm////////////////////////////////////39/foqKimpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqaoqKi39/f//////////////////////////////// + /////Pz8urq6mpqampqampqampqampqampqampqampqau7u7////09PT09PT8/PznZ2dmpqampqampqa + mpqampqampqampqaoaGh7Ozs////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqazMzM//////////// + /////////////////////////f39urq6mpqampqampqampqampqampqampqampqa7Ozs09PT09PTx8fH + mpqampqampqampqampqampqampqanp6e6urq////////////////////////////////////ysrKmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaysrK/////////////////////////////////////Pz8sLCwmpqampqampqampqampqampqampqa + w8PD09PT09PTpaWlmpqampqampqampqampqampqampqa3t7e//////////////////////////////// + ////2dnZmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqa2dnZ////////////////////////////////////8/Pzn5+fmpqampqa + mpqampqampqampqapaWl09PT09PTm5ubmpqampqampqampqampqampqav7+///////////////////// + ////////////////8/Pznp6empqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqan5+f8/Pz//////////////////////////////// + ////zc3Nmpqampqampqampqampqampqam5ub09PT09PTrKysmpqampqampqampqampqam5ub8vLy//// + ////////////////////////////////vb29mpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29//////////////// + ////////////////////8/PzmpqampqampqampqampqampqarKys09PT09PT39/fmpqampqampqampqa + mpqawsLC////////////////////////////////////8fHxmpqampqampqampqampqampqampqampqa + mpqasLCwxcXFrq6umpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqam5ub + 8fHx////////////////////////////////////wsLCmpqampqampqampqampqa39/f09PT09PT//// + 3d3dqKiompqaoKCgysrK/f39////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqazs7O////////////yMjImpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqazMzM/////////////////////////////////////f39ysrKoKCgmpqaqKio3d3d + ////09PT09PT////////////+/v7/v7+////////////////////////////////////////////r6+v + mpqampqampqampqampqampqampqaqqqq/////////////////f39paWlmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqar6+v//////////////////////////////////////////// + /v7++/v7////////////09PT09PT//////////////////////////////////////////////////// + /////////f39nJycmpqampqampqampqampqampqampqavb29////////////////////uLi4mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqanJyc/v7+//////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////9PT0mpqampqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa9PT0//////// + ////////////////////////////////////////////////////09PT09PT////////////+vz//f7/ + ////////////////////////////////////////7+/vmpqampqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqa7u7u/////////////////////////////////////////f7/+vz/////////////09PT09PT//// + rMn/J3X/Al7/FGn/fKr/+/z/////////////////////////////////8/Pzmpqampqampqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqa8/Pz////////////////////////////////+/z/e6r/FGn/Al7/KHX/rMn/ + ////09PT09PTsMv/AV7/AF7/AF7/AF7/AF7/aJ7//////////////////////////////////Pz8m5ub + mpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqam5ub/f39////////////////////////////////aJ7/AF7/ + AF7/AF7/AF7/Al//sMz/09PT09PTMHv/AF7/AF7/AF7/AF7/AF7/A1//4+3///////////////////// + ////////////rKysmpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqarKys//////////////////////////// + ////3+r/Al7/AF7/AF7/AF7/AF7/AF7/MHv/09PT09PTBGD/AF7/AF7/AF7/AF7/AF7/AF7/hbD///// + ////////////////////////////x8fHmpqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqax8fH//////////// + ////////////////////YZr/AF7/AF7/AF7/AF7/AF7/AF7/BGD/09PT09PTHm//AF7/AF7/AF7/AF7/ + AF7/AF7/D2b/4uz/////////////////////////////7Ozsmpqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + 7Ozs////////////////////////////rcr/AV7/AF7/AF7/AF7/AF7/AF7/AF7/HnD/09PT09PTaZ// + AF7/AF7/AF7/AF7/AF7/AF7/AF7/OoH/+Pr/////////////////////////////tbW1mpqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqatbW1////////////////////////////zN7/DGX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + dKX/09PT09PTz+D/AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH//P3///////////////////////// + 7e3tm5ubmpqampqampqampqampqauLi4////////////////////srKympqampqampqampqampqampqa + mpqampqampqampqampqampqanJyc7e3t////////////////////////0OD/FGn/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/CWP/4+z/09PT09PT////VJH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH/+fv///// + ////////////////////zs7OmpqampqampqampqampqanZ2d8vLy////////////7e3tm5ubmpqampqa + mpqampqampqampqampqampqampqampqampqampqazs7O////////////////////////wtf/EWj/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/gK3/////09PT09PT////4ez/Dmb/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/PYP/6fD//////////////////////v7+vb29mpqampqampqampqampqaqKio4+Pj+fn54ODg + paWlmpqampqampqampqampqampqampqampqampqampqampqampqavLy8/v7+//////////////////// + nL//B2L/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/NH3/+vv/////09PT09PT////////pcX/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/G27/vtX//////////////////////f39vb29mpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29/f39//////// + ////////8fb/Xpj/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/3+r/////////09PT09PT//// + ////////c6T/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Al//bKD/8fb///////////////////// + 0NDQnJycmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqanJyc0NDQ + ////////////////////ttD/H3D/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CmT/xtr///////// + ////09PT09PT/////////////f3/WZX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/GGz/mL3/ + +/z/////////////////7u7utra2mpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqatra27u7u////////////////2OX/T47/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/ + utL/////////////////09PT09PT////////////////+vz/WZT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/InL/lbr/9Pj/////////////////6urqwsLCoqKimpqampqampqampqampqampqa + mpqampqaoqKiwsLC6urq////////////////0+L/XZf/BGD/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/DWX/vdT/////////////////////09PT09PT/////////////////////P3/bqL/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/EGf/Z53/wdb//P3//////////////v7+7e3t2tra + zs7OyMjIyMjIzs7O2tra7e3t/v7+////////////8PX/oMH/P4T/AV7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/HG7/z9//////////////////////////09PT09PT//////////////////// + ////////mL3/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/WJT/lrv/ + ytz/9fn/////////////////////////////////8fb/wdb/iLL/RIj/B2L/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/PYP/5+//////////////////////////////09PT09PT//// + ////////////////////////////zN7/JnT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al7/Gm3/NH3/Ron/To7/T47/R4n/NH3/GGz/AV3/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/A1//fKv/+/z///////////////////////////// + ////09PT09PT////////////////////////////////////9Pj/cKP/Al//AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Knf/x9r///////////////////// + ////////////////////09PT09PT////////////////////////////////////////////zd7/PIP/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Dmb/ibP/+fv///////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////////v7/sc3/MXz/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/cKP/6fH/ + ////////////////////////////////////////////////////09PT09PT//////////////////// + /////////////////////////////////////v//uNH/Sov/Al7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/ + e6r/5+//////////////////////////////////////////////////////////////09PT09PT//// + ////////////////////////////////////////////////////////////////4Or/hLD/LXj/AV7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + BmH/TI3/qcf/9/r///////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////3en/l7z/V5P/HW//AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + A17/KXb/Zp3/q8n/7/X///////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + /////////////////////////////////////////v//7PL/wtf/n8H/g6//bqL/YJn/WZT/WJT/X5n/ + bqL/hLD/osP/x9r/8fb///////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PTAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + + \ No newline at end of file diff --git a/GUI.NET/Forms/NetPlay/frmClientConfig.Designer.cs b/GUI.NET/Forms/NetPlay/frmClientConfig.Designer.cs new file mode 100644 index 00000000..6a9a1843 --- /dev/null +++ b/GUI.NET/Forms/NetPlay/frmClientConfig.Designer.cs @@ -0,0 +1,186 @@ +namespace Mesen.GUI.Forms.NetPlay +{ + partial class frmClientConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmClientConfig)); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.txtPort = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.lblHost = new System.Windows.Forms.Label(); + this.lblPort = new System.Windows.Forms.Label(); + this.txtHost = new System.Windows.Forms.TextBox(); + this.chkSpectator = new System.Windows.Forms.CheckBox(); + this.tableLayoutPanel1.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.txtPort, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.lblHost, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.lblPort, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.txtHost, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.chkSpectator, 0, 2); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + 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.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(290, 140); + this.tableLayoutPanel1.TabIndex = 0; + // + // txtPort + // + this.txtPort.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtPort.Location = new System.Drawing.Point(41, 29); + this.txtPort.Name = "txtPort"; + this.txtPort.Size = new System.Drawing.Size(246, 20); + this.txtPort.TabIndex = 6; + this.txtPort.TextChanged += new System.EventHandler(this.Field_TextChanged); + // + // flowLayoutPanel1 + // + this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 2); + this.flowLayoutPanel1.Controls.Add(this.btnCancel); + this.flowLayoutPanel1.Controls.Add(this.btnOK); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 111); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(290, 29); + this.flowLayoutPanel1.TabIndex = 2; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(212, 3); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 0; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // btnOK + // + this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnOK.Location = new System.Drawing.Point(131, 3); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 1; + this.btnOK.Text = "Connect"; + this.btnOK.UseVisualStyleBackColor = true; + // + // lblHost + // + this.lblHost.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblHost.AutoSize = true; + this.lblHost.Location = new System.Drawing.Point(3, 6); + this.lblHost.Name = "lblHost"; + this.lblHost.Size = new System.Drawing.Size(32, 13); + this.lblHost.TabIndex = 3; + this.lblHost.Text = "Host:"; + // + // lblPort + // + this.lblPort.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblPort.AutoSize = true; + this.lblPort.Location = new System.Drawing.Point(3, 32); + this.lblPort.Name = "lblPort"; + this.lblPort.Size = new System.Drawing.Size(29, 13); + this.lblPort.TabIndex = 4; + this.lblPort.Text = "Port:"; + // + // txtHost + // + this.txtHost.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtHost.Location = new System.Drawing.Point(41, 3); + this.txtHost.Name = "txtHost"; + this.txtHost.Size = new System.Drawing.Size(246, 20); + this.txtHost.TabIndex = 5; + this.txtHost.TextChanged += new System.EventHandler(this.Field_TextChanged); + // + // chkSpectator + // + this.chkSpectator.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.chkSpectator, 2); + this.chkSpectator.Enabled = false; + this.chkSpectator.Location = new System.Drawing.Point(3, 55); + this.chkSpectator.Name = "chkSpectator"; + this.chkSpectator.Size = new System.Drawing.Size(106, 17); + this.chkSpectator.TabIndex = 7; + this.chkSpectator.Text = "Join as spectator"; + this.chkSpectator.UseVisualStyleBackColor = true; + // + // frmClientConfig + // + this.AcceptButton = this.btnOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(290, 140); + this.Controls.Add(this.tableLayoutPanel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(306, 178); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(306, 178); + this.Name = "frmClientConfig"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Connect..."; + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.TextBox txtPort; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Label lblHost; + private System.Windows.Forms.Label lblPort; + private System.Windows.Forms.TextBox txtHost; + private System.Windows.Forms.CheckBox chkSpectator; + } +} \ No newline at end of file diff --git a/GUI.NET/Forms/NetPlay/frmClientConfig.cs b/GUI.NET/Forms/NetPlay/frmClientConfig.cs new file mode 100644 index 00000000..94919336 --- /dev/null +++ b/GUI.NET/Forms/NetPlay/frmClientConfig.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Mesen.GUI.Forms.NetPlay +{ + public partial class frmClientConfig : BaseConfigForm + { + public frmClientConfig() + { + InitializeComponent(); + + this.txtHost.Text = ConfigManager.Config.ClientConnectionInfo.Host; + this.txtPort.Text = ConfigManager.Config.ClientConnectionInfo.Port.ToString(); + } + + protected override void UpdateConfig() + { + ConfigManager.Config.ClientConnectionInfo = new ClientConnectionInfo() { Host = this.txtHost.Text, Port = Convert.ToUInt16(this.txtPort.Text) }; + } + + private void Field_TextChanged(object sender, EventArgs e) + { + UInt16 port; + if(!UInt16.TryParse(this.txtPort.Text, out port)) { + this.btnOK.Enabled = false; + } else { + this.btnOK.Enabled = !string.IsNullOrWhiteSpace(this.txtHost.Text); + } + } + } +} diff --git a/GUI.NET/Forms/NetPlay/frmClientConfig.resx b/GUI.NET/Forms/NetPlay/frmClientConfig.resx new file mode 100644 index 00000000..f7d049ce --- /dev/null +++ b/GUI.NET/Forms/NetPlay/frmClientConfig.resx @@ -0,0 +1,409 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAMAEBAAAAAAGABoAwAANgAAACAgAAAAABgAqAwAAJ4DAABAQAAAAAAYACgyAABGEAAAKAAAABAA + AAAgAAAAAQAYAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAANPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT0/////////////////////////7+/v7+/v///////////////////////9PT09PT + 0////////////+np6cHBwaamppubm5qamqWlpb6+vuTk5P///////////9PT09PT0/////j4+Ly8vJqa + mpqamq2trb6+vr6+vq6urpubm5qamrW1tfT09P///9PT09PT0/b29qqqqpqamry8vPDw8Pz8/Ofn5+fn + 5/z8/PPz88PDw5ubm6WlpfLy8tPT09PT07a2tpqamtbW1v///+Li4qKiopqampqamqKiouLi4v///9/f + 35ubm7Ozs9PT09PT06WlpcPDw/////T09J6enp6enqmpqZqampqamp6envT09P///8XFxaWlpdPT09PT + 0/f5/f7+/////9jY2JqamsTExO3t7ZqampqampqamtjY2P////7+//f5/dPT09PT0xxv/22i/////93d + 3ZqamsbGxu/v75qampqampqamt3d3f///2mg/xxv/9PT09PT00CG/wRg/67L//v7+6mpqbq6uuHh4Zqa + mpqamqmpqfv7+5e9/wFf/0eL/9PT09PT093q/xtv/wJf/2mg/9ji9b29vaCgoKCgoL29vc/d9FeV/wBe + /yh3/+jw/9PT09PT0////+Pt/0SJ/wBe/wJf/zR//1uX/1qX/zF8/wFf/wBe/1eV/+70/////9PT09PT + 0////////////7zU/1yY/x1w/wFf/wFf/x9x/2Kc/8jc/////////////9PT09PT0/////////////// + //////////z9//z9/////////////////////////9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT0///AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAIAAAAEAAAAABABgAAAAAAAAMAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /Pz84eHhycnJtra2qqqqpKSkpKSkqqqqtra2x8fH3t7e+fn5//////////////////////////////// + ////09PT09PT////////////////////////////7u7uwcHBn5+fmpqampqampqampqampqampqampqa + mpqampqampqanJycubm54+Pj////////////////////////////09PT09PT//////////////////// + 8/Pzvb29m5ubmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqasLCw6Ojo + ////////////////////09PT09PT////////////////2NjYn5+fmpqampqampqampqampqampqapqam + tbW1vb29vb29tbW1p6enmpqampqampqampqampqampqam5ubxcXF/Pz8////////////09PT09PT//// + /////f39wcHBmpqampqampqampqampqarKys1NTU8/Pz////////////////////////9vb22tratbW1 + mpqampqampqampqampqasLCw9vb2////////09PT09PT/////f39ubm5mpqampqampqampqaqqqq4eHh + ////////////////////////////////////////////////7e3tt7e3mpqampqampqampqaq6ur9/f3 + ////09PT09PT////wcHBmpqampqampqampqayMjI/Pz8////////////7e3txMTEqqqqnZ2dnZ2dqqqq + xMTE7e3t////////////////29vbn5+fmpqampqampqatLS0/v7+09PT09PT3t7empqampqampqanJyc + 3Nzc/////////////f39xsbGm5ubmpqampqampqampqampqampqam5ubxsbG/f39////////////7Ozs + o6Ojmpqampqampqa1tbW09PT09PTrKysmpqampqampqa3d3d/////////////v7+u7u7mpqampqampqa + mpqampqampqampqampqampqampqau7u7/v7+////////////6urqnZ2dmpqampqaqqqq09PT09PTnZ2d + mpqampqawcHB////////////////1dXVmpqampqampqampqampqampqampqampqampqampqampqampqa + 1dXV////////////////xcXFmpqampqanZ2d09PT09PTz8/Pm5ubqKio8/Pz/////////////v7+pKSk + mpqampqampqavLy819fXpaWlmpqampqampqampqampqampqapaWl/v7+////////////8/PzqKiom5ub + 0NDQ09PT09PT/////Pz8/v7+////////////////6+vrmpqampqampqanp6e/f39////19fXmpqampqa + mpqampqampqampqampqa6+vr/////////////////v7+/Pz8////09PT09PT////+Pr//v7///////// + ////////3t7empqampqampqaoqKi////////3d3dmpqampqampqampqampqampqampqa3t7e//////// + /////////v7/+Pr/////09PT09PTiLP/BWD/JXT/4ez/////////////4uLimpqampqampqaoqKi//// + ////3d3dmpqampqampqampqampqampqampqa4uLi////////////4ez/JXT/BWD/ibP/09PT09PTCmT/ + AF7/AF7/b6P/////////////9vb2m5ubmpqampqaoqKi////////3d3dmpqampqampqampqampqampqa + m5ub9vb2////////////Y5z/AF7/AF7/CmT/09PT09PTKnj/AF7/AF7/B2L/zN7/////////////ubm5 + mpqampqaoqKi////////3d3dmpqampqampqampqampqampqauLi4////////////qsj/AV//AF7/AF7/ + Lnr/09PT09PTmr7/AF7/AF7/AF7/F2z/0eH/////////8PDwn5+fmpqam5ub8fHx////yMjImpqampqa + mpqampqampqan5+f8PDw////////qMf/BmH/AF7/AF7/AF7/rcv/09PT09PT/f3/Qof/AF7/AF7/AF7/ + DWb/pcX/////////5eXloKCgmpqaoaGhsbGxmpqampqampqampqampqaoKCg5eXl////+fv/dqf/AV// + AF7/AF7/AF7/ZJz/////09PT09PT////7PL/Knj/AF7/AF7/AF7/AF7/Soz/0uL/////8fHxurq6m5ub + mpqampqampqampqam5uburq68fHx////tM//KXf/AF7/AF7/AF7/AF7/UI//+vz/////09PT09PT//// + ////6vH/OIH/AF7/AF7/AF7/AF7/AV//RYn/osP/6vH/9PT02trazs7Ozs7O2tra9PT04uz/k7r/L3v/ + AF7/AF7/AF7/AF7/AF7/ZJz/+vz/////////09PT09PT////////////+Pr/bqP/Al//AF7/AF7/AF7/ + AF7/AF7/AV7/InP/Ror/WJX/WZX/RYn/HnD/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ncH///////////// + ////09PT09PT////////////////////xtr/OIH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al//WZb/4u3/////////////////////09PT09PT//////////////////// + ////////utP/UJD/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ZZ3/1OP///////// + ////////////////////09PT09PT////////////////////////////////////8PX/rMr/cqX/R4r/ + Knj/G27/G27/Knj/SYv/d6n/ttD/9vn/////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAQAAAAIAAAAABABgAAAAAAAAwAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////////////////////////////////////////+vr66Ojo2dnZzc3NxMTE + v7+/vLy8vLy8v7+/xcXFzc3N2NjY5ubm+Pj4//////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////////////////////////////////////////////+fn53d3dwsLCqqqqmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqapaWlvLy81dXV8vLy//////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + /////////////////////////////////////////////////////////////////Pz83Nzct7e3nJyc + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaq6urzc3N8/Pz//////////////////////////////////////////////////////////////// + ////09PT09PT////////////////////////////////////////////////////////////9fX1ysrK + oqKimpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqam5ubtra24uLi//////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + 9vb2xcXFnZ2dmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqara2t4ODg//////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////f39z8/Pn5+fmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + sbGx6+vr////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////6Ojoqqqqmpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqam5ubxsbG+/v7////////////////////////////////////09PT09PT//// + /////////////////////////////f39ysrKm5ubmpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqaoqKirq6utbW1uLi4uLi4tbW1rq6uo6Ojmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqaqKio6urq//////////////////////////// + ////09PT09PT////////////////////////////9fX1sbGxmpqampqampqampqampqampqampqampqa + mpqampqampqampqampqanJyctLS0z8/P5eXl+fn5////////////////////////////////+/v76enp + 1NTUvLy8oaGhmpqampqampqampqampqampqampqampqampqampqampqampqampqanJyc1tbW//////// + ////////////////////09PT09PT////////////////////////6+vrpKSkmpqampqampqampqampqa + mpqampqampqampqampqampqampqasrKy2NjY+fn5//////////////////////////////////////// + /////////////////////////v7+5eXlwsLCn5+fmpqampqampqampqampqampqampqampqampqampqa + mpqampqaxcXF/v7+////////////////////09PT09PT////////////////////5OTkn5+fmpqampqa + mpqampqampqampqampqampqampqampqam5ubvr6+7Ozs//////////////////////////////////// + ////////////////////////////////////////////////////+vr61NTUpqammpqampqampqampqa + mpqampqampqampqampqampqampqavb29/v7+////////////////09PT09PT////////////////4+Pj + nZ2dmpqampqampqampqampqampqampqampqampqampqauLi47+/v//////////////////////////// + /////////////////////////////////////////////////////////////////////////////f39 + 1dXVoqKimpqampqampqampqampqampqampqampqampqampqavb29/v7+////////////09PT09PT//// + ////////6OjonZ2dmpqampqampqampqampqampqampqampqampqapaWl4eHh//////////////////// + ////////////////////////+/v76enp3d3d19fX19fX3d3d6enp+/v7//////////////////////// + ////////////////////+fn5w8PDmpqampqampqampqampqampqampqampqampqampqaxsbG//////// + ////09PT09PT////////8vLyoaGhmpqampqampqampqampqampqampqampqampqavr6++fn5//////// + ////////////////////////////9vb20NDQsLCwm5ubmpqampqampqampqampqampqam5ubsLCw0NDQ + 9vb2////////////////////////////////////////5OTkpKSkmpqampqampqampqampqampqampqa + mpqampqa29vb////////09PT09PT/////f39rq6umpqampqampqampqampqampqampqampqanJyc19fX + ////////////////////////////////////9/f3xMTEnZ2dmpqampqampqampqampqampqampqampqa + mpqampqampqampqanZ2dxMTE9/f3////////////////////////////////////9vb2sbGxmpqampqa + mpqampqampqampqampqampqan5+f8/Pz////09PT09PT////zMzMmpqampqampqampqampqampqampqa + mpqaoKCg5ubm////////////////////////////////////39/foqKimpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqaoqKi39/f//////////////////////////////// + /////Pz8urq6mpqampqampqampqampqampqampqampqau7u7////09PT09PT8/PznZ2dmpqampqampqa + mpqampqampqampqaoaGh7Ozs////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqazMzM//////////// + /////////////////////////f39urq6mpqampqampqampqampqampqampqampqa7Ozs09PT09PTx8fH + mpqampqampqampqampqampqampqanp6e6urq////////////////////////////////////ysrKmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaysrK/////////////////////////////////////Pz8sLCwmpqampqampqampqampqampqampqa + w8PD09PT09PTpaWlmpqampqampqampqampqampqampqa3t7e//////////////////////////////// + ////2dnZmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqa2dnZ////////////////////////////////////8/Pzn5+fmpqampqa + mpqampqampqampqapaWl09PT09PTm5ubmpqampqampqampqampqampqav7+///////////////////// + ////////////////8/Pznp6empqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqan5+f8/Pz//////////////////////////////// + ////zc3Nmpqampqampqampqampqampqam5ub09PT09PTrKysmpqampqampqampqampqam5ub8vLy//// + ////////////////////////////////vb29mpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29//////////////// + ////////////////////8/PzmpqampqampqampqampqampqarKys09PT09PT39/fmpqampqampqampqa + mpqawsLC////////////////////////////////////8fHxmpqampqampqampqampqampqampqampqa + mpqasLCwxcXFrq6umpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqam5ub + 8fHx////////////////////////////////////wsLCmpqampqampqampqampqa39/f09PT09PT//// + 3d3dqKiompqaoKCgysrK/f39////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqazs7O////////////yMjImpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqazMzM/////////////////////////////////////f39ysrKoKCgmpqaqKio3d3d + ////09PT09PT////////////+/v7/v7+////////////////////////////////////////////r6+v + mpqampqampqampqampqampqampqaqqqq/////////////////f39paWlmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqar6+v//////////////////////////////////////////// + /v7++/v7////////////09PT09PT//////////////////////////////////////////////////// + /////////f39nJycmpqampqampqampqampqampqampqavb29////////////////////uLi4mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqanJyc/v7+//////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////9PT0mpqampqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa9PT0//////// + ////////////////////////////////////////////////////09PT09PT////////////+vz//f7/ + ////////////////////////////////////////7+/vmpqampqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqa7u7u/////////////////////////////////////////f7/+vz/////////////09PT09PT//// + rMn/J3X/Al7/FGn/fKr/+/z/////////////////////////////////8/Pzmpqampqampqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqa8/Pz////////////////////////////////+/z/e6r/FGn/Al7/KHX/rMn/ + ////09PT09PTsMv/AV7/AF7/AF7/AF7/AF7/aJ7//////////////////////////////////Pz8m5ub + mpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqam5ub/f39////////////////////////////////aJ7/AF7/ + AF7/AF7/AF7/Al//sMz/09PT09PTMHv/AF7/AF7/AF7/AF7/AF7/A1//4+3///////////////////// + ////////////rKysmpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqarKys//////////////////////////// + ////3+r/Al7/AF7/AF7/AF7/AF7/AF7/MHv/09PT09PTBGD/AF7/AF7/AF7/AF7/AF7/AF7/hbD///// + ////////////////////////////x8fHmpqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqax8fH//////////// + ////////////////////YZr/AF7/AF7/AF7/AF7/AF7/AF7/BGD/09PT09PTHm//AF7/AF7/AF7/AF7/ + AF7/AF7/D2b/4uz/////////////////////////////7Ozsmpqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + 7Ozs////////////////////////////rcr/AV7/AF7/AF7/AF7/AF7/AF7/AF7/HnD/09PT09PTaZ// + AF7/AF7/AF7/AF7/AF7/AF7/AF7/OoH/+Pr/////////////////////////////tbW1mpqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqatbW1////////////////////////////zN7/DGX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + dKX/09PT09PTz+D/AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH//P3///////////////////////// + 7e3tm5ubmpqampqampqampqampqauLi4////////////////////srKympqampqampqampqampqampqa + mpqampqampqampqampqampqanJyc7e3t////////////////////////0OD/FGn/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/CWP/4+z/09PT09PT////VJH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH/+fv///// + ////////////////////zs7OmpqampqampqampqampqanZ2d8vLy////////////7e3tm5ubmpqampqa + mpqampqampqampqampqampqampqampqampqampqazs7O////////////////////////wtf/EWj/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/gK3/////09PT09PT////4ez/Dmb/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/PYP/6fD//////////////////////v7+vb29mpqampqampqampqampqaqKio4+Pj+fn54ODg + paWlmpqampqampqampqampqampqampqampqampqampqampqampqavLy8/v7+//////////////////// + nL//B2L/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/NH3/+vv/////09PT09PT////////pcX/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/G27/vtX//////////////////////f39vb29mpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29/f39//////// + ////////8fb/Xpj/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/3+r/////////09PT09PT//// + ////////c6T/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Al//bKD/8fb///////////////////// + 0NDQnJycmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqanJyc0NDQ + ////////////////////ttD/H3D/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CmT/xtr///////// + ////09PT09PT/////////////f3/WZX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/GGz/mL3/ + +/z/////////////////7u7utra2mpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqatra27u7u////////////////2OX/T47/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/ + utL/////////////////09PT09PT////////////////+vz/WZT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/InL/lbr/9Pj/////////////////6urqwsLCoqKimpqampqampqampqampqampqa + mpqampqaoqKiwsLC6urq////////////////0+L/XZf/BGD/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/DWX/vdT/////////////////////09PT09PT/////////////////////P3/bqL/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/EGf/Z53/wdb//P3//////////////v7+7e3t2tra + zs7OyMjIyMjIzs7O2tra7e3t/v7+////////////8PX/oMH/P4T/AV7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/HG7/z9//////////////////////////09PT09PT//////////////////// + ////////mL3/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/WJT/lrv/ + ytz/9fn/////////////////////////////////8fb/wdb/iLL/RIj/B2L/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/PYP/5+//////////////////////////////09PT09PT//// + ////////////////////////////zN7/JnT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al7/Gm3/NH3/Ron/To7/T47/R4n/NH3/GGz/AV3/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/A1//fKv/+/z///////////////////////////// + ////09PT09PT////////////////////////////////////9Pj/cKP/Al//AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Knf/x9r///////////////////// + ////////////////////09PT09PT////////////////////////////////////////////zd7/PIP/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Dmb/ibP/+fv///////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////////v7/sc3/MXz/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/cKP/6fH/ + ////////////////////////////////////////////////////09PT09PT//////////////////// + /////////////////////////////////////v//uNH/Sov/Al7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/ + e6r/5+//////////////////////////////////////////////////////////////09PT09PT//// + ////////////////////////////////////////////////////////////////4Or/hLD/LXj/AV7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + BmH/TI3/qcf/9/r///////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////3en/l7z/V5P/HW//AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + A17/KXb/Zp3/q8n/7/X///////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + /////////////////////////////////////////v//7PL/wtf/n8H/g6//bqL/YJn/WZT/WJT/X5n/ + bqL/hLD/osP/x9r/8fb///////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PTAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + + \ No newline at end of file diff --git a/GUI.NET/Forms/NetPlay/frmPlayerProfile.Designer.cs b/GUI.NET/Forms/NetPlay/frmPlayerProfile.Designer.cs new file mode 100644 index 00000000..e8a275a3 --- /dev/null +++ b/GUI.NET/Forms/NetPlay/frmPlayerProfile.Designer.cs @@ -0,0 +1,171 @@ +namespace Mesen.GUI.Forms.NetPlay +{ + partial class frmPlayerProfile + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmPlayerProfile)); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.lblName = new System.Windows.Forms.Label(); + this.lblAvatar = new System.Windows.Forms.Label(); + this.txtPlayerName = new System.Windows.Forms.TextBox(); + this.picAvatar = new System.Windows.Forms.PictureBox(); + this.tableLayoutPanel1.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picAvatar)).BeginInit(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.lblName, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.lblAvatar, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.txtPlayerName, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.picAvatar, 1, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + 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.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(302, 163); + this.tableLayoutPanel1.TabIndex = 1; + // + // flowLayoutPanel1 + // + this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 2); + this.flowLayoutPanel1.Controls.Add(this.btnCancel); + this.flowLayoutPanel1.Controls.Add(this.btnOK); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 134); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(302, 29); + this.flowLayoutPanel1.TabIndex = 2; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(224, 3); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 0; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // btnOK + // + this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnOK.Location = new System.Drawing.Point(143, 3); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 1; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + // + // lblName + // + this.lblName.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblName.AutoSize = true; + this.lblName.Location = new System.Drawing.Point(3, 6); + this.lblName.Name = "lblName"; + this.lblName.Size = new System.Drawing.Size(68, 13); + this.lblName.TabIndex = 3; + this.lblName.Text = "Player name:"; + // + // lblAvatar + // + this.lblAvatar.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblAvatar.AutoSize = true; + this.lblAvatar.Location = new System.Drawing.Point(3, 55); + this.lblAvatar.Name = "lblAvatar"; + this.lblAvatar.Size = new System.Drawing.Size(41, 13); + this.lblAvatar.TabIndex = 4; + this.lblAvatar.Text = "Avatar:"; + // + // txtPlayerName + // + this.txtPlayerName.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtPlayerName.Location = new System.Drawing.Point(77, 3); + this.txtPlayerName.Name = "txtPlayerName"; + this.txtPlayerName.Size = new System.Drawing.Size(222, 20); + this.txtPlayerName.TabIndex = 5; + this.txtPlayerName.Text = "DefaultPlayer"; + // + // picAvatar + // + this.picAvatar.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.picAvatar.Location = new System.Drawing.Point(77, 29); + this.picAvatar.Name = "picAvatar"; + this.picAvatar.Size = new System.Drawing.Size(66, 66); + this.picAvatar.TabIndex = 8; + this.picAvatar.TabStop = false; + this.picAvatar.Click += new System.EventHandler(this.picAvatar_Click); + // + // frmPlayerProfile + // + this.AcceptButton = this.btnOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(302, 163); + this.Controls.Add(this.tableLayoutPanel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "frmPlayerProfile"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Profile"; + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.picAvatar)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Label lblName; + private System.Windows.Forms.Label lblAvatar; + private System.Windows.Forms.TextBox txtPlayerName; + private System.Windows.Forms.PictureBox picAvatar; + } +} \ No newline at end of file diff --git a/GUI.NET/Forms/NetPlay/frmPlayerProfile.cs b/GUI.NET/Forms/NetPlay/frmPlayerProfile.cs new file mode 100644 index 00000000..b7dd2ddd --- /dev/null +++ b/GUI.NET/Forms/NetPlay/frmPlayerProfile.cs @@ -0,0 +1,44 @@ +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.NetPlay +{ + public partial class frmPlayerProfile : BaseConfigForm + { + public frmPlayerProfile() + { + InitializeComponent(); + + this.txtPlayerName.Text = ConfigManager.Config.Profile.PlayerName; + this.picAvatar.Image = ConfigManager.Config.Profile.GetAvatarImage(); + } + + private void picAvatar_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Filter = "All supported image files (*.bmp, *.jpg, *.png)|*.bmp;*.jpg;*.png"; + if(ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { + try { + this.picAvatar.Image = Image.FromFile(ofd.FileName).ResizeImage(64, 64); + } catch { + MessageBox.Show("Invalid image format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + protected override void UpdateConfig() + { + PlayerProfile profile = new PlayerProfile(); + profile.PlayerName = this.txtPlayerName.Text; + profile.SetAvatar(this.picAvatar.Image); + ConfigManager.Config.Profile = profile; + } + } +} diff --git a/GUI.NET/Forms/NetPlay/frmPlayerProfile.resx b/GUI.NET/Forms/NetPlay/frmPlayerProfile.resx new file mode 100644 index 00000000..f7d049ce --- /dev/null +++ b/GUI.NET/Forms/NetPlay/frmPlayerProfile.resx @@ -0,0 +1,409 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAMAEBAAAAAAGABoAwAANgAAACAgAAAAABgAqAwAAJ4DAABAQAAAAAAYACgyAABGEAAAKAAAABAA + AAAgAAAAAQAYAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAANPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT0/////////////////////////7+/v7+/v///////////////////////9PT09PT + 0////////////+np6cHBwaamppubm5qamqWlpb6+vuTk5P///////////9PT09PT0/////j4+Ly8vJqa + mpqamq2trb6+vr6+vq6urpubm5qamrW1tfT09P///9PT09PT0/b29qqqqpqamry8vPDw8Pz8/Ofn5+fn + 5/z8/PPz88PDw5ubm6WlpfLy8tPT09PT07a2tpqamtbW1v///+Li4qKiopqampqamqKiouLi4v///9/f + 35ubm7Ozs9PT09PT06WlpcPDw/////T09J6enp6enqmpqZqampqamp6envT09P///8XFxaWlpdPT09PT + 0/f5/f7+/////9jY2JqamsTExO3t7ZqampqampqamtjY2P////7+//f5/dPT09PT0xxv/22i/////93d + 3ZqamsbGxu/v75qampqampqamt3d3f///2mg/xxv/9PT09PT00CG/wRg/67L//v7+6mpqbq6uuHh4Zqa + mpqamqmpqfv7+5e9/wFf/0eL/9PT09PT093q/xtv/wJf/2mg/9ji9b29vaCgoKCgoL29vc/d9FeV/wBe + /yh3/+jw/9PT09PT0////+Pt/0SJ/wBe/wJf/zR//1uX/1qX/zF8/wFf/wBe/1eV/+70/////9PT09PT + 0////////////7zU/1yY/x1w/wFf/wFf/x9x/2Kc/8jc/////////////9PT09PT0/////////////// + //////////z9//z9/////////////////////////9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT0///AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAIAAAAEAAAAABABgAAAAAAAAMAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /Pz84eHhycnJtra2qqqqpKSkpKSkqqqqtra2x8fH3t7e+fn5//////////////////////////////// + ////09PT09PT////////////////////////////7u7uwcHBn5+fmpqampqampqampqampqampqampqa + mpqampqampqanJycubm54+Pj////////////////////////////09PT09PT//////////////////// + 8/Pzvb29m5ubmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqasLCw6Ojo + ////////////////////09PT09PT////////////////2NjYn5+fmpqampqampqampqampqampqapqam + tbW1vb29vb29tbW1p6enmpqampqampqampqampqampqam5ubxcXF/Pz8////////////09PT09PT//// + /////f39wcHBmpqampqampqampqampqarKys1NTU8/Pz////////////////////////9vb22tratbW1 + mpqampqampqampqampqasLCw9vb2////////09PT09PT/////f39ubm5mpqampqampqampqaqqqq4eHh + ////////////////////////////////////////////////7e3tt7e3mpqampqampqampqaq6ur9/f3 + ////09PT09PT////wcHBmpqampqampqampqayMjI/Pz8////////////7e3txMTEqqqqnZ2dnZ2dqqqq + xMTE7e3t////////////////29vbn5+fmpqampqampqatLS0/v7+09PT09PT3t7empqampqampqanJyc + 3Nzc/////////////f39xsbGm5ubmpqampqampqampqampqampqam5ubxsbG/f39////////////7Ozs + o6Ojmpqampqampqa1tbW09PT09PTrKysmpqampqampqa3d3d/////////////v7+u7u7mpqampqampqa + mpqampqampqampqampqampqampqau7u7/v7+////////////6urqnZ2dmpqampqaqqqq09PT09PTnZ2d + mpqampqawcHB////////////////1dXVmpqampqampqampqampqampqampqampqampqampqampqampqa + 1dXV////////////////xcXFmpqampqanZ2d09PT09PTz8/Pm5ubqKio8/Pz/////////////v7+pKSk + mpqampqampqavLy819fXpaWlmpqampqampqampqampqampqapaWl/v7+////////////8/PzqKiom5ub + 0NDQ09PT09PT/////Pz8/v7+////////////////6+vrmpqampqampqanp6e/f39////19fXmpqampqa + mpqampqampqampqampqa6+vr/////////////////v7+/Pz8////09PT09PT////+Pr//v7///////// + ////////3t7empqampqampqaoqKi////////3d3dmpqampqampqampqampqampqampqa3t7e//////// + /////////v7/+Pr/////09PT09PTiLP/BWD/JXT/4ez/////////////4uLimpqampqampqaoqKi//// + ////3d3dmpqampqampqampqampqampqampqa4uLi////////////4ez/JXT/BWD/ibP/09PT09PTCmT/ + AF7/AF7/b6P/////////////9vb2m5ubmpqampqaoqKi////////3d3dmpqampqampqampqampqampqa + m5ub9vb2////////////Y5z/AF7/AF7/CmT/09PT09PTKnj/AF7/AF7/B2L/zN7/////////////ubm5 + mpqampqaoqKi////////3d3dmpqampqampqampqampqampqauLi4////////////qsj/AV//AF7/AF7/ + Lnr/09PT09PTmr7/AF7/AF7/AF7/F2z/0eH/////////8PDwn5+fmpqam5ub8fHx////yMjImpqampqa + mpqampqampqan5+f8PDw////////qMf/BmH/AF7/AF7/AF7/rcv/09PT09PT/f3/Qof/AF7/AF7/AF7/ + DWb/pcX/////////5eXloKCgmpqaoaGhsbGxmpqampqampqampqampqaoKCg5eXl////+fv/dqf/AV// + AF7/AF7/AF7/ZJz/////09PT09PT////7PL/Knj/AF7/AF7/AF7/AF7/Soz/0uL/////8fHxurq6m5ub + mpqampqampqampqam5uburq68fHx////tM//KXf/AF7/AF7/AF7/AF7/UI//+vz/////09PT09PT//// + ////6vH/OIH/AF7/AF7/AF7/AF7/AV//RYn/osP/6vH/9PT02trazs7Ozs7O2tra9PT04uz/k7r/L3v/ + AF7/AF7/AF7/AF7/AF7/ZJz/+vz/////////09PT09PT////////////+Pr/bqP/Al//AF7/AF7/AF7/ + AF7/AF7/AV7/InP/Ror/WJX/WZX/RYn/HnD/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ncH///////////// + ////09PT09PT////////////////////xtr/OIH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al//WZb/4u3/////////////////////09PT09PT//////////////////// + ////////utP/UJD/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ZZ3/1OP///////// + ////////////////////09PT09PT////////////////////////////////////8PX/rMr/cqX/R4r/ + Knj/G27/G27/Knj/SYv/d6n/ttD/9vn/////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAQAAAAIAAAAABABgAAAAAAAAwAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////////////////////////////////////////+vr66Ojo2dnZzc3NxMTE + v7+/vLy8vLy8v7+/xcXFzc3N2NjY5ubm+Pj4//////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////////////////////////////////////////////+fn53d3dwsLCqqqqmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqapaWlvLy81dXV8vLy//////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + /////////////////////////////////////////////////////////////////Pz83Nzct7e3nJyc + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaq6urzc3N8/Pz//////////////////////////////////////////////////////////////// + ////09PT09PT////////////////////////////////////////////////////////////9fX1ysrK + oqKimpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqam5ubtra24uLi//////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + 9vb2xcXFnZ2dmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqara2t4ODg//////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////f39z8/Pn5+fmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + sbGx6+vr////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////6Ojoqqqqmpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqam5ubxsbG+/v7////////////////////////////////////09PT09PT//// + /////////////////////////////f39ysrKm5ubmpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqaoqKirq6utbW1uLi4uLi4tbW1rq6uo6Ojmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqaqKio6urq//////////////////////////// + ////09PT09PT////////////////////////////9fX1sbGxmpqampqampqampqampqampqampqampqa + mpqampqampqampqampqanJyctLS0z8/P5eXl+fn5////////////////////////////////+/v76enp + 1NTUvLy8oaGhmpqampqampqampqampqampqampqampqampqampqampqampqampqanJyc1tbW//////// + ////////////////////09PT09PT////////////////////////6+vrpKSkmpqampqampqampqampqa + mpqampqampqampqampqampqampqasrKy2NjY+fn5//////////////////////////////////////// + /////////////////////////v7+5eXlwsLCn5+fmpqampqampqampqampqampqampqampqampqampqa + mpqampqaxcXF/v7+////////////////////09PT09PT////////////////////5OTkn5+fmpqampqa + mpqampqampqampqampqampqampqampqam5ubvr6+7Ozs//////////////////////////////////// + ////////////////////////////////////////////////////+vr61NTUpqammpqampqampqampqa + mpqampqampqampqampqampqampqavb29/v7+////////////////09PT09PT////////////////4+Pj + nZ2dmpqampqampqampqampqampqampqampqampqampqauLi47+/v//////////////////////////// + /////////////////////////////////////////////////////////////////////////////f39 + 1dXVoqKimpqampqampqampqampqampqampqampqampqampqavb29/v7+////////////09PT09PT//// + ////////6OjonZ2dmpqampqampqampqampqampqampqampqampqapaWl4eHh//////////////////// + ////////////////////////+/v76enp3d3d19fX19fX3d3d6enp+/v7//////////////////////// + ////////////////////+fn5w8PDmpqampqampqampqampqampqampqampqampqampqaxsbG//////// + ////09PT09PT////////8vLyoaGhmpqampqampqampqampqampqampqampqampqavr6++fn5//////// + ////////////////////////////9vb20NDQsLCwm5ubmpqampqampqampqampqampqam5ubsLCw0NDQ + 9vb2////////////////////////////////////////5OTkpKSkmpqampqampqampqampqampqampqa + mpqampqa29vb////////09PT09PT/////f39rq6umpqampqampqampqampqampqampqampqanJyc19fX + ////////////////////////////////////9/f3xMTEnZ2dmpqampqampqampqampqampqampqampqa + mpqampqampqampqanZ2dxMTE9/f3////////////////////////////////////9vb2sbGxmpqampqa + mpqampqampqampqampqampqan5+f8/Pz////09PT09PT////zMzMmpqampqampqampqampqampqampqa + mpqaoKCg5ubm////////////////////////////////////39/foqKimpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqaoqKi39/f//////////////////////////////// + /////Pz8urq6mpqampqampqampqampqampqampqampqau7u7////09PT09PT8/PznZ2dmpqampqampqa + mpqampqampqampqaoaGh7Ozs////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqazMzM//////////// + /////////////////////////f39urq6mpqampqampqampqampqampqampqampqa7Ozs09PT09PTx8fH + mpqampqampqampqampqampqampqanp6e6urq////////////////////////////////////ysrKmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaysrK/////////////////////////////////////Pz8sLCwmpqampqampqampqampqampqampqa + w8PD09PT09PTpaWlmpqampqampqampqampqampqampqa3t7e//////////////////////////////// + ////2dnZmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqa2dnZ////////////////////////////////////8/Pzn5+fmpqampqa + mpqampqampqampqapaWl09PT09PTm5ubmpqampqampqampqampqampqav7+///////////////////// + ////////////////8/Pznp6empqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqan5+f8/Pz//////////////////////////////// + ////zc3Nmpqampqampqampqampqampqam5ub09PT09PTrKysmpqampqampqampqampqam5ub8vLy//// + ////////////////////////////////vb29mpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29//////////////// + ////////////////////8/PzmpqampqampqampqampqampqarKys09PT09PT39/fmpqampqampqampqa + mpqawsLC////////////////////////////////////8fHxmpqampqampqampqampqampqampqampqa + mpqasLCwxcXFrq6umpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqam5ub + 8fHx////////////////////////////////////wsLCmpqampqampqampqampqa39/f09PT09PT//// + 3d3dqKiompqaoKCgysrK/f39////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqazs7O////////////yMjImpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqazMzM/////////////////////////////////////f39ysrKoKCgmpqaqKio3d3d + ////09PT09PT////////////+/v7/v7+////////////////////////////////////////////r6+v + mpqampqampqampqampqampqampqaqqqq/////////////////f39paWlmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqar6+v//////////////////////////////////////////// + /v7++/v7////////////09PT09PT//////////////////////////////////////////////////// + /////////f39nJycmpqampqampqampqampqampqampqavb29////////////////////uLi4mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqanJyc/v7+//////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////9PT0mpqampqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa9PT0//////// + ////////////////////////////////////////////////////09PT09PT////////////+vz//f7/ + ////////////////////////////////////////7+/vmpqampqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqa7u7u/////////////////////////////////////////f7/+vz/////////////09PT09PT//// + rMn/J3X/Al7/FGn/fKr/+/z/////////////////////////////////8/Pzmpqampqampqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqa8/Pz////////////////////////////////+/z/e6r/FGn/Al7/KHX/rMn/ + ////09PT09PTsMv/AV7/AF7/AF7/AF7/AF7/aJ7//////////////////////////////////Pz8m5ub + mpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqam5ub/f39////////////////////////////////aJ7/AF7/ + AF7/AF7/AF7/Al//sMz/09PT09PTMHv/AF7/AF7/AF7/AF7/AF7/A1//4+3///////////////////// + ////////////rKysmpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqarKys//////////////////////////// + ////3+r/Al7/AF7/AF7/AF7/AF7/AF7/MHv/09PT09PTBGD/AF7/AF7/AF7/AF7/AF7/AF7/hbD///// + ////////////////////////////x8fHmpqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqax8fH//////////// + ////////////////////YZr/AF7/AF7/AF7/AF7/AF7/AF7/BGD/09PT09PTHm//AF7/AF7/AF7/AF7/ + AF7/AF7/D2b/4uz/////////////////////////////7Ozsmpqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + 7Ozs////////////////////////////rcr/AV7/AF7/AF7/AF7/AF7/AF7/AF7/HnD/09PT09PTaZ// + AF7/AF7/AF7/AF7/AF7/AF7/AF7/OoH/+Pr/////////////////////////////tbW1mpqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqatbW1////////////////////////////zN7/DGX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + dKX/09PT09PTz+D/AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH//P3///////////////////////// + 7e3tm5ubmpqampqampqampqampqauLi4////////////////////srKympqampqampqampqampqampqa + mpqampqampqampqampqampqanJyc7e3t////////////////////////0OD/FGn/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/CWP/4+z/09PT09PT////VJH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH/+fv///// + ////////////////////zs7OmpqampqampqampqampqanZ2d8vLy////////////7e3tm5ubmpqampqa + mpqampqampqampqampqampqampqampqampqampqazs7O////////////////////////wtf/EWj/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/gK3/////09PT09PT////4ez/Dmb/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/PYP/6fD//////////////////////v7+vb29mpqampqampqampqampqaqKio4+Pj+fn54ODg + paWlmpqampqampqampqampqampqampqampqampqampqampqampqavLy8/v7+//////////////////// + nL//B2L/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/NH3/+vv/////09PT09PT////////pcX/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/G27/vtX//////////////////////f39vb29mpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29/f39//////// + ////////8fb/Xpj/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/3+r/////////09PT09PT//// + ////////c6T/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Al//bKD/8fb///////////////////// + 0NDQnJycmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqanJyc0NDQ + ////////////////////ttD/H3D/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CmT/xtr///////// + ////09PT09PT/////////////f3/WZX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/GGz/mL3/ + +/z/////////////////7u7utra2mpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqatra27u7u////////////////2OX/T47/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/ + utL/////////////////09PT09PT////////////////+vz/WZT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/InL/lbr/9Pj/////////////////6urqwsLCoqKimpqampqampqampqampqampqa + mpqampqaoqKiwsLC6urq////////////////0+L/XZf/BGD/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/DWX/vdT/////////////////////09PT09PT/////////////////////P3/bqL/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/EGf/Z53/wdb//P3//////////////v7+7e3t2tra + zs7OyMjIyMjIzs7O2tra7e3t/v7+////////////8PX/oMH/P4T/AV7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/HG7/z9//////////////////////////09PT09PT//////////////////// + ////////mL3/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/WJT/lrv/ + ytz/9fn/////////////////////////////////8fb/wdb/iLL/RIj/B2L/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/PYP/5+//////////////////////////////09PT09PT//// + ////////////////////////////zN7/JnT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al7/Gm3/NH3/Ron/To7/T47/R4n/NH3/GGz/AV3/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/A1//fKv/+/z///////////////////////////// + ////09PT09PT////////////////////////////////////9Pj/cKP/Al//AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Knf/x9r///////////////////// + ////////////////////09PT09PT////////////////////////////////////////////zd7/PIP/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Dmb/ibP/+fv///////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////////v7/sc3/MXz/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/cKP/6fH/ + ////////////////////////////////////////////////////09PT09PT//////////////////// + /////////////////////////////////////v//uNH/Sov/Al7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/ + e6r/5+//////////////////////////////////////////////////////////////09PT09PT//// + ////////////////////////////////////////////////////////////////4Or/hLD/LXj/AV7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + BmH/TI3/qcf/9/r///////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////3en/l7z/V5P/HW//AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + A17/KXb/Zp3/q8n/7/X///////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + /////////////////////////////////////////v//7PL/wtf/n8H/g6//bqL/YJn/WZT/WJT/X5n/ + bqL/hLD/osP/x9r/8fb///////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PTAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + + \ No newline at end of file diff --git a/GUI.NET/Forms/NetPlay/frmServerConfig.Designer.cs b/GUI.NET/Forms/NetPlay/frmServerConfig.Designer.cs new file mode 100644 index 00000000..ea6b387e --- /dev/null +++ b/GUI.NET/Forms/NetPlay/frmServerConfig.Designer.cs @@ -0,0 +1,270 @@ +namespace Mesen.GUI.Forms.NetPlay +{ + partial class frmServerConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmServerConfig)); + this.tlpMain = new System.Windows.Forms.TableLayoutPanel(); + this.txtPort = new System.Windows.Forms.TextBox(); + this.lblPort = new System.Windows.Forms.Label(); + this.chkPublicServer = new System.Windows.Forms.CheckBox(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.lblServerName = new System.Windows.Forms.Label(); + this.txtServerName = new System.Windows.Forms.TextBox(); + this.chkSpectator = new System.Windows.Forms.CheckBox(); + this.lblMaxPlayers = new System.Windows.Forms.Label(); + this.lblPassword = new System.Windows.Forms.Label(); + this.txtPassword = new System.Windows.Forms.TextBox(); + this.nudNbPlayers = new System.Windows.Forms.NumericUpDown(); + this.tlpMain.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudNbPlayers)).BeginInit(); + this.SuspendLayout(); + // + // tlpMain + // + this.tlpMain.ColumnCount = 2; + this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tlpMain.Controls.Add(this.txtPort, 1, 1); + this.tlpMain.Controls.Add(this.lblPort, 0, 1); + this.tlpMain.Controls.Add(this.chkPublicServer, 0, 4); + this.tlpMain.Controls.Add(this.flowLayoutPanel1, 0, 6); + this.tlpMain.Controls.Add(this.lblServerName, 0, 0); + this.tlpMain.Controls.Add(this.txtServerName, 1, 0); + this.tlpMain.Controls.Add(this.chkSpectator, 0, 5); + this.tlpMain.Controls.Add(this.lblMaxPlayers, 0, 3); + this.tlpMain.Controls.Add(this.lblPassword, 0, 2); + this.tlpMain.Controls.Add(this.txtPassword, 1, 2); + this.tlpMain.Controls.Add(this.nudNbPlayers, 1, 3); + this.tlpMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.tlpMain.Location = new System.Drawing.Point(0, 0); + 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()); + this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tlpMain.Size = new System.Drawing.Size(302, 190); + this.tlpMain.TabIndex = 1; + // + // txtPort + // + this.txtPort.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtPort.Location = new System.Drawing.Point(128, 29); + this.txtPort.Name = "txtPort"; + this.txtPort.Size = new System.Drawing.Size(171, 20); + this.txtPort.TabIndex = 13; + this.txtPort.TextChanged += new System.EventHandler(this.Field_ValueChanged); + // + // lblPort + // + this.lblPort.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblPort.AutoSize = true; + this.lblPort.Location = new System.Drawing.Point(3, 32); + this.lblPort.Name = "lblPort"; + this.lblPort.Size = new System.Drawing.Size(29, 13); + this.lblPort.TabIndex = 12; + this.lblPort.Text = "Port:"; + // + // chkPublicServer + // + this.chkPublicServer.AutoSize = true; + this.tlpMain.SetColumnSpan(this.chkPublicServer, 2); + this.chkPublicServer.Enabled = false; + this.chkPublicServer.Location = new System.Drawing.Point(3, 107); + this.chkPublicServer.Name = "chkPublicServer"; + this.chkPublicServer.Size = new System.Drawing.Size(87, 17); + this.chkPublicServer.TabIndex = 11; + this.chkPublicServer.Text = "Public server"; + this.chkPublicServer.UseVisualStyleBackColor = true; + this.chkPublicServer.CheckedChanged += new System.EventHandler(this.Field_ValueChanged); + // + // flowLayoutPanel1 + // + this.tlpMain.SetColumnSpan(this.flowLayoutPanel1, 2); + this.flowLayoutPanel1.Controls.Add(this.btnCancel); + this.flowLayoutPanel1.Controls.Add(this.btnOK); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 161); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(302, 29); + this.flowLayoutPanel1.TabIndex = 2; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(224, 3); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 0; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // btnOK + // + this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnOK.Location = new System.Drawing.Point(143, 3); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 1; + this.btnOK.Text = "Start Server"; + this.btnOK.UseVisualStyleBackColor = true; + // + // lblServerName + // + this.lblServerName.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblServerName.AutoSize = true; + this.lblServerName.Location = new System.Drawing.Point(3, 6); + this.lblServerName.Name = "lblServerName"; + this.lblServerName.Size = new System.Drawing.Size(70, 13); + this.lblServerName.TabIndex = 3; + this.lblServerName.Text = "Server name:"; + // + // txtServerName + // + this.txtServerName.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtServerName.Location = new System.Drawing.Point(128, 3); + this.txtServerName.Name = "txtServerName"; + this.txtServerName.Size = new System.Drawing.Size(171, 20); + this.txtServerName.TabIndex = 5; + this.txtServerName.TextChanged += new System.EventHandler(this.Field_ValueChanged); + // + // chkSpectator + // + this.chkSpectator.AutoSize = true; + this.tlpMain.SetColumnSpan(this.chkSpectator, 2); + this.chkSpectator.Enabled = false; + this.chkSpectator.Location = new System.Drawing.Point(3, 130); + this.chkSpectator.Name = "chkSpectator"; + this.chkSpectator.Size = new System.Drawing.Size(103, 17); + this.chkSpectator.TabIndex = 7; + this.chkSpectator.Text = "Allow spectators"; + this.chkSpectator.UseVisualStyleBackColor = true; + this.chkSpectator.CheckedChanged += new System.EventHandler(this.Field_ValueChanged); + // + // lblMaxPlayers + // + this.lblMaxPlayers.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblMaxPlayers.AutoSize = true; + this.lblMaxPlayers.Location = new System.Drawing.Point(3, 84); + this.lblMaxPlayers.Name = "lblMaxPlayers"; + this.lblMaxPlayers.Size = new System.Drawing.Size(119, 13); + this.lblMaxPlayers.TabIndex = 4; + this.lblMaxPlayers.Text = "Max. number of players:"; + // + // lblPassword + // + this.lblPassword.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblPassword.AutoSize = true; + this.lblPassword.Location = new System.Drawing.Point(3, 58); + this.lblPassword.Name = "lblPassword"; + this.lblPassword.Size = new System.Drawing.Size(56, 13); + this.lblPassword.TabIndex = 9; + this.lblPassword.Text = "Password:"; + // + // txtPassword + // + this.txtPassword.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtPassword.Location = new System.Drawing.Point(128, 55); + this.txtPassword.Name = "txtPassword"; + this.txtPassword.Size = new System.Drawing.Size(171, 20); + this.txtPassword.TabIndex = 10; + this.txtPassword.UseSystemPasswordChar = true; + this.txtPassword.TextChanged += new System.EventHandler(this.Field_ValueChanged); + // + // nudNbPlayers + // + this.nudNbPlayers.Location = new System.Drawing.Point(128, 81); + this.nudNbPlayers.Maximum = new decimal(new int[] { + 4, + 0, + 0, + 0}); + this.nudNbPlayers.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nudNbPlayers.Name = "nudNbPlayers"; + this.nudNbPlayers.Size = new System.Drawing.Size(39, 20); + this.nudNbPlayers.TabIndex = 8; + this.nudNbPlayers.Value = new decimal(new int[] { + 4, + 0, + 0, + 0}); + this.nudNbPlayers.ValueChanged += new System.EventHandler(this.Field_ValueChanged); + // + // frmServerConfig + // + this.AcceptButton = this.btnOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(302, 190); + this.Controls.Add(this.tlpMain); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "frmServerConfig"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Server Configuration"; + this.tlpMain.ResumeLayout(false); + this.tlpMain.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.nudNbPlayers)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tlpMain; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Label lblServerName; + private System.Windows.Forms.Label lblMaxPlayers; + private System.Windows.Forms.TextBox txtServerName; + private System.Windows.Forms.CheckBox chkSpectator; + private System.Windows.Forms.NumericUpDown nudNbPlayers; + private System.Windows.Forms.CheckBox chkPublicServer; + private System.Windows.Forms.Label lblPassword; + private System.Windows.Forms.TextBox txtPassword; + private System.Windows.Forms.Label lblPort; + private System.Windows.Forms.TextBox txtPort; + } +} \ No newline at end of file diff --git a/GUI.NET/Forms/NetPlay/frmServerConfig.cs b/GUI.NET/Forms/NetPlay/frmServerConfig.cs new file mode 100644 index 00000000..f880b41c --- /dev/null +++ b/GUI.NET/Forms/NetPlay/frmServerConfig.cs @@ -0,0 +1,49 @@ +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.NetPlay +{ + public partial class frmServerConfig : BaseConfigForm + { + public frmServerConfig() + { + InitializeComponent(); + + this.txtServerName.Text = ConfigManager.Config.ServerInfo.Name; + this.txtPort.Text = ConfigManager.Config.ServerInfo.Port.ToString(); + this.txtPassword.Text = string.Empty; + this.nudNbPlayers.Value = ConfigManager.Config.ServerInfo.MaxPlayers; + this.chkSpectator.Checked = ConfigManager.Config.ServerInfo.AllowSpectators; + this.chkPublicServer.Checked = ConfigManager.Config.ServerInfo.PublicServer; + } + + protected override void UpdateConfig() + { + ConfigManager.Config.ServerInfo = new ServerInfo() { + Name = this.txtServerName.Text, + Port = Convert.ToUInt16(this.txtPort.Text), + Password = BitConverter.ToString(System.Security.Cryptography.SHA1.Create().ComputeHash(Encoding.UTF8.GetBytes(this.txtPassword.Text))).Replace("-", ""), + MaxPlayers = (int)this.nudNbPlayers.Value, + AllowSpectators = this.chkSpectator.Checked, + PublicServer = this.chkPublicServer.Checked + }; + } + + private void Field_ValueChanged(object sender, EventArgs e) + { + UInt16 port; + if(!UInt16.TryParse(this.txtPort.Text, out port)) { + this.btnOK.Enabled = false; + } else { + this.btnOK.Enabled = !string.IsNullOrWhiteSpace(this.txtServerName.Text); + } + } + } +} diff --git a/GUI.NET/Forms/NetPlay/frmServerConfig.resx b/GUI.NET/Forms/NetPlay/frmServerConfig.resx new file mode 100644 index 00000000..f7d049ce --- /dev/null +++ b/GUI.NET/Forms/NetPlay/frmServerConfig.resx @@ -0,0 +1,409 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAMAEBAAAAAAGABoAwAANgAAACAgAAAAABgAqAwAAJ4DAABAQAAAAAAYACgyAABGEAAAKAAAABAA + AAAgAAAAAQAYAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAANPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT0/////////////////////////7+/v7+/v///////////////////////9PT09PT + 0////////////+np6cHBwaamppubm5qamqWlpb6+vuTk5P///////////9PT09PT0/////j4+Ly8vJqa + mpqamq2trb6+vr6+vq6urpubm5qamrW1tfT09P///9PT09PT0/b29qqqqpqamry8vPDw8Pz8/Ofn5+fn + 5/z8/PPz88PDw5ubm6WlpfLy8tPT09PT07a2tpqamtbW1v///+Li4qKiopqampqamqKiouLi4v///9/f + 35ubm7Ozs9PT09PT06WlpcPDw/////T09J6enp6enqmpqZqampqamp6envT09P///8XFxaWlpdPT09PT + 0/f5/f7+/////9jY2JqamsTExO3t7ZqampqampqamtjY2P////7+//f5/dPT09PT0xxv/22i/////93d + 3ZqamsbGxu/v75qampqampqamt3d3f///2mg/xxv/9PT09PT00CG/wRg/67L//v7+6mpqbq6uuHh4Zqa + mpqamqmpqfv7+5e9/wFf/0eL/9PT09PT093q/xtv/wJf/2mg/9ji9b29vaCgoKCgoL29vc/d9FeV/wBe + /yh3/+jw/9PT09PT0////+Pt/0SJ/wBe/wJf/zR//1uX/1qX/zF8/wFf/wBe/1eV/+70/////9PT09PT + 0////////////7zU/1yY/x1w/wFf/wFf/x9x/2Kc/8jc/////////////9PT09PT0/////////////// + //////////z9//z9/////////////////////////9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT0///AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAIAAAAEAAAAABABgAAAAAAAAMAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /Pz84eHhycnJtra2qqqqpKSkpKSkqqqqtra2x8fH3t7e+fn5//////////////////////////////// + ////09PT09PT////////////////////////////7u7uwcHBn5+fmpqampqampqampqampqampqampqa + mpqampqampqanJycubm54+Pj////////////////////////////09PT09PT//////////////////// + 8/Pzvb29m5ubmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqasLCw6Ojo + ////////////////////09PT09PT////////////////2NjYn5+fmpqampqampqampqampqampqapqam + tbW1vb29vb29tbW1p6enmpqampqampqampqampqampqam5ubxcXF/Pz8////////////09PT09PT//// + /////f39wcHBmpqampqampqampqampqarKys1NTU8/Pz////////////////////////9vb22tratbW1 + mpqampqampqampqampqasLCw9vb2////////09PT09PT/////f39ubm5mpqampqampqampqaqqqq4eHh + ////////////////////////////////////////////////7e3tt7e3mpqampqampqampqaq6ur9/f3 + ////09PT09PT////wcHBmpqampqampqampqayMjI/Pz8////////////7e3txMTEqqqqnZ2dnZ2dqqqq + xMTE7e3t////////////////29vbn5+fmpqampqampqatLS0/v7+09PT09PT3t7empqampqampqanJyc + 3Nzc/////////////f39xsbGm5ubmpqampqampqampqampqampqam5ubxsbG/f39////////////7Ozs + o6Ojmpqampqampqa1tbW09PT09PTrKysmpqampqampqa3d3d/////////////v7+u7u7mpqampqampqa + mpqampqampqampqampqampqampqau7u7/v7+////////////6urqnZ2dmpqampqaqqqq09PT09PTnZ2d + mpqampqawcHB////////////////1dXVmpqampqampqampqampqampqampqampqampqampqampqampqa + 1dXV////////////////xcXFmpqampqanZ2d09PT09PTz8/Pm5ubqKio8/Pz/////////////v7+pKSk + mpqampqampqavLy819fXpaWlmpqampqampqampqampqampqapaWl/v7+////////////8/PzqKiom5ub + 0NDQ09PT09PT/////Pz8/v7+////////////////6+vrmpqampqampqanp6e/f39////19fXmpqampqa + mpqampqampqampqampqa6+vr/////////////////v7+/Pz8////09PT09PT////+Pr//v7///////// + ////////3t7empqampqampqaoqKi////////3d3dmpqampqampqampqampqampqampqa3t7e//////// + /////////v7/+Pr/////09PT09PTiLP/BWD/JXT/4ez/////////////4uLimpqampqampqaoqKi//// + ////3d3dmpqampqampqampqampqampqampqa4uLi////////////4ez/JXT/BWD/ibP/09PT09PTCmT/ + AF7/AF7/b6P/////////////9vb2m5ubmpqampqaoqKi////////3d3dmpqampqampqampqampqampqa + m5ub9vb2////////////Y5z/AF7/AF7/CmT/09PT09PTKnj/AF7/AF7/B2L/zN7/////////////ubm5 + mpqampqaoqKi////////3d3dmpqampqampqampqampqampqauLi4////////////qsj/AV//AF7/AF7/ + Lnr/09PT09PTmr7/AF7/AF7/AF7/F2z/0eH/////////8PDwn5+fmpqam5ub8fHx////yMjImpqampqa + mpqampqampqan5+f8PDw////////qMf/BmH/AF7/AF7/AF7/rcv/09PT09PT/f3/Qof/AF7/AF7/AF7/ + DWb/pcX/////////5eXloKCgmpqaoaGhsbGxmpqampqampqampqampqaoKCg5eXl////+fv/dqf/AV// + AF7/AF7/AF7/ZJz/////09PT09PT////7PL/Knj/AF7/AF7/AF7/AF7/Soz/0uL/////8fHxurq6m5ub + mpqampqampqampqam5uburq68fHx////tM//KXf/AF7/AF7/AF7/AF7/UI//+vz/////09PT09PT//// + ////6vH/OIH/AF7/AF7/AF7/AF7/AV//RYn/osP/6vH/9PT02trazs7Ozs7O2tra9PT04uz/k7r/L3v/ + AF7/AF7/AF7/AF7/AF7/ZJz/+vz/////////09PT09PT////////////+Pr/bqP/Al//AF7/AF7/AF7/ + AF7/AF7/AV7/InP/Ror/WJX/WZX/RYn/HnD/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ncH///////////// + ////09PT09PT////////////////////xtr/OIH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al//WZb/4u3/////////////////////09PT09PT//////////////////// + ////////utP/UJD/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ZZ3/1OP///////// + ////////////////////09PT09PT////////////////////////////////////8PX/rMr/cqX/R4r/ + Knj/G27/G27/Knj/SYv/d6n/ttD/9vn/////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAQAAAAIAAAAABABgAAAAAAAAwAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////////////////////////////////////////+vr66Ojo2dnZzc3NxMTE + v7+/vLy8vLy8v7+/xcXFzc3N2NjY5ubm+Pj4//////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////////////////////////////////////////////+fn53d3dwsLCqqqqmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqapaWlvLy81dXV8vLy//////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + /////////////////////////////////////////////////////////////////Pz83Nzct7e3nJyc + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaq6urzc3N8/Pz//////////////////////////////////////////////////////////////// + ////09PT09PT////////////////////////////////////////////////////////////9fX1ysrK + oqKimpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqam5ubtra24uLi//////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + 9vb2xcXFnZ2dmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqara2t4ODg//////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////f39z8/Pn5+fmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + sbGx6+vr////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////6Ojoqqqqmpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqam5ubxsbG+/v7////////////////////////////////////09PT09PT//// + /////////////////////////////f39ysrKm5ubmpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqaoqKirq6utbW1uLi4uLi4tbW1rq6uo6Ojmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqaqKio6urq//////////////////////////// + ////09PT09PT////////////////////////////9fX1sbGxmpqampqampqampqampqampqampqampqa + mpqampqampqampqampqanJyctLS0z8/P5eXl+fn5////////////////////////////////+/v76enp + 1NTUvLy8oaGhmpqampqampqampqampqampqampqampqampqampqampqampqampqanJyc1tbW//////// + ////////////////////09PT09PT////////////////////////6+vrpKSkmpqampqampqampqampqa + mpqampqampqampqampqampqampqasrKy2NjY+fn5//////////////////////////////////////// + /////////////////////////v7+5eXlwsLCn5+fmpqampqampqampqampqampqampqampqampqampqa + mpqampqaxcXF/v7+////////////////////09PT09PT////////////////////5OTkn5+fmpqampqa + mpqampqampqampqampqampqampqampqam5ubvr6+7Ozs//////////////////////////////////// + ////////////////////////////////////////////////////+vr61NTUpqammpqampqampqampqa + mpqampqampqampqampqampqampqavb29/v7+////////////////09PT09PT////////////////4+Pj + nZ2dmpqampqampqampqampqampqampqampqampqampqauLi47+/v//////////////////////////// + /////////////////////////////////////////////////////////////////////////////f39 + 1dXVoqKimpqampqampqampqampqampqampqampqampqampqavb29/v7+////////////09PT09PT//// + ////////6OjonZ2dmpqampqampqampqampqampqampqampqampqapaWl4eHh//////////////////// + ////////////////////////+/v76enp3d3d19fX19fX3d3d6enp+/v7//////////////////////// + ////////////////////+fn5w8PDmpqampqampqampqampqampqampqampqampqampqaxsbG//////// + ////09PT09PT////////8vLyoaGhmpqampqampqampqampqampqampqampqampqavr6++fn5//////// + ////////////////////////////9vb20NDQsLCwm5ubmpqampqampqampqampqampqam5ubsLCw0NDQ + 9vb2////////////////////////////////////////5OTkpKSkmpqampqampqampqampqampqampqa + mpqampqa29vb////////09PT09PT/////f39rq6umpqampqampqampqampqampqampqampqanJyc19fX + ////////////////////////////////////9/f3xMTEnZ2dmpqampqampqampqampqampqampqampqa + mpqampqampqampqanZ2dxMTE9/f3////////////////////////////////////9vb2sbGxmpqampqa + mpqampqampqampqampqampqan5+f8/Pz////09PT09PT////zMzMmpqampqampqampqampqampqampqa + mpqaoKCg5ubm////////////////////////////////////39/foqKimpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqaoqKi39/f//////////////////////////////// + /////Pz8urq6mpqampqampqampqampqampqampqampqau7u7////09PT09PT8/PznZ2dmpqampqampqa + mpqampqampqampqaoaGh7Ozs////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqazMzM//////////// + /////////////////////////f39urq6mpqampqampqampqampqampqampqampqa7Ozs09PT09PTx8fH + mpqampqampqampqampqampqampqanp6e6urq////////////////////////////////////ysrKmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaysrK/////////////////////////////////////Pz8sLCwmpqampqampqampqampqampqampqa + w8PD09PT09PTpaWlmpqampqampqampqampqampqampqa3t7e//////////////////////////////// + ////2dnZmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqa2dnZ////////////////////////////////////8/Pzn5+fmpqampqa + mpqampqampqampqapaWl09PT09PTm5ubmpqampqampqampqampqampqav7+///////////////////// + ////////////////8/Pznp6empqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqan5+f8/Pz//////////////////////////////// + ////zc3Nmpqampqampqampqampqampqam5ub09PT09PTrKysmpqampqampqampqampqam5ub8vLy//// + ////////////////////////////////vb29mpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29//////////////// + ////////////////////8/PzmpqampqampqampqampqampqarKys09PT09PT39/fmpqampqampqampqa + mpqawsLC////////////////////////////////////8fHxmpqampqampqampqampqampqampqampqa + mpqasLCwxcXFrq6umpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqam5ub + 8fHx////////////////////////////////////wsLCmpqampqampqampqampqa39/f09PT09PT//// + 3d3dqKiompqaoKCgysrK/f39////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqazs7O////////////yMjImpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqazMzM/////////////////////////////////////f39ysrKoKCgmpqaqKio3d3d + ////09PT09PT////////////+/v7/v7+////////////////////////////////////////////r6+v + mpqampqampqampqampqampqampqaqqqq/////////////////f39paWlmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqar6+v//////////////////////////////////////////// + /v7++/v7////////////09PT09PT//////////////////////////////////////////////////// + /////////f39nJycmpqampqampqampqampqampqampqavb29////////////////////uLi4mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqanJyc/v7+//////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////9PT0mpqampqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa9PT0//////// + ////////////////////////////////////////////////////09PT09PT////////////+vz//f7/ + ////////////////////////////////////////7+/vmpqampqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqa7u7u/////////////////////////////////////////f7/+vz/////////////09PT09PT//// + rMn/J3X/Al7/FGn/fKr/+/z/////////////////////////////////8/Pzmpqampqampqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqa8/Pz////////////////////////////////+/z/e6r/FGn/Al7/KHX/rMn/ + ////09PT09PTsMv/AV7/AF7/AF7/AF7/AF7/aJ7//////////////////////////////////Pz8m5ub + mpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqam5ub/f39////////////////////////////////aJ7/AF7/ + AF7/AF7/AF7/Al//sMz/09PT09PTMHv/AF7/AF7/AF7/AF7/AF7/A1//4+3///////////////////// + ////////////rKysmpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqarKys//////////////////////////// + ////3+r/Al7/AF7/AF7/AF7/AF7/AF7/MHv/09PT09PTBGD/AF7/AF7/AF7/AF7/AF7/AF7/hbD///// + ////////////////////////////x8fHmpqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqax8fH//////////// + ////////////////////YZr/AF7/AF7/AF7/AF7/AF7/AF7/BGD/09PT09PTHm//AF7/AF7/AF7/AF7/ + AF7/AF7/D2b/4uz/////////////////////////////7Ozsmpqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + 7Ozs////////////////////////////rcr/AV7/AF7/AF7/AF7/AF7/AF7/AF7/HnD/09PT09PTaZ// + AF7/AF7/AF7/AF7/AF7/AF7/AF7/OoH/+Pr/////////////////////////////tbW1mpqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqatbW1////////////////////////////zN7/DGX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + dKX/09PT09PTz+D/AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH//P3///////////////////////// + 7e3tm5ubmpqampqampqampqampqauLi4////////////////////srKympqampqampqampqampqampqa + mpqampqampqampqampqampqanJyc7e3t////////////////////////0OD/FGn/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/CWP/4+z/09PT09PT////VJH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH/+fv///// + ////////////////////zs7OmpqampqampqampqampqanZ2d8vLy////////////7e3tm5ubmpqampqa + mpqampqampqampqampqampqampqampqampqampqazs7O////////////////////////wtf/EWj/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/gK3/////09PT09PT////4ez/Dmb/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/PYP/6fD//////////////////////v7+vb29mpqampqampqampqampqaqKio4+Pj+fn54ODg + paWlmpqampqampqampqampqampqampqampqampqampqampqampqavLy8/v7+//////////////////// + nL//B2L/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/NH3/+vv/////09PT09PT////////pcX/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/G27/vtX//////////////////////f39vb29mpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29/f39//////// + ////////8fb/Xpj/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/3+r/////////09PT09PT//// + ////////c6T/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Al//bKD/8fb///////////////////// + 0NDQnJycmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqanJyc0NDQ + ////////////////////ttD/H3D/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CmT/xtr///////// + ////09PT09PT/////////////f3/WZX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/GGz/mL3/ + +/z/////////////////7u7utra2mpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqatra27u7u////////////////2OX/T47/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/ + utL/////////////////09PT09PT////////////////+vz/WZT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/InL/lbr/9Pj/////////////////6urqwsLCoqKimpqampqampqampqampqampqa + mpqampqaoqKiwsLC6urq////////////////0+L/XZf/BGD/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/DWX/vdT/////////////////////09PT09PT/////////////////////P3/bqL/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/EGf/Z53/wdb//P3//////////////v7+7e3t2tra + zs7OyMjIyMjIzs7O2tra7e3t/v7+////////////8PX/oMH/P4T/AV7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/HG7/z9//////////////////////////09PT09PT//////////////////// + ////////mL3/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/WJT/lrv/ + ytz/9fn/////////////////////////////////8fb/wdb/iLL/RIj/B2L/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/PYP/5+//////////////////////////////09PT09PT//// + ////////////////////////////zN7/JnT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al7/Gm3/NH3/Ron/To7/T47/R4n/NH3/GGz/AV3/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/A1//fKv/+/z///////////////////////////// + ////09PT09PT////////////////////////////////////9Pj/cKP/Al//AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Knf/x9r///////////////////// + ////////////////////09PT09PT////////////////////////////////////////////zd7/PIP/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Dmb/ibP/+fv///////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////////v7/sc3/MXz/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/cKP/6fH/ + ////////////////////////////////////////////////////09PT09PT//////////////////// + /////////////////////////////////////v//uNH/Sov/Al7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/ + e6r/5+//////////////////////////////////////////////////////////////09PT09PT//// + ////////////////////////////////////////////////////////////////4Or/hLD/LXj/AV7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + BmH/TI3/qcf/9/r///////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////3en/l7z/V5P/HW//AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + A17/KXb/Zp3/q8n/7/X///////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + /////////////////////////////////////////v//7PL/wtf/n8H/g6//bqL/YJn/WZT/WJT/X5n/ + bqL/hLD/osP/x9r/8fb///////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PTAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + + \ No newline at end of file diff --git a/GUI.NET/Forms/frmMain.Designer.cs b/GUI.NET/Forms/frmMain.Designer.cs new file mode 100644 index 00000000..f2fb936b --- /dev/null +++ b/GUI.NET/Forms/frmMain.Designer.cs @@ -0,0 +1,526 @@ +namespace Mesen.GUI.Forms +{ + partial class frmMain + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + if(_notifListener != null) { + _notifListener.Dispose(); + _notifListener = null; + } + StopEmu(); + InteropEmu.Release(); + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain)); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.mnuFile = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuOpen = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem4 = 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.mnuStop = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuOptions = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuLimitFPS = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuShowFPS = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuInputDevices = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuVideoConfig = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuAudioConfig = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuTools = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuNetPlay = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuStartServer = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuStopServer = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuFindServer = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuConnect = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuDisconnect = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuProfile = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuMovies = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuPlayMovie = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuRecordFrom = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuRecordFromStart = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuRecordFromNow = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuStopMovie = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuDebugger = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuTakeScreenshot = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuCheckForUpdates = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuSaveState = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuLoadState = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuSaveState1 = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuLoadState1 = new System.Windows.Forms.ToolStripMenuItem(); + this.dxViewer = new Mesen.GUI.Controls.DXViewer(); + this.menuStrip.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip + // + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuFile, + this.mnuGame, + this.mnuOptions, + this.mnuTools, + this.mnuHelp}); + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Size = new System.Drawing.Size(365, 24); + this.menuStrip.TabIndex = 0; + this.menuStrip.Text = "menuStrip1"; + // + // mnuFile + // + this.mnuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuOpen, + this.toolStripMenuItem4, + this.mnuSaveState, + this.mnuLoadState, + this.toolStripMenuItem7, + this.mnuRecentFiles, + this.toolStripMenuItem6, + this.mnuExit}); + this.mnuFile.Name = "mnuFile"; + this.mnuFile.Size = new System.Drawing.Size(37, 20); + this.mnuFile.Text = "File"; + // + // mnuOpen + // + this.mnuOpen.Name = "mnuOpen"; + this.mnuOpen.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.mnuOpen.Size = new System.Drawing.Size(146, 22); + this.mnuOpen.Text = "Open"; + this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click); + // + // toolStripMenuItem4 + // + this.toolStripMenuItem4.Name = "toolStripMenuItem4"; + this.toolStripMenuItem4.Size = new System.Drawing.Size(143, 6); + // + // 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.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.mnuStop}); + this.mnuGame.Name = "mnuGame"; + this.mnuGame.Size = new System.Drawing.Size(50, 20); + this.mnuGame.Text = "Game"; + // + // mnuPause + // + this.mnuPause.Enabled = false; + this.mnuPause.Name = "mnuPause"; + this.mnuPause.ShortcutKeyDisplayString = "Esc"; + this.mnuPause.Size = new System.Drawing.Size(152, 22); + this.mnuPause.Text = "Pause"; + this.mnuPause.Click += new System.EventHandler(this.mnuPause_Click); + // + // mnuReset + // + this.mnuReset.Enabled = false; + this.mnuReset.Name = "mnuReset"; + this.mnuReset.Size = new System.Drawing.Size(152, 22); + this.mnuReset.Text = "Reset"; + this.mnuReset.Click += new System.EventHandler(this.mnuReset_Click); + // + // mnuStop + // + this.mnuStop.Enabled = false; + this.mnuStop.Name = "mnuStop"; + this.mnuStop.Size = new System.Drawing.Size(152, 22); + this.mnuStop.Text = "Stop"; + this.mnuStop.Click += new System.EventHandler(this.mnuStop_Click); + // + // mnuOptions + // + this.mnuOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuLimitFPS, + this.mnuShowFPS, + this.toolStripMenuItem1, + this.mnuInputDevices, + this.mnuVideoConfig, + this.mnuAudioConfig}); + this.mnuOptions.Name = "mnuOptions"; + this.mnuOptions.Size = new System.Drawing.Size(61, 20); + this.mnuOptions.Text = "Options"; + // + // mnuLimitFPS + // + this.mnuLimitFPS.Checked = true; + this.mnuLimitFPS.CheckState = System.Windows.Forms.CheckState.Checked; + this.mnuLimitFPS.Name = "mnuLimitFPS"; + this.mnuLimitFPS.ShortcutKeys = System.Windows.Forms.Keys.F9; + this.mnuLimitFPS.Size = new System.Drawing.Size(152, 22); + this.mnuLimitFPS.Text = "Limit FPS"; + this.mnuLimitFPS.Click += new System.EventHandler(this.mnuLimitFPS_Click); + // + // mnuShowFPS + // + this.mnuShowFPS.Name = "mnuShowFPS"; + this.mnuShowFPS.ShortcutKeys = System.Windows.Forms.Keys.F10; + this.mnuShowFPS.Size = new System.Drawing.Size(152, 22); + this.mnuShowFPS.Text = "Show FPS"; + this.mnuShowFPS.Click += new System.EventHandler(this.mnuShowFPS_Click); + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6); + // + // mnuInputDevices + // + this.mnuInputDevices.Enabled = false; + this.mnuInputDevices.Name = "mnuInputDevices"; + this.mnuInputDevices.Size = new System.Drawing.Size(152, 22); + this.mnuInputDevices.Text = "Input Devices"; + // + // mnuVideoConfig + // + this.mnuVideoConfig.Enabled = false; + this.mnuVideoConfig.Name = "mnuVideoConfig"; + this.mnuVideoConfig.Size = new System.Drawing.Size(152, 22); + this.mnuVideoConfig.Text = "Video"; + this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click); + // + // mnuAudioConfig + // + this.mnuAudioConfig.Enabled = false; + this.mnuAudioConfig.Name = "mnuAudioConfig"; + this.mnuAudioConfig.Size = new System.Drawing.Size(152, 22); + this.mnuAudioConfig.Text = "Audio"; + // + // mnuTools + // + this.mnuTools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuNetPlay, + this.mnuMovies, + this.mnuDebugger, + this.mnuTakeScreenshot}); + this.mnuTools.Name = "mnuTools"; + this.mnuTools.Size = new System.Drawing.Size(48, 20); + this.mnuTools.Text = "Tools"; + // + // mnuNetPlay + // + this.mnuNetPlay.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuStartServer, + this.mnuStopServer, + this.toolStripMenuItem2, + this.mnuFindServer, + this.mnuConnect, + this.mnuDisconnect, + this.toolStripMenuItem3, + this.mnuProfile}); + this.mnuNetPlay.Name = "mnuNetPlay"; + this.mnuNetPlay.Size = new System.Drawing.Size(185, 22); + this.mnuNetPlay.Text = "Net Play"; + // + // mnuStartServer + // + this.mnuStartServer.Name = "mnuStartServer"; + this.mnuStartServer.Size = new System.Drawing.Size(177, 22); + this.mnuStartServer.Text = "Start Server"; + this.mnuStartServer.Click += new System.EventHandler(this.mnuStartServer_Click); + // + // mnuStopServer + // + this.mnuStopServer.Name = "mnuStopServer"; + this.mnuStopServer.Size = new System.Drawing.Size(177, 22); + this.mnuStopServer.Text = "Stop Server"; + this.mnuStopServer.Click += new System.EventHandler(this.mnuStopServer_Click); + // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(174, 6); + // + // mnuFindServer + // + this.mnuFindServer.Enabled = false; + this.mnuFindServer.Name = "mnuFindServer"; + this.mnuFindServer.Size = new System.Drawing.Size(177, 22); + this.mnuFindServer.Text = "Find Public Server..."; + // + // mnuConnect + // + this.mnuConnect.Name = "mnuConnect"; + this.mnuConnect.Size = new System.Drawing.Size(177, 22); + this.mnuConnect.Text = "Connect..."; + this.mnuConnect.Click += new System.EventHandler(this.mnuConnect_Click); + // + // mnuDisconnect + // + this.mnuDisconnect.Name = "mnuDisconnect"; + this.mnuDisconnect.Size = new System.Drawing.Size(177, 22); + this.mnuDisconnect.Text = "Disconnect"; + this.mnuDisconnect.Click += new System.EventHandler(this.mnuDisconnect_Click); + // + // toolStripMenuItem3 + // + this.toolStripMenuItem3.Name = "toolStripMenuItem3"; + this.toolStripMenuItem3.Size = new System.Drawing.Size(174, 6); + // + // mnuProfile + // + this.mnuProfile.Name = "mnuProfile"; + this.mnuProfile.Size = new System.Drawing.Size(177, 22); + this.mnuProfile.Text = "Configure Profile"; + this.mnuProfile.Click += new System.EventHandler(this.mnuProfile_Click); + // + // mnuMovies + // + this.mnuMovies.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuPlayMovie, + this.mnuRecordFrom, + this.mnuStopMovie}); + this.mnuMovies.Name = "mnuMovies"; + this.mnuMovies.Size = new System.Drawing.Size(185, 22); + this.mnuMovies.Text = "Movies"; + // + // mnuPlayMovie + // + this.mnuPlayMovie.Name = "mnuPlayMovie"; + this.mnuPlayMovie.Size = new System.Drawing.Size(152, 22); + this.mnuPlayMovie.Text = "Play..."; + this.mnuPlayMovie.Click += new System.EventHandler(this.mnuPlayMovie_Click); + // + // mnuRecordFrom + // + this.mnuRecordFrom.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuRecordFromStart, + this.mnuRecordFromNow}); + this.mnuRecordFrom.Name = "mnuRecordFrom"; + this.mnuRecordFrom.Size = new System.Drawing.Size(152, 22); + this.mnuRecordFrom.Text = "Record from..."; + // + // mnuRecordFromStart + // + this.mnuRecordFromStart.Name = "mnuRecordFromStart"; + this.mnuRecordFromStart.Size = new System.Drawing.Size(152, 22); + this.mnuRecordFromStart.Text = "Start"; + this.mnuRecordFromStart.Click += new System.EventHandler(this.mnuRecordFromStart_Click); + // + // mnuRecordFromNow + // + this.mnuRecordFromNow.Name = "mnuRecordFromNow"; + this.mnuRecordFromNow.Size = new System.Drawing.Size(152, 22); + this.mnuRecordFromNow.Text = "Now"; + this.mnuRecordFromNow.Click += new System.EventHandler(this.mnuRecordFromNow_Click); + // + // mnuStopMovie + // + this.mnuStopMovie.Name = "mnuStopMovie"; + this.mnuStopMovie.Size = new System.Drawing.Size(152, 22); + this.mnuStopMovie.Text = "Stop"; + this.mnuStopMovie.Click += new System.EventHandler(this.mnuStopMovie_Click); + // + // mnuDebugger + // + this.mnuDebugger.Name = "mnuDebugger"; + this.mnuDebugger.Size = new System.Drawing.Size(185, 22); + this.mnuDebugger.Text = "Debugger"; + this.mnuDebugger.Click += new System.EventHandler(this.mnuDebugger_Click); + // + // mnuTakeScreenshot + // + this.mnuTakeScreenshot.Name = "mnuTakeScreenshot"; + this.mnuTakeScreenshot.ShortcutKeys = System.Windows.Forms.Keys.F12; + this.mnuTakeScreenshot.Size = new System.Drawing.Size(185, 22); + this.mnuTakeScreenshot.Text = "Take Screenshot"; + this.mnuTakeScreenshot.Click += new System.EventHandler(this.mnuTakeScreenshot_Click); + // + // mnuHelp + // + this.mnuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuCheckForUpdates, + this.toolStripMenuItem5, + this.mnuAbout}); + this.mnuHelp.Name = "mnuHelp"; + this.mnuHelp.Size = new System.Drawing.Size(44, 20); + this.mnuHelp.Text = "Help"; + // + // mnuCheckForUpdates + // + this.mnuCheckForUpdates.Enabled = false; + this.mnuCheckForUpdates.Name = "mnuCheckForUpdates"; + this.mnuCheckForUpdates.Size = new System.Drawing.Size(170, 22); + this.mnuCheckForUpdates.Text = "Check for updates"; + // + // toolStripMenuItem5 + // + this.toolStripMenuItem5.Name = "toolStripMenuItem5"; + this.toolStripMenuItem5.Size = new System.Drawing.Size(167, 6); + // + // mnuAbout + // + this.mnuAbout.Enabled = false; + this.mnuAbout.Name = "mnuAbout"; + this.mnuAbout.Size = new System.Drawing.Size(170, 22); + this.mnuAbout.Text = "About"; + // + // toolStripMenuItem7 + // + this.toolStripMenuItem7.Name = "toolStripMenuItem7"; + this.toolStripMenuItem7.Size = new System.Drawing.Size(143, 6); + // + // mnuSaveState + // + this.mnuSaveState.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuSaveState1}); + this.mnuSaveState.Name = "mnuSaveState"; + this.mnuSaveState.Size = new System.Drawing.Size(146, 22); + this.mnuSaveState.Text = "Save State"; + this.mnuSaveState.DropDownOpening += new System.EventHandler(this.mnuSaveState_DropDownOpening); + // + // mnuLoadState + // + this.mnuLoadState.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuLoadState1}); + this.mnuLoadState.Name = "mnuLoadState"; + this.mnuLoadState.Size = new System.Drawing.Size(146, 22); + this.mnuLoadState.Text = "Load State"; + this.mnuLoadState.DropDownOpening += new System.EventHandler(this.mnuLoadState_DropDownOpening); + // + // mnuSaveState1 + // + this.mnuSaveState1.Font = new System.Drawing.Font("Segoe UI", 9F); + this.mnuSaveState1.Name = "mnuSaveState1"; + this.mnuSaveState1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F1))); + this.mnuSaveState1.Size = new System.Drawing.Size(187, 22); + this.mnuSaveState1.Text = "1. "; + this.mnuSaveState1.Click += new System.EventHandler(this.mnuSaveState1_Click); + // + // mnuLoadState1 + // + this.mnuLoadState1.Name = "mnuLoadState1"; + this.mnuLoadState1.ShortcutKeys = System.Windows.Forms.Keys.F1; + this.mnuLoadState1.Size = new System.Drawing.Size(155, 22); + this.mnuLoadState1.Text = "1. "; + this.mnuLoadState1.Click += new System.EventHandler(this.mnuLoadState1_Click); + // + // dxViewer + // + this.dxViewer.BackColor = System.Drawing.Color.Black; + this.dxViewer.Location = new System.Drawing.Point(0, 24); + this.dxViewer.Margin = new System.Windows.Forms.Padding(0); + this.dxViewer.Name = "dxViewer"; + this.dxViewer.Size = new System.Drawing.Size(1024, 896); + this.dxViewer.TabIndex = 1; + // + // frmMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.ClientSize = new System.Drawing.Size(365, 272); + this.Controls.Add(this.dxViewer); + this.Controls.Add(this.menuStrip); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MainMenuStrip = this.menuStrip; + this.Name = "frmMain"; + this.Text = "Mesen"; + this.menuStrip.ResumeLayout(false); + this.menuStrip.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip; + private System.Windows.Forms.ToolStripMenuItem mnuFile; + private System.Windows.Forms.ToolStripMenuItem mnuOpen; + private System.Windows.Forms.ToolStripMenuItem mnuGame; + private Mesen.GUI.Controls.DXViewer dxViewer; + private System.Windows.Forms.ToolStripMenuItem mnuPause; + private System.Windows.Forms.ToolStripMenuItem mnuReset; + private System.Windows.Forms.ToolStripMenuItem mnuStop; + private System.Windows.Forms.ToolStripMenuItem mnuOptions; + private System.Windows.Forms.ToolStripMenuItem mnuLimitFPS; + private System.Windows.Forms.ToolStripMenuItem mnuShowFPS; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem mnuInputDevices; + private System.Windows.Forms.ToolStripMenuItem mnuVideoConfig; + private System.Windows.Forms.ToolStripMenuItem mnuAudioConfig; + private System.Windows.Forms.ToolStripMenuItem mnuTools; + private System.Windows.Forms.ToolStripMenuItem mnuNetPlay; + private System.Windows.Forms.ToolStripMenuItem mnuStartServer; + private System.Windows.Forms.ToolStripMenuItem mnuStopServer; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; + private System.Windows.Forms.ToolStripMenuItem mnuConnect; + private System.Windows.Forms.ToolStripMenuItem mnuDisconnect; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3; + private System.Windows.Forms.ToolStripMenuItem mnuProfile; + private System.Windows.Forms.ToolStripMenuItem mnuMovies; + private System.Windows.Forms.ToolStripMenuItem mnuPlayMovie; + private System.Windows.Forms.ToolStripMenuItem mnuDebugger; + private System.Windows.Forms.ToolStripMenuItem mnuTakeScreenshot; + private System.Windows.Forms.ToolStripMenuItem mnuRecordFrom; + private System.Windows.Forms.ToolStripMenuItem mnuRecordFromStart; + private System.Windows.Forms.ToolStripMenuItem mnuRecordFromNow; + private System.Windows.Forms.ToolStripMenuItem mnuStopMovie; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4; + private System.Windows.Forms.ToolStripMenuItem mnuExit; + private System.Windows.Forms.ToolStripMenuItem mnuFindServer; + private System.Windows.Forms.ToolStripMenuItem mnuHelp; + private System.Windows.Forms.ToolStripMenuItem mnuCheckForUpdates; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5; + private System.Windows.Forms.ToolStripMenuItem mnuAbout; + private System.Windows.Forms.ToolStripMenuItem mnuRecentFiles; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem6; + private System.Windows.Forms.ToolStripMenuItem mnuSaveState; + private System.Windows.Forms.ToolStripMenuItem mnuLoadState; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem7; + private System.Windows.Forms.ToolStripMenuItem mnuSaveState1; + private System.Windows.Forms.ToolStripMenuItem mnuLoadState1; + } +} + diff --git a/GUI.NET/Forms/frmMain.cs b/GUI.NET/Forms/frmMain.cs new file mode 100644 index 00000000..c7bf7ca4 --- /dev/null +++ b/GUI.NET/Forms/frmMain.cs @@ -0,0 +1,353 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using Mesen.GUI.Debugger; +using Mesen.GUI.Forms.NetPlay; + +namespace Mesen.GUI.Forms +{ + public partial class frmMain : Form + { + private InteropEmu.NotificationListener _notifListener; + private Thread _emuThread; + private Thread _renderThread; + private bool _stop = false; + + public frmMain() + { + Application.ThreadException += Application_ThreadException; + InitializeComponent(); + + InteropEmu.InitializeEmu(this.Handle, this.dxViewer.Handle); + InteropEmu.SetFlags((int)EmulationFlags.LimitFPS); + _notifListener = new InteropEmu.NotificationListener(); + _notifListener.OnNotification += _notifListener_OnNotification; + + UpdateMenus(); + UpdateRecentFiles(); + StartRenderThread(); + } + + void Application_ThreadException(object sender, ThreadExceptionEventArgs e) + { + MessageBox.Show(e.Exception.ToString(), "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e) + { + if(e.NotificationType == InteropEmu.ConsoleNotificationType.GameLoaded) { + this.StartEmuThread(); + } + UpdateMenus(); + } + + private void mnuOpen_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Filter = "All supported formats (*.nes, *.zip)|*.NES;*.ZIP|NES Roms (*.nes)|*.NES|ZIP Archives (*.zip)|*.ZIP|All (*.*)|*.*"; + if(ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { + LoadROM(ofd.FileName); + } + } + + private void LoadROM(string filename) + { + ConfigManager.Config.AddRecentFile(filename); + InteropEmu.LoadROM(filename); + UpdateRecentFiles(); + } + + private void UpdateMenus() + { + try { + if(this.InvokeRequired) { + this.BeginInvoke((MethodInvoker)(() => this.UpdateMenus())); + } else { + mnuSaveState.Enabled = mnuLoadState.Enabled = mnuPause.Enabled = mnuStop.Enabled = mnuReset.Enabled = (_emuThread != null && !InteropEmu.IsConnected()); + mnuPause.Text = InteropEmu.IsPaused() ? "Resume" : "Pause"; + + bool netPlay = InteropEmu.IsServerRunning() || InteropEmu.IsConnected(); + + mnuStartServer.Enabled = !netPlay; + mnuStopServer.Enabled = !mnuStartServer.Enabled && !InteropEmu.IsConnected(); + + mnuConnect.Enabled = !netPlay; + mnuDisconnect.Enabled = !mnuConnect.Enabled && !InteropEmu.IsServerRunning(); + + bool moviePlaying = InteropEmu.MoviePlaying(); + bool movieRecording = InteropEmu.MovieRecording(); + mnuPlayMovie.Enabled = _emuThread != null && !netPlay && !moviePlaying && !movieRecording; + mnuStopMovie.Enabled = _emuThread != null && !netPlay && (moviePlaying || movieRecording); + mnuRecordFrom.Enabled = _emuThread != null && !moviePlaying && !movieRecording; + mnuRecordFromStart.Enabled = _emuThread != null && !InteropEmu.IsConnected() && !moviePlaying && !movieRecording; + mnuRecordFromNow.Enabled = _emuThread != null && !moviePlaying && !movieRecording; + + mnuDebugger.Enabled = !netPlay && _emuThread != null; + + mnuTakeScreenshot.Enabled = _emuThread != null; + } + } catch { } + } + + private void UpdateRecentFiles() + { + mnuRecentFiles.DropDownItems.Clear(); + foreach(string filepath in ConfigManager.Config.RecentFiles) { + ToolStripMenuItem tsmi = new ToolStripMenuItem(); + tsmi.Text = System.IO.Path.GetFileName(filepath); + tsmi.Click += (object sender, EventArgs args) => { + LoadROM(filepath); + }; + mnuRecentFiles.DropDownItems.Add(tsmi); + } + } + + private void StartEmuThread() + { + if(_emuThread == null) { + _emuThread = new Thread(() => { + try { + InteropEmu.Run(); + _emuThread = null; + } catch(Exception ex) { + MessageBox.Show(ex.Message); + } + }); + _emuThread.Start(); + } + UpdateMenus(); + } + + private void StartRenderThread() + { + _renderThread = new Thread(() => { + int count = 0; + while(true) { + InteropEmu.Render(); + count++; + if(count == 20) { + count = 0; + UpdateMenus(); + } + System.Threading.Thread.Sleep(5); + System.Threading.Thread.MemoryBarrier(); + if(_stop) { + break; + } + } + }); + _renderThread.Start(); + } + + private void StopEmu() + { + InteropEmu.Stop(); + _stop = true; + _renderThread.Join(); + } + + private void PauseEmu() + { + if(InteropEmu.IsPaused()) { + InteropEmu.Resume(); + } else { + InteropEmu.Pause(); + } + } + + private void ResetEmu() + { + InteropEmu.Reset(); + } + + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if(keyData == Keys.Escape && _emuThread != null && mnuPause.Enabled) { + PauseEmu(); + return true; + } + return base.ProcessCmdKey(ref msg, keyData); + } + + const int NumberOfSaveSlots = 5; + private void InitializeStateMenu(ToolStripMenuItem menu, bool forSave) + { + menu.DropDownItems.Clear(); + for(uint i = 1; i <= frmMain.NumberOfSaveSlots; i++) { + Int64 fileTime = InteropEmu.GetStateInfo(i); + string label; + if(fileTime == 0) { + label = i.ToString() + ". "; + } else { + DateTime dateTime = DateTime.FromFileTime(fileTime); + label = i.ToString() + ". " + dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); + } + + ToolStripMenuItem item = (ToolStripMenuItem)menu.DropDownItems.Add(label); + uint stateIndex = i; + item.Click += (object sender, EventArgs e) => { + if(forSave) { + InteropEmu.SaveState(stateIndex); + } else { + InteropEmu.LoadState(stateIndex); + } + }; + item.ShortcutKeys = (Keys)((int)Keys.F1 + i - 1); + if(forSave) { + item.ShortcutKeys |= Keys.Shift; + } + } + } + + #region Events + + private void mnuPause_Click(object sender, EventArgs e) + { + PauseEmu(); + } + + private void mnuReset_Click(object sender, EventArgs e) + { + ResetEmu(); + } + + private void mnuStop_Click(object sender, EventArgs e) + { + InteropEmu.Stop(); + } + + private void mnuLimitFPS_Click(object sender, EventArgs e) + { + if(mnuLimitFPS.Checked) { + InteropEmu.ClearFlags((int)EmulationFlags.LimitFPS); + } else { + InteropEmu.SetFlags((int)EmulationFlags.LimitFPS); + } + mnuLimitFPS.Checked = !mnuLimitFPS.Checked; + } + + private void mnuShowFPS_Click(object sender, EventArgs e) + { + + } + + private void mnuStartServer_Click(object sender, EventArgs e) + { + frmServerConfig frm = new frmServerConfig(); + if(frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { + InteropEmu.StartServer(ConfigManager.Config.ServerInfo.Port); + } + } + + private void mnuConnect_Click(object sender, EventArgs e) + { + frmClientConfig frm = new frmClientConfig(); + if(frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { + InteropEmu.Connect(ConfigManager.Config.ClientConnectionInfo.Host, ConfigManager.Config.ClientConnectionInfo.Port, ConfigManager.Config.Profile.PlayerName, ConfigManager.Config.Profile.PlayerAvatar, (UInt16)ConfigManager.Config.Profile.PlayerAvatar.Length); + } + } + + private void mnuProfile_Click(object sender, EventArgs e) + { + new frmPlayerProfile().ShowDialog(); + } + + private void mnuStopServer_Click(object sender, EventArgs e) + { + Task.Run(() => InteropEmu.StopServer()); + } + + private void mnuDisconnect_Click(object sender, EventArgs e) + { + Task.Run(() => InteropEmu.Disconnect()); + } + + private void mnuExit_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void mnuVideoConfig_Click(object sender, EventArgs e) + { + + } + + private void mnuDebugger_Click(object sender, EventArgs e) + { + new frmDebugger().Show(); + } + + private void mnuSaveState1_Click(object sender, EventArgs e) + { + InteropEmu.SaveState(1); + } + + private void mnuLoadState1_Click(object sender, EventArgs e) + { + InteropEmu.LoadState(1); + } + + private void mnuSaveState_DropDownOpening(object sender, EventArgs e) + { + InitializeStateMenu(mnuSaveState, true); + } + + private void mnuLoadState_DropDownOpening(object sender, EventArgs e) + { + InitializeStateMenu(mnuLoadState, false); + } + + private void mnuTakeScreenshot_Click(object sender, EventArgs e) + { + InteropEmu.TakeScreenshot(); + } + + #endregion + + private enum EmulationFlags + { + LimitFPS = 0x01, + Paused = 0x02, + } + + private void RecordMovie(bool resetEmu) + { + SaveFileDialog sfd = new SaveFileDialog(); + sfd.Filter = "Movie files (*.mmo)|*.mmo|All (*.*)|*.*"; + if(sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { + InteropEmu.MovieRecord(sfd.FileName, resetEmu); + } + } + + private void mnuPlayMovie_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Filter = "Movie files (*.mmo)|*.mmo|All (*.*)|*.*"; + if(ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { + InteropEmu.MoviePlay(ofd.FileName); + } + } + + private void mnuStopMovie_Click(object sender, EventArgs e) + { + InteropEmu.MovieStop(); + } + + private void mnuRecordFromStart_Click(object sender, EventArgs e) + { + RecordMovie(true); + } + + private void mnuRecordFromNow_Click(object sender, EventArgs e) + { + RecordMovie(false); + } + } +} diff --git a/GUI.NET/Forms/frmMain.resx b/GUI.NET/Forms/frmMain.resx new file mode 100644 index 00000000..5b87d984 --- /dev/null +++ b/GUI.NET/Forms/frmMain.resx @@ -0,0 +1,412 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + + AAABAAMAEBAAAAAAGABoAwAANgAAACAgAAAAABgAqAwAAJ4DAABAQAAAAAAYACgyAABGEAAAKAAAABAA + AAAgAAAAAQAYAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAANPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT0/////////////////////////7+/v7+/v///////////////////////9PT09PT + 0////////////+np6cHBwaamppubm5qamqWlpb6+vuTk5P///////////9PT09PT0/////j4+Ly8vJqa + mpqamq2trb6+vr6+vq6urpubm5qamrW1tfT09P///9PT09PT0/b29qqqqpqamry8vPDw8Pz8/Ofn5+fn + 5/z8/PPz88PDw5ubm6WlpfLy8tPT09PT07a2tpqamtbW1v///+Li4qKiopqampqamqKiouLi4v///9/f + 35ubm7Ozs9PT09PT06WlpcPDw/////T09J6enp6enqmpqZqampqamp6envT09P///8XFxaWlpdPT09PT + 0/f5/f7+/////9jY2JqamsTExO3t7ZqampqampqamtjY2P////7+//f5/dPT09PT0xxv/22i/////93d + 3ZqamsbGxu/v75qampqampqamt3d3f///2mg/xxv/9PT09PT00CG/wRg/67L//v7+6mpqbq6uuHh4Zqa + mpqamqmpqfv7+5e9/wFf/0eL/9PT09PT093q/xtv/wJf/2mg/9ji9b29vaCgoKCgoL29vc/d9FeV/wBe + /yh3/+jw/9PT09PT0////+Pt/0SJ/wBe/wJf/zR//1uX/1qX/zF8/wFf/wBe/1eV/+70/////9PT09PT + 0////////////7zU/1yY/x1w/wFf/wFf/x9x/2Kc/8jc/////////////9PT09PT0/////////////// + //////////z9//z9/////////////////////////9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT0///AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAIAAAAEAAAAABABgAAAAAAAAMAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /Pz84eHhycnJtra2qqqqpKSkpKSkqqqqtra2x8fH3t7e+fn5//////////////////////////////// + ////09PT09PT////////////////////////////7u7uwcHBn5+fmpqampqampqampqampqampqampqa + mpqampqampqanJycubm54+Pj////////////////////////////09PT09PT//////////////////// + 8/Pzvb29m5ubmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqasLCw6Ojo + ////////////////////09PT09PT////////////////2NjYn5+fmpqampqampqampqampqampqapqam + tbW1vb29vb29tbW1p6enmpqampqampqampqampqampqam5ubxcXF/Pz8////////////09PT09PT//// + /////f39wcHBmpqampqampqampqampqarKys1NTU8/Pz////////////////////////9vb22tratbW1 + mpqampqampqampqampqasLCw9vb2////////09PT09PT/////f39ubm5mpqampqampqampqaqqqq4eHh + ////////////////////////////////////////////////7e3tt7e3mpqampqampqampqaq6ur9/f3 + ////09PT09PT////wcHBmpqampqampqampqayMjI/Pz8////////////7e3txMTEqqqqnZ2dnZ2dqqqq + xMTE7e3t////////////////29vbn5+fmpqampqampqatLS0/v7+09PT09PT3t7empqampqampqanJyc + 3Nzc/////////////f39xsbGm5ubmpqampqampqampqampqampqam5ubxsbG/f39////////////7Ozs + o6Ojmpqampqampqa1tbW09PT09PTrKysmpqampqampqa3d3d/////////////v7+u7u7mpqampqampqa + mpqampqampqampqampqampqampqau7u7/v7+////////////6urqnZ2dmpqampqaqqqq09PT09PTnZ2d + mpqampqawcHB////////////////1dXVmpqampqampqampqampqampqampqampqampqampqampqampqa + 1dXV////////////////xcXFmpqampqanZ2d09PT09PTz8/Pm5ubqKio8/Pz/////////////v7+pKSk + mpqampqampqavLy819fXpaWlmpqampqampqampqampqampqapaWl/v7+////////////8/PzqKiom5ub + 0NDQ09PT09PT/////Pz8/v7+////////////////6+vrmpqampqampqanp6e/f39////19fXmpqampqa + mpqampqampqampqampqa6+vr/////////////////v7+/Pz8////09PT09PT////+Pr//v7///////// + ////////3t7empqampqampqaoqKi////////3d3dmpqampqampqampqampqampqampqa3t7e//////// + /////////v7/+Pr/////09PT09PTiLP/BWD/JXT/4ez/////////////4uLimpqampqampqaoqKi//// + ////3d3dmpqampqampqampqampqampqampqa4uLi////////////4ez/JXT/BWD/ibP/09PT09PTCmT/ + AF7/AF7/b6P/////////////9vb2m5ubmpqampqaoqKi////////3d3dmpqampqampqampqampqampqa + m5ub9vb2////////////Y5z/AF7/AF7/CmT/09PT09PTKnj/AF7/AF7/B2L/zN7/////////////ubm5 + mpqampqaoqKi////////3d3dmpqampqampqampqampqampqauLi4////////////qsj/AV//AF7/AF7/ + Lnr/09PT09PTmr7/AF7/AF7/AF7/F2z/0eH/////////8PDwn5+fmpqam5ub8fHx////yMjImpqampqa + mpqampqampqan5+f8PDw////////qMf/BmH/AF7/AF7/AF7/rcv/09PT09PT/f3/Qof/AF7/AF7/AF7/ + DWb/pcX/////////5eXloKCgmpqaoaGhsbGxmpqampqampqampqampqaoKCg5eXl////+fv/dqf/AV// + AF7/AF7/AF7/ZJz/////09PT09PT////7PL/Knj/AF7/AF7/AF7/AF7/Soz/0uL/////8fHxurq6m5ub + mpqampqampqampqam5uburq68fHx////tM//KXf/AF7/AF7/AF7/AF7/UI//+vz/////09PT09PT//// + ////6vH/OIH/AF7/AF7/AF7/AF7/AV//RYn/osP/6vH/9PT02trazs7Ozs7O2tra9PT04uz/k7r/L3v/ + AF7/AF7/AF7/AF7/AF7/ZJz/+vz/////////09PT09PT////////////+Pr/bqP/Al//AF7/AF7/AF7/ + AF7/AF7/AV7/InP/Ror/WJX/WZX/RYn/HnD/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ncH///////////// + ////09PT09PT////////////////////xtr/OIH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al//WZb/4u3/////////////////////09PT09PT//////////////////// + ////////utP/UJD/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/DWb/ZZ3/1OP///////// + ////////////////////09PT09PT////////////////////////////////////8PX/rMr/cqX/R4r/ + Knj/G27/G27/Knj/SYv/d6n/ttD/9vn/////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAQAAAAIAAAAABABgAAAAAAAAwAAAAAAAAAAAAAAAA + AAAAAAAA09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////////////////////////////////////////+vr66Ojo2dnZzc3NxMTE + v7+/vLy8vLy8v7+/xcXFzc3N2NjY5ubm+Pj4//////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////////////////////////////////////////////+fn53d3dwsLCqqqqmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqapaWlvLy81dXV8vLy//////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + /////////////////////////////////////////////////////////////////Pz83Nzct7e3nJyc + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaq6urzc3N8/Pz//////////////////////////////////////////////////////////////// + ////09PT09PT////////////////////////////////////////////////////////////9fX1ysrK + oqKimpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqam5ubtra24uLi//////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + 9vb2xcXFnZ2dmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqara2t4ODg//////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////f39z8/Pn5+fmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + sbGx6+vr////////////////////////////////////////////09PT09PT//////////////////// + ////////////////////6Ojoqqqqmpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqam5ubxsbG+/v7////////////////////////////////////09PT09PT//// + /////////////////////////////f39ysrKm5ubmpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqaoqKirq6utbW1uLi4uLi4tbW1rq6uo6Ojmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqaqKio6urq//////////////////////////// + ////09PT09PT////////////////////////////9fX1sbGxmpqampqampqampqampqampqampqampqa + mpqampqampqampqampqanJyctLS0z8/P5eXl+fn5////////////////////////////////+/v76enp + 1NTUvLy8oaGhmpqampqampqampqampqampqampqampqampqampqampqampqampqanJyc1tbW//////// + ////////////////////09PT09PT////////////////////////6+vrpKSkmpqampqampqampqampqa + mpqampqampqampqampqampqampqasrKy2NjY+fn5//////////////////////////////////////// + /////////////////////////v7+5eXlwsLCn5+fmpqampqampqampqampqampqampqampqampqampqa + mpqampqaxcXF/v7+////////////////////09PT09PT////////////////////5OTkn5+fmpqampqa + mpqampqampqampqampqampqampqampqam5ubvr6+7Ozs//////////////////////////////////// + ////////////////////////////////////////////////////+vr61NTUpqammpqampqampqampqa + mpqampqampqampqampqampqampqavb29/v7+////////////////09PT09PT////////////////4+Pj + nZ2dmpqampqampqampqampqampqampqampqampqampqauLi47+/v//////////////////////////// + /////////////////////////////////////////////////////////////////////////////f39 + 1dXVoqKimpqampqampqampqampqampqampqampqampqampqavb29/v7+////////////09PT09PT//// + ////////6OjonZ2dmpqampqampqampqampqampqampqampqampqapaWl4eHh//////////////////// + ////////////////////////+/v76enp3d3d19fX19fX3d3d6enp+/v7//////////////////////// + ////////////////////+fn5w8PDmpqampqampqampqampqampqampqampqampqampqaxsbG//////// + ////09PT09PT////////8vLyoaGhmpqampqampqampqampqampqampqampqampqavr6++fn5//////// + ////////////////////////////9vb20NDQsLCwm5ubmpqampqampqampqampqampqam5ubsLCw0NDQ + 9vb2////////////////////////////////////////5OTkpKSkmpqampqampqampqampqampqampqa + mpqampqa29vb////////09PT09PT/////f39rq6umpqampqampqampqampqampqampqampqanJyc19fX + ////////////////////////////////////9/f3xMTEnZ2dmpqampqampqampqampqampqampqampqa + mpqampqampqampqanZ2dxMTE9/f3////////////////////////////////////9vb2sbGxmpqampqa + mpqampqampqampqampqampqan5+f8/Pz////09PT09PT////zMzMmpqampqampqampqampqampqampqa + mpqaoKCg5ubm////////////////////////////////////39/foqKimpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqaoqKi39/f//////////////////////////////// + /////Pz8urq6mpqampqampqampqampqampqampqampqau7u7////09PT09PT8/PznZ2dmpqampqampqa + mpqampqampqampqaoaGh7Ozs////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqazMzM//////////// + /////////////////////////f39urq6mpqampqampqampqampqampqampqampqa7Ozs09PT09PTx8fH + mpqampqampqampqampqampqampqanp6e6urq////////////////////////////////////ysrKmpqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqaysrK/////////////////////////////////////Pz8sLCwmpqampqampqampqampqampqampqa + w8PD09PT09PTpaWlmpqampqampqampqampqampqampqa3t7e//////////////////////////////// + ////2dnZmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqa2dnZ////////////////////////////////////8/Pzn5+fmpqampqa + mpqampqampqampqapaWl09PT09PTm5ubmpqampqampqampqampqampqav7+///////////////////// + ////////////////8/Pznp6empqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqan5+f8/Pz//////////////////////////////// + ////zc3Nmpqampqampqampqampqampqam5ub09PT09PTrKysmpqampqampqampqampqam5ub8vLy//// + ////////////////////////////////vb29mpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29//////////////// + ////////////////////8/PzmpqampqampqampqampqampqarKys09PT09PT39/fmpqampqampqampqa + mpqawsLC////////////////////////////////////8fHxmpqampqampqampqampqampqampqampqa + mpqasLCwxcXFrq6umpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqam5ub + 8fHx////////////////////////////////////wsLCmpqampqampqampqampqa39/f09PT09PT//// + 3d3dqKiompqaoKCgysrK/f39////////////////////////////////////zMzMmpqampqampqampqa + mpqampqampqampqazs7O////////////yMjImpqampqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqazMzM/////////////////////////////////////f39ysrKoKCgmpqaqKio3d3d + ////09PT09PT////////////+/v7/v7+////////////////////////////////////////////r6+v + mpqampqampqampqampqampqampqaqqqq/////////////////f39paWlmpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqar6+v//////////////////////////////////////////// + /v7++/v7////////////09PT09PT//////////////////////////////////////////////////// + /////////f39nJycmpqampqampqampqampqampqampqavb29////////////////////uLi4mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqanJyc/v7+//////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + ////////////////////////9PT0mpqampqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqa9PT0//////// + ////////////////////////////////////////////////////09PT09PT////////////+vz//f7/ + ////////////////////////////////////////7+/vmpqampqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqa7u7u/////////////////////////////////////////f7/+vz/////////////09PT09PT//// + rMn/J3X/Al7/FGn/fKr/+/z/////////////////////////////////8/Pzmpqampqampqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqampqampqa8/Pz////////////////////////////////+/z/e6r/FGn/Al7/KHX/rMn/ + ////09PT09PTsMv/AV7/AF7/AF7/AF7/AF7/aJ7//////////////////////////////////Pz8m5ub + mpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqa + mpqampqampqampqampqampqampqampqam5ub/f39////////////////////////////////aJ7/AF7/ + AF7/AF7/AF7/Al//sMz/09PT09PTMHv/AF7/AF7/AF7/AF7/AF7/A1//4+3///////////////////// + ////////////rKysmpqampqampqampqampqampqampqavr6+////////////////////ubm5mpqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqarKys//////////////////////////// + ////3+r/Al7/AF7/AF7/AF7/AF7/AF7/MHv/09PT09PTBGD/AF7/AF7/AF7/AF7/AF7/AF7/hbD///// + ////////////////////////////x8fHmpqampqampqampqampqampqampqavr6+//////////////// + ////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqax8fH//////////// + ////////////////////YZr/AF7/AF7/AF7/AF7/AF7/AF7/BGD/09PT09PTHm//AF7/AF7/AF7/AF7/ + AF7/AF7/D2b/4uz/////////////////////////////7Ozsmpqampqampqampqampqampqampqavr6+ + ////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqampqampqampqampqa + 7Ozs////////////////////////////rcr/AV7/AF7/AF7/AF7/AF7/AF7/AF7/HnD/09PT09PTaZ// + AF7/AF7/AF7/AF7/AF7/AF7/AF7/OoH/+Pr/////////////////////////////tbW1mpqampqampqa + mpqampqampqavr6+////////////////////ubm5mpqampqampqampqampqampqampqampqampqampqa + mpqampqampqatbW1////////////////////////////zN7/DGX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + dKX/09PT09PTz+D/AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH//P3///////////////////////// + 7e3tm5ubmpqampqampqampqampqauLi4////////////////////srKympqampqampqampqampqampqa + mpqampqampqampqampqampqanJyc7e3t////////////////////////0OD/FGn/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/CWP/4+z/09PT09PT////VJH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/VZH/+fv///// + ////////////////////zs7OmpqampqampqampqampqanZ2d8vLy////////////7e3tm5ubmpqampqa + mpqampqampqampqampqampqampqampqampqampqazs7O////////////////////////wtf/EWj/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/gK3/////09PT09PT////4ez/Dmb/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/PYP/6fD//////////////////////v7+vb29mpqampqampqampqampqaqKio4+Pj+fn54ODg + paWlmpqampqampqampqampqampqampqampqampqampqampqampqavLy8/v7+//////////////////// + nL//B2L/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/NH3/+vv/////09PT09PT////////pcX/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/G27/vtX//////////////////////f39vb29mpqampqampqampqa + mpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqavb29/f39//////// + ////////8fb/Xpj/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/3+r/////////09PT09PT//// + ////////c6T/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Al//bKD/8fb///////////////////// + 0NDQnJycmpqampqampqampqampqampqampqampqampqampqampqampqampqampqampqampqanJyc0NDQ + ////////////////////ttD/H3D/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CmT/xtr///////// + ////09PT09PT/////////////f3/WZX/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/GGz/mL3/ + +/z/////////////////7u7utra2mpqampqampqampqampqampqampqampqampqampqampqampqampqa + mpqatra27u7u////////////////2OX/T47/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/ + utL/////////////////09PT09PT////////////////+vz/WZT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/InL/lbr/9Pj/////////////////6urqwsLCoqKimpqampqampqampqampqampqa + mpqampqaoqKiwsLC6urq////////////////0+L/XZf/BGD/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/DWX/vdT/////////////////////09PT09PT/////////////////////P3/bqL/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/EGf/Z53/wdb//P3//////////////v7+7e3t2tra + zs7OyMjIyMjIzs7O2tra7e3t/v7+////////////8PX/oMH/P4T/AV7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/HG7/z9//////////////////////////09PT09PT//////////////////// + ////////mL3/BmH/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/WJT/lrv/ + ytz/9fn/////////////////////////////////8fb/wdb/iLL/RIj/B2L/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/PYP/5+//////////////////////////////09PT09PT//// + ////////////////////////////zN7/JnT/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/Al7/Gm3/NH3/Ron/To7/T47/R4n/NH3/GGz/AV3/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/A1//fKv/+/z///////////////////////////// + ////09PT09PT////////////////////////////////////9Pj/cKP/Al//AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Knf/x9r///////////////////// + ////////////////////09PT09PT////////////////////////////////////////////zd7/PIP/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/Dmb/ibP/+fv///////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + /////////////v7/sc3/MXz/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/CWP/cKP/6fH/ + ////////////////////////////////////////////////////09PT09PT//////////////////// + /////////////////////////////////////v//uNH/Sov/Al7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/FWr/ + e6r/5+//////////////////////////////////////////////////////////////09PT09PT//// + ////////////////////////////////////////////////////////////////4Or/hLD/LXj/AV7/ + AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + BmH/TI3/qcf/9/r///////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + ////////////3en/l7z/V5P/HW//AV7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/AF7/ + A17/KXb/Zp3/q8n/7/X///////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + /////////////////////////////////////////v//7PL/wtf/n8H/g6//bqL/YJn/WZT/WJT/X5n/ + bqL/hLD/osP/x9r/8fb///////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT//////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////09PT09PT//// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////09PT09PT//////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////09PT09PT//////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////09PT09PT//////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT + 09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PTAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + + \ No newline at end of file diff --git a/GUI.NET/GUI.NET.csproj b/GUI.NET/GUI.NET.csproj new file mode 100644 index 00000000..db7cef17 --- /dev/null +++ b/GUI.NET/GUI.NET.csproj @@ -0,0 +1,185 @@ + + + + + Debug + AnyCPU + {08D83A7E-52A9-451E-A53A-1A7946F8BB77} + WinExe + Properties + Mesen.GUI + Mesen + v4.5 + 512 + + + x86 + true + full + false + ..\Debug\ + DEBUG;TRACE + prompt + 4 + true + + + x86 + pdbonly + true + ..\Release\ + TRACE + prompt + 4 + true + + + Icon.ico + + + + + + + + + + + + + + + + + UserControl + + + DXViewer.cs + + + UserControl + + + ctrlConsoleStatus.cs + + + UserControl + + + ctrlDebuggerCode.cs + + + Component + + + UserControl + + + ctrlWatch.cs + + + Form + + + frmDebugger.cs + + + Form + + + Form + + + frmVideoConfig.cs + + + Form + + + frmClientConfig.cs + + + Form + + + frmMain.cs + + + Form + + + frmPlayerProfile.cs + + + Form + + + frmServerConfig.cs + + + + + + ctrlConsoleStatus.cs + + + ctrlDebuggerCode.cs + + + ctrlWatch.cs + + + frmDebugger.cs + + + frmVideoConfig.cs + + + frmMain.cs + + + frmClientConfig.cs + + + frmPlayerProfile.cs + + + frmServerConfig.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/GUI.NET/Icon.bmp b/GUI.NET/Icon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..12dfc3ebbf5711e74bc9de18c64fd0418c313bc5 GIT binary patch literal 5174 zcmeH~X?PXY8OJjwB3eXHY^`gR7SXE3rL=VcOYaSe(G-giln^i>fJLN=N(;6c5={(b zq^#L@gzO2~$Xar+EWqD0XXc!lx%Z}g;7dO^&-30n=Y8Mb z|IEDSJ(DNXUY$J7jb4*I+}tLT(Tj=+ZX>B*`l%i*o0~u;!~|c!Z9X6nyMdTHF^>hn zh=ssSZv!{`1GfYKqZR?T5*r-|+(vB7VqokNVBAvR&Ub*jmH~Ia3*56DxR=;{?*aEq zwgPy7*hB9F6IKEbe+Wz@_Q*%TqaOp0uL35m2A*64Jo5?g>}SC9Yk?PtO$`PNp@3%? zFrCEW%;0VY`6M zCBT+aU~3t$tsID{1mgDq3B;02Kxz%Jvkpk#2V@Y-tOs(wA=UuoHUfoap!i#$Ku-d=PP{%{Y_MeGQ%|Mmji-vd48fZjgf?Afz8 zckUd{pFfWa7cQW$uMZb5Uc{wKm+-w5zX)9D2l@tpOM^gve?JBW1~51{h@qh&^b_B} z5HKj&WnhTd<;z!a$pVmI$(nS$PZV)=G@KU!GZq% zfg$0WavF!ra$Ucs$e`B^y35;tLzOEH7rbTLd`}(ACVvSxIY~J2HDO*X-}!Fz&2Ug~ z;A=ysJ5xH(8)-TP9dBL#vM$&4WNyAjLCfbl)XX(*Fc?2Ka|M;Rh8Z0Jui5kb{N~Mm z)zNR5xr+&KzGkj2%k!=E*-b3TocERgEBf%il^EmmU(?3l+{9U?VapEE6(__-BMP6T zi5V9aFi3xI{_4+~MFOaR%x7wL&97KbX=m0An&zMal+RUh?{rPRIWKbK#>hOi+ID-> zTJ;e=C#e!&rPgMV`rfq>KFWp|eIjaA)hxAATPbgy%_KcH^0c~O^_fU`dT<>N)$*Ns z*(9z1CBtXr@SJGPd&*(2XdbjIWW?KqH?f6YQOnLHS)z3Rk_%Y5K!GTJq2#>8d&(ZB z#nf>a7qIv!-nF9Wtqh}hbhC=+N1J(yN$D4FQB;Z?sK#E>Q|gS=i(TQe*C>j!=*Xyk zodQ(AaTLICyGahs62)jb3gVGH9P$a_JFEDNdw5z9bw!i?i=1hg5oYB9Ui)>#70Sir zfo2cFW*BBh%74Gi@>!B4<|xSP($vbTt2pP#IrP^i^)>B(jni&r-(LA${qzsusa;9J zocL-6ETXCl*i^Y!Yu93YYrE<#W`JwHNX=|-mHAcox{vu&8}ln0V=%bpc?Yyj8{>Z8 zD)RjQxIrM-bBwpJuc%Aj$oJ_viE>{piVsQy!J~``$o(|T`m`TS}0f0kIvp?+bP{W3+0T|F$zAijP%cMl!-9uJ2||LGSj6Ksc0!8 z(up8f>}`x#EcIW>C^nr?LF2Xnnm;qMDNWb@{&MsF?IxB#zJ>Phhiop4`-}=$WdUVX zb_<|;zwfs^d+bi7|6k-T_ZRk2g$QbCcThuKC;sdpwzH0SO16(h6?!q}&lCwwEP*zNmb{yLEt zou*AFS7P$>OOwQVbOL1Je#iJn9)IG|@wdAbe@5!I)G(7JA!^i*OkY?bTCkeL7*!P!A`Q6h`O`fuJWxRYU ZG#nca%d>=Q+<)Y+QJ`ytulK)q@dsSo0<5nn?I}{2jw?YBSM!8d3%4M{aJLOVnA3txOAE&41J@5Owv|vz9e*N`1 z&-GWIBW)PIs-ruJR`Dxc~tb2rPCD_3ArSXg-Q;6b$~igHYmbm%4BMpeNPCf0o~lktfH< zcZUVAC`ocMsQwoFAR@A|Tz)rJ?in1I@wx90@=UI5+^-LVZ{^<-zb0L66h7gg_8EPP zw5>-3{j4*8UHLQpj6Ugxj7Vi?9IlV{(kP$yLJQ;k*YWB4^odQIHqqDd4IefK1fnG+ zB?k^1xP19?n6}Zx@IQI-BtC57#EGVZdWGEF+~v!cA3Ai%VA_HgA74d}R1fFH^ePJq z3XUB+W`iS#@$oud&NySdDfto*X3Uro&IL-iH>%X+V&gY9Hc}x@syTD!l$V!NB9p`j zcBgo5x$%?v)^RHJRlOXSTOv={-WyL9PNJMHY*voBt}ND_nZFyFXwqg_l8 zaNguNzBwSMFSj$@w{M?av5OWhVk}gAnwiO+_OO3{izlR9xOwlpM#&=#OfGeGbyKHK zHBby(iccjQrH&Gs1Oh8otT2zf0tT3wENW|ODWY0ZOvN`EYROn4?AWoxi|Hsavs2N8 z)Bsq;FDomfurp`QwA%@+=&S~cA$`}bT@0;8V+53T5dZ-Sz-`;MDL%RLHfneqN&L@07Yycn22E|jrw^KD8IO;d>9C}KHaCd|tnz>G z)uiUL&&U?5pr%L1<1bsb%+Si)n4EgR_S=6<;^(YN;-mcP0Qu;eS6~jPT@r?8&YS^+ zer+mE1q?7#{Fx>4nWtNz@;4{(>4HD~TZ{gVzA|lnlF^YPN0>qZHF@&n`Sa&H;5@xsoBp)%9ORiBWAC7<9{~?1ftb-@@}Dg=e1Tzl(~Z2`~#vA zG}?hvgQ=nx!F+egWu{?)2Ic){V^XS|gAhxa&q&F*x)%qf)@r%Cs>f(CHcz~F=M z^HDN%mMqyO7viQTsqvjcWg3mCpG={=_BRG!bGc66?t0)x$AfiBSN>k-&#Y4(BI1PW zRQwwW>uo|eg;Hzjrl9I2d5gcdT5g!~R{h_ws`h5ozV+YG(7;lC&z?P7w{B%2xq9_# zRyPC$7Dp&qq#r$cl)XRmU^(-q~iYWfHJ$sWa27keV1&m5DoWq%_ zhP^Th%fOLlx59NeJ9XfA`Ey{H5|c*7fgu~GQS{Q+Givij*e8#vC4Iyex>JNOe@+Ba zdPtfy2Y~4_OvjSG#&Dc+SaFKr@W<7}lV{vdXLDZLIr9qkT?q&@`*=^HWuzT)5*z;_ za7v~^Z2n9|;`U_!Y-?C+k!FL2UOPTZ<a-@HJp!Nsr)HRRMpX<;+;%P!K1Ra^&~fh!vd`$rU(#I{+xK) zm`3LKBWCO)J4R6Rsr- z{bxY;j&~HHjr@U)@q19R8FKPluqDa=q0m`&$6mq>$EXk<@7ksQfsM+svNou8n?EwN zwf?#6={zF(mx3rTiJI@VvHpRL%JS(P4?}1x|9b~{o_?{faMQpWn7BGUw_WN#YNDQB z>Nan!ZSE>4|Nav_{IU7r8_DZB;ZlUJx3#hT0~pQ)4fkqp@8hR8WLlDcS(U$l6yZ1T z_%Gga^DW$q8Lb=+><)R~l%r(i0?L$|kB3W5@-C8r=U!P; zcoxmfiX9}jDcA!~bMnJpVtCq+yIQ!E<np2TUH1zL zg1ZhE!CS*oN|HN1|I7vHIW~^TSAH+JQw=tMG%tM^myjW2z$5|R32f;^&FG?NqbCUo z9VjmL+~>OiW$Kf=b6j&W!Qs!WpKDac*el#QK*koi6Ab1p`lE*!!uBJKovF_5Bl4@a zQ)Eq_E&SMU4+Mul8fHg5-b;Z)x$b{aMi{v9et#zycKybf0X=EVc?V$XbRiud3k=k6z^>1W9f`|9=&wO5{!U*A&S!Or`!;m zR4hMvGtzY%<_LEWl(I^fd=!7RqmkH`9&NO+OrLtQfjlxI z&b>JJc)w2~cDuvv$1Wse-#3P&^&;#XnP`3O1;NF28!5khJ80G2M+Q+kPKT#5Lt`2_ zY_{9iY=-gtv806$_T8Mc3127q!J$%Oxf+|ckyG+l%dH3GN5eC#y0#RGk(4{k-a+3m zS0PRQ7&kS^{H?(+oZ3PxWm-HWue&C=lAKmZpTEMfI9~RVJUYs=nn=kl-T)84@-V8O zMinMg{syP2R^BX-Z@rq9_lseUi~GetWLAk>Y`#}-@Y58s=5O#TYGlkxdHh|uXHdFj z>DW^qct!e-m)V=-RJ}pUMrb>KlPgV&%j!&eCl<@_dBF(S`-5O8XI$v@K@jDAaituW z5}rXBkW7Vk { + this.ProcessNotification(type); + }; + _notificationListener = InteropEmu.RegisterNotificationCallback(_callback); + } + + public void Dispose() + { + InteropEmu.UnregisterNotificationCallback(_notificationListener); + } + + public void ProcessNotification(int type) + { + if(this.OnNotification != null) { + this.OnNotification(new NotificationEventArgs() { NotificationType = (ConsoleNotificationType)type }); + } + } + } + } + + public struct DebugState + { + public CPUState CPU; + public PPUDebugState PPU; + } + + public struct PPUDebugState + { + public PPUControlFlags ControlFlags; + public PPUStatusFlags StatusFlags; + public PPUState State; + public Int32 Scanline; + public UInt32 Cycle; + } + + public struct PPUState + { + public Byte Control; + public Byte Mask; + public Byte Status; + public UInt32 SpriteRamAddr; + public UInt16 VideoRamAddr; + public Byte XScroll; + public UInt16 TmpVideoRamAddr; + public Byte WriteToggle; + + public UInt16 HighBitShift; + public UInt16 LowBitShift; + } + + public struct PPUControlFlags + { + public Byte VerticalWrite; + public UInt16 SpritePatternAddr; + public UInt16 BackgroundPatternAddr; + public Byte LargeSprites; + public Byte VBlank; + + public Byte Grayscale; + public Byte BackgroundMask; + public Byte SpriteMask; + public Byte BackgroundEnabled; + public Byte SpritesEnabled; + public Byte IntensifyRed; + public Byte IntensifyGreen; + public Byte IntensifyBlue; + } + + public struct PPUStatusFlags + { + public Byte SpriteOverflow; + public Byte Sprite0Hit; + public Byte VerticalBlank; + } + + public struct CPUState + { + public UInt16 PC; + public Byte SP; + public Byte A; + public Byte X; + public Byte Y; + public Byte PS; + public IRQSource IRQFlag; + public bool NMIFlag; + }; + + [Flags] + public enum IRQSource : uint + { + External = 1, + FrameCounter = 2, + DMC = 4, + } + + [Flags] + public enum PSFlags + { + Carry = 0x01, + Zero = 0x02, + Interrupt = 0x04, + Decimal = 0x08, + Break = 0x10, + Reserved = 0x20, + Overflow = 0x40, + Negative = 0x80 + } +} diff --git a/GUI.NET/Program.cs b/GUI.NET/Program.cs new file mode 100644 index 00000000..5ab8d0b4 --- /dev/null +++ b/GUI.NET/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Mesen.GUI +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Mesen.GUI.Forms.frmMain()); + } + } +} diff --git a/GUI.NET/Properties/AssemblyInfo.cs b/GUI.NET/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..911dfda5 --- /dev/null +++ b/GUI.NET/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Mesen")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Mesen")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c8d4fadf-6247-47bc-8cd5-4c2e29812c3c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/GUI.NET/Properties/Resources.Designer.cs b/GUI.NET/Properties/Resources.Designer.cs new file mode 100644 index 00000000..2cd217d3 --- /dev/null +++ b/GUI.NET/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18408 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Mesen.GUI.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Mesen.GUI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap MesenLogo { + get { + object obj = ResourceManager.GetObject("MesenLogo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/GUI.NET/Properties/Resources.resx b/GUI.NET/Properties/Resources.resx new file mode 100644 index 00000000..2721d0b7 --- /dev/null +++ b/GUI.NET/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\MesenLogo.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/GUI.NET/Properties/Settings.Designer.cs b/GUI.NET/Properties/Settings.Designer.cs new file mode 100644 index 00000000..cd9f978d --- /dev/null +++ b/GUI.NET/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18408 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Mesen.GUI.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/GUI.NET/Properties/Settings.settings b/GUI.NET/Properties/Settings.settings new file mode 100644 index 00000000..39645652 --- /dev/null +++ b/GUI.NET/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/GUI.NET/Resources/MesenLogo.bmp b/GUI.NET/Resources/MesenLogo.bmp new file mode 100644 index 0000000000000000000000000000000000000000..12dfc3ebbf5711e74bc9de18c64fd0418c313bc5 GIT binary patch literal 5174 zcmeH~X?PXY8OJjwB3eXHY^`gR7SXE3rL=VcOYaSe(G-giln^i>fJLN=N(;6c5={(b zq^#L@gzO2~$Xar+EWqD0XXc!lx%Z}g;7dO^&-30n=Y8Mb z|IEDSJ(DNXUY$J7jb4*I+}tLT(Tj=+ZX>B*`l%i*o0~u;!~|c!Z9X6nyMdTHF^>hn zh=ssSZv!{`1GfYKqZR?T5*r-|+(vB7VqokNVBAvR&Ub*jmH~Ia3*56DxR=;{?*aEq zwgPy7*hB9F6IKEbe+Wz@_Q*%TqaOp0uL35m2A*64Jo5?g>}SC9Yk?PtO$`PNp@3%? zFrCEW%;0VY`6M zCBT+aU~3t$tsID{1mgDq3B;02Kxz%Jvkpk#2V@Y-tOs(wA=UuoHUfoap!i#$Ku-d=PP{%{Y_MeGQ%|Mmji-vd48fZjgf?Afz8 zckUd{pFfWa7cQW$uMZb5Uc{wKm+-w5zX)9D2l@tpOM^gve?JBW1~51{h@qh&^b_B} z5HKj&WnhTd<;z!a$pVmI$(nS$PZV)=G@KU!GZq% zfg$0WavF!ra$Ucs$e`B^y35;tLzOEH7rbTLd`}(ACVvSxIY~J2HDO*X-}!Fz&2Ug~ z;A=ysJ5xH(8)-TP9dBL#vM$&4WNyAjLCfbl)XX(*Fc?2Ka|M;Rh8Z0Jui5kb{N~Mm z)zNR5xr+&KzGkj2%k!=E*-b3TocERgEBf%il^EmmU(?3l+{9U?VapEE6(__-BMP6T zi5V9aFi3xI{_4+~MFOaR%x7wL&97KbX=m0An&zMal+RUh?{rPRIWKbK#>hOi+ID-> zTJ;e=C#e!&rPgMV`rfq>KFWp|eIjaA)hxAATPbgy%_KcH^0c~O^_fU`dT<>N)$*Ns z*(9z1CBtXr@SJGPd&*(2XdbjIWW?KqH?f6YQOnLHS)z3Rk_%Y5K!GTJq2#>8d&(ZB z#nf>a7qIv!-nF9Wtqh}hbhC=+N1J(yN$D4FQB;Z?sK#E>Q|gS=i(TQe*C>j!=*Xyk zodQ(AaTLICyGahs62)jb3gVGH9P$a_JFEDNdw5z9bw!i?i=1hg5oYB9Ui)>#70Sir zfo2cFW*BBh%74Gi@>!B4<|xSP($vbTt2pP#IrP^i^)>B(jni&r-(LA${qzsusa;9J zocL-6ETXCl*i^Y!Yu93YYrE<#W`JwHNX=|-mHAcox{vu&8}ln0V=%bpc?Yyj8{>Z8 zD)RjQxIrM-bBwpJuc%Aj$oJ_viE>{piVsQy!J~``$o(|T`m`TS}0f0kIvp?+bP{W3+0T|F$zAijP%cMl!-9uJ2||LGSj6Ksc0!8 z(up8f>}`x#EcIW>C^nr?LF2Xnnm;qMDNWb@{&MsF?IxB#zJ>Phhiop4`-}=$WdUVX zb_<|;zwfs^d+bi7|6k-T_ZRk2g$QbCcThuKC;sdpwzH0SO16(h6?!q}&lCwwEP*zNmb{yLEt zou*AFS7P$>OOwQVbOL1Je#iJn9)IG|@wdAbe@5!I)G(7JA!^i*OkY?bTCkeL7*!P!A`Q6h`O`fuJWxRYU ZG#nca%d>=Q+<)Y+QJ`ytulK)q@dsSo - - - - - - - - - - - - - - - - - - - - - - - Create Create @@ -157,7 +134,6 @@ true - diff --git a/GUI/GUI.vcxproj.filters b/GUI/GUI.vcxproj.filters index 0fe931ce..9e8291a2 100644 --- a/GUI/GUI.vcxproj.filters +++ b/GUI/GUI.vcxproj.filters @@ -13,9 +13,6 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - {e3fb11e9-60dd-47df-8444-72d62eb07828} - {5c2b5caf-e71a-40cc-823a-625c65ee7cb2} @@ -27,66 +24,9 @@ Header Files - - Header Files - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files\DirectXTK - - - Header Files - Header Files - - Header Files - - - Header Files - Debugger @@ -104,18 +44,6 @@ Source Files - - Source Files - - - Source Files - - - Source Files - - - Source Files - Debugger @@ -134,9 +62,6 @@ - - Header Files\DirectXTK - Resource Files diff --git a/InteropDLL/ConsoleWrapper.cpp b/InteropDLL/ConsoleWrapper.cpp new file mode 100644 index 00000000..e7c86b6a --- /dev/null +++ b/InteropDLL/ConsoleWrapper.cpp @@ -0,0 +1,130 @@ +#include "stdafx.h" + +#include "../Core/MessageManager.h" +#include "../Core/Console.h" +#include "../Windows/Renderer.h" +#include "../Windows/SoundManager.h" +#include "../Windows/InputManager.h" +#include "../Core/GameServer.h" +#include "../Core/GameClient.h" +#include "../Core/ClientConnectionData.h" +#include "../Core/SaveStateManager.h" + +static NES::Renderer *_renderer = nullptr; +static SoundManager *_soundManager = nullptr; +static InputManager *_inputManager = nullptr; +static HWND _windowHandle = nullptr; +static HWND _viewerHandle = nullptr; + +typedef void (__stdcall *NotificationListenerCallback)(int); + +namespace InteropEmu { + class InteropNotificationListener : public INotificationListener + { + NotificationListenerCallback _callback; + public: + InteropNotificationListener(NotificationListenerCallback callback) + { + _callback = callback; + } + + void ProcessNotification(ConsoleNotificationType type) + { + _callback((int)type); + } + }; + + extern "C" { + DllExport void __stdcall InitializeEmu(HWND windowHandle, HWND dxViewerHandle) + { + _windowHandle = windowHandle; + _viewerHandle = dxViewerHandle; + + _renderer = new NES::Renderer(_viewerHandle); + MessageManager::RegisterMessageManager(_renderer); + _renderer->SetFlags(NES::UIFlags::ShowFPS); + + _soundManager = new SoundManager(_windowHandle); + _inputManager = new InputManager(_windowHandle, 0); + } + + DllExport void __stdcall LoadROM(wchar_t* filename) { Console::LoadROM(filename); } + + DllExport void __stdcall Run() + { + if(Console::GetInstance()) { + Console::GetInstance()->Run(); + } + } + + DllExport void __stdcall Resume() { Console::ClearFlags(EmulationFlags::Paused); } + DllExport int __stdcall IsPaused() { return Console::CheckFlag(EmulationFlags::Paused); } + DllExport void __stdcall Stop() + { + if(Console::GetInstance()) { + Console::GetInstance()->Stop(); + } + } + DllExport void __stdcall Reset() { Console::Reset(); } + DllExport void __stdcall SetFlags(int flags) { Console::SetFlags(flags); } + DllExport void __stdcall ClearFlags(int flags) { Console::ClearFlags(flags); } + + DllExport void __stdcall StartServer(uint16_t port) { GameServer::StartServer(port); } + DllExport void __stdcall StopServer() { GameServer::StopServer(); } + DllExport int __stdcall IsServerRunning() { return GameServer::Started(); } + + DllExport void __stdcall Connect(char* host, uint16_t port, wchar_t* playerName, uint8_t* avatarData, uint32_t avatarSize) + { + shared_ptr connectionData(new ClientConnectionData( + host, + port, + playerName, + avatarData, + avatarSize + )); + + GameClient::Connect(connectionData); + } + + DllExport void __stdcall Disconnect() { GameClient::Disconnect(); } + DllExport int __stdcall IsConnected() { return GameClient::Connected(); } + + DllExport void __stdcall Pause() + { + if(!IsConnected()) { + Console::SetFlags(EmulationFlags::Paused); + } + } + + DllExport void __stdcall Release() + { + GameServer::StopServer(); + GameClient::Disconnect(); + MessageManager::RegisterMessageManager(nullptr); + delete _renderer; + delete _soundManager; + delete _inputManager; + } + + DllExport void __stdcall Render() { _renderer->Render(); } + DllExport void __stdcall TakeScreenshot() { _renderer->TakeScreenshot(Console::GetROMPath()); } + + DllExport INotificationListener* __stdcall RegisterNotificationCallback(NotificationListenerCallback callback) + { + INotificationListener* listener = new InteropNotificationListener(callback); + MessageManager::RegisterNotificationListener(listener); + return listener; + } + DllExport void __stdcall UnregisterNotificationCallback(INotificationListener *listener) { MessageManager::UnregisterNotificationListener(listener); } + + DllExport void __stdcall SaveState(uint32_t stateIndex) { SaveStateManager::SaveState(stateIndex); } + DllExport uint32_t __stdcall LoadState(uint32_t stateIndex) { return SaveStateManager::LoadState(stateIndex); } + DllExport int64_t __stdcall GetStateInfo(uint32_t stateIndex) { return SaveStateManager::GetStateInfo(stateIndex); } + + DllExport void __stdcall MoviePlay(wchar_t* filename) { Movie::Play(filename); } + DllExport void __stdcall MovieRecord(wchar_t* filename, int reset) { Movie::Record(filename, reset != 0); } + DllExport void __stdcall MovieStop() { Movie::Stop(); } + DllExport int __stdcall MoviePlaying() { return Movie::Playing(); } + DllExport int __stdcall MovieRecording() { return Movie::Recording(); } + } +} \ No newline at end of file diff --git a/InteropDLL/DebugWrapper.cpp b/InteropDLL/DebugWrapper.cpp new file mode 100644 index 00000000..cc816cc4 --- /dev/null +++ b/InteropDLL/DebugWrapper.cpp @@ -0,0 +1,40 @@ +#include "stdafx.h" +#include "../Core/Console.h" +#include "../Core/Debugger.h" + +static shared_ptr _debugger = nullptr; + +extern "C" +{ + //Debugger wrapper + DllExport void __stdcall DebugInitialize() + { + _debugger = Console::GetInstance()->GetDebugger(); + } + + DllExport void __stdcall DebugRelease() + { + if(_debugger != nullptr) { + _debugger->Run(); + _debugger.reset(); + } + } + + DllExport void __stdcall DebugGetState(DebugState *state) { _debugger->GetState(state); } + + DllExport void DebugSetBreakpoints() + { + + } + + DllExport void __stdcall DebugRun() { _debugger->Run(); } + DllExport void __stdcall DebugStep(uint32_t count) { _debugger->Step(count); } + DllExport void __stdcall DebugStepCycles(uint32_t count) { _debugger->StepCycles(count); } + DllExport void __stdcall DebugStepOver() { _debugger->StepOver(); } + DllExport void __stdcall DebugStepOut() { _debugger->StepOut(); } + DllExport int __stdcall DebugIsCodeChanged() { return _debugger->IsCodeChanged(); } + DllExport const char* __stdcall DebugGetCode() { return _debugger->GetCode()->c_str(); } + + DllExport uint8_t __stdcall DebugGetMemoryValue(uint32_t addr) { return _debugger->GetMemoryValue(addr); } + DllExport uint32_t __stdcall DebugGetRelativeAddress(uint32_t addr) { return _debugger->GetRelativeAddress(addr); } +}; diff --git a/InteropDLL/InteropDLL.vcxproj b/InteropDLL/InteropDLL.vcxproj new file mode 100644 index 00000000..ce7a5390 --- /dev/null +++ b/InteropDLL/InteropDLL.vcxproj @@ -0,0 +1,96 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {37749BB2-FA78-4EC9-8990-5628FC0BBA19} + Win32Proj + InteropDLL + + + + DynamicLibrary + true + v120 + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + + + + + + + + + + + true + WinMesen + + + false + WinMesen + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;INTEROPDLL_EXPORTS;%(PreprocessorDefinitions) + Cdecl + + + Windows + true + Xinput9_1_0.lib;d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib; + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;INTEROPDLL_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + Xinput9_1_0.lib;d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib; + + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/InteropDLL/InteropDLL.vcxproj.filters b/InteropDLL/InteropDLL.vcxproj.filters new file mode 100644 index 00000000..2a4fc2e2 --- /dev/null +++ b/InteropDLL/InteropDLL.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/InteropDLL/stdafx.cpp b/InteropDLL/stdafx.cpp new file mode 100644 index 00000000..5de39fc4 --- /dev/null +++ b/InteropDLL/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// InteropDLL.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/InteropDLL/stdafx.h b/InteropDLL/stdafx.h new file mode 100644 index 00000000..fda836ae --- /dev/null +++ b/InteropDLL/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include +#include + +#ifdef _DEBUG + #pragma comment(lib, "../Debug/Core.lib") + #pragma comment(lib, "../Debug/Utilities.lib") + #pragma comment(lib, "../Debug/Windows.lib") + #pragma comment(lib, "../Windows/DirectXTK/DirectXTK.debug.lib") + #pragma comment(lib, "../Core/Nes_Apu/Nes_Apu.debug.lib") +#else + #pragma comment(lib, "../Release/Core.lib") + #pragma comment(lib, "../Release/Utilities.lib") + #pragma comment(lib, "../Release/Windows.lib") + #pragma comment(lib, "../Windows/DirectXTK/DirectXTK.lib") + #pragma comment(lib, "../Core/Nes_Apu/Nes_Apu.lib") +#endif + +#define DllExport __declspec(dllexport) + +// TODO: reference additional headers your program requires here diff --git a/InteropDLL/targetver.h b/InteropDLL/targetver.h new file mode 100644 index 00000000..87c0086d --- /dev/null +++ b/InteropDLL/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/NES.sln b/NES.sln index 47d41d11..f1a748ed 100644 --- a/NES.sln +++ b/NES.sln @@ -4,6 +4,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 12.0.30501.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core.vcxproj", "{78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}" + ProjectSection(ProjectDependencies) = postProject + {B5330148-E8C7-46BA-B54E-69BE59EA337D} = {B5330148-E8C7-46BA-B54E-69BE59EA337D} + {7761E790-B42C-4179-8550-8365FF9EB23E} = {7761E790-B42C-4179-8550-8365FF9EB23E} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUI", "GUI\GUI.vcxproj", "{6675D943-322A-4045-B16C-4756FD32CAF2}" ProjectSection(ProjectDependencies) = postProject @@ -13,24 +17,89 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUI", "GUI\GUI.vcxproj", "{ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utilities", "Utilities\Utilities.vcxproj", "{B5330148-E8C7-46BA-B54E-69BE59EA337D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GUI.NET", "GUI.NET\GUI.NET.csproj", "{08D83A7E-52A9-451E-A53A-1A7946F8BB77}" + ProjectSection(ProjectDependencies) = postProject + {37749BB2-FA78-4EC9-8990-5628FC0BBA19} = {37749BB2-FA78-4EC9-8990-5628FC0BBA19} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Windows", "Windows\Windows.vcxproj", "{7761E790-B42C-4179-8550-8365FF9EB23E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InteropDLL", "InteropDLL\InteropDLL.vcxproj", "{37749BB2-FA78-4EC9-8990-5628FC0BBA19}" + ProjectSection(ProjectDependencies) = postProject + {7761E790-B42C-4179-8550-8365FF9EB23E} = {7761E790-B42C-4179-8550-8365FF9EB23E} + {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0} = {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms Debug|Win32 = Debug|Win32 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}.Debug|Win32.ActiveCfg = Debug|Win32 {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}.Debug|Win32.Build.0 = Debug|Win32 + {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}.Release|Any CPU.ActiveCfg = Release|Win32 + {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}.Release|Mixed Platforms.Build.0 = Release|Win32 {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}.Release|Win32.ActiveCfg = Release|Win32 {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}.Release|Win32.Build.0 = Release|Win32 + {6675D943-322A-4045-B16C-4756FD32CAF2}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {6675D943-322A-4045-B16C-4756FD32CAF2}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {6675D943-322A-4045-B16C-4756FD32CAF2}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {6675D943-322A-4045-B16C-4756FD32CAF2}.Debug|Win32.ActiveCfg = Debug|Win32 {6675D943-322A-4045-B16C-4756FD32CAF2}.Debug|Win32.Build.0 = Debug|Win32 + {6675D943-322A-4045-B16C-4756FD32CAF2}.Release|Any CPU.ActiveCfg = Release|Win32 + {6675D943-322A-4045-B16C-4756FD32CAF2}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {6675D943-322A-4045-B16C-4756FD32CAF2}.Release|Mixed Platforms.Build.0 = Release|Win32 {6675D943-322A-4045-B16C-4756FD32CAF2}.Release|Win32.ActiveCfg = Release|Win32 {6675D943-322A-4045-B16C-4756FD32CAF2}.Release|Win32.Build.0 = Release|Win32 + {B5330148-E8C7-46BA-B54E-69BE59EA337D}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {B5330148-E8C7-46BA-B54E-69BE59EA337D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {B5330148-E8C7-46BA-B54E-69BE59EA337D}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {B5330148-E8C7-46BA-B54E-69BE59EA337D}.Debug|Win32.ActiveCfg = Debug|Win32 {B5330148-E8C7-46BA-B54E-69BE59EA337D}.Debug|Win32.Build.0 = Debug|Win32 + {B5330148-E8C7-46BA-B54E-69BE59EA337D}.Release|Any CPU.ActiveCfg = Release|Win32 + {B5330148-E8C7-46BA-B54E-69BE59EA337D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {B5330148-E8C7-46BA-B54E-69BE59EA337D}.Release|Mixed Platforms.Build.0 = Release|Win32 {B5330148-E8C7-46BA-B54E-69BE59EA337D}.Release|Win32.ActiveCfg = Release|Win32 {B5330148-E8C7-46BA-B54E-69BE59EA337D}.Release|Win32.Build.0 = Release|Win32 + {08D83A7E-52A9-451E-A53A-1A7946F8BB77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08D83A7E-52A9-451E-A53A-1A7946F8BB77}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08D83A7E-52A9-451E-A53A-1A7946F8BB77}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {08D83A7E-52A9-451E-A53A-1A7946F8BB77}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {08D83A7E-52A9-451E-A53A-1A7946F8BB77}.Debug|Win32.ActiveCfg = Debug|Any CPU + {08D83A7E-52A9-451E-A53A-1A7946F8BB77}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08D83A7E-52A9-451E-A53A-1A7946F8BB77}.Release|Any CPU.Build.0 = Release|Any CPU + {08D83A7E-52A9-451E-A53A-1A7946F8BB77}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {08D83A7E-52A9-451E-A53A-1A7946F8BB77}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {08D83A7E-52A9-451E-A53A-1A7946F8BB77}.Release|Win32.ActiveCfg = Release|Any CPU + {7761E790-B42C-4179-8550-8365FF9EB23E}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {7761E790-B42C-4179-8550-8365FF9EB23E}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {7761E790-B42C-4179-8550-8365FF9EB23E}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {7761E790-B42C-4179-8550-8365FF9EB23E}.Debug|Win32.ActiveCfg = Debug|Win32 + {7761E790-B42C-4179-8550-8365FF9EB23E}.Debug|Win32.Build.0 = Debug|Win32 + {7761E790-B42C-4179-8550-8365FF9EB23E}.Release|Any CPU.ActiveCfg = Release|Win32 + {7761E790-B42C-4179-8550-8365FF9EB23E}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {7761E790-B42C-4179-8550-8365FF9EB23E}.Release|Mixed Platforms.Build.0 = Release|Win32 + {7761E790-B42C-4179-8550-8365FF9EB23E}.Release|Win32.ActiveCfg = Release|Win32 + {7761E790-B42C-4179-8550-8365FF9EB23E}.Release|Win32.Build.0 = Release|Win32 + {37749BB2-FA78-4EC9-8990-5628FC0BBA19}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {37749BB2-FA78-4EC9-8990-5628FC0BBA19}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {37749BB2-FA78-4EC9-8990-5628FC0BBA19}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {37749BB2-FA78-4EC9-8990-5628FC0BBA19}.Debug|Win32.ActiveCfg = Debug|Win32 + {37749BB2-FA78-4EC9-8990-5628FC0BBA19}.Debug|Win32.Build.0 = Debug|Win32 + {37749BB2-FA78-4EC9-8990-5628FC0BBA19}.Release|Any CPU.ActiveCfg = Release|Win32 + {37749BB2-FA78-4EC9-8990-5628FC0BBA19}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {37749BB2-FA78-4EC9-8990-5628FC0BBA19}.Release|Mixed Platforms.Build.0 = Release|Win32 + {37749BB2-FA78-4EC9-8990-5628FC0BBA19}.Release|Win32.ActiveCfg = Release|Win32 + {37749BB2-FA78-4EC9-8990-5628FC0BBA19}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Utilities/ConfigManager.cpp b/Utilities/ConfigManager.cpp deleted file mode 100644 index 82340db4..00000000 --- a/Utilities/ConfigManager.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include "stdafx.h" -#include "ConfigManager.h" -#include "FolderUtilities.h" - -string ConfigManager::ConfigTagNames[] = { - "ShowFPS", - "LimitFPS", - "MRU0", - "MRU1", - "MRU2", - "MRU3", - "MRU4", - "LastGameFolder", - "LastNetPlayHost", - "Player1_ButtonA", - "Player1_ButtonB", - "Player1_Select", - "Player1_Start", - "Player1_Up", - "Player1_Down", - "Player1_Left", - "Player1_Right", -}; - -shared_ptr ConfigManager::Instance = nullptr; - -void ConfigManager::LoadConfigFile() -{ - _configFilePath = FolderUtilities::GetHomeFolder() + L"Settings.xml"; - - ifstream configFile(_configFilePath, ifstream::in); - - if(configFile) { - configFile.close(); - _xmlDocument.LoadFile(utf8util::UTF8FromUTF16(_configFilePath).c_str()); - } else { - _xmlDocument.InsertFirstChild(_xmlDocument.NewDeclaration()); - - tinyxml2::XMLElement* mainNode = _xmlDocument.NewElement("Config"); - _xmlDocument.InsertEndChild(mainNode); - } -} - -tinyxml2::XMLElement* ConfigManager::GetConfigNode() -{ - return _xmlDocument.LastChildElement(); -} - -tinyxml2::XMLElement* ConfigManager::GetNode(Config config) -{ - if(!_loaded) { - LoadConfigFile(); - _loaded = true; - } - - tinyxml2::XMLElement* currentNode = GetConfigNode()->FirstChildElement(); - tinyxml2::XMLElement* configNode = nullptr; - if(currentNode) { - do { - if(ConfigTagNames[(int)config].compare(currentNode->Name()) == 0) { - configNode = currentNode; - break; - } - } - while(currentNode = currentNode->NextSiblingElement()); - } - - if(!configNode) { - configNode = _xmlDocument.NewElement(ConfigTagNames[(int)config].c_str()); - GetConfigNode()->InsertEndChild(configNode); - } - - return configNode; -} - -void ConfigManager::AddToMRU(wstring romFilepath) -{ - wstring MRU0 = ConfigManager::GetValue(Config::MRU0); - wstring MRU1 = ConfigManager::GetValue(Config::MRU1); - wstring MRU2 = ConfigManager::GetValue(Config::MRU2); - wstring MRU3 = ConfigManager::GetValue(Config::MRU3); - wstring MRU4 = ConfigManager::GetValue(Config::MRU4); - - if(MRU0.compare(romFilepath) == 0) { - return; - } else if(MRU1.compare(romFilepath) == 0) { - MRU1 = MRU0; - MRU0 = romFilepath; - } else if(MRU2.compare(romFilepath) == 0) { - MRU2 = MRU1; - MRU1 = MRU0; - MRU0 = romFilepath; - } else if(MRU3.compare(romFilepath) == 0) { - MRU3 = MRU2; - MRU2 = MRU1; - MRU1 = MRU0; - MRU0 = romFilepath; - } else { - MRU4 = MRU3; - MRU3 = MRU2; - MRU2 = MRU1; - MRU1 = MRU0; - MRU0 = romFilepath; - } - - ConfigManager::SetValue(Config::MRU0, MRU0); - ConfigManager::SetValue(Config::MRU1, MRU1); - ConfigManager::SetValue(Config::MRU2, MRU2); - ConfigManager::SetValue(Config::MRU3, MRU3); - ConfigManager::SetValue(Config::MRU4, MRU4); -} \ No newline at end of file diff --git a/Utilities/ConfigManager.h b/Utilities/ConfigManager.h deleted file mode 100644 index f4569fad..00000000 --- a/Utilities/ConfigManager.h +++ /dev/null @@ -1,110 +0,0 @@ -#pragma once - -#include "stdafx.h" -#include "../Utilities/tinyxml2.h" -#include "utf8conv.h" - -enum class Config -{ - ShowFPS = 0, - LimitFPS, - MRU0, - MRU1, - MRU2, - MRU3, - MRU4, - LastGameFolder, - LastNetPlayHost, - Player1_ButtonA, - Player1_ButtonB, - Player1_Select, - Player1_Start, - Player1_Up, - Player1_Down, - Player1_Left, - Player1_Right, -}; - -class ConfigManager -{ - private: - static shared_ptr Instance; - static string ConfigTagNames[256]; - - bool _loaded; - wstring _configFilePath; - tinyxml2::XMLDocument _xmlDocument; - ConfigManager() { } - - void LoadConfigFile(); - - tinyxml2::XMLElement* GetNode(Config config); - tinyxml2::XMLElement* GetConfigNode(); - - template - T GetValueAttribute(tinyxml2::XMLElement* element); - - template<> - int GetValueAttribute(tinyxml2::XMLElement* element) - { - return element->IntAttribute("value"); - } - - template<> - bool GetValueAttribute(tinyxml2::XMLElement* element) - { - return element->BoolAttribute("value"); - } - - template<> - double GetValueAttribute(tinyxml2::XMLElement* element) - { - return element->DoubleAttribute("value"); - } - - template<> - wstring GetValueAttribute(tinyxml2::XMLElement* element) - { - if(element->Attribute("value")) { - return utf8util::UTF16FromUTF8(string(element->Attribute("value"))); - } else { - return L""; - } - } - - template - void SetValueAttribute(tinyxml2::XMLElement* element, T value) - { - element->SetAttribute("value", value); - } - - template<> - void SetValueAttribute(tinyxml2::XMLElement* element, std::wstring value) - { - element->SetAttribute("value", utf8util::UTF8FromUTF16(value).c_str()); - } - - public: - static shared_ptr GetInstance() - { - if(ConfigManager::Instance == nullptr) { - ConfigManager::Instance.reset(new ConfigManager()); - } - return ConfigManager::Instance; - } - - template - static T GetValue(Config config) - { - return GetInstance()->GetValueAttribute(GetInstance()->GetNode(config)); - } - - template - static void SetValue(Config config, T value) - { - GetInstance()->SetValueAttribute(GetInstance()->GetNode(config), value); - GetInstance()->_xmlDocument.SaveFile(utf8util::UTF8FromUTF16(GetInstance()->_configFilePath).c_str(), false); - } - - static void AddToMRU(wstring romFilepath); -}; diff --git a/Utilities/FolderUtilities.cpp b/Utilities/FolderUtilities.cpp index 440bb6df..292568fd 100644 --- a/Utilities/FolderUtilities.cpp +++ b/Utilities/FolderUtilities.cpp @@ -118,36 +118,25 @@ wstring FolderUtilities::GetFolderName(wstring filepath) int index = filepath.find_last_of(L"/\\"); return filepath.substr(0, index); } - -wstring FolderUtilities::OpenFile(LPCWSTR filter, wstring defaultFolder, bool forSave, wstring defaultExt) -{ - return OpenFile(filter, defaultFolder.c_str(), forSave, defaultExt.c_str()); -} -wstring FolderUtilities::OpenFile(LPCWSTR filter, LPCWSTR defaultFolder, bool forSave, LPCWSTR defaultExt) +wstring FolderUtilities::CombinePath(wstring folder, wstring filename) { - wchar_t buffer[2000]; - buffer[0] = '\0'; +#ifdef WIN32 + wstring separator = L"\\"; +#else + wstring separator = L"/"; +#endif - OPENFILENAME ofn; - ZeroMemory(&ofn, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = nullptr; - ofn.lpstrDefExt = defaultExt; - ofn.lpstrFile = buffer; - ofn.nMaxFile = sizeof(buffer); - ofn.lpstrFilter = filter; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = nullptr; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = defaultFolder; - if(forSave) { - ofn.Flags = OFN_OVERWRITEPROMPT; - GetSaveFileName(&ofn); - } else { - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - GetOpenFileName(&ofn); + if(folder.find_last_of(separator) != folder.length() - 1) { + folder += separator; } - return wstring(buffer); + return folder + filename; +} + +int64_t FolderUtilities::GetFileModificationTime(wstring filepath) +{ + WIN32_FILE_ATTRIBUTE_DATA fileAttrData = {0}; + GetFileAttributesEx(filepath.c_str(), GetFileExInfoStandard, &fileAttrData); + return ((int64_t)fileAttrData.ftLastWriteTime.dwHighDateTime << 32) | (int64_t)fileAttrData.ftLastWriteTime.dwLowDateTime; } \ No newline at end of file diff --git a/Utilities/FolderUtilities.h b/Utilities/FolderUtilities.h index 805d2d03..755e0082 100644 --- a/Utilities/FolderUtilities.h +++ b/Utilities/FolderUtilities.h @@ -17,6 +17,7 @@ class FolderUtilities static wstring GetFilename(wstring filepath, bool includeExtension); static wstring GetFolderName(wstring filepath); - static wstring OpenFile(LPCWSTR filter, wstring defaultFolder, bool forSave, wstring defaultExt = L""); - static wstring OpenFile(LPCWSTR filter, LPCWSTR defaultFolder, bool forSave, LPCWSTR defaultExt = L""); + static int64_t GetFileModificationTime(wstring filepath); + + static wstring CombinePath(wstring folder, wstring filename); }; \ No newline at end of file diff --git a/Utilities/SimpleLock.cpp b/Utilities/SimpleLock.cpp new file mode 100644 index 00000000..8d260f0b --- /dev/null +++ b/Utilities/SimpleLock.cpp @@ -0,0 +1,54 @@ +#include "stdafx.h" +#include "SimpleLock.h" + +SimpleLock::SimpleLock() +{ + _lock.clear(); + _lockCount = 0; + _holderThreadID = ~0; +} + +SimpleLock::~SimpleLock() +{ +} + +void SimpleLock::Acquire() +{ + if(_lockCount == 0 || _holderThreadID != GetCurrentThreadId()) { + while(_lock.test_and_set()); + _holderThreadID = GetCurrentThreadId(); + _lockCount = 1; + } else { + //Same thread can acquire the same lock multiple times + _lockCount++; + } +} + +bool SimpleLock::IsFree() +{ + if(!_lock.test_and_set()) { + _lock.clear(); + return true; + } + return false; +} + +void SimpleLock::WaitForRelease() +{ + //Wait until we are able to grab a lock, and then release it again + Acquire(); + Release(); +} + +void SimpleLock::Release() +{ + if(_lockCount > 0 && _holderThreadID == GetCurrentThreadId()) { + _lockCount--; + if(_lockCount == 0) { + _holderThreadID = ~0; + _lock.clear(); + } + } else { + assert(false); + } +} \ No newline at end of file diff --git a/Utilities/SimpleLock.h b/Utilities/SimpleLock.h index 47f66a77..94c7ae05 100644 --- a/Utilities/SimpleLock.h +++ b/Utilities/SimpleLock.h @@ -9,51 +9,11 @@ private: atomic_flag _lock; public: - SimpleLock() - { - _lockCount = 0; - _holderThreadID = ~0; - } - - void Acquire() - { - if(_lockCount == 0 || _holderThreadID != GetCurrentThreadId()) { - while(_lock.test_and_set()); - _holderThreadID = GetCurrentThreadId(); - _lockCount = 1; - } else { - //Same thread can acquire the same lock multiple times - _lockCount++; - } - } - - bool IsFree() - { - if(!_lock.test_and_set()) { - _lock.clear(); - return true; - } - return false; - } - - void WaitForRelease() - { - //Wait until we are able to grab a lock, and then release it again - Acquire(); - Release(); - } - - void Release() - { - if(_lockCount > 0 && _holderThreadID == GetCurrentThreadId()) { - _lockCount--; - if(_lockCount == 0) { - _holderThreadID = ~0; - _lock.clear(); - } - } else { - assert(false); - } - } + SimpleLock(); + ~SimpleLock(); + void Acquire(); + bool IsFree(); + void WaitForRelease(); + void Release(); }; diff --git a/Utilities/Socket.h b/Utilities/Socket.h index 2479febe..1ec3284e 100644 --- a/Utilities/Socket.h +++ b/Utilities/Socket.h @@ -166,10 +166,21 @@ public: int Send(char *buf, int len, int flags) { - int nError; + int retryCount = 15; + int nError = 0; int returnVal; do { //Loop until everything has been sent (shouldn't loop at all in the vast majority of cases) + if(nError == WSAEWOULDBLOCK) { + retryCount--; + if(retryCount == 0) { + //Connection seems dead, close it. + std::cout << "Unable to send data, closing socket." << std::endl; + Close(); + return 0; + } + } + returnVal = send(_socket, buf, len, flags); nError = WSAGetLastError(); diff --git a/Utilities/UPnPPortMapper.h b/Utilities/UPnPPortMapper.h index 0018c85c..9cc74835 100644 --- a/Utilities/UPnPPortMapper.h +++ b/Utilities/UPnPPortMapper.h @@ -62,10 +62,10 @@ public: std::wcout << localIP.c_str(); std::cout << " HRESULT: 0x" << std::hex << hResult << std::endl; } - spmc->Release(); } else { std::cout << "Unable to add UPnP port mapping." << std::endl; } + spmc->Release(); } nat->Release(); } diff --git a/Utilities/Utilities.vcxproj b/Utilities/Utilities.vcxproj index c30d5d88..067ef2e2 100644 --- a/Utilities/Utilities.vcxproj +++ b/Utilities/Utilities.vcxproj @@ -47,6 +47,7 @@ Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) true + Cdecl Windows @@ -71,7 +72,6 @@ - @@ -82,20 +82,16 @@ - - - - + Create Create - diff --git a/Utilities/Utilities.vcxproj.filters b/Utilities/Utilities.vcxproj.filters index 213fbbf5..f4ce66a5 100644 --- a/Utilities/Utilities.vcxproj.filters +++ b/Utilities/Utilities.vcxproj.filters @@ -9,9 +9,6 @@ {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hh;hpp;hxx;hm;inl;inc;xsd - - {ad8fb33b-acfa-4566-a97f-3c31099eb131} - @@ -23,18 +20,6 @@ Header Files - - TinyXML2 - - - Header Files - - - Header Files - - - Header Files - Header Files @@ -64,12 +49,6 @@ Source Files - - TinyXML2 - - - Source Files - Source Files @@ -79,5 +58,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/Utilities/stdafx.h b/Utilities/stdafx.h index 9b00d683..f91fc559 100644 --- a/Utilities/stdafx.h +++ b/Utilities/stdafx.h @@ -14,10 +14,10 @@ #include #include -using std::atomic_flag; using std::shared_ptr; using std::ifstream; using std::string; using std::wstring; using std::vector; -using std::atomic; \ No newline at end of file +using std::atomic; +using std::atomic_flag; \ No newline at end of file diff --git a/Utilities/tinyxml2.cpp b/Utilities/tinyxml2.cpp deleted file mode 100644 index 5186b75c..00000000 --- a/Utilities/tinyxml2.cpp +++ /dev/null @@ -1,2188 +0,0 @@ -/* -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#include "stdafx.h" - -#include "tinyxml2.h" - -#include // yes, this one new style header, is in the Android SDK. -# ifdef ANDROID_NDK -# include -#else -# include -#endif - -static const char LINE_FEED = (char)0x0a; // all line endings are normalized to LF -static const char LF = LINE_FEED; -static const char CARRIAGE_RETURN = (char)0x0d; // CR gets filtered out -static const char CR = CARRIAGE_RETURN; -static const char SINGLE_QUOTE = '\''; -static const char DOUBLE_QUOTE = '\"'; - -// Bunch of unicode info at: -// http://www.unicode.org/faq/utf_bom.html -// ef bb bf (Microsoft "lead bytes") - designates UTF-8 - -static const unsigned char TIXML_UTF_LEAD_0 = 0xefU; -static const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; -static const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - - -#define DELETE_NODE( node ) { \ - if ( node ) { \ - MemPool* pool = node->_memPool; \ - node->~XMLNode(); \ - pool->Free( node ); \ - } \ - } -#define DELETE_ATTRIBUTE( attrib ) { \ - if ( attrib ) { \ - MemPool* pool = attrib->_memPool; \ - attrib->~XMLAttribute(); \ - pool->Free( attrib ); \ - } \ - } - -namespace tinyxml2 -{ - -struct Entity { - const char* pattern; - int length; - char value; -}; - -static const int NUM_ENTITIES = 5; -static const Entity entities[NUM_ENTITIES] = { - { "quot", 4, DOUBLE_QUOTE }, - { "amp", 3, '&' }, - { "apos", 4, SINGLE_QUOTE }, - { "lt", 2, '<' }, - { "gt", 2, '>' } -}; - - -StrPair::~StrPair() -{ - Reset(); -} - - -void StrPair::Reset() -{ - if ( _flags & NEEDS_DELETE ) { - delete [] _start; - } - _flags = 0; - _start = 0; - _end = 0; -} - - -void StrPair::SetStr( const char* str, int flags ) -{ - Reset(); - size_t len = strlen( str ); - _start = new char[ len+1 ]; - memcpy( _start, str, len+1 ); - _end = _start + len; - _flags = flags | NEEDS_DELETE; -} - - -char* StrPair::ParseText( char* p, const char* endTag, int strFlags ) -{ - TIXMLASSERT( endTag && *endTag ); - - char* start = p; // fixme: hides a member - char endChar = *endTag; - size_t length = strlen( endTag ); - - // Inner loop of text parsing. - while ( *p ) { - if ( *p == endChar && strncmp( p, endTag, length ) == 0 ) { - Set( start, p, strFlags ); - return p + length; - } - ++p; - } - return 0; -} - - -char* StrPair::ParseName( char* p ) -{ - char* start = p; - - if ( !start || !(*start) ) { - return 0; - } - - while( *p && ( p == start ? XMLUtil::IsNameStartChar( *p ) : XMLUtil::IsNameChar( *p ) )) { - ++p; - } - - if ( p > start ) { - Set( start, p, 0 ); - return p; - } - return 0; -} - - -void StrPair::CollapseWhitespace() -{ - // Trim leading space. - _start = XMLUtil::SkipWhiteSpace( _start ); - - if ( _start && *_start ) { - char* p = _start; // the read pointer - char* q = _start; // the write pointer - - while( *p ) { - if ( XMLUtil::IsWhiteSpace( *p )) { - p = XMLUtil::SkipWhiteSpace( p ); - if ( *p == 0 ) { - break; // don't write to q; this trims the trailing space. - } - *q = ' '; - ++q; - } - *q = *p; - ++q; - ++p; - } - *q = 0; - } -} - - -const char* StrPair::GetStr() -{ - if ( _flags & NEEDS_FLUSH ) { - *_end = 0; - _flags ^= NEEDS_FLUSH; - - if ( _flags ) { - char* p = _start; // the read pointer - char* q = _start; // the write pointer - - while( p < _end ) { - if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) { - // CR-LF pair becomes LF - // CR alone becomes LF - // LF-CR becomes LF - if ( *(p+1) == LF ) { - p += 2; - } - else { - ++p; - } - *q++ = LF; - } - else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) { - if ( *(p+1) == CR ) { - p += 2; - } - else { - ++p; - } - *q++ = LF; - } - else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) { - // Entities handled by tinyXML2: - // - special entities in the entity table [in/out] - // - numeric character reference [in] - // 中 or 中 - - if ( *(p+1) == '#' ) { - char buf[10] = { 0 }; - int len; - p = const_cast( XMLUtil::GetCharacterRef( p, buf, &len ) ); - for( int i=0; i(p); - // Check for BOM: - if ( *(pu+0) == TIXML_UTF_LEAD_0 - && *(pu+1) == TIXML_UTF_LEAD_1 - && *(pu+2) == TIXML_UTF_LEAD_2 ) { - *bom = true; - p += 3; - } - return p; -} - - -void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) -{ - const unsigned long BYTE_MASK = 0xBF; - const unsigned long BYTE_MARK = 0x80; - const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - - if (input < 0x80) { - *length = 1; - } - else if ( input < 0x800 ) { - *length = 2; - } - else if ( input < 0x10000 ) { - *length = 3; - } - else if ( input < 0x200000 ) { - *length = 4; - } - else { - *length = 0; // This code won't covert this correctly anyway. - return; - } - - output += *length; - - // Scary scary fall throughs. - switch (*length) { - case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 1: - --output; - *output = (char)(input | FIRST_BYTE_MARK[*length]); - default: - break; - } -} - - -const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length ) -{ - // Presume an entity, and pull it out. - *length = 0; - - if ( *(p+1) == '#' && *(p+2) ) { - unsigned long ucs = 0; - ptrdiff_t delta = 0; - unsigned mult = 1; - - if ( *(p+2) == 'x' ) { - // Hexadecimal. - if ( !*(p+3) ) { - return 0; - } - - const char* q = p+3; - q = strchr( q, ';' ); - - if ( !q || !*q ) { - return 0; - } - - delta = q-p; - --q; - - while ( *q != 'x' ) { - if ( *q >= '0' && *q <= '9' ) { - ucs += mult * (*q - '0'); - } - else if ( *q >= 'a' && *q <= 'f' ) { - ucs += mult * (*q - 'a' + 10); - } - else if ( *q >= 'A' && *q <= 'F' ) { - ucs += mult * (*q - 'A' + 10 ); - } - else { - return 0; - } - mult *= 16; - --q; - } - } - else { - // Decimal. - if ( !*(p+2) ) { - return 0; - } - - const char* q = p+2; - q = strchr( q, ';' ); - - if ( !q || !*q ) { - return 0; - } - - delta = q-p; - --q; - - while ( *q != '#' ) { - if ( *q >= '0' && *q <= '9' ) { - ucs += mult * (*q - '0'); - } - else { - return 0; - } - mult *= 10; - --q; - } - } - // convert the UCS to UTF-8 - ConvertUTF32ToUTF8( ucs, value, length ); - return p + delta + 1; - } - return p+1; -} - - -void XMLUtil::ToStr( int v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%d", v ); -} - - -void XMLUtil::ToStr( unsigned v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%u", v ); -} - - -void XMLUtil::ToStr( bool v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%d", v ? 1 : 0 ); -} - -/* - ToStr() of a number is a very tricky topic. - https://github.com/leethomason/tinyxml2/issues/106 -*/ -void XMLUtil::ToStr( float v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%.8g", v ); -} - - -void XMLUtil::ToStr( double v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%.17g", v ); -} - - -bool XMLUtil::ToInt( const char* str, int* value ) -{ - if ( TIXML_SSCANF( str, "%d", value ) == 1 ) { - return true; - } - return false; -} - -bool XMLUtil::ToUnsigned( const char* str, unsigned *value ) -{ - if ( TIXML_SSCANF( str, "%u", value ) == 1 ) { - return true; - } - return false; -} - -bool XMLUtil::ToBool( const char* str, bool* value ) -{ - int ival = 0; - if ( ToInt( str, &ival )) { - *value = (ival==0) ? false : true; - return true; - } - if ( StringEqual( str, "true" ) ) { - *value = true; - return true; - } - else if ( StringEqual( str, "false" ) ) { - *value = false; - return true; - } - return false; -} - - -bool XMLUtil::ToFloat( const char* str, float* value ) -{ - if ( TIXML_SSCANF( str, "%f", value ) == 1 ) { - return true; - } - return false; -} - -bool XMLUtil::ToDouble( const char* str, double* value ) -{ - if ( TIXML_SSCANF( str, "%lf", value ) == 1 ) { - return true; - } - return false; -} - - -char* XMLDocument::Identify( char* p, XMLNode** node ) -{ - XMLNode* returnNode = 0; - char* start = p; - p = XMLUtil::SkipWhiteSpace( p ); - if( !p || !*p ) { - return p; - } - - // What is this thing? - // These strings define the matching patters: - static const char* xmlHeader = { "_memPool = &_commentPool; - p += xmlHeaderLen; - } - else if ( XMLUtil::StringEqual( p, commentHeader, commentHeaderLen ) ) { - returnNode = new (_commentPool.Alloc()) XMLComment( this ); - returnNode->_memPool = &_commentPool; - p += commentHeaderLen; - } - else if ( XMLUtil::StringEqual( p, cdataHeader, cdataHeaderLen ) ) { - XMLText* text = new (_textPool.Alloc()) XMLText( this ); - returnNode = text; - returnNode->_memPool = &_textPool; - p += cdataHeaderLen; - text->SetCData( true ); - } - else if ( XMLUtil::StringEqual( p, dtdHeader, dtdHeaderLen ) ) { - returnNode = new (_commentPool.Alloc()) XMLUnknown( this ); - returnNode->_memPool = &_commentPool; - p += dtdHeaderLen; - } - else if ( XMLUtil::StringEqual( p, elementHeader, elementHeaderLen ) ) { - returnNode = new (_elementPool.Alloc()) XMLElement( this ); - returnNode->_memPool = &_elementPool; - p += elementHeaderLen; - } - else { - returnNode = new (_textPool.Alloc()) XMLText( this ); - returnNode->_memPool = &_textPool; - p = start; // Back it up, all the text counts. - } - - *node = returnNode; - return p; -} - - -bool XMLDocument::Accept( XMLVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this ) ) { - for ( const XMLNode* node=FirstChild(); node; node=node->NextSibling() ) { - if ( !node->Accept( visitor ) ) { - break; - } - } - } - return visitor->VisitExit( *this ); -} - - -// --------- XMLNode ----------- // - -XMLNode::XMLNode( XMLDocument* doc ) : - _document( doc ), - _parent( 0 ), - _firstChild( 0 ), _lastChild( 0 ), - _prev( 0 ), _next( 0 ), - _memPool( 0 ) -{ -} - - -XMLNode::~XMLNode() -{ - DeleteChildren(); - if ( _parent ) { - _parent->Unlink( this ); - } -} - -const char* XMLNode::Value() const -{ - return _value.GetStr(); -} - -void XMLNode::SetValue( const char* str, bool staticMem ) -{ - if ( staticMem ) { - _value.SetInternedStr( str ); - } - else { - _value.SetStr( str ); - } -} - - -void XMLNode::DeleteChildren() -{ - while( _firstChild ) { - XMLNode* node = _firstChild; - Unlink( node ); - - DELETE_NODE( node ); - } - _firstChild = _lastChild = 0; -} - - -void XMLNode::Unlink( XMLNode* child ) -{ - if ( child == _firstChild ) { - _firstChild = _firstChild->_next; - } - if ( child == _lastChild ) { - _lastChild = _lastChild->_prev; - } - - if ( child->_prev ) { - child->_prev->_next = child->_next; - } - if ( child->_next ) { - child->_next->_prev = child->_prev; - } - child->_parent = 0; -} - - -void XMLNode::DeleteChild( XMLNode* node ) -{ - TIXMLASSERT( node->_parent == this ); - DELETE_NODE( node ); -} - - -XMLNode* XMLNode::InsertEndChild( XMLNode* addThis ) -{ - if (addThis->_document != _document) - return 0; - - if (addThis->_parent) - addThis->_parent->Unlink( addThis ); - else - addThis->_memPool->SetTracked(); - - if ( _lastChild ) { - TIXMLASSERT( _firstChild ); - TIXMLASSERT( _lastChild->_next == 0 ); - _lastChild->_next = addThis; - addThis->_prev = _lastChild; - _lastChild = addThis; - - addThis->_next = 0; - } - else { - TIXMLASSERT( _firstChild == 0 ); - _firstChild = _lastChild = addThis; - - addThis->_prev = 0; - addThis->_next = 0; - } - addThis->_parent = this; - return addThis; -} - - -XMLNode* XMLNode::InsertFirstChild( XMLNode* addThis ) -{ - if (addThis->_document != _document) - return 0; - - if (addThis->_parent) - addThis->_parent->Unlink( addThis ); - else - addThis->_memPool->SetTracked(); - - if ( _firstChild ) { - TIXMLASSERT( _lastChild ); - TIXMLASSERT( _firstChild->_prev == 0 ); - - _firstChild->_prev = addThis; - addThis->_next = _firstChild; - _firstChild = addThis; - - addThis->_prev = 0; - } - else { - TIXMLASSERT( _lastChild == 0 ); - _firstChild = _lastChild = addThis; - - addThis->_prev = 0; - addThis->_next = 0; - } - addThis->_parent = this; - return addThis; -} - - -XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ) -{ - if (addThis->_document != _document) - return 0; - - TIXMLASSERT( afterThis->_parent == this ); - - if ( afterThis->_parent != this ) { - return 0; - } - - if ( afterThis->_next == 0 ) { - // The last node or the only node. - return InsertEndChild( addThis ); - } - if (addThis->_parent) - addThis->_parent->Unlink( addThis ); - else - addThis->_memPool->SetTracked(); - addThis->_prev = afterThis; - addThis->_next = afterThis->_next; - afterThis->_next->_prev = addThis; - afterThis->_next = addThis; - addThis->_parent = this; - return addThis; -} - - - - -const XMLElement* XMLNode::FirstChildElement( const char* value ) const -{ - for( XMLNode* node=_firstChild; node; node=node->_next ) { - XMLElement* element = node->ToElement(); - if ( element ) { - if ( !value || XMLUtil::StringEqual( element->Name(), value ) ) { - return element; - } - } - } - return 0; -} - - -const XMLElement* XMLNode::LastChildElement( const char* value ) const -{ - for( XMLNode* node=_lastChild; node; node=node->_prev ) { - XMLElement* element = node->ToElement(); - if ( element ) { - if ( !value || XMLUtil::StringEqual( element->Name(), value ) ) { - return element; - } - } - } - return 0; -} - - -const XMLElement* XMLNode::NextSiblingElement( const char* value ) const -{ - for( XMLNode* element=this->_next; element; element = element->_next ) { - if ( element->ToElement() - && (!value || XMLUtil::StringEqual( value, element->Value() ))) { - return element->ToElement(); - } - } - return 0; -} - - -const XMLElement* XMLNode::PreviousSiblingElement( const char* value ) const -{ - for( XMLNode* element=_prev; element; element = element->_prev ) { - if ( element->ToElement() - && (!value || XMLUtil::StringEqual( value, element->Value() ))) { - return element->ToElement(); - } - } - return 0; -} - - -char* XMLNode::ParseDeep( char* p, StrPair* parentEnd ) -{ - // This is a recursive method, but thinking about it "at the current level" - // it is a pretty simple flat list: - // - // - // - // With a special case: - // - // - // - // - // Where the closing element (/foo) *must* be the next thing after the opening - // element, and the names must match. BUT the tricky bit is that the closing - // element will be read by the child. - // - // 'endTag' is the end tag for this node, it is returned by a call to a child. - // 'parentEnd' is the end tag for the parent, which is filled in and returned. - - while( p && *p ) { - XMLNode* node = 0; - - p = _document->Identify( p, &node ); - if ( p == 0 || node == 0 ) { - break; - } - - StrPair endTag; - p = node->ParseDeep( p, &endTag ); - if ( !p ) { - DELETE_NODE( node ); - node = 0; - if ( !_document->Error() ) { - _document->SetError( XML_ERROR_PARSING, 0, 0 ); - } - break; - } - - // We read the end tag. Return it to the parent. - if ( node->ToElement() && node->ToElement()->ClosingType() == XMLElement::CLOSING ) { - if ( parentEnd ) { - *parentEnd = static_cast(node)->_value; - } - node->_memPool->SetTracked(); // created and then immediately deleted. - DELETE_NODE( node ); - return p; - } - - // Handle an end tag returned to this level. - // And handle a bunch of annoying errors. - XMLElement* ele = node->ToElement(); - if ( ele ) { - if ( endTag.Empty() && ele->ClosingType() == XMLElement::OPEN ) { - _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 ); - p = 0; - } - else if ( !endTag.Empty() && ele->ClosingType() != XMLElement::OPEN ) { - _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 ); - p = 0; - } - else if ( !endTag.Empty() ) { - if ( !XMLUtil::StringEqual( endTag.GetStr(), node->Value() )) { - _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 ); - p = 0; - } - } - } - if ( p == 0 ) { - DELETE_NODE( node ); - node = 0; - } - if ( node ) { - this->InsertEndChild( node ); - } - } - return 0; -} - -// --------- XMLText ---------- // -char* XMLText::ParseDeep( char* p, StrPair* ) -{ - const char* start = p; - if ( this->CData() ) { - p = _value.ParseText( p, "]]>", StrPair::NEEDS_NEWLINE_NORMALIZATION ); - if ( !p ) { - _document->SetError( XML_ERROR_PARSING_CDATA, start, 0 ); - } - return p; - } - else { - int flags = _document->ProcessEntities() ? StrPair::TEXT_ELEMENT : StrPair::TEXT_ELEMENT_LEAVE_ENTITIES; - if ( _document->WhitespaceMode() == COLLAPSE_WHITESPACE ) { - flags |= StrPair::COLLAPSE_WHITESPACE; - } - - p = _value.ParseText( p, "<", flags ); - if ( !p ) { - _document->SetError( XML_ERROR_PARSING_TEXT, start, 0 ); - } - if ( p && *p ) { - return p-1; - } - } - return 0; -} - - -XMLNode* XMLText::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLText* text = doc->NewText( Value() ); // fixme: this will always allocate memory. Intern? - text->SetCData( this->CData() ); - return text; -} - - -bool XMLText::ShallowEqual( const XMLNode* compare ) const -{ - return ( compare->ToText() && XMLUtil::StringEqual( compare->ToText()->Value(), Value() )); -} - - -bool XMLText::Accept( XMLVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -// --------- XMLComment ---------- // - -XMLComment::XMLComment( XMLDocument* doc ) : XMLNode( doc ) -{ -} - - -XMLComment::~XMLComment() -{ -} - - -char* XMLComment::ParseDeep( char* p, StrPair* ) -{ - // Comment parses as text. - const char* start = p; - p = _value.ParseText( p, "-->", StrPair::COMMENT ); - if ( p == 0 ) { - _document->SetError( XML_ERROR_PARSING_COMMENT, start, 0 ); - } - return p; -} - - -XMLNode* XMLComment::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLComment* comment = doc->NewComment( Value() ); // fixme: this will always allocate memory. Intern? - return comment; -} - - -bool XMLComment::ShallowEqual( const XMLNode* compare ) const -{ - return ( compare->ToComment() && XMLUtil::StringEqual( compare->ToComment()->Value(), Value() )); -} - - -bool XMLComment::Accept( XMLVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -// --------- XMLDeclaration ---------- // - -XMLDeclaration::XMLDeclaration( XMLDocument* doc ) : XMLNode( doc ) -{ -} - - -XMLDeclaration::~XMLDeclaration() -{ - //printf( "~XMLDeclaration\n" ); -} - - -char* XMLDeclaration::ParseDeep( char* p, StrPair* ) -{ - // Declaration parses as text. - const char* start = p; - p = _value.ParseText( p, "?>", StrPair::NEEDS_NEWLINE_NORMALIZATION ); - if ( p == 0 ) { - _document->SetError( XML_ERROR_PARSING_DECLARATION, start, 0 ); - } - return p; -} - - -XMLNode* XMLDeclaration::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLDeclaration* dec = doc->NewDeclaration( Value() ); // fixme: this will always allocate memory. Intern? - return dec; -} - - -bool XMLDeclaration::ShallowEqual( const XMLNode* compare ) const -{ - return ( compare->ToDeclaration() && XMLUtil::StringEqual( compare->ToDeclaration()->Value(), Value() )); -} - - - -bool XMLDeclaration::Accept( XMLVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - -// --------- XMLUnknown ---------- // - -XMLUnknown::XMLUnknown( XMLDocument* doc ) : XMLNode( doc ) -{ -} - - -XMLUnknown::~XMLUnknown() -{ -} - - -char* XMLUnknown::ParseDeep( char* p, StrPair* ) -{ - // Unknown parses as text. - const char* start = p; - - p = _value.ParseText( p, ">", StrPair::NEEDS_NEWLINE_NORMALIZATION ); - if ( !p ) { - _document->SetError( XML_ERROR_PARSING_UNKNOWN, start, 0 ); - } - return p; -} - - -XMLNode* XMLUnknown::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLUnknown* text = doc->NewUnknown( Value() ); // fixme: this will always allocate memory. Intern? - return text; -} - - -bool XMLUnknown::ShallowEqual( const XMLNode* compare ) const -{ - return ( compare->ToUnknown() && XMLUtil::StringEqual( compare->ToUnknown()->Value(), Value() )); -} - - -bool XMLUnknown::Accept( XMLVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - -// --------- XMLAttribute ---------- // - -const char* XMLAttribute::Name() const -{ - return _name.GetStr(); -} - -const char* XMLAttribute::Value() const -{ - return _value.GetStr(); -} - -char* XMLAttribute::ParseDeep( char* p, bool processEntities ) -{ - // Parse using the name rules: bug fix, was using ParseText before - p = _name.ParseName( p ); - if ( !p || !*p ) { - return 0; - } - - // Skip white space before = - p = XMLUtil::SkipWhiteSpace( p ); - if ( !p || *p != '=' ) { - return 0; - } - - ++p; // move up to opening quote - p = XMLUtil::SkipWhiteSpace( p ); - if ( *p != '\"' && *p != '\'' ) { - return 0; - } - - char endTag[2] = { *p, 0 }; - ++p; // move past opening quote - - p = _value.ParseText( p, endTag, processEntities ? StrPair::ATTRIBUTE_VALUE : StrPair::ATTRIBUTE_VALUE_LEAVE_ENTITIES ); - return p; -} - - -void XMLAttribute::SetName( const char* n ) -{ - _name.SetStr( n ); -} - - -XMLError XMLAttribute::QueryIntValue( int* value ) const -{ - if ( XMLUtil::ToInt( Value(), value )) { - return XML_NO_ERROR; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const -{ - if ( XMLUtil::ToUnsigned( Value(), value )) { - return XML_NO_ERROR; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryBoolValue( bool* value ) const -{ - if ( XMLUtil::ToBool( Value(), value )) { - return XML_NO_ERROR; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryFloatValue( float* value ) const -{ - if ( XMLUtil::ToFloat( Value(), value )) { - return XML_NO_ERROR; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryDoubleValue( double* value ) const -{ - if ( XMLUtil::ToDouble( Value(), value )) { - return XML_NO_ERROR; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -void XMLAttribute::SetAttribute( const char* v ) -{ - _value.SetStr( v ); -} - - -void XMLAttribute::SetAttribute( int v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - - -void XMLAttribute::SetAttribute( unsigned v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - - -void XMLAttribute::SetAttribute( bool v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - -void XMLAttribute::SetAttribute( double v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - -void XMLAttribute::SetAttribute( float v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - - -// --------- XMLElement ---------- // -XMLElement::XMLElement( XMLDocument* doc ) : XMLNode( doc ), - _closingType( 0 ), - _rootAttribute( 0 ) -{ -} - - -XMLElement::~XMLElement() -{ - while( _rootAttribute ) { - XMLAttribute* next = _rootAttribute->_next; - DELETE_ATTRIBUTE( _rootAttribute ); - _rootAttribute = next; - } -} - - -XMLAttribute* XMLElement::FindAttribute( const char* name ) -{ - XMLAttribute* a = 0; - for( a=_rootAttribute; a; a = a->_next ) { - if ( XMLUtil::StringEqual( a->Name(), name ) ) { - return a; - } - } - return 0; -} - - -const XMLAttribute* XMLElement::FindAttribute( const char* name ) const -{ - XMLAttribute* a = 0; - for( a=_rootAttribute; a; a = a->_next ) { - if ( XMLUtil::StringEqual( a->Name(), name ) ) { - return a; - } - } - return 0; -} - - -const char* XMLElement::Attribute( const char* name, const char* value ) const -{ - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return 0; - } - if ( !value || XMLUtil::StringEqual( a->Value(), value )) { - return a->Value(); - } - return 0; -} - - -const char* XMLElement::GetText() const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - return FirstChild()->ToText()->Value(); - } - return 0; -} - - -void XMLElement::SetText( const char* inText ) -{ - if ( FirstChild() && FirstChild()->ToText() ) - FirstChild()->SetValue( inText ); - else { - XMLText* theText = GetDocument()->NewText( inText ); - InsertFirstChild( theText ); - } -} - - -void XMLElement::SetText( int v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText( unsigned v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText( bool v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText( float v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText( double v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -XMLError XMLElement::QueryIntText( int* ival ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->ToText()->Value(); - if ( XMLUtil::ToInt( t, ival ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryUnsignedText( unsigned* uval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->ToText()->Value(); - if ( XMLUtil::ToUnsigned( t, uval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryBoolText( bool* bval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->ToText()->Value(); - if ( XMLUtil::ToBool( t, bval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryDoubleText( double* dval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->ToText()->Value(); - if ( XMLUtil::ToDouble( t, dval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryFloatText( float* fval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->ToText()->Value(); - if ( XMLUtil::ToFloat( t, fval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - - -XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name ) -{ - XMLAttribute* last = 0; - XMLAttribute* attrib = 0; - for( attrib = _rootAttribute; - attrib; - last = attrib, attrib = attrib->_next ) { - if ( XMLUtil::StringEqual( attrib->Name(), name ) ) { - break; - } - } - if ( !attrib ) { - attrib = new (_document->_attributePool.Alloc() ) XMLAttribute(); - attrib->_memPool = &_document->_attributePool; - if ( last ) { - last->_next = attrib; - } - else { - _rootAttribute = attrib; - } - attrib->SetName( name ); - attrib->_memPool->SetTracked(); // always created and linked. - } - return attrib; -} - - -void XMLElement::DeleteAttribute( const char* name ) -{ - XMLAttribute* prev = 0; - for( XMLAttribute* a=_rootAttribute; a; a=a->_next ) { - if ( XMLUtil::StringEqual( name, a->Name() ) ) { - if ( prev ) { - prev->_next = a->_next; - } - else { - _rootAttribute = a->_next; - } - DELETE_ATTRIBUTE( a ); - break; - } - prev = a; - } -} - - -char* XMLElement::ParseAttributes( char* p ) -{ - const char* start = p; - XMLAttribute* prevAttribute = 0; - - // Read the attributes. - while( p ) { - p = XMLUtil::SkipWhiteSpace( p ); - if ( !p || !(*p) ) { - _document->SetError( XML_ERROR_PARSING_ELEMENT, start, Name() ); - return 0; - } - - // attribute. - if (XMLUtil::IsNameStartChar( *p ) ) { - XMLAttribute* attrib = new (_document->_attributePool.Alloc() ) XMLAttribute(); - attrib->_memPool = &_document->_attributePool; - attrib->_memPool->SetTracked(); - - p = attrib->ParseDeep( p, _document->ProcessEntities() ); - if ( !p || Attribute( attrib->Name() ) ) { - DELETE_ATTRIBUTE( attrib ); - _document->SetError( XML_ERROR_PARSING_ATTRIBUTE, start, p ); - return 0; - } - // There is a minor bug here: if the attribute in the source xml - // document is duplicated, it will not be detected and the - // attribute will be doubly added. However, tracking the 'prevAttribute' - // avoids re-scanning the attribute list. Preferring performance for - // now, may reconsider in the future. - if ( prevAttribute ) { - prevAttribute->_next = attrib; - } - else { - _rootAttribute = attrib; - } - prevAttribute = attrib; - } - // end of the tag - else if ( *p == '/' && *(p+1) == '>' ) { - _closingType = CLOSED; - return p+2; // done; sealed element. - } - // end of the tag - else if ( *p == '>' ) { - ++p; - break; - } - else { - _document->SetError( XML_ERROR_PARSING_ELEMENT, start, p ); - return 0; - } - } - return p; -} - - -// -// -// foobar -// -char* XMLElement::ParseDeep( char* p, StrPair* strPair ) -{ - // Read the element name. - p = XMLUtil::SkipWhiteSpace( p ); - if ( !p ) { - return 0; - } - - // The closing element is the form. It is - // parsed just like a regular element then deleted from - // the DOM. - if ( *p == '/' ) { - _closingType = CLOSING; - ++p; - } - - p = _value.ParseName( p ); - if ( _value.Empty() ) { - return 0; - } - - p = ParseAttributes( p ); - if ( !p || !*p || _closingType ) { - return p; - } - - p = XMLNode::ParseDeep( p, strPair ); - return p; -} - - - -XMLNode* XMLElement::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLElement* element = doc->NewElement( Value() ); // fixme: this will always allocate memory. Intern? - for( const XMLAttribute* a=FirstAttribute(); a; a=a->Next() ) { - element->SetAttribute( a->Name(), a->Value() ); // fixme: this will always allocate memory. Intern? - } - return element; -} - - -bool XMLElement::ShallowEqual( const XMLNode* compare ) const -{ - const XMLElement* other = compare->ToElement(); - if ( other && XMLUtil::StringEqual( other->Value(), Value() )) { - - const XMLAttribute* a=FirstAttribute(); - const XMLAttribute* b=other->FirstAttribute(); - - while ( a && b ) { - if ( !XMLUtil::StringEqual( a->Value(), b->Value() ) ) { - return false; - } - a = a->Next(); - b = b->Next(); - } - if ( a || b ) { - // different count - return false; - } - return true; - } - return false; -} - - -bool XMLElement::Accept( XMLVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this, _rootAttribute ) ) { - for ( const XMLNode* node=FirstChild(); node; node=node->NextSibling() ) { - if ( !node->Accept( visitor ) ) { - break; - } - } - } - return visitor->VisitExit( *this ); -} - - -// --------- XMLDocument ----------- // -XMLDocument::XMLDocument( bool processEntities, Whitespace whitespace ) : - XMLNode( 0 ), - _writeBOM( false ), - _processEntities( processEntities ), - _errorID( XML_NO_ERROR ), - _whitespace( whitespace ), - _errorStr1( 0 ), - _errorStr2( 0 ), - _charBuffer( 0 ) -{ - _document = this; // avoid warning about 'this' in initializer list -} - - -XMLDocument::~XMLDocument() -{ - DeleteChildren(); - delete [] _charBuffer; - -#if 0 - _textPool.Trace( "text" ); - _elementPool.Trace( "element" ); - _commentPool.Trace( "comment" ); - _attributePool.Trace( "attribute" ); -#endif - -#ifdef DEBUG - if ( Error() == false ) { - TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() ); - TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() ); - TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() ); - TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() ); - } -#endif -} - - -void XMLDocument::Clear() -{ - DeleteChildren(); - - _errorID = XML_NO_ERROR; - _errorStr1 = 0; - _errorStr2 = 0; - - delete [] _charBuffer; - _charBuffer = 0; -} - - -XMLElement* XMLDocument::NewElement( const char* name ) -{ - XMLElement* ele = new (_elementPool.Alloc()) XMLElement( this ); - ele->_memPool = &_elementPool; - ele->SetName( name ); - return ele; -} - - -XMLComment* XMLDocument::NewComment( const char* str ) -{ - XMLComment* comment = new (_commentPool.Alloc()) XMLComment( this ); - comment->_memPool = &_commentPool; - comment->SetValue( str ); - return comment; -} - - -XMLText* XMLDocument::NewText( const char* str ) -{ - XMLText* text = new (_textPool.Alloc()) XMLText( this ); - text->_memPool = &_textPool; - text->SetValue( str ); - return text; -} - - -XMLDeclaration* XMLDocument::NewDeclaration( const char* str ) -{ - XMLDeclaration* dec = new (_commentPool.Alloc()) XMLDeclaration( this ); - dec->_memPool = &_commentPool; - dec->SetValue( str ? str : "xml version=\"1.0\" encoding=\"UTF-8\"" ); - return dec; -} - - -XMLUnknown* XMLDocument::NewUnknown( const char* str ) -{ - XMLUnknown* unk = new (_commentPool.Alloc()) XMLUnknown( this ); - unk->_memPool = &_commentPool; - unk->SetValue( str ); - return unk; -} - - -XMLError XMLDocument::LoadFile( const char* filename ) -{ - Clear(); - FILE* fp = 0; - -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - errno_t err = fopen_s(&fp, filename, "rb" ); - if ( !fp || err) { -#else - fp = fopen( filename, "rb" ); - if ( !fp) { -#endif - SetError( XML_ERROR_FILE_NOT_FOUND, filename, 0 ); - return _errorID; - } - LoadFile( fp ); - fclose( fp ); - return _errorID; -} - - -XMLError XMLDocument::LoadFile( FILE* fp ) -{ - Clear(); - - fseek( fp, 0, SEEK_SET ); - fgetc( fp ); - if ( ferror( fp ) != 0 ) { - SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); - return _errorID; - } - - fseek( fp, 0, SEEK_END ); - size_t size = ftell( fp ); - fseek( fp, 0, SEEK_SET ); - - if ( size == 0 ) { - SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); - return _errorID; - } - - _charBuffer = new char[size+1]; - size_t read = fread( _charBuffer, 1, size, fp ); - if ( read != size ) { - SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); - return _errorID; - } - - _charBuffer[size] = 0; - - const char* p = _charBuffer; - p = XMLUtil::SkipWhiteSpace( p ); - p = XMLUtil::ReadBOM( p, &_writeBOM ); - if ( !p || !*p ) { - SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); - return _errorID; - } - - ParseDeep( _charBuffer + (p-_charBuffer), 0 ); - return _errorID; -} - - -XMLError XMLDocument::SaveFile( const char* filename, bool compact ) -{ - FILE* fp = 0; -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - errno_t err = fopen_s(&fp, filename, "w" ); - if ( !fp || err) { -#else - fp = fopen( filename, "w" ); - if ( !fp) { -#endif - SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0 ); - return _errorID; - } - SaveFile(fp, compact); - fclose( fp ); - return _errorID; -} - - -XMLError XMLDocument::SaveFile( FILE* fp, bool compact ) -{ - XMLPrinter stream( fp, compact ); - Print( &stream ); - return _errorID; -} - - -XMLError XMLDocument::Parse( const char* p, size_t len ) -{ - const char* start = p; - Clear(); - - if ( len == 0 || !p || !*p ) { - SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); - return _errorID; - } - if ( len == (size_t)(-1) ) { - len = strlen( p ); - } - _charBuffer = new char[ len+1 ]; - memcpy( _charBuffer, p, len ); - _charBuffer[len] = 0; - - p = XMLUtil::SkipWhiteSpace( p ); - p = XMLUtil::ReadBOM( p, &_writeBOM ); - if ( !p || !*p ) { - SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); - return _errorID; - } - - ptrdiff_t delta = p - start; // skip initial whitespace, BOM, etc. - ParseDeep( _charBuffer+delta, 0 ); - return _errorID; -} - - -void XMLDocument::Print( XMLPrinter* streamer ) const -{ - XMLPrinter stdStreamer( stdout ); - if ( !streamer ) { - streamer = &stdStreamer; - } - Accept( streamer ); -} - - -void XMLDocument::SetError( XMLError error, const char* str1, const char* str2 ) -{ - _errorID = error; - _errorStr1 = str1; - _errorStr2 = str2; -} - - -void XMLDocument::PrintError() const -{ - if ( _errorID ) { - static const int LEN = 20; - char buf1[LEN] = { 0 }; - char buf2[LEN] = { 0 }; - - if ( _errorStr1 ) { - TIXML_SNPRINTF( buf1, LEN, "%s", _errorStr1 ); - } - if ( _errorStr2 ) { - TIXML_SNPRINTF( buf2, LEN, "%s", _errorStr2 ); - } - - printf( "XMLDocument error id=%d str1=%s str2=%s\n", - _errorID, buf1, buf2 ); - } -} - - -XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : - _elementJustOpened( false ), - _firstElement( true ), - _fp( file ), - _depth( depth ), - _textDepth( -1 ), - _processEntities( true ), - _compactMode( compact ) -{ - for( int i=0; i'] = true; // not required, but consistency is nice - _buffer.Push( 0 ); -} - - -void XMLPrinter::Print( const char* format, ... ) -{ - va_list va; - va_start( va, format ); - - if ( _fp ) { - vfprintf( _fp, format, va ); - } - else { -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - int len = _vscprintf( format, va ); -#else - int len = vsnprintf( 0, 0, format, va ); -#endif - // Close out and re-start the va-args - va_end( va ); - va_start( va, format ); - char* p = _buffer.PushArr( len ) - 1; // back up over the null terminator. -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - vsnprintf_s( p, len+1, _TRUNCATE, format, va ); -#else - vsnprintf( p, len+1, format, va ); -#endif - } - va_end( va ); -} - - -void XMLPrinter::PrintSpace( int depth ) -{ - for( int i=0; i 0 && *q < ENTITY_RANGE ) { - // Check for entities. If one is found, flush - // the stream up until the entity, write the - // entity, and keep looking. - if ( flag[(unsigned)(*q)] ) { - while ( p < q ) { - Print( "%c", *p ); - ++p; - } - for( int i=0; i 0) ) { - Print( "%s", p ); - } -} - - -void XMLPrinter::PushHeader( bool writeBOM, bool writeDec ) -{ - if ( writeBOM ) { - static const unsigned char bom[] = { TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, TIXML_UTF_LEAD_2, 0 }; - Print( "%s", bom ); - } - if ( writeDec ) { - PushDeclaration( "xml version=\"1.0\"" ); - } -} - - -void XMLPrinter::OpenElement( const char* name, bool compactMode ) -{ - if ( _elementJustOpened ) { - SealElement(); - } - _stack.Push( name ); - - if ( _textDepth < 0 && !_firstElement && !compactMode ) { - Print( "\n" ); - } - if ( !compactMode ) { - PrintSpace( _depth ); - } - - Print( "<%s", name ); - _elementJustOpened = true; - _firstElement = false; - ++_depth; -} - - -void XMLPrinter::PushAttribute( const char* name, const char* value ) -{ - TIXMLASSERT( _elementJustOpened ); - Print( " %s=\"", name ); - PrintString( value, false ); - Print( "\"" ); -} - - -void XMLPrinter::PushAttribute( const char* name, int v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::PushAttribute( const char* name, unsigned v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::PushAttribute( const char* name, bool v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::PushAttribute( const char* name, double v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::CloseElement( bool compactMode ) -{ - --_depth; - const char* name = _stack.Pop(); - - if ( _elementJustOpened ) { - Print( "/>" ); - } - else { - if ( _textDepth < 0 && !compactMode) { - Print( "\n" ); - PrintSpace( _depth ); - } - Print( "", name ); - } - - if ( _textDepth == _depth ) { - _textDepth = -1; - } - if ( _depth == 0 && !compactMode) { - Print( "\n" ); - } - _elementJustOpened = false; -} - - -void XMLPrinter::SealElement() -{ - _elementJustOpened = false; - Print( ">" ); -} - - -void XMLPrinter::PushText( const char* text, bool cdata ) -{ - _textDepth = _depth-1; - - if ( _elementJustOpened ) { - SealElement(); - } - if ( cdata ) { - Print( "" ); - } - else { - PrintString( text, true ); - } -} - -void XMLPrinter::PushText( int value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( unsigned value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( bool value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( float value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( double value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushComment( const char* comment ) -{ - if ( _elementJustOpened ) { - SealElement(); - } - if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Print( "\n" ); - PrintSpace( _depth ); - } - _firstElement = false; - Print( "", comment ); -} - - -void XMLPrinter::PushDeclaration( const char* value ) -{ - if ( _elementJustOpened ) { - SealElement(); - } - if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Print( "\n" ); - PrintSpace( _depth ); - } - _firstElement = false; - Print( "", value ); -} - - -void XMLPrinter::PushUnknown( const char* value ) -{ - if ( _elementJustOpened ) { - SealElement(); - } - if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Print( "\n" ); - PrintSpace( _depth ); - } - _firstElement = false; - Print( "", value ); -} - - -bool XMLPrinter::VisitEnter( const XMLDocument& doc ) -{ - _processEntities = doc.ProcessEntities(); - if ( doc.HasBOM() ) { - PushHeader( true, false ); - } - return true; -} - - -bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute ) -{ - const XMLElement* parentElem = element.Parent()->ToElement(); - bool compactMode = parentElem ? CompactMode(*parentElem) : _compactMode; - OpenElement( element.Name(), compactMode ); - while ( attribute ) { - PushAttribute( attribute->Name(), attribute->Value() ); - attribute = attribute->Next(); - } - return true; -} - - -bool XMLPrinter::VisitExit( const XMLElement& element ) -{ - CloseElement( CompactMode(element) ); - return true; -} - - -bool XMLPrinter::Visit( const XMLText& text ) -{ - PushText( text.Value(), text.CData() ); - return true; -} - - -bool XMLPrinter::Visit( const XMLComment& comment ) -{ - PushComment( comment.Value() ); - return true; -} - -bool XMLPrinter::Visit( const XMLDeclaration& declaration ) -{ - PushDeclaration( declaration.Value() ); - return true; -} - - -bool XMLPrinter::Visit( const XMLUnknown& unknown ) -{ - PushUnknown( unknown.Value() ); - return true; -} - -} // namespace tinyxml2 - diff --git a/Utilities/tinyxml2.h b/Utilities/tinyxml2.h deleted file mode 100644 index 0a9ae1cb..00000000 --- a/Utilities/tinyxml2.h +++ /dev/null @@ -1,2076 +0,0 @@ -/* -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#ifndef TINYXML2_INCLUDED -#define TINYXML2_INCLUDED - -#if defined(ANDROID_NDK) || defined(__BORLANDC__) -# include -# include -# include -# include -# include -# include -#else -# include -# include -# include -# include -# include -# include -#endif - -/* - TODO: intern strings instead of allocation. -*/ -/* - gcc: - g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe - - Formatting, Artistic Style: - AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h -*/ - -#if defined( _DEBUG ) || defined( DEBUG ) || defined (__DEBUG__) -# ifndef DEBUG -# define DEBUG -# endif -#endif - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4251) -#endif - -#ifdef _WIN32 -# ifdef TINYXML2_EXPORT -# define TINYXML2_LIB __declspec(dllexport) -# elif defined(TINYXML2_IMPORT) -# define TINYXML2_LIB __declspec(dllimport) -# else -# define TINYXML2_LIB -# endif -#else -# define TINYXML2_LIB -#endif - - -#if defined(DEBUG) -# if defined(_MSC_VER) -# define TIXMLASSERT( x ) if ( !(x)) { __debugbreak(); } //if ( !(x)) WinDebugBreak() -# elif defined (ANDROID_NDK) -# include -# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } -# else -# include -# define TIXMLASSERT assert -# endif -# else -# define TIXMLASSERT( x ) {} -#endif - - -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) -// Microsoft visual studio, version 2005 and higher. -/*int _snprintf_s( - char *buffer, - size_t sizeOfBuffer, - size_t count, - const char *format [, - argument] ... -);*/ -inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... ) -{ - va_list va; - va_start( va, format ); - int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va ); - va_end( va ); - return result; -} -#define TIXML_SSCANF sscanf_s -#else -// GCC version 3 and higher -//#warning( "Using sn* functions." ) -#define TIXML_SNPRINTF snprintf -#define TIXML_SSCANF sscanf -#endif - -/* Versioning, past 1.0.14: - http://semver.org/ -*/ -static const int TIXML2_MAJOR_VERSION = 2; -static const int TIXML2_MINOR_VERSION = 1; -static const int TIXML2_PATCH_VERSION = 0; - -namespace tinyxml2 -{ -class XMLDocument; -class XMLElement; -class XMLAttribute; -class XMLComment; -class XMLText; -class XMLDeclaration; -class XMLUnknown; -class XMLPrinter; - -/* - A class that wraps strings. Normally stores the start and end - pointers into the XML file itself, and will apply normalization - and entity translation if actually read. Can also store (and memory - manage) a traditional char[] -*/ -class StrPair -{ -public: - enum { - NEEDS_ENTITY_PROCESSING = 0x01, - NEEDS_NEWLINE_NORMALIZATION = 0x02, - COLLAPSE_WHITESPACE = 0x04, - - TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, - TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, - ATTRIBUTE_NAME = 0, - ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, - ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, - COMMENT = NEEDS_NEWLINE_NORMALIZATION - }; - - StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {} - ~StrPair(); - - void Set( char* start, char* end, int flags ) { - Reset(); - _start = start; - _end = end; - _flags = flags | NEEDS_FLUSH; - } - - const char* GetStr(); - - bool Empty() const { - return _start == _end; - } - - void SetInternedStr( const char* str ) { - Reset(); - _start = const_cast(str); - } - - void SetStr( const char* str, int flags=0 ); - - char* ParseText( char* in, const char* endTag, int strFlags ); - char* ParseName( char* in ); - -private: - void Reset(); - void CollapseWhitespace(); - - enum { - NEEDS_FLUSH = 0x100, - NEEDS_DELETE = 0x200 - }; - - // After parsing, if *_end != 0, it can be set to zero. - int _flags; - char* _start; - char* _end; -}; - - -/* - A dynamic array of Plain Old Data. Doesn't support constructors, etc. - Has a small initial memory pool, so that low or no usage will not - cause a call to new/delete -*/ -template -class DynArray -{ -public: - DynArray< T, INIT >() { - _mem = _pool; - _allocated = INIT; - _size = 0; - } - - ~DynArray() { - if ( _mem != _pool ) { - delete [] _mem; - } - } - - void Clear() { - _size = 0; - } - - void Push( T t ) { - EnsureCapacity( _size+1 ); - _mem[_size++] = t; - } - - T* PushArr( int count ) { - EnsureCapacity( _size+count ); - T* ret = &_mem[_size]; - _size += count; - return ret; - } - - T Pop() { - return _mem[--_size]; - } - - void PopArr( int count ) { - TIXMLASSERT( _size >= count ); - _size -= count; - } - - bool Empty() const { - return _size == 0; - } - - T& operator[](int i) { - TIXMLASSERT( i>= 0 && i < _size ); - return _mem[i]; - } - - const T& operator[](int i) const { - TIXMLASSERT( i>= 0 && i < _size ); - return _mem[i]; - } - - const T& PeekTop() const { - TIXMLASSERT( _size > 0 ); - return _mem[ _size - 1]; - } - - int Size() const { - return _size; - } - - int Capacity() const { - return _allocated; - } - - const T* Mem() const { - return _mem; - } - - T* Mem() { - return _mem; - } - -private: - void EnsureCapacity( int cap ) { - if ( cap > _allocated ) { - int newAllocated = cap * 2; - T* newMem = new T[newAllocated]; - memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs - if ( _mem != _pool ) { - delete [] _mem; - } - _mem = newMem; - _allocated = newAllocated; - } - } - - T* _mem; - T _pool[INIT]; - int _allocated; // objects allocated - int _size; // number objects in use -}; - - -/* - Parent virtual class of a pool for fast allocation - and deallocation of objects. -*/ -class MemPool -{ -public: - MemPool() {} - virtual ~MemPool() {} - - virtual int ItemSize() const = 0; - virtual void* Alloc() = 0; - virtual void Free( void* ) = 0; - virtual void SetTracked() = 0; -}; - - -/* - Template child class to create pools of the correct type. -*/ -template< int SIZE > -class MemPoolT : public MemPool -{ -public: - MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {} - ~MemPoolT() { - // Delete the blocks. - for( int i=0; i<_blockPtrs.Size(); ++i ) { - delete _blockPtrs[i]; - } - } - - virtual int ItemSize() const { - return SIZE; - } - int CurrentAllocs() const { - return _currentAllocs; - } - - virtual void* Alloc() { - if ( !_root ) { - // Need a new block. - Block* block = new Block(); - _blockPtrs.Push( block ); - - for( int i=0; ichunk[i].next = &block->chunk[i+1]; - } - block->chunk[COUNT-1].next = 0; - _root = block->chunk; - } - void* result = _root; - _root = _root->next; - - ++_currentAllocs; - if ( _currentAllocs > _maxAllocs ) { - _maxAllocs = _currentAllocs; - } - _nAllocs++; - _nUntracked++; - return result; - } - virtual void Free( void* mem ) { - if ( !mem ) { - return; - } - --_currentAllocs; - Chunk* chunk = (Chunk*)mem; -#ifdef DEBUG - memset( chunk, 0xfe, sizeof(Chunk) ); -#endif - chunk->next = _root; - _root = chunk; - } - void Trace( const char* name ) { - printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n", - name, _maxAllocs, _maxAllocs*SIZE/1024, _currentAllocs, SIZE, _nAllocs, _blockPtrs.Size() ); - } - - void SetTracked() { - _nUntracked--; - } - - int Untracked() const { - return _nUntracked; - } - - // This number is perf sensitive. 4k seems like a good tradeoff on my machine. - // The test file is large, 170k. - // Release: VS2010 gcc(no opt) - // 1k: 4000 - // 2k: 4000 - // 4k: 3900 21000 - // 16k: 5200 - // 32k: 4300 - // 64k: 4000 21000 - enum { COUNT = (4*1024)/SIZE }; // Some compilers do not accept to use COUNT in private part if COUNT is private - -private: - union Chunk { - Chunk* next; - char mem[SIZE]; - }; - struct Block { - Chunk chunk[COUNT]; - }; - DynArray< Block*, 10 > _blockPtrs; - Chunk* _root; - - int _currentAllocs; - int _nAllocs; - int _maxAllocs; - int _nUntracked; -}; - - - -/** - Implements the interface to the "Visitor pattern" (see the Accept() method.) - If you call the Accept() method, it requires being passed a XMLVisitor - class to handle callbacks. For nodes that contain other nodes (Document, Element) - you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs - are simply called with Visit(). - - If you return 'true' from a Visit method, recursive parsing will continue. If you return - false, no children of this node or its siblings will be visited. - - All flavors of Visit methods have a default implementation that returns 'true' (continue - visiting). You need to only override methods that are interesting to you. - - Generally Accept() is called on the XMLDocument, although all nodes support visiting. - - You should never change the document from a callback. - - @sa XMLNode::Accept() -*/ -class TINYXML2_LIB XMLVisitor -{ -public: - virtual ~XMLVisitor() {} - - /// Visit a document. - virtual bool VisitEnter( const XMLDocument& /*doc*/ ) { - return true; - } - /// Visit a document. - virtual bool VisitExit( const XMLDocument& /*doc*/ ) { - return true; - } - - /// Visit an element. - virtual bool VisitEnter( const XMLElement& /*element*/, const XMLAttribute* /*firstAttribute*/ ) { - return true; - } - /// Visit an element. - virtual bool VisitExit( const XMLElement& /*element*/ ) { - return true; - } - - /// Visit a declaration. - virtual bool Visit( const XMLDeclaration& /*declaration*/ ) { - return true; - } - /// Visit a text node. - virtual bool Visit( const XMLText& /*text*/ ) { - return true; - } - /// Visit a comment node. - virtual bool Visit( const XMLComment& /*comment*/ ) { - return true; - } - /// Visit an unknown node. - virtual bool Visit( const XMLUnknown& /*unknown*/ ) { - return true; - } -}; - - -/* - Utility functionality. -*/ -class XMLUtil -{ -public: - // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't - // correct, but simple, and usually works. - static const char* SkipWhiteSpace( const char* p ) { - while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast(p) ) ) { - ++p; - } - return p; - } - static char* SkipWhiteSpace( char* p ) { - while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast(p) ) ) { - ++p; - } - return p; - } - static bool IsWhiteSpace( char p ) { - return !IsUTF8Continuation(p) && isspace( static_cast(p) ); - } - - inline static bool IsNameStartChar( unsigned char ch ) { - return ( ( ch < 128 ) ? isalpha( ch ) : 1 ) - || ch == ':' - || ch == '_'; - } - - inline static bool IsNameChar( unsigned char ch ) { - return IsNameStartChar( ch ) - || isdigit( ch ) - || ch == '.' - || ch == '-'; - } - - inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) { - int n = 0; - if ( p == q ) { - return true; - } - while( *p && *q && *p == *q && n(const_cast(this)->FirstChildElement( value )); - } - - /// Get the last child node, or null if none exists. - const XMLNode* LastChild() const { - return _lastChild; - } - - XMLNode* LastChild() { - return const_cast(const_cast(this)->LastChild() ); - } - - /** Get the last child element or optionally the last child - element with the specified name. - */ - const XMLElement* LastChildElement( const char* value=0 ) const; - - XMLElement* LastChildElement( const char* value=0 ) { - return const_cast(const_cast(this)->LastChildElement(value) ); - } - - /// Get the previous (left) sibling node of this node. - const XMLNode* PreviousSibling() const { - return _prev; - } - - XMLNode* PreviousSibling() { - return _prev; - } - - /// Get the previous (left) sibling element of this node, with an optionally supplied name. - const XMLElement* PreviousSiblingElement( const char* value=0 ) const ; - - XMLElement* PreviousSiblingElement( const char* value=0 ) { - return const_cast(const_cast(this)->PreviousSiblingElement( value ) ); - } - - /// Get the next (right) sibling node of this node. - const XMLNode* NextSibling() const { - return _next; - } - - XMLNode* NextSibling() { - return _next; - } - - /// Get the next (right) sibling element of this node, with an optionally supplied name. - const XMLElement* NextSiblingElement( const char* value=0 ) const; - - XMLElement* NextSiblingElement( const char* value=0 ) { - return const_cast(const_cast(this)->NextSiblingElement( value ) ); - } - - /** - Add a child node as the last (right) child. - If the child node is already part of the document, - it is moved from its old location to the new location. - Returns the addThis argument or 0 if the node does not - belong to the same document. - */ - XMLNode* InsertEndChild( XMLNode* addThis ); - - XMLNode* LinkEndChild( XMLNode* addThis ) { - return InsertEndChild( addThis ); - } - /** - Add a child node as the first (left) child. - If the child node is already part of the document, - it is moved from its old location to the new location. - Returns the addThis argument or 0 if the node does not - belong to the same document. - */ - XMLNode* InsertFirstChild( XMLNode* addThis ); - /** - Add a node after the specified child node. - If the child node is already part of the document, - it is moved from its old location to the new location. - Returns the addThis argument or 0 if the afterThis node - is not a child of this node, or if the node does not - belong to the same document. - */ - XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ); - - /** - Delete all the children of this node. - */ - void DeleteChildren(); - - /** - Delete a child of this node. - */ - void DeleteChild( XMLNode* node ); - - /** - Make a copy of this node, but not its children. - You may pass in a Document pointer that will be - the owner of the new Node. If the 'document' is - null, then the node returned will be allocated - from the current Document. (this->GetDocument()) - - Note: if called on a XMLDocument, this will return null. - */ - virtual XMLNode* ShallowClone( XMLDocument* document ) const = 0; - - /** - Test if 2 nodes are the same, but don't test children. - The 2 nodes do not need to be in the same Document. - - Note: if called on a XMLDocument, this will return false. - */ - virtual bool ShallowEqual( const XMLNode* compare ) const = 0; - - /** Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the XMLVisitor interface. - - This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this - interface versus any other.) - - The interface has been based on ideas from: - - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - - Which are both good references for "visiting". - - An example of using Accept(): - @verbatim - XMLPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( XMLVisitor* visitor ) const = 0; - - // internal - virtual char* ParseDeep( char*, StrPair* ); - -protected: - XMLNode( XMLDocument* ); - virtual ~XMLNode(); - XMLNode( const XMLNode& ); // not supported - XMLNode& operator=( const XMLNode& ); // not supported - - XMLDocument* _document; - XMLNode* _parent; - mutable StrPair _value; - - XMLNode* _firstChild; - XMLNode* _lastChild; - - XMLNode* _prev; - XMLNode* _next; - -private: - MemPool* _memPool; - void Unlink( XMLNode* child ); -}; - - -/** XML text. - - Note that a text node can have child element nodes, for example: - @verbatim - This is bold - @endverbatim - - A text node can have 2 ways to output the next. "normal" output - and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with - SetCData() and query it with CData(). -*/ -class TINYXML2_LIB XMLText : public XMLNode -{ - friend class XMLBase; - friend class XMLDocument; -public: - virtual bool Accept( XMLVisitor* visitor ) const; - - virtual XMLText* ToText() { - return this; - } - virtual const XMLText* ToText() const { - return this; - } - - /// Declare whether this should be CDATA or standard text. - void SetCData( bool isCData ) { - _isCData = isCData; - } - /// Returns true if this is a CDATA text element. - bool CData() const { - return _isCData; - } - - char* ParseDeep( char*, StrPair* endTag ); - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {} - virtual ~XMLText() {} - XMLText( const XMLText& ); // not supported - XMLText& operator=( const XMLText& ); // not supported - -private: - bool _isCData; -}; - - -/** An XML Comment. */ -class TINYXML2_LIB XMLComment : public XMLNode -{ - friend class XMLDocument; -public: - virtual XMLComment* ToComment() { - return this; - } - virtual const XMLComment* ToComment() const { - return this; - } - - virtual bool Accept( XMLVisitor* visitor ) const; - - char* ParseDeep( char*, StrPair* endTag ); - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - XMLComment( XMLDocument* doc ); - virtual ~XMLComment(); - XMLComment( const XMLComment& ); // not supported - XMLComment& operator=( const XMLComment& ); // not supported - -private: -}; - - -/** In correct XML the declaration is the first entry in the file. - @verbatim - - @endverbatim - - TinyXML-2 will happily read or write files without a declaration, - however. - - The text of the declaration isn't interpreted. It is parsed - and written as a string. -*/ -class TINYXML2_LIB XMLDeclaration : public XMLNode -{ - friend class XMLDocument; -public: - virtual XMLDeclaration* ToDeclaration() { - return this; - } - virtual const XMLDeclaration* ToDeclaration() const { - return this; - } - - virtual bool Accept( XMLVisitor* visitor ) const; - - char* ParseDeep( char*, StrPair* endTag ); - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - XMLDeclaration( XMLDocument* doc ); - virtual ~XMLDeclaration(); - XMLDeclaration( const XMLDeclaration& ); // not supported - XMLDeclaration& operator=( const XMLDeclaration& ); // not supported -}; - - -/** Any tag that TinyXML-2 doesn't recognize is saved as an - unknown. It is a tag of text, but should not be modified. - It will be written back to the XML, unchanged, when the file - is saved. - - DTD tags get thrown into XMLUnknowns. -*/ -class TINYXML2_LIB XMLUnknown : public XMLNode -{ - friend class XMLDocument; -public: - virtual XMLUnknown* ToUnknown() { - return this; - } - virtual const XMLUnknown* ToUnknown() const { - return this; - } - - virtual bool Accept( XMLVisitor* visitor ) const; - - char* ParseDeep( char*, StrPair* endTag ); - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - XMLUnknown( XMLDocument* doc ); - virtual ~XMLUnknown(); - XMLUnknown( const XMLUnknown& ); // not supported - XMLUnknown& operator=( const XMLUnknown& ); // not supported -}; - - -enum XMLError { - XML_NO_ERROR = 0, - XML_SUCCESS = 0, - - XML_NO_ATTRIBUTE, - XML_WRONG_ATTRIBUTE_TYPE, - - XML_ERROR_FILE_NOT_FOUND, - XML_ERROR_FILE_COULD_NOT_BE_OPENED, - XML_ERROR_FILE_READ_ERROR, - XML_ERROR_ELEMENT_MISMATCH, - XML_ERROR_PARSING_ELEMENT, - XML_ERROR_PARSING_ATTRIBUTE, - XML_ERROR_IDENTIFYING_TAG, - XML_ERROR_PARSING_TEXT, - XML_ERROR_PARSING_CDATA, - XML_ERROR_PARSING_COMMENT, - XML_ERROR_PARSING_DECLARATION, - XML_ERROR_PARSING_UNKNOWN, - XML_ERROR_EMPTY_DOCUMENT, - XML_ERROR_MISMATCHED_ELEMENT, - XML_ERROR_PARSING, - - XML_CAN_NOT_CONVERT_TEXT, - XML_NO_TEXT_NODE -}; - - -/** An attribute is a name-value pair. Elements have an arbitrary - number of attributes, each with a unique name. - - @note The attributes are not XMLNodes. You may only query the - Next() attribute in a list. -*/ -class TINYXML2_LIB XMLAttribute -{ - friend class XMLElement; -public: - /// The name of the attribute. - const char* Name() const; - - /// The value of the attribute. - const char* Value() const; - - /// The next attribute in the list. - const XMLAttribute* Next() const { - return _next; - } - - /** IntValue interprets the attribute as an integer, and returns the value. - If the value isn't an integer, 0 will be returned. There is no error checking; - use QueryIntValue() if you need error checking. - */ - int IntValue() const { - int i=0; - QueryIntValue( &i ); - return i; - } - /// Query as an unsigned integer. See IntValue() - unsigned UnsignedValue() const { - unsigned i=0; - QueryUnsignedValue( &i ); - return i; - } - /// Query as a boolean. See IntValue() - bool BoolValue() const { - bool b=false; - QueryBoolValue( &b ); - return b; - } - /// Query as a double. See IntValue() - double DoubleValue() const { - double d=0; - QueryDoubleValue( &d ); - return d; - } - /// Query as a float. See IntValue() - float FloatValue() const { - float f=0; - QueryFloatValue( &f ); - return f; - } - - /** QueryIntValue interprets the attribute as an integer, and returns the value - in the provided parameter. The function will return XML_NO_ERROR on success, - and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful. - */ - XMLError QueryIntValue( int* value ) const; - /// See QueryIntValue - XMLError QueryUnsignedValue( unsigned int* value ) const; - /// See QueryIntValue - XMLError QueryBoolValue( bool* value ) const; - /// See QueryIntValue - XMLError QueryDoubleValue( double* value ) const; - /// See QueryIntValue - XMLError QueryFloatValue( float* value ) const; - - /// Set the attribute to a string value. - void SetAttribute( const char* value ); - /// Set the attribute to value. - void SetAttribute( int value ); - /// Set the attribute to value. - void SetAttribute( unsigned value ); - /// Set the attribute to value. - void SetAttribute( bool value ); - /// Set the attribute to value. - void SetAttribute( double value ); - /// Set the attribute to value. - void SetAttribute( float value ); - -private: - enum { BUF_SIZE = 200 }; - - XMLAttribute() : _next( 0 ), _memPool( 0 ) {} - virtual ~XMLAttribute() {} - - XMLAttribute( const XMLAttribute& ); // not supported - void operator=( const XMLAttribute& ); // not supported - void SetName( const char* name ); - - char* ParseDeep( char* p, bool processEntities ); - - mutable StrPair _name; - mutable StrPair _value; - XMLAttribute* _next; - MemPool* _memPool; -}; - - -/** The element is a container class. It has a value, the element name, - and can contain other elements, text, comments, and unknowns. - Elements also contain an arbitrary number of attributes. -*/ -class TINYXML2_LIB XMLElement : public XMLNode -{ - friend class XMLBase; - friend class XMLDocument; -public: - /// Get the name of an element (which is the Value() of the node.) - const char* Name() const { - return Value(); - } - /// Set the name of the element. - void SetName( const char* str, bool staticMem=false ) { - SetValue( str, staticMem ); - } - - virtual XMLElement* ToElement() { - return this; - } - virtual const XMLElement* ToElement() const { - return this; - } - virtual bool Accept( XMLVisitor* visitor ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none - exists. For example: - - @verbatim - const char* value = ele->Attribute( "foo" ); - @endverbatim - - The 'value' parameter is normally null. However, if specified, - the attribute will only be returned if the 'name' and 'value' - match. This allow you to write code: - - @verbatim - if ( ele->Attribute( "foo", "bar" ) ) callFooIsBar(); - @endverbatim - - rather than: - @verbatim - if ( ele->Attribute( "foo" ) ) { - if ( strcmp( ele->Attribute( "foo" ), "bar" ) == 0 ) callFooIsBar(); - } - @endverbatim - */ - const char* Attribute( const char* name, const char* value=0 ) const; - - /** Given an attribute name, IntAttribute() returns the value - of the attribute interpreted as an integer. 0 will be - returned if there is an error. For a method with error - checking, see QueryIntAttribute() - */ - int IntAttribute( const char* name ) const { - int i=0; - QueryIntAttribute( name, &i ); - return i; - } - /// See IntAttribute() - unsigned UnsignedAttribute( const char* name ) const { - unsigned i=0; - QueryUnsignedAttribute( name, &i ); - return i; - } - /// See IntAttribute() - bool BoolAttribute( const char* name ) const { - bool b=false; - QueryBoolAttribute( name, &b ); - return b; - } - /// See IntAttribute() - double DoubleAttribute( const char* name ) const { - double d=0; - QueryDoubleAttribute( name, &d ); - return d; - } - /// See IntAttribute() - float FloatAttribute( const char* name ) const { - float f=0; - QueryFloatAttribute( name, &f ); - return f; - } - - /** Given an attribute name, QueryIntAttribute() returns - XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the conversion - can't be performed, or XML_NO_ATTRIBUTE if the attribute - doesn't exist. If successful, the result of the conversion - will be written to 'value'. If not successful, nothing will - be written to 'value'. This allows you to provide default - value: - - @verbatim - int value = 10; - QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 - @endverbatim - */ - XMLError QueryIntAttribute( const char* name, int* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryIntValue( value ); - } - /// See QueryIntAttribute() - XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryUnsignedValue( value ); - } - /// See QueryIntAttribute() - XMLError QueryBoolAttribute( const char* name, bool* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryBoolValue( value ); - } - /// See QueryIntAttribute() - XMLError QueryDoubleAttribute( const char* name, double* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryDoubleValue( value ); - } - /// See QueryIntAttribute() - XMLError QueryFloatAttribute( const char* name, float* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryFloatValue( value ); - } - - - /** Given an attribute name, QueryAttribute() returns - XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the conversion - can't be performed, or XML_NO_ATTRIBUTE if the attribute - doesn't exist. It is overloaded for the primitive types, - and is a generally more convenient replacement of - QueryIntAttribute() and related functions. - - If successful, the result of the conversion - will be written to 'value'. If not successful, nothing will - be written to 'value'. This allows you to provide default - value: - - @verbatim - int value = 10; - QueryAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 - @endverbatim - */ - int QueryAttribute( const char* name, int* value ) const { - return QueryIntAttribute( name, value ); - } - - int QueryAttribute( const char* name, unsigned int* value ) const { - return QueryUnsignedAttribute( name, value ); - } - - int QueryAttribute( const char* name, bool* value ) const { - return QueryBoolAttribute( name, value ); - } - - int QueryAttribute( const char* name, double* value ) const { - return QueryDoubleAttribute( name, value ); - } - - int QueryAttribute( const char* name, float* value ) const { - return QueryFloatAttribute( name, value ); - } - - /// Sets the named attribute to value. - void SetAttribute( const char* name, const char* value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, int value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, unsigned value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, bool value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, double value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, float value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - - /** - Delete an attribute. - */ - void DeleteAttribute( const char* name ); - - /// Return the first attribute in the list. - const XMLAttribute* FirstAttribute() const { - return _rootAttribute; - } - /// Query a specific attribute in the list. - const XMLAttribute* FindAttribute( const char* name ) const; - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the XMLText child - and accessing it directly. - - If the first child of 'this' is a XMLText, the GetText() - returns the character string of the Text node, else null is returned. - - This is a convenient method for getting the text of simple contained text: - @verbatim - This is text - const char* str = fooElement->GetText(); - @endverbatim - - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - This is text - @endverbatim - GetText() will return "This is ". - */ - const char* GetText() const; - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, SetText() is limited compared to creating an XMLText child - and mutating it directly. - - If the first child of 'this' is a XMLText, SetText() sets its value to - the given string, otherwise it will create a first child that is an XMLText. - - This is a convenient method for setting the text of simple contained text: - @verbatim - This is text - fooElement->SetText( "Hullaballoo!" ); - Hullaballoo! - @endverbatim - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then it will not change "This is text", but rather prefix it with a text element: - @verbatim - Hullaballoo!This is text - @endverbatim - - For this XML: - @verbatim - - @endverbatim - SetText() will generate - @verbatim - Hullaballoo! - @endverbatim - */ - void SetText( const char* inText ); - /// Convenience method for setting text inside and element. See SetText() for important limitations. - void SetText( int value ); - /// Convenience method for setting text inside and element. See SetText() for important limitations. - void SetText( unsigned value ); - /// Convenience method for setting text inside and element. See SetText() for important limitations. - void SetText( bool value ); - /// Convenience method for setting text inside and element. See SetText() for important limitations. - void SetText( double value ); - /// Convenience method for setting text inside and element. See SetText() for important limitations. - void SetText( float value ); - - /** - Convenience method to query the value of a child text node. This is probably best - shown by example. Given you have a document is this form: - @verbatim - - 1 - 1.4 - - @endverbatim - - The QueryIntText() and similar functions provide a safe and easier way to get to the - "value" of x and y. - - @verbatim - int x = 0; - float y = 0; // types of x and y are contrived for example - const XMLElement* xElement = pointElement->FirstChildElement( "x" ); - const XMLElement* yElement = pointElement->FirstChildElement( "y" ); - xElement->QueryIntText( &x ); - yElement->QueryFloatText( &y ); - @endverbatim - - @returns XML_SUCCESS (0) on success, XML_CAN_NOT_CONVERT_TEXT if the text cannot be converted - to the requested type, and XML_NO_TEXT_NODE if there is no child text to query. - - */ - XMLError QueryIntText( int* ival ) const; - /// See QueryIntText() - XMLError QueryUnsignedText( unsigned* uval ) const; - /// See QueryIntText() - XMLError QueryBoolText( bool* bval ) const; - /// See QueryIntText() - XMLError QueryDoubleText( double* dval ) const; - /// See QueryIntText() - XMLError QueryFloatText( float* fval ) const; - - // internal: - enum { - OPEN, // - CLOSED, // - CLOSING // - }; - int ClosingType() const { - return _closingType; - } - char* ParseDeep( char* p, StrPair* endTag ); - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -private: - XMLElement( XMLDocument* doc ); - virtual ~XMLElement(); - XMLElement( const XMLElement& ); // not supported - void operator=( const XMLElement& ); // not supported - - XMLAttribute* FindAttribute( const char* name ); - XMLAttribute* FindOrCreateAttribute( const char* name ); - //void LinkAttribute( XMLAttribute* attrib ); - char* ParseAttributes( char* p ); - - enum { BUF_SIZE = 200 }; - int _closingType; - // The attribute list is ordered; there is no 'lastAttribute' - // because the list needs to be scanned for dupes before adding - // a new attribute. - XMLAttribute* _rootAttribute; -}; - - -enum Whitespace { - PRESERVE_WHITESPACE, - COLLAPSE_WHITESPACE -}; - - -/** A Document binds together all the functionality. - It can be saved, loaded, and printed to the screen. - All Nodes are connected and allocated to a Document. - If the Document is deleted, all its Nodes are also deleted. -*/ -class TINYXML2_LIB XMLDocument : public XMLNode -{ - friend class XMLElement; -public: - /// constructor - XMLDocument( bool processEntities = true, Whitespace = PRESERVE_WHITESPACE ); - ~XMLDocument(); - - virtual XMLDocument* ToDocument() { - return this; - } - virtual const XMLDocument* ToDocument() const { - return this; - } - - /** - Parse an XML file from a character string. - Returns XML_NO_ERROR (0) on success, or - an errorID. - - You may optionally pass in the 'nBytes', which is - the number of bytes which will be parsed. If not - specified, TinyXML-2 will assume 'xml' points to a - null terminated string. - */ - XMLError Parse( const char* xml, size_t nBytes=(size_t)(-1) ); - - /** - Load an XML file from disk. - Returns XML_NO_ERROR (0) on success, or - an errorID. - */ - XMLError LoadFile( const char* filename ); - - /** - Load an XML file from disk. You are responsible - for providing and closing the FILE*. - - Returns XML_NO_ERROR (0) on success, or - an errorID. - */ - XMLError LoadFile( FILE* ); - - /** - Save the XML file to disk. - Returns XML_NO_ERROR (0) on success, or - an errorID. - */ - XMLError SaveFile( const char* filename, bool compact = false ); - - /** - Save the XML file to disk. You are responsible - for providing and closing the FILE*. - - Returns XML_NO_ERROR (0) on success, or - an errorID. - */ - XMLError SaveFile( FILE* fp, bool compact = false ); - - bool ProcessEntities() const { - return _processEntities; - } - Whitespace WhitespaceMode() const { - return _whitespace; - } - - /** - Returns true if this document has a leading Byte Order Mark of UTF8. - */ - bool HasBOM() const { - return _writeBOM; - } - /** Sets whether to write the BOM when writing the file. - */ - void SetBOM( bool useBOM ) { - _writeBOM = useBOM; - } - - /** Return the root element of DOM. Equivalent to FirstChildElement(). - To get the first node, use FirstChild(). - */ - XMLElement* RootElement() { - return FirstChildElement(); - } - const XMLElement* RootElement() const { - return FirstChildElement(); - } - - /** Print the Document. If the Printer is not provided, it will - print to stdout. If you provide Printer, this can print to a file: - @verbatim - XMLPrinter printer( fp ); - doc.Print( &printer ); - @endverbatim - - Or you can use a printer to print to memory: - @verbatim - XMLPrinter printer; - doc.Print( &printer ); - // printer.CStr() has a const char* to the XML - @endverbatim - */ - void Print( XMLPrinter* streamer=0 ) const; - virtual bool Accept( XMLVisitor* visitor ) const; - - /** - Create a new Element associated with - this Document. The memory for the Element - is managed by the Document. - */ - XMLElement* NewElement( const char* name ); - /** - Create a new Comment associated with - this Document. The memory for the Comment - is managed by the Document. - */ - XMLComment* NewComment( const char* comment ); - /** - Create a new Text associated with - this Document. The memory for the Text - is managed by the Document. - */ - XMLText* NewText( const char* text ); - /** - Create a new Declaration associated with - this Document. The memory for the object - is managed by the Document. - - If the 'text' param is null, the standard - declaration is used.: - @verbatim - - @endverbatim - */ - XMLDeclaration* NewDeclaration( const char* text=0 ); - /** - Create a new Unknown associated with - this Document. The memory for the object - is managed by the Document. - */ - XMLUnknown* NewUnknown( const char* text ); - - /** - Delete a node associated with this document. - It will be unlinked from the DOM. - */ - void DeleteNode( XMLNode* node ) { - node->_parent->DeleteChild( node ); - } - - void SetError( XMLError error, const char* str1, const char* str2 ); - - /// Return true if there was an error parsing the document. - bool Error() const { - return _errorID != XML_NO_ERROR; - } - /// Return the errorID. - XMLError ErrorID() const { - return _errorID; - } - /// Return a possibly helpful diagnostic location or string. - const char* GetErrorStr1() const { - return _errorStr1; - } - /// Return a possibly helpful secondary diagnostic location or string. - const char* GetErrorStr2() const { - return _errorStr2; - } - /// If there is an error, print it to stdout. - void PrintError() const; - - /// Clear the document, resetting it to the initial state. - void Clear(); - - // internal - char* Identify( char* p, XMLNode** node ); - - virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const { - return 0; - } - virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const { - return false; - } - -private: - XMLDocument( const XMLDocument& ); // not supported - void operator=( const XMLDocument& ); // not supported - - bool _writeBOM; - bool _processEntities; - XMLError _errorID; - Whitespace _whitespace; - const char* _errorStr1; - const char* _errorStr2; - char* _charBuffer; - - MemPoolT< sizeof(XMLElement) > _elementPool; - MemPoolT< sizeof(XMLAttribute) > _attributePool; - MemPoolT< sizeof(XMLText) > _textPool; - MemPoolT< sizeof(XMLComment) > _commentPool; -}; - - -/** - A XMLHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that XMLHandle is not part of the TinyXML-2 - DOM structure. It is a separate utility class. - - Take an example: - @verbatim - - - - - - - @endverbatim - - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very - easy to write a *lot* of code that looks like: - - @verbatim - XMLElement* root = document.FirstChildElement( "Document" ); - if ( root ) - { - XMLElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - XMLElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - XMLElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. - @endverbatim - - And that doesn't even cover "else" cases. XMLHandle addresses the verbosity - of such code. A XMLHandle checks for null pointers so it is perfectly safe - and correct to use: - - @verbatim - XMLHandle docHandle( &document ); - XMLElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild().NextSibling().ToElement(); - if ( child2 ) - { - // do something useful - @endverbatim - - Which is MUCH more concise and useful. - - It is also safe to copy handles - internally they are nothing more than node pointers. - @verbatim - XMLHandle handleCopy = handle; - @endverbatim - - See also XMLConstHandle, which is the same as XMLHandle, but operates on const objects. -*/ -class TINYXML2_LIB XMLHandle -{ -public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - XMLHandle( XMLNode* node ) { - _node = node; - } - /// Create a handle from a node. - XMLHandle( XMLNode& node ) { - _node = &node; - } - /// Copy constructor - XMLHandle( const XMLHandle& ref ) { - _node = ref._node; - } - /// Assignment - XMLHandle& operator=( const XMLHandle& ref ) { - _node = ref._node; - return *this; - } - - /// Get the first child of this handle. - XMLHandle FirstChild() { - return XMLHandle( _node ? _node->FirstChild() : 0 ); - } - /// Get the first child element of this handle. - XMLHandle FirstChildElement( const char* value=0 ) { - return XMLHandle( _node ? _node->FirstChildElement( value ) : 0 ); - } - /// Get the last child of this handle. - XMLHandle LastChild() { - return XMLHandle( _node ? _node->LastChild() : 0 ); - } - /// Get the last child element of this handle. - XMLHandle LastChildElement( const char* _value=0 ) { - return XMLHandle( _node ? _node->LastChildElement( _value ) : 0 ); - } - /// Get the previous sibling of this handle. - XMLHandle PreviousSibling() { - return XMLHandle( _node ? _node->PreviousSibling() : 0 ); - } - /// Get the previous sibling element of this handle. - XMLHandle PreviousSiblingElement( const char* _value=0 ) { - return XMLHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 ); - } - /// Get the next sibling of this handle. - XMLHandle NextSibling() { - return XMLHandle( _node ? _node->NextSibling() : 0 ); - } - /// Get the next sibling element of this handle. - XMLHandle NextSiblingElement( const char* _value=0 ) { - return XMLHandle( _node ? _node->NextSiblingElement( _value ) : 0 ); - } - - /// Safe cast to XMLNode. This can return null. - XMLNode* ToNode() { - return _node; - } - /// Safe cast to XMLElement. This can return null. - XMLElement* ToElement() { - return ( ( _node && _node->ToElement() ) ? _node->ToElement() : 0 ); - } - /// Safe cast to XMLText. This can return null. - XMLText* ToText() { - return ( ( _node && _node->ToText() ) ? _node->ToText() : 0 ); - } - /// Safe cast to XMLUnknown. This can return null. - XMLUnknown* ToUnknown() { - return ( ( _node && _node->ToUnknown() ) ? _node->ToUnknown() : 0 ); - } - /// Safe cast to XMLDeclaration. This can return null. - XMLDeclaration* ToDeclaration() { - return ( ( _node && _node->ToDeclaration() ) ? _node->ToDeclaration() : 0 ); - } - -private: - XMLNode* _node; -}; - - -/** - A variant of the XMLHandle class for working with const XMLNodes and Documents. It is the - same in all regards, except for the 'const' qualifiers. See XMLHandle for API. -*/ -class TINYXML2_LIB XMLConstHandle -{ -public: - XMLConstHandle( const XMLNode* node ) { - _node = node; - } - XMLConstHandle( const XMLNode& node ) { - _node = &node; - } - XMLConstHandle( const XMLConstHandle& ref ) { - _node = ref._node; - } - - XMLConstHandle& operator=( const XMLConstHandle& ref ) { - _node = ref._node; - return *this; - } - - const XMLConstHandle FirstChild() const { - return XMLConstHandle( _node ? _node->FirstChild() : 0 ); - } - const XMLConstHandle FirstChildElement( const char* value=0 ) const { - return XMLConstHandle( _node ? _node->FirstChildElement( value ) : 0 ); - } - const XMLConstHandle LastChild() const { - return XMLConstHandle( _node ? _node->LastChild() : 0 ); - } - const XMLConstHandle LastChildElement( const char* _value=0 ) const { - return XMLConstHandle( _node ? _node->LastChildElement( _value ) : 0 ); - } - const XMLConstHandle PreviousSibling() const { - return XMLConstHandle( _node ? _node->PreviousSibling() : 0 ); - } - const XMLConstHandle PreviousSiblingElement( const char* _value=0 ) const { - return XMLConstHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 ); - } - const XMLConstHandle NextSibling() const { - return XMLConstHandle( _node ? _node->NextSibling() : 0 ); - } - const XMLConstHandle NextSiblingElement( const char* _value=0 ) const { - return XMLConstHandle( _node ? _node->NextSiblingElement( _value ) : 0 ); - } - - - const XMLNode* ToNode() const { - return _node; - } - const XMLElement* ToElement() const { - return ( ( _node && _node->ToElement() ) ? _node->ToElement() : 0 ); - } - const XMLText* ToText() const { - return ( ( _node && _node->ToText() ) ? _node->ToText() : 0 ); - } - const XMLUnknown* ToUnknown() const { - return ( ( _node && _node->ToUnknown() ) ? _node->ToUnknown() : 0 ); - } - const XMLDeclaration* ToDeclaration() const { - return ( ( _node && _node->ToDeclaration() ) ? _node->ToDeclaration() : 0 ); - } - -private: - const XMLNode* _node; -}; - - -/** - Printing functionality. The XMLPrinter gives you more - options than the XMLDocument::Print() method. - - It can: - -# Print to memory. - -# Print to a file you provide. - -# Print XML without a XMLDocument. - - Print to Memory - - @verbatim - XMLPrinter printer; - doc.Print( &printer ); - SomeFunction( printer.CStr() ); - @endverbatim - - Print to a File - - You provide the file pointer. - @verbatim - XMLPrinter printer( fp ); - doc.Print( &printer ); - @endverbatim - - Print without a XMLDocument - - When loading, an XML parser is very useful. However, sometimes - when saving, it just gets in the way. The code is often set up - for streaming, and constructing the DOM is just overhead. - - The Printer supports the streaming case. The following code - prints out a trivially simple XML file without ever creating - an XML document. - - @verbatim - XMLPrinter printer( fp ); - printer.OpenElement( "foo" ); - printer.PushAttribute( "foo", "bar" ); - printer.CloseElement(); - @endverbatim -*/ -class TINYXML2_LIB XMLPrinter : public XMLVisitor -{ -public: - /** Construct the printer. If the FILE* is specified, - this will print to the FILE. Else it will print - to memory, and the result is available in CStr(). - If 'compact' is set to true, then output is created - with only required whitespace and newlines. - */ - XMLPrinter( FILE* file=0, bool compact = false, int depth = 0 ); - virtual ~XMLPrinter() {} - - /** If streaming, write the BOM and declaration. */ - void PushHeader( bool writeBOM, bool writeDeclaration ); - /** If streaming, start writing an element. - The element must be closed with CloseElement() - */ - void OpenElement( const char* name, bool compactMode=false ); - /// If streaming, add an attribute to an open element. - void PushAttribute( const char* name, const char* value ); - void PushAttribute( const char* name, int value ); - void PushAttribute( const char* name, unsigned value ); - void PushAttribute( const char* name, bool value ); - void PushAttribute( const char* name, double value ); - /// If streaming, close the Element. - virtual void CloseElement( bool compactMode=false ); - - /// Add a text node. - void PushText( const char* text, bool cdata=false ); - /// Add a text node from an integer. - void PushText( int value ); - /// Add a text node from an unsigned. - void PushText( unsigned value ); - /// Add a text node from a bool. - void PushText( bool value ); - /// Add a text node from a float. - void PushText( float value ); - /// Add a text node from a double. - void PushText( double value ); - - /// Add a comment - void PushComment( const char* comment ); - - void PushDeclaration( const char* value ); - void PushUnknown( const char* value ); - - virtual bool VisitEnter( const XMLDocument& /*doc*/ ); - virtual bool VisitExit( const XMLDocument& /*doc*/ ) { - return true; - } - - virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute ); - virtual bool VisitExit( const XMLElement& element ); - - virtual bool Visit( const XMLText& text ); - virtual bool Visit( const XMLComment& comment ); - virtual bool Visit( const XMLDeclaration& declaration ); - virtual bool Visit( const XMLUnknown& unknown ); - - /** - If in print to memory mode, return a pointer to - the XML file in memory. - */ - const char* CStr() const { - return _buffer.Mem(); - } - /** - If in print to memory mode, return the size - of the XML file in memory. (Note the size returned - includes the terminating null.) - */ - int CStrSize() const { - return _buffer.Size(); - } - /** - If in print to memory mode, reset the buffer to the - beginning. - */ - void ClearBuffer() { - _buffer.Clear(); - _buffer.Push(0); - } - -protected: - virtual bool CompactMode( const XMLElement& ) { return _compactMode; } - - /** Prints out the space before an element. You may override to change - the space and tabs used. A PrintSpace() override should call Print(). - */ - virtual void PrintSpace( int depth ); - void Print( const char* format, ... ); - - void SealElement(); - bool _elementJustOpened; - DynArray< const char*, 10 > _stack; - -private: - void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities. - - bool _firstElement; - FILE* _fp; - int _depth; - int _textDepth; - bool _processEntities; - bool _compactMode; - - enum { - ENTITY_RANGE = 64, - BUF_SIZE = 200 - }; - bool _entityFlag[ENTITY_RANGE]; - bool _restrictedEntityFlag[ENTITY_RANGE]; - - DynArray< char, 20 > _buffer; -#ifdef _MSC_VER - DynArray< char, 20 > _accumulator; -#endif -}; - - -} // tinyxml2 - -#if defined(_MSC_VER) -# pragma warning(pop) -#endif - -#endif // TINYXML2_INCLUDED diff --git a/Utilities/utf8conv.h b/Utilities/utf8conv.h deleted file mode 100644 index 46ab7316..00000000 --- a/Utilities/utf8conv.h +++ /dev/null @@ -1,162 +0,0 @@ -////////////////////////////////////////////////////////////////////////// -// -// FILE: utf8conv.h -// -// Header file defining prototypes of helper functions for converting -// strings between Unicode UTF-8 and UTF-16. -// (The implementation file is "utf8conv_inl.h"). -// -// UTF-8 text is stored in std::string; -// UTF-16 text is stored in std::wstring. -// -// This code just uses Win32 Platform SDK and C++ standard library; -// so it can be used also with the Express editions of Visual Studio. -// -// -// Original code: February 4th, 2011 -// Last update: October 15th, 2011 -// -// - Added more information to the utf8_conversion_error class -// (like the return code of ::GetLastError()); -// moreover, the class now derives from std::runtime_error. -// -// - Added conversion function overloads taking raw C strings as input. -// (This is more efficient when there are raw C strings already -// available, because it avoids the creation of temporary -// new std::[w]string's.) -// -// - UTF-8 conversion functions now detect invalid UTF-8 sequences -// thanks to MB_ERR_INVALID_CHARS flag, and throw an exception -// in this case. -// -// -// by Giovanni Dicanio -// -////////////////////////////////////////////////////////////////////////// - - -#pragma once - - -//------------------------------------------------------------------------ -// INCLUDES -//------------------------------------------------------------------------ - -#include // std::runtime_error -#include // STL string classes - - - -namespace utf8util { - - - -//------------------------------------------------------------------------ -// Exception class representing an error occurred during UTF-8 conversion. -//------------------------------------------------------------------------ -class utf8_conversion_error - : public std::runtime_error -{ -public: - - // - // Naming convention note: - // ----------------------- - // - // This exception class is derived from std::runtime_error class, - // so I chose to use the same naming convention of STL classes - // (e.g. do_something_intersting() instead of DoSomethingInteresting()). - // - - - // Error code type - // (a DWORD, as the return value type from ::GetLastError()) - typedef unsigned long error_code_type; - - // Type of conversion - enum conversion_type - { - conversion_utf8_from_utf16, // UTF-16 ---> UTF-8 - conversion_utf16_from_utf8 // UTF-8 ---> UTF-16 - }; - - - // Constructs an UTF-8 conversion error exception - // with a raw C string message, conversion type and error code. - utf8_conversion_error( - const char * message, - conversion_type conversion, - error_code_type error_code - ); - - - // Constructs an UTF-8 conversion error exception - // with a std::string message, conversion type and error code. - utf8_conversion_error( - const std::string & message, - conversion_type conversion, - error_code_type error_code - ); - - - // Returns the type of conversion (UTF-8 from UTF-16, or vice versa) - conversion_type conversion() const; - - - // Returns the error code occurred during the conversion - // (which is typically the return value of ::GetLastError()). - error_code_type error_code() const; - - - - // - // IMPLEMENTATION - // -private: - conversion_type m_conversion; // kind of conversion - error_code_type m_error_code; // error code -}; - -//------------------------------------------------------------------------ - - - -//------------------------------------------------------------------------ -// Converts a string from UTF-8 to UTF-16. -// On error, can throw an utf8_conversion_error exception. -//------------------------------------------------------------------------ -std::wstring UTF16FromUTF8(const std::string & utf8); - - -//------------------------------------------------------------------------ -// Converts a raw C string from UTF-8 to UTF-16. -// On error, can throw an utf8_conversion_error exception. -// If the input pointer is NULL, an empty string is returned. -//------------------------------------------------------------------------ -std::wstring UTF16FromUTF8(const char * utf8); - - -//------------------------------------------------------------------------ -// Converts a string from UTF-16 to UTF-8. -// On error, can throw an utf8_conversion_error exception. -//------------------------------------------------------------------------ -std::string UTF8FromUTF16(const std::wstring & utf16); - - -//------------------------------------------------------------------------ -// Converts a raw C string from UTF-16 to UTF-8. -// On error, can throw an utf8_conversion_error exception. -// If the input pointer is NULL, an empty string is returned. -//------------------------------------------------------------------------ -std::string UTF8FromUTF16(const wchar_t * utf16); - - -} // namespace utf8util - - - -#include "utf8conv_inl.h" // inline implementations - - -////////////////////////////////////////////////////////////////////////// - diff --git a/Utilities/utf8conv_inl.h b/Utilities/utf8conv_inl.h deleted file mode 100644 index 759b1cc7..00000000 --- a/Utilities/utf8conv_inl.h +++ /dev/null @@ -1,368 +0,0 @@ -////////////////////////////////////////////////////////////////////////// -// -// FILE: utf8conv_inl.h -// -// by Giovanni Dicanio -// -// Private header file containing implementations of inline functions. -// The public header file for this module is "utf8conv.h"; -// users should *not* #include this private header file directly. -// -////////////////////////////////////////////////////////////////////////// - -#pragma once - - -#include // strlen() - -#include // Win32 Platform SDK main header - - - -namespace utf8util { - - -//------------------------------------------------------------------------ -// Implementation of utf8_conversion_error class methods -//------------------------------------------------------------------------ - -inline utf8_conversion_error::utf8_conversion_error( - const char * message, - conversion_type conversion, - error_code_type error_code - ) : - std::runtime_error(message), - m_conversion(conversion), - m_error_code(error_code) -{ -} - - -inline utf8_conversion_error::utf8_conversion_error( - const std::string & message, - conversion_type conversion, - error_code_type error_code - ) : - std::runtime_error(message), - m_conversion(conversion), - m_error_code(error_code) -{ -} - - -inline utf8_conversion_error::conversion_type utf8_conversion_error::conversion() const -{ - return m_conversion; -} - - -inline utf8_conversion_error::error_code_type utf8_conversion_error::error_code() const -{ - return m_error_code; -} - - - -//------------------------------------------------------------------------ -// Implementation of module functions -//------------------------------------------------------------------------ - - -inline std::wstring UTF16FromUTF8(const std::string & utf8) -{ - // - // Special case of empty input string - // - if (utf8.empty()) - return std::wstring(); - - - // Fail if an invalid input character is encountered - const DWORD conversionFlags = MB_ERR_INVALID_CHARS; - - - // - // Get length (in wchar_t's) of resulting UTF-16 string - // - const int utf16Length = ::MultiByteToWideChar( - CP_UTF8, // convert from UTF-8 - conversionFlags, // flags - utf8.data(), // source UTF-8 string - utf8.length(), // length (in chars) of source UTF-8 string - NULL, // unused - no conversion done in this step - 0 // request size of destination buffer, in wchar_t's - ); - if (utf16Length == 0) - { - // Error - DWORD error = ::GetLastError(); - - throw utf8_conversion_error( - (error == ERROR_NO_UNICODE_TRANSLATION) ? - "Invalid UTF-8 sequence found in input string." : - "Can't get length of UTF-16 string (MultiByteToWideChar failed).", - utf8_conversion_error::conversion_utf16_from_utf8, - error); - } - - - // - // Allocate destination buffer for UTF-16 string - // - std::wstring utf16; - utf16.resize(utf16Length); - - - // - // Do the conversion from UTF-8 to UTF-16 - // - if ( ! ::MultiByteToWideChar( - CP_UTF8, // convert from UTF-8 - 0, // validation was done in previous call, - // so speed up things with default flags - utf8.data(), // source UTF-8 string - utf8.length(), // length (in chars) of source UTF-8 string - &utf16[0], // destination buffer - utf16.length() // size of destination buffer, in wchar_t's - ) ) - { - // Error - DWORD error = ::GetLastError(); - throw utf8_conversion_error( - "Can't convert string from UTF-8 to UTF-16 (MultiByteToWideChar failed).", - utf8_conversion_error::conversion_utf16_from_utf8, - error); - } - - - // - // Return resulting UTF-16 string - // - return utf16; -} - - - -inline std::wstring UTF16FromUTF8(const char * utf8) -{ - // - // Special case of empty input string - // - if (utf8 == NULL || *utf8 == '\0') - return std::wstring(); - - - // Prefetch the length of the input UTF-8 string - const int utf8Length = static_cast(strlen(utf8)); - - // Fail if an invalid input character is encountered - const DWORD conversionFlags = MB_ERR_INVALID_CHARS; - - // - // Get length (in wchar_t's) of resulting UTF-16 string - // - const int utf16Length = ::MultiByteToWideChar( - CP_UTF8, // convert from UTF-8 - conversionFlags, // flags - utf8, // source UTF-8 string - utf8Length, // length (in chars) of source UTF-8 string - NULL, // unused - no conversion done in this step - 0 // request size of destination buffer, in wchar_t's - ); - if (utf16Length == 0) - { - // Error - DWORD error = ::GetLastError(); - throw utf8_conversion_error( - (error == ERROR_NO_UNICODE_TRANSLATION) ? - "Invalid UTF-8 sequence found in input string." : - "Can't get length of UTF-16 string (MultiByteToWideChar failed).", - utf8_conversion_error::conversion_utf16_from_utf8, - error); - } - - - // - // Allocate destination buffer for UTF-16 string - // - std::wstring utf16; - utf16.resize(utf16Length); - - - // - // Do the conversion from UTF-8 to UTF-16 - // - if ( ! ::MultiByteToWideChar( - CP_UTF8, // convert from UTF-8 - 0, // validation was done in previous call, - // so speed up things with default flags - utf8, // source UTF-8 string - utf8Length, // length (in chars) of source UTF-8 string - &utf16[0], // destination buffer - utf16.length() // size of destination buffer, in wchar_t's - ) ) - { - // Error - DWORD error = ::GetLastError(); - throw utf8_conversion_error( - "Can't convert string from UTF-8 to UTF-16 (MultiByteToWideChar failed).", - utf8_conversion_error::conversion_utf16_from_utf8, - error); - } - - - // - // Return resulting UTF-16 string - // - return utf16; -} - - - -inline std::string UTF8FromUTF16(const std::wstring & utf16) -{ - // - // Special case of empty input string - // - if (utf16.empty()) - return std::string(); - - - // - // Get length (in chars) of resulting UTF-8 string - // - const int utf8Length = ::WideCharToMultiByte( - CP_UTF8, // convert to UTF-8 - 0, // default flags - utf16.data(), // source UTF-16 string - utf16.length(), // source string length, in wchar_t's, - NULL, // unused - no conversion required in this step - 0, // request buffer size - NULL, NULL // unused - ); - if (utf8Length == 0) - { - // Error - DWORD error = ::GetLastError(); - throw utf8_conversion_error( - "Can't get length of UTF-8 string (WideCharToMultiByte failed).", - utf8_conversion_error::conversion_utf8_from_utf16, - error); - } - - - // - // Allocate destination buffer for UTF-8 string - // - std::string utf8; - utf8.resize(utf8Length); - - - // - // Do the conversion from UTF-16 to UTF-8 - // - if ( ! ::WideCharToMultiByte( - CP_UTF8, // convert to UTF-8 - 0, // default flags - utf16.data(), // source UTF-16 string - utf16.length(), // source string length, in wchar_t's, - &utf8[0], // destination buffer - utf8.length(), // destination buffer size, in chars - NULL, NULL // unused - ) ) - { - // Error - DWORD error = ::GetLastError(); - throw utf8_conversion_error( - "Can't convert string from UTF-16 to UTF-8 (WideCharToMultiByte failed).", - utf8_conversion_error::conversion_utf8_from_utf16, - error); - } - - - // - // Return resulting UTF-8 string - // - return utf8; -} - - - -inline std::string UTF8FromUTF16(const wchar_t * utf16) -{ - // - // Special case of empty input string - // - if (utf16 == NULL || *utf16 == L'\0') - return std::string(); - - - // Prefetch the length of the input UTF-16 string - const int utf16Length = static_cast(wcslen(utf16)); - - - // - // Get length (in chars) of resulting UTF-8 string - // - const int utf8Length = ::WideCharToMultiByte( - CP_UTF8, // convert to UTF-8 - 0, // default flags - utf16, // source UTF-16 string - utf16Length, // source string length, in wchar_t's, - NULL, // unused - no conversion required in this step - 0, // request buffer size - NULL, NULL // unused - ); - if (utf8Length == 0) - { - // Error - DWORD error = ::GetLastError(); - throw utf8_conversion_error( - "Can't get length of UTF-8 string (WideCharToMultiByte failed).", - utf8_conversion_error::conversion_utf8_from_utf16, - error); - } - - - // - // Allocate destination buffer for UTF-8 string - // - std::string utf8; - utf8.resize(utf8Length); - - - // - // Do the conversion from UTF-16 to UTF-8 - // - if ( ! ::WideCharToMultiByte( - CP_UTF8, // convert to UTF-8 - 0, // default flags - utf16, // source UTF-16 string - utf16Length, // source string length, in wchar_t's, - &utf8[0], // destination buffer - utf8.length(), // destination buffer size, in chars - NULL, NULL // unused - ) ) - { - // Error - DWORD error = ::GetLastError(); - throw utf8_conversion_error( - "Can't convert string from UTF-16 to UTF-8 (WideCharToMultiByte failed).", - utf8_conversion_error::conversion_utf8_from_utf16, - error); - } - - - // - // Return resulting UTF-8 string - // - return utf8; -} - - - -} // namespace utf8util - - -////////////////////////////////////////////////////////////////////////// - diff --git a/GUI/DirectXTK/Audio.h b/Windows/DirectXTK/Audio.h similarity index 100% rename from GUI/DirectXTK/Audio.h rename to Windows/DirectXTK/Audio.h diff --git a/GUI/DirectXTK/CommonStates.h b/Windows/DirectXTK/CommonStates.h similarity index 100% rename from GUI/DirectXTK/CommonStates.h rename to Windows/DirectXTK/CommonStates.h diff --git a/GUI/DirectXTK/DDSTextureLoader.h b/Windows/DirectXTK/DDSTextureLoader.h similarity index 100% rename from GUI/DirectXTK/DDSTextureLoader.h rename to Windows/DirectXTK/DDSTextureLoader.h diff --git a/GUI/DirectXTK/DirectXHelpers.h b/Windows/DirectXTK/DirectXHelpers.h similarity index 100% rename from GUI/DirectXTK/DirectXHelpers.h rename to Windows/DirectXTK/DirectXHelpers.h diff --git a/GUI/DirectXTK/DirectXTK.debug.lib b/Windows/DirectXTK/DirectXTK.debug.lib similarity index 100% rename from GUI/DirectXTK/DirectXTK.debug.lib rename to Windows/DirectXTK/DirectXTK.debug.lib diff --git a/GUI/DirectXTK/DirectXTK.lib b/Windows/DirectXTK/DirectXTK.lib similarity index 100% rename from GUI/DirectXTK/DirectXTK.lib rename to Windows/DirectXTK/DirectXTK.lib diff --git a/GUI/DirectXTK/Effects.h b/Windows/DirectXTK/Effects.h similarity index 100% rename from GUI/DirectXTK/Effects.h rename to Windows/DirectXTK/Effects.h diff --git a/GUI/DirectXTK/GeometricPrimitive.h b/Windows/DirectXTK/GeometricPrimitive.h similarity index 100% rename from GUI/DirectXTK/GeometricPrimitive.h rename to Windows/DirectXTK/GeometricPrimitive.h diff --git a/GUI/DirectXTK/Model.h b/Windows/DirectXTK/Model.h similarity index 100% rename from GUI/DirectXTK/Model.h rename to Windows/DirectXTK/Model.h diff --git a/GUI/DirectXTK/PrimitiveBatch.h b/Windows/DirectXTK/PrimitiveBatch.h similarity index 100% rename from GUI/DirectXTK/PrimitiveBatch.h rename to Windows/DirectXTK/PrimitiveBatch.h diff --git a/GUI/DirectXTK/ScreenGrab.h b/Windows/DirectXTK/ScreenGrab.h similarity index 100% rename from GUI/DirectXTK/ScreenGrab.h rename to Windows/DirectXTK/ScreenGrab.h diff --git a/GUI/DirectXTK/SimpleMath.h b/Windows/DirectXTK/SimpleMath.h similarity index 100% rename from GUI/DirectXTK/SimpleMath.h rename to Windows/DirectXTK/SimpleMath.h diff --git a/GUI/DirectXTK/SimpleMath.inl b/Windows/DirectXTK/SimpleMath.inl similarity index 100% rename from GUI/DirectXTK/SimpleMath.inl rename to Windows/DirectXTK/SimpleMath.inl diff --git a/GUI/DirectXTK/SpriteBatch.h b/Windows/DirectXTK/SpriteBatch.h similarity index 100% rename from GUI/DirectXTK/SpriteBatch.h rename to Windows/DirectXTK/SpriteBatch.h diff --git a/GUI/DirectXTK/SpriteFont.h b/Windows/DirectXTK/SpriteFont.h similarity index 100% rename from GUI/DirectXTK/SpriteFont.h rename to Windows/DirectXTK/SpriteFont.h diff --git a/GUI/DirectXTK/VertexTypes.h b/Windows/DirectXTK/VertexTypes.h similarity index 100% rename from GUI/DirectXTK/VertexTypes.h rename to Windows/DirectXTK/VertexTypes.h diff --git a/GUI/DirectXTK/WICTextureLoader.h b/Windows/DirectXTK/WICTextureLoader.h similarity index 100% rename from GUI/DirectXTK/WICTextureLoader.h rename to Windows/DirectXTK/WICTextureLoader.h diff --git a/GUI/DirectXTK/XboxDDSTextureLoader.h b/Windows/DirectXTK/XboxDDSTextureLoader.h similarity index 100% rename from GUI/DirectXTK/XboxDDSTextureLoader.h rename to Windows/DirectXTK/XboxDDSTextureLoader.h diff --git a/GUI/GamePad.cpp b/Windows/GamePad.cpp similarity index 100% rename from GUI/GamePad.cpp rename to Windows/GamePad.cpp diff --git a/GUI/GamePad.h b/Windows/GamePad.h similarity index 100% rename from GUI/GamePad.h rename to Windows/GamePad.h diff --git a/GUI/InputManager.cpp b/Windows/InputManager.cpp similarity index 88% rename from GUI/InputManager.cpp rename to Windows/InputManager.cpp index 75c424d1..43bdfa2a 100644 --- a/GUI/InputManager.cpp +++ b/Windows/InputManager.cpp @@ -1,10 +1,17 @@ #include "stdafx.h" #include "InputManager.h" +#include "../Core/ControlManager.h" InputManager::InputManager(HWND hWnd, uint8_t port) { _hWnd = hWnd; _port = port; + ControlManager::RegisterControlDevice(this, port); +} + +InputManager::~InputManager() +{ + ControlManager::UnregisterControlDevice(this); } bool InputManager::IsKeyPressed(int key) diff --git a/GUI/InputManager.h b/Windows/InputManager.h similarity index 94% rename from GUI/InputManager.h rename to Windows/InputManager.h index 758f8e38..720fde0b 100644 --- a/GUI/InputManager.h +++ b/Windows/InputManager.h @@ -16,5 +16,6 @@ class InputManager : public IControlDevice public: InputManager(HWND hWnd, uint8_t port); + ~InputManager(); ButtonState GetButtonState(); }; \ No newline at end of file diff --git a/GUI/Renderer.cpp b/Windows/Renderer.cpp similarity index 64% rename from GUI/Renderer.cpp rename to Windows/Renderer.cpp index a3b6ecab..9da341d2 100644 --- a/GUI/Renderer.cpp +++ b/Windows/Renderer.cpp @@ -1,7 +1,14 @@ #include "stdafx.h" #include "Renderer.h" +#include "DirectXTK\SpriteBatch.h" +#include "DirectXTK\SpriteFont.h" +#include "DirectXTK\DDSTextureLoader.h" +#include "DirectXTK\WICTextureLoader.h" #include "..\Core\PPU.h" #include "..\Core\Console.h" +#include "..\Core\MessageManager.h" + +using namespace DirectX; namespace NES { @@ -30,7 +37,7 @@ namespace NES _bytesPerPixel = 4; _hdScreenWidth = _screenWidth * 4; - _hdScreenHeight = _screenHeight * 4; + _hdScreenHeight = (_screenHeight - 16) * 4; _screenBufferSize = _screenWidth * _screenHeight * _bytesPerPixel; _hdScreenBufferSize = _hdScreenWidth * _hdScreenHeight * _bytesPerPixel; @@ -40,6 +47,7 @@ namespace NES { if(_pTexture) _pTexture->Release(); if(_overlayTexture) _overlayTexture->Release(); + if(_toastTexture) { _toastTexture->Release(); } if(_samplerState) _samplerState->Release(); if(_pRenderTargetView) _pRenderTargetView->Release(); @@ -48,6 +56,8 @@ namespace NES if(_pDeviceContext1) _pDeviceContext1->Release(); if(_pd3dDevice1) _pd3dDevice1->Release(); if(_pd3dDevice) _pd3dDevice->Release(); + if(_pAlphaEnableBlendingState) _pAlphaEnableBlendingState->Release(); + if(_pDepthDisabledStencilState) _pDepthDisabledStencilState->Release(); if(_videoRAM) { delete[] _videoRAM; @@ -63,6 +73,7 @@ namespace NES delete[] _overlayBuffer; _overlayBuffer = nullptr; } + } //-------------------------------------------------------------------------------------- @@ -72,9 +83,6 @@ namespace NES { HRESULT hr = S_OK; - RECT rc; - GetClientRect(_hWnd, &rc); - UINT createDeviceFlags = 0; #ifdef _DEBUG createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; @@ -101,7 +109,7 @@ namespace NES ZeroMemory(&sd, sizeof(sd)); sd.BufferCount = 1; sd.BufferDesc.Width = _hdScreenWidth; - sd.BufferDesc.Height = _hdScreenHeight - (16 *4); + sd.BufferDesc.Height = _hdScreenHeight; sd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; sd.BufferDesc.RefreshRate.Numerator = 60; sd.BufferDesc.RefreshRate.Denominator = 1; @@ -149,83 +157,94 @@ namespace NES return hr; } + D3D11_DEPTH_STENCIL_DESC depthDisabledStencilDesc; + ZeroMemory(&depthDisabledStencilDesc, sizeof(depthDisabledStencilDesc)); + depthDisabledStencilDesc.DepthEnable = false; + depthDisabledStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; + depthDisabledStencilDesc.DepthFunc = D3D11_COMPARISON_LESS; + depthDisabledStencilDesc.StencilEnable = true; + depthDisabledStencilDesc.StencilReadMask = 0xFF; + depthDisabledStencilDesc.StencilWriteMask = 0xFF; + depthDisabledStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; + depthDisabledStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR; + depthDisabledStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP; + depthDisabledStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; + depthDisabledStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP; + depthDisabledStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR; + depthDisabledStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP; + depthDisabledStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; + + // Create the state using the device. + if(FAILED(_pd3dDevice->CreateDepthStencilState(&depthDisabledStencilDesc, &_pDepthDisabledStencilState))) { + return false; + } + + // Clear the blend state description. + D3D11_BLEND_DESC blendStateDescription; + ZeroMemory(&blendStateDescription, sizeof(D3D11_BLEND_DESC)); + + // Create an alpha enabled blend state description. + blendStateDescription.RenderTarget[0].BlendEnable = TRUE; + blendStateDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE; + blendStateDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blendStateDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; + blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO; + blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendStateDescription.RenderTarget[0].RenderTargetWriteMask = 0x0f; + + // Create the blend state using the description. + if(FAILED(_pd3dDevice->CreateBlendState(&blendStateDescription, &_pAlphaEnableBlendingState))) { + return false; + } + + float blendFactor[4]; + blendFactor[0] = 0.0f; + blendFactor[1] = 0.0f; + blendFactor[2] = 0.0f; + blendFactor[3] = 0.0f; + + _pDeviceContext->OMSetBlendState(_pAlphaEnableBlendingState, blendFactor, 0xffffffff); + _pDeviceContext->OMSetDepthStencilState(_pDepthDisabledStencilState, 1); _pDeviceContext->OMSetRenderTargets(1, &_pRenderTargetView, nullptr); // Setup the viewport D3D11_VIEWPORT vp; vp.Width = (FLOAT)_hdScreenWidth; - vp.Height = (FLOAT)_hdScreenHeight - (16 * 4); + vp.Height = (FLOAT)_hdScreenHeight; vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0; vp.TopLeftY = 0; _pDeviceContext->RSSetViewports(1, &vp); - UINT fred; - _pd3dDevice->CheckMultisampleQualityLevels(DXGI_FORMAT_B8G8R8A8_UNORM, 16, &fred); - - D3D11_TEXTURE2D_DESC desc; - ZeroMemory(&desc, sizeof(D3D11_TEXTURE2D_DESC)); - desc.ArraySize = 1; - desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; - desc.MipLevels = 1; - desc.MiscFlags = 0; - desc.SampleDesc.Count = 1; - desc.SampleDesc.Quality = fred; - desc.Usage = D3D11_USAGE_DYNAMIC; - desc.Width = _screenWidth; - desc.Height = _screenHeight; - desc.MiscFlags = 0; - _videoRAM = new uint8_t[_screenBufferSize]; _nextFrameBuffer = new uint8_t[_screenBufferSize]; memset(_videoRAM, 0x00, _screenBufferSize); memset(_nextFrameBuffer, 0x00, _screenBufferSize); - D3D11_SUBRESOURCE_DATA tbsd; - tbsd.pSysMem = (void *)_videoRAM; - tbsd.SysMemPitch = _screenWidth * _bytesPerPixel; - tbsd.SysMemSlicePitch = _screenBufferSize; // Not needed since this is a 2d texture - - if(FAILED(_pd3dDevice->CreateTexture2D(&desc, &tbsd, &_pTexture))) { + _pTexture = CreateTexture(_screenWidth, _screenHeight); + if(!_pTexture) { return 0; } _overlayBuffer = new uint8_t[_hdScreenBufferSize]; //High res overlay for UI elements (4x res) memset(_overlayBuffer, 0x00, _hdScreenBufferSize); - ZeroMemory(&desc, sizeof(D3D11_TEXTURE2D_DESC)); - desc.ArraySize = 1; - desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; - desc.MipLevels = 1; - desc.MiscFlags = 0; - desc.SampleDesc.Count = 1; - desc.SampleDesc.Quality = fred; - desc.Usage = D3D11_USAGE_DYNAMIC; - desc.Width = _hdScreenWidth; - desc.Height = _hdScreenHeight; - desc.MiscFlags = 0; - - tbsd.pSysMem = (void *)_overlayBuffer; - tbsd.SysMemPitch = _hdScreenWidth * _bytesPerPixel; - tbsd.SysMemSlicePitch = _hdScreenBufferSize; - - if(FAILED(_pd3dDevice->CreateTexture2D(&desc, &tbsd, &_overlayTexture))) { + _overlayTexture = CreateTexture(_hdScreenWidth, _hdScreenHeight); + if(!_overlayTexture) { return 0; } //////////////////////////////////////////////////////////////////////////// _spriteBatch.reset(new SpriteBatch(_pDeviceContext)); - _font.reset(new SpriteFont(_pd3dDevice, L"Calibri.30.spritefont")); + _smallFont.reset(new SpriteFont(_pd3dDevice, L"Roboto.9.spritefont")); + _font.reset(new SpriteFont(_pd3dDevice, L"Roboto.12.spritefont")); //Sample state D3D11_SAMPLER_DESC samplerDesc; - ZeroMemory(&desc, sizeof(desc)); + ZeroMemory(&samplerDesc, sizeof(samplerDesc)); samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; @@ -238,6 +257,11 @@ namespace NES samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; _pd3dDevice->CreateSamplerState(&samplerDesc, &_samplerState); + + if(!FAILED(CreateDDSTextureFromFile(_pd3dDevice, L"Toast.dds", nullptr, &_toastTexture))) { + return 0; + } + /* ID3DBlob* vertexShaderBlob = nullptr; ID3D11VertexShader* vertexShader = nullptr; @@ -258,6 +282,34 @@ namespace NES return S_OK; } + ID3D11Texture2D* Renderer::CreateTexture(uint32_t width, uint32_t height) + { + ID3D11Texture2D* texture; + + UINT fred; + _pd3dDevice->CheckMultisampleQualityLevels(DXGI_FORMAT_B8G8R8A8_UNORM, 16, &fred); + + D3D11_TEXTURE2D_DESC desc; + ZeroMemory(&desc, sizeof(D3D11_TEXTURE2D_DESC)); + desc.ArraySize = 1; + desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + desc.MipLevels = 1; + desc.MiscFlags = 0; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = fred; + desc.Usage = D3D11_USAGE_DYNAMIC; + desc.Width = width; + desc.Height = height; + desc.MiscFlags = 0; + + if(FAILED(_pd3dDevice->CreateTexture2D(&desc, nullptr, &texture))) { + return nullptr; + } + return texture; + } + ID3D11ShaderResourceView* Renderer::GetShaderResourceView(ID3D11Texture2D* texture) { D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc; @@ -276,23 +328,15 @@ namespace NES return shaderResourceView; } - void Renderer::DisplayMessage(wstring text) + void Renderer::DisplayMessage(wstring title, wstring message) { - _displayMessages.push_front(text); - _displayTimestamps.push_front(timeGetTime() + 4000); //4 secs + shared_ptr toast(new ToastInfo(title, message, 4000, L"Icon.bmp")); + DisplayToast(toast); } - void Renderer::RemoveOldMessages() + void Renderer::DisplayToast(shared_ptr toast) { - uint32_t currentTime = timeGetTime(); - while(!_displayTimestamps.empty()) { - if(_displayTimestamps.back() < currentTime) { - _displayMessages.pop_back(); - _displayTimestamps.pop_back(); - } else { - break; - } - } + _toasts.push_front(toast); } void Renderer::DrawOutlinedString(wstring message, float x, float y, DirectX::FXMVECTOR color, float scale) @@ -333,7 +377,7 @@ namespace NES memcpy(dd.pData, _nextFrameBuffer, _screenBufferSize); _frameLock.Release(); _pDeviceContext->Unmap(_pTexture, 0); - + ID3D11ShaderResourceView *nesOutputBuffer = GetShaderResourceView(_pTexture); _spriteBatch->Draw(nesOutputBuffer, position, &sourceRect, Colors::White, 0.0f, position, 4.0f); nesOutputBuffer->Release(); @@ -365,12 +409,12 @@ namespace NES _spriteBatch->Draw(shaderResourceView, destRect); // , position, &sourceRect, Colors::White, 0.0f, position, 4.0f); shaderResourceView->Release(); - DrawOutlinedString(L"PAUSED", (float)_hdScreenWidth / 2 - 145, (float)_hdScreenHeight / 2 - 77, Colors::AntiqueWhite, 2.0f); + DrawOutlinedString(L"PAUSED", (float)_hdScreenWidth / 2 - 145, (float)_hdScreenHeight / 2 - 47, Colors::AntiqueWhite, 4.5f); } void Renderer::Render() { - if(_frameChanged || Console::CheckFlag(EmulationFlags::Paused) || !_displayMessages.empty()) { + if(_frameChanged || Console::CheckFlag(EmulationFlags::Paused) || !_toasts.empty()) { _frameChanged = false; // Clear the back buffer _pDeviceContext->ClearRenderTargetView(_pRenderTargetView, Colors::Black); @@ -382,9 +426,9 @@ namespace NES //Draw nes screen DrawNESScreen(); - _spriteBatch->End(); + /*_spriteBatch->End(); - _spriteBatch->Begin(SpriteSortMode_Deferred, nullptr, _samplerState); + _spriteBatch->Begin(SpriteSortMode_Deferred, nullptr, _samplerState);*/ if(Console::CheckFlag(EmulationFlags::Paused)) { DrawPauseScreen(); @@ -392,16 +436,11 @@ namespace NES //Draw FPS counter if(CheckFlag(UIFlags::ShowFPS)) { wstring fpsString = wstring(L"FPS: ") + std::to_wstring(Console::GetFPS()); - DrawOutlinedString(fpsString, 256 * 4 - 149, 13, Colors::AntiqueWhite, 1.0f); + DrawOutlinedString(fpsString, 256 * 4 - 80, 13, Colors::AntiqueWhite, 1.0f); } } - RemoveOldMessages(); - int counter = 0; - for(wstring message : _displayMessages) { - DrawOutlinedString(message, 11, 11 + (float)counter*50, Colors::AntiqueWhite, 1.0f); - counter++; - } + DrawToasts(); _spriteBatch->End(); @@ -410,6 +449,95 @@ namespace NES } } + void Renderer::RemoveOldToasts() + { + _toasts.remove_if([](shared_ptr toast) { return toast->IsToastExpired(); }); + } + + void Renderer::DrawToasts() + { + RemoveOldToasts(); + + int counter = 0; + for(shared_ptr toast : _toasts) { + if(counter < 3) { + DrawToast(toast, counter); + } else { + break; + } + counter++; + } + } + + wstring Renderer::WrapText(wstring text, SpriteFont* font, float maxLineWidth) + { + wstring wrappedText; + list words; + wstring currentWord; + for(int i = 0, len = text.length(); i < len; i++) { + if(text[i] == L' ') { + if(currentWord.length() > 0) { + words.push_back(currentWord); + currentWord.clear(); + } + } else { + currentWord += text[i]; + } + } + if(currentWord.length() > 0) { + words.push_back(currentWord); + } + + float spaceWidth = font->MeasureString(L" ").m128_f32[0]; + float lineWidth = 0.0f; + for(wstring word : words) { + float wordWidth = font->MeasureString(word.c_str()).m128_f32[0]; + + if(lineWidth + wordWidth < maxLineWidth) { + wrappedText += word + L" "; + lineWidth += wordWidth + spaceWidth; + } else { + wrappedText += L"\n" + word + L" "; + lineWidth = wordWidth + spaceWidth; + } + } + + return wrappedText; + } + + void Renderer::DrawToast(shared_ptr toast, int posIndex) + { + RECT dest; + dest.top = _hdScreenHeight - (100 * (posIndex + 1)) - 50; + dest.left = (_hdScreenWidth - 340) / 2; + dest.bottom = dest.top + 70; + dest.right = dest.left + 340; + + //Get opacity for fade in/out effect + float opacity = toast->GetOpacity(); + XMVECTORF32 color = { opacity, opacity, opacity, opacity }; + + _spriteBatch->Draw(_toastTexture, dest, color); + + float textLeftMargin = 10.0f; + if(toast->HasIcon()) { + ID3D11ShaderResourceView* icon; + if(!FAILED(CreateWICTextureFromMemory(_pd3dDevice, toast->GetToastIcon(), toast->GetIconSize(), nullptr, &icon))) { + RECT iconRect; + iconRect.top = dest.top + 3; + iconRect.bottom = dest.bottom - 3; + iconRect.left = dest.left + 3; + iconRect.right = iconRect.left + 64; + _spriteBatch->Draw(icon, iconRect, color); + textLeftMargin = 75.0f; + icon->Release(); + } + } + + _smallFont->DrawString(_spriteBatch.get(), WrapText(toast->GetToastTitle(), _smallFont.get(), 340 - 30 - textLeftMargin).c_str(), XMFLOAT2(dest.left + textLeftMargin - 5.0f, dest.top + 5.0f), color); + _font->DrawString(_spriteBatch.get(), WrapText(toast->GetToastMessage(), _font.get(), 340 - 30 - textLeftMargin).c_str(), XMFLOAT2(dest.left + textLeftMargin - 2.0f, dest.top + 19.0f), color); + } + void Renderer::UpdateFrame(uint8_t* frameBuffer) { _frameChanged = true; @@ -433,7 +561,7 @@ namespace NES } int counter = 0; - wstring baseFilename = FolderUtilities::GetScreenshotFolder() + romFilename; + wstring baseFilename = FolderUtilities::GetScreenshotFolder() + FolderUtilities::GetFilename(romFilename, false); wstring ssFilename; while(true) { wstring counterStr = std::to_wstring(counter); @@ -451,7 +579,7 @@ namespace NES } PNGWriter::WritePNG(ssFilename, (uint8_t*)frameBuffer, 256, 240); - Console::DisplayMessage(L"Screenshot saved."); + MessageManager::DisplayMessage(L"Screenshot saved", FolderUtilities::GetFilename(ssFilename, true)); } } \ No newline at end of file diff --git a/GUI/Renderer.h b/Windows/Renderer.h similarity index 76% rename from GUI/Renderer.h rename to Windows/Renderer.h index 95b8cea6..21215b0c 100644 --- a/GUI/Renderer.h +++ b/Windows/Renderer.h @@ -1,6 +1,6 @@ +#pragma once + #include "stdafx.h" -#include "DirectXTK\SpriteBatch.h" -#include "DirectXTK\SpriteFont.h" #include "../Core/IVideoDevice.h" #include "../Core/IMessageManager.h" #include "../Utilities/PNGWriter.h" @@ -9,6 +9,11 @@ using namespace DirectX; +namespace DirectX { + class SpriteBatch; + class SpriteFont; +} + namespace NES { enum UIFlags { @@ -28,6 +33,9 @@ namespace NES { ID3D11DeviceContext1* _pDeviceContext1 = nullptr; IDXGISwapChain* _pSwapChain = nullptr; ID3D11RenderTargetView* _pRenderTargetView = nullptr; + ID3D11DepthStencilState* _pDepthDisabledStencilState = nullptr; + ID3D11BlendState* _pAlphaEnableBlendingState = nullptr; + ID3D11SamplerState* _samplerState = nullptr; @@ -40,10 +48,11 @@ namespace NES { unique_ptr _font; + unique_ptr _smallFont; ID3D11Texture2D* _overlayTexture = nullptr; byte* _overlayBuffer = nullptr; - std::unique_ptr _spriteBatch; + unique_ptr _spriteBatch; //ID3D11PixelShader* _pixelShader = nullptr; uint32_t _screenWidth; @@ -56,21 +65,26 @@ namespace NES { uint32_t _flags = 0; - list _displayMessages; - list _displayTimestamps; + list> _toasts; + ID3D11ShaderResourceView* _toastTexture; HRESULT InitDevice(); void CleanupDevice(); void SetScreenSize(uint32_t screenWidth, uint32_t screenHeight); + ID3D11Texture2D* CreateTexture(uint32_t width, uint32_t height); ID3D11ShaderResourceView* GetShaderResourceView(ID3D11Texture2D* texture); void DrawNESScreen(); void DrawPauseScreen(); - void RemoveOldMessages(); + wstring WrapText(wstring text, SpriteFont* font, float maxLineWidth); void DrawOutlinedString(wstring message, float x, float y, DirectX::FXMVECTOR color, float scale); + void DrawToasts(); + void DrawToast(shared_ptr toast, int posIndex); + void RemoveOldToasts(); + //HRESULT CompileShader(wstring filename, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3DBlob** ppBlobOut); public: @@ -79,7 +93,7 @@ namespace NES { void Render(); - void DisplayMessage(wstring text); + void DisplayMessage(wstring title, wstring message); void SetFlags(uint32_t flags) { @@ -97,6 +111,8 @@ namespace NES { } void UpdateFrame(uint8_t* frameBuffer); + void DisplayToast(shared_ptr toast); + void TakeScreenshot(wstring romFilename); }; } \ No newline at end of file diff --git a/GUI/SoundManager.cpp b/Windows/SoundManager.cpp similarity index 100% rename from GUI/SoundManager.cpp rename to Windows/SoundManager.cpp diff --git a/GUI/SoundManager.h b/Windows/SoundManager.h similarity index 100% rename from GUI/SoundManager.h rename to Windows/SoundManager.h diff --git a/Windows/Toast.dds b/Windows/Toast.dds new file mode 100644 index 0000000000000000000000000000000000000000..ddea493cea01697f2b102465a1ddcb9efac92130 GIT binary patch literal 95328 zcmeI#K}y456ot{>fn!}lHxh_YQpiZK%W+#-UyP^|^$xBGIyhpnJ}AP+;Res=r_=Ko zM&zATHE1`II3Kw)5A*DwF$Pt&w}X}|yj40HzOdA6sXAD*8KFz^co>}mJ>@x0cH z0S1x*d&)+#;m!sFodJ8=_2Nq}1{g>N>?s?`hC3S!bO!8c*NZQ`7+@e7u%~P!8}4i{ z&>66&T`#`$Vt|2Uz@D;^Y`C+*Kxe?7cD?x0ivb3b0ei|uvf<7K1DyeT+V$c~F9sM$ z2J9&t$%Z={40HzUY1fM{y%=C18L+2pBpdE*FwhyWr(G|;^kRU4WWb)Xk!-lL!9Zug zo_4+X(u)BGk^y_lMzZ0~1_PY|d)oElOD_f(NCxaF8_9+{8w_*?>}l7FFTEIGAQ`Zy zY$O}*Y%tInu%}%wzVu>%fn>m*vXN}Kv%x@Tz@B!!_|l6329g1L%0{x`&ISXW0ejl@ z;!7_E7)S=}DI3X#I~xpi2JC6qi!Z$xU?3T=r)(q}?rbp78L+2aFTV6*fPrMdp0bf_ zxU<1PXTY9zz4+3L0S1x*d&)+#;m!sFodJ8=_2Nq}1{g>N>?s?`hC3S!bO!8c*NZQ` z7+@e7u%~P!8}4i{&>66&T`#`$Vt|2Uz@D;^Y`C+*Kxe?7cD?x0ivb3b0ei|uvf<7K z1DyeT+V$c~F9sM$2J9&t$%Z={40HzUY1fM{y%=C18L+2pBpdE*FwhyWr(G|;^kRU4 zWWb)Xk!-lL!9Zugo_4+X(u)BGk^y_lMzZ0~1_PY|d)oElOD_f(NCxaF8_9+{8w_*? z>}l7FFTEIGAQ`ZyY$O}*Y%tInu%}%wzVu>%fn>m*vXN}Kv%x@Tz@B!!_|l6329g1L z%0{x`&ISXW0ejl@;!7_E7)S=}DI3X#I~xpi2JC6qi!Z$xU?3T=r)(q}?rbp78L+2a hFTV6*fPrM-yFJ~uZTHfE0R|XgfB^;=VBoI}yZ}#XGQ + + + + Debug + Win32 + + + Release + Win32 + + + + {7761E790-B42C-4179-8550-8365FF9EB23E} + Win32Proj + Windows + + + + StaticLibrary + true + v120 + Unicode + + + StaticLibrary + false + v120 + true + Unicode + + + + + + + + + + + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + Cdecl + + + Windows + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + + \ No newline at end of file diff --git a/Windows/Windows.vcxproj.filters b/Windows/Windows.vcxproj.filters new file mode 100644 index 00000000..1ead44ac --- /dev/null +++ b/Windows/Windows.vcxproj.filters @@ -0,0 +1,107 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {e65ed40e-43de-490e-8c87-ff96e845a513} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + Header Files\DirectXTK + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files\DirectXTK + + + \ No newline at end of file diff --git a/Windows/stdafx.cpp b/Windows/stdafx.cpp new file mode 100644 index 00000000..45cd8848 --- /dev/null +++ b/Windows/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// Windows.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/Windows/stdafx.h b/Windows/stdafx.h new file mode 100644 index 00000000..742dccee --- /dev/null +++ b/Windows/stdafx.h @@ -0,0 +1,53 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include +#include + +#ifdef _DEBUG + #pragma comment( lib, "../Core/Nes_Apu/Nes_Apu.debug.lib" ) +#else + #pragma comment( lib, "../Core/Nes_Apu/Nes_Apu.lib" ) +#endif + +#pragma comment(lib, "dsound.lib") +#pragma comment(lib, "dxguid.lib") +#pragma comment(lib, "winmm.lib") + + +// C RunTime Header Files +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +using std::list; +using std::vector; +using std::shared_ptr; +using std::wstring; +using std::string; \ No newline at end of file diff --git a/Windows/targetver.h b/Windows/targetver.h new file mode 100644 index 00000000..87c0086d --- /dev/null +++ b/Windows/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include