From ac1b032fa034d6650e1c52cf963e38a6d39a444e Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 20 Jun 2012 23:16:18 +0000 Subject: Added Poke Memory page --- wpspec/wpspec/GamePage.xaml.cs | 4 +- wpspec/wpspec/PokeMemoryPage.xaml | 72 +++++++++++++++++++++++++++++ wpspec/wpspec/PokeMemoryPage.xaml.cs | 65 ++++++++++++++++++++++++++ wpspec/wpspec/Resources/Strings.Designer.cs | 36 +++++++++++++++ wpspec/wpspec/Resources/Strings.resx | 12 +++++ wpspec/wpspec/wpspec.csproj | 7 +++ 6 files changed, 193 insertions(+), 3 deletions(-) create mode 100644 wpspec/wpspec/PokeMemoryPage.xaml create mode 100644 wpspec/wpspec/PokeMemoryPage.xaml.cs diff --git a/wpspec/wpspec/GamePage.xaml.cs b/wpspec/wpspec/GamePage.xaml.cs index 6932bdd..5e483d5 100644 --- a/wpspec/wpspec/GamePage.xaml.cs +++ b/wpspec/wpspec/GamePage.xaml.cs @@ -111,7 +111,7 @@ namespace wpspec // Initialise locations for normal and zoomed display // location = new Vector2(SharedGraphicsDeviceManager.Current.GraphicsDevice.DisplayMode.Width / 2 - Shared.Spectrum.Width / 2, 10); - locationZoomed = new Rectangle(SharedGraphicsDeviceManager.Current.GraphicsDevice.DisplayMode.Width / 2 - Shared.Spectrum.Width * 100 / 120, 10, + locationZoomed = new Rectangle(SharedGraphicsDeviceManager.Current.GraphicsDevice.DisplayMode.Width / 2 - Shared.Spectrum.Width * 100 / 120, -20, Shared.Spectrum.Height * 100 / 60, Shared.Spectrum.Width * 100 / 60); // Reset settings @@ -232,8 +232,6 @@ namespace wpspec { Shared.Spectrum.Run(); Shared.Spectrum.Run(); - Shared.Spectrum.Run(); - Shared.Spectrum.Run(); } } diff --git a/wpspec/wpspec/PokeMemoryPage.xaml b/wpspec/wpspec/PokeMemoryPage.xaml new file mode 100644 index 0000000..2e95083 --- /dev/null +++ b/wpspec/wpspec/PokeMemoryPage.xaml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wpspec/wpspec/PokeMemoryPage.xaml.cs b/wpspec/wpspec/PokeMemoryPage.xaml.cs new file mode 100644 index 0000000..33b5a9d --- /dev/null +++ b/wpspec/wpspec/PokeMemoryPage.xaml.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; +using Microsoft.Phone.Controls; +using Noddybox.Emulation.EightBit; + +namespace wpspec +{ + public partial class PokeMemoryPage : PhoneApplicationPage + { + public PokeMemoryPage() + { + InitializeComponent(); + } + + private void PokeClick(object sender, RoutedEventArgs e) + { + int address; + int value; + bool ok = true; + + if (int.TryParse(addressText.Text, out address) && (address >= 0) && (address < 0x10000)) + { + addressText.Background = (SolidColorBrush)Resources["PhoneTextBoxBrush"]; + } + else + { + addressText.Background = (SolidColorBrush)Resources["PhoneAccentBrush"]; + ok = false; + } + + if (int.TryParse(valueText.Text, out value) && (value >= 0) && (value < 0x100)) + { + valueText.Background = (SolidColorBrush)Resources["PhoneTextBoxBrush"]; + } + else + { + valueText.Background = (SolidColorBrush)Resources["PhoneAccentBrush"]; + ok = false; + } + + if (!ok) + { + return; + } + + IMemory memory = Shared.Spectrum; + + memory.Write((ushort)address, (byte)value); + + address = (address+1) % 0x10000; + + addressText.Text = address.ToString(); + } + + } +} \ No newline at end of file diff --git a/wpspec/wpspec/Resources/Strings.Designer.cs b/wpspec/wpspec/Resources/Strings.Designer.cs index 26f924b..bd74210 100644 --- a/wpspec/wpspec/Resources/Strings.Designer.cs +++ b/wpspec/wpspec/Resources/Strings.Designer.cs @@ -262,6 +262,15 @@ namespace wpspec.Resources { } } + /// + /// Looks up a localized string similar to Address. + /// + public static string PokeMemoryAddressText { + get { + return ResourceManager.GetString("PokeMemoryAddressText", resourceCulture); + } + } + /// /// Looks up a localized string similar to Poke Memory. /// @@ -271,6 +280,33 @@ namespace wpspec.Resources { } } + /// + /// Looks up a localized string similar to Poke!. + /// + public static string PokeMemoryPokeButton { + get { + return ResourceManager.GetString("PokeMemoryPokeButton", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Poke Memory. + /// + public static string PokeMemoryTitleText { + get { + return ResourceManager.GetString("PokeMemoryTitleText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Value. + /// + public static string PokeMemoryValueText { + get { + return ResourceManager.GetString("PokeMemoryValueText", resourceCulture); + } + } + /// /// Looks up a localized string similar to Failed to fetch tape; got error - "{0}". /// diff --git a/wpspec/wpspec/Resources/Strings.resx b/wpspec/wpspec/Resources/Strings.resx index 3c5cbe0..9c58111 100644 --- a/wpspec/wpspec/Resources/Strings.resx +++ b/wpspec/wpspec/Resources/Strings.resx @@ -292,4 +292,16 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY Up + + Address + + + Poke! + + + Poke Memory + + + Value + \ No newline at end of file diff --git a/wpspec/wpspec/wpspec.csproj b/wpspec/wpspec/wpspec.csproj index 88e1790..0e53113 100644 --- a/wpspec/wpspec/wpspec.csproj +++ b/wpspec/wpspec/wpspec.csproj @@ -100,6 +100,9 @@ OpenRemoteTapePage.xaml + + PokeMemoryPage.xaml + GamePage.xaml @@ -168,6 +171,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile -- cgit v1.2.3