summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wpspec/wpspec/GamePage.xaml.cs79
-rw-r--r--wpspec/wpspec/Resources/Strings.Designer.cs11
-rw-r--r--wpspec/wpspec/Resources/Strings.resx5
-rw-r--r--wpspec/wpspec/Settings.cs20
-rw-r--r--wpspec/wpspec/SettingsPage.xaml22
-rw-r--r--wpspec/wpspec/SoundManager.cs14
-rw-r--r--wpspec/wpspec/Spectrum/Emulation.cs15
-rw-r--r--wpspec/wpspec/ViewModels/SettingsViewModel.cs22
8 files changed, 91 insertions, 97 deletions
diff --git a/wpspec/wpspec/GamePage.xaml.cs b/wpspec/wpspec/GamePage.xaml.cs
index 5ed296f..6932bdd 100644
--- a/wpspec/wpspec/GamePage.xaml.cs
+++ b/wpspec/wpspec/GamePage.xaml.cs
@@ -111,8 +111,8 @@ 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 / 140, 10,
- Shared.Spectrum.Height * 100 / 70, Shared.Spectrum.Width * 100 / 70);
+ locationZoomed = new Rectangle(SharedGraphicsDeviceManager.Current.GraphicsDevice.DisplayMode.Width / 2 - Shared.Spectrum.Width * 100 / 120, 10,
+ Shared.Spectrum.Height * 100 / 60, Shared.Spectrum.Width * 100 / 60);
// Reset settings
//
@@ -306,7 +306,7 @@ namespace wpspec
}
else
{
- SoundManager.StopSoundManager();
+ SoundManager.StartSoundManager();
}
break;
@@ -362,6 +362,79 @@ namespace wpspec
private void HandleJoystickEvent(object sender, JoystickDriver.DigitalJoystickEventArgs e)
{
resetPressed = false;
+
+ Shared.Spectrum.Joystick(e.State, e.Buttons);
+
+ if (Settings.Instance.KeyboardJoystick)
+ {
+ if ((e.State & DigitalJoystickState.Up) == DigitalJoystickState.Up)
+ {
+ Shared.Spectrum.KeyPressed(Settings.Instance.JoystickKeyUp);
+ }
+ else
+ {
+ Shared.Spectrum.KeyReleased(Settings.Instance.JoystickKeyUp);
+ }
+
+ if ((e.State & DigitalJoystickState.Down) == DigitalJoystickState.Down)
+ {
+ Shared.Spectrum.KeyPressed(Settings.Instance.JoystickKeyDown);
+ }
+ else
+ {
+ Shared.Spectrum.KeyReleased(Settings.Instance.JoystickKeyDown);
+ }
+
+ if ((e.State & DigitalJoystickState.Left) == DigitalJoystickState.Left)
+ {
+ Shared.Spectrum.KeyPressed(Settings.Instance.JoystickKeyLeft);
+ }
+ else
+ {
+ Shared.Spectrum.KeyReleased(Settings.Instance.JoystickKeyLeft);
+ }
+
+ if ((e.State & DigitalJoystickState.Right) == DigitalJoystickState.Right)
+ {
+ Shared.Spectrum.KeyPressed(Settings.Instance.JoystickKeyRight);
+ }
+ else
+ {
+ Shared.Spectrum.KeyReleased(Settings.Instance.JoystickKeyRight);
+ }
+
+ if (Settings.Instance.JoystickKeyFire1 == Settings.Instance.JoystickKeyFire2)
+ {
+ if (e.Buttons[0] || e.Buttons[1])
+ {
+ Shared.Spectrum.KeyPressed(Settings.Instance.JoystickKeyFire1);
+ }
+ else
+ {
+ Shared.Spectrum.KeyReleased(Settings.Instance.JoystickKeyFire1);
+ }
+ }
+ else
+ {
+ if (e.Buttons[0])
+ {
+ Shared.Spectrum.KeyPressed(Settings.Instance.JoystickKeyFire1);
+ }
+ else
+ {
+ Shared.Spectrum.KeyReleased(Settings.Instance.JoystickKeyFire1);
+ }
+
+ if (e.Buttons[1])
+ {
+ Shared.Spectrum.KeyPressed(Settings.Instance.JoystickKeyFire2);
+ }
+ else
+ {
+ Shared.Spectrum.KeyReleased(Settings.Instance.JoystickKeyFire2);
+ }
+ }
+ }
}
#endregion
diff --git a/wpspec/wpspec/Resources/Strings.Designer.cs b/wpspec/wpspec/Resources/Strings.Designer.cs
index e0ff595..26f924b 100644
--- a/wpspec/wpspec/Resources/Strings.Designer.cs
+++ b/wpspec/wpspec/Resources/Strings.Designer.cs
@@ -380,7 +380,7 @@ namespace wpspec.Resources {
}
/// <summary>
- /// Looks up a localized string similar to Cursor.
+ /// Looks up a localized string similar to Set to Cursor.
/// </summary>
public static string SettingsCursorJoystick {
get {
@@ -497,15 +497,6 @@ namespace wpspec.Resources {
}
/// <summary>
- /// Looks up a localized string similar to Miner Willy.
- /// </summary>
- public static string SettingsManicJoystick {
- get {
- return ResourceManager.GetString("SettingsManicJoystick", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to Joysticks.
/// </summary>
public static string SettingsPageTitleJoystick {
diff --git a/wpspec/wpspec/Resources/Strings.resx b/wpspec/wpspec/Resources/Strings.resx
index 8dd4f93..3c5cbe0 100644
--- a/wpspec/wpspec/Resources/Strings.resx
+++ b/wpspec/wpspec/Resources/Strings.resx
@@ -251,7 +251,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
<value>Tape Contents</value>
</data>
<data name="SettingsCursorJoystick" xml:space="preserve">
- <value>Cursor</value>
+ <value>Set to Cursor</value>
</data>
<data name="SettingsFullerJoystick" xml:space="preserve">
<value>Fuller</value>
@@ -259,9 +259,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
<data name="SettingsJoystickLock" xml:space="preserve">
<value>Joystick Lock</value>
</data>
- <data name="SettingsManicJoystick" xml:space="preserve">
- <value>Miner Willy</value>
- </data>
<data name="SettingsKempstonJoystick" xml:space="preserve">
<value>Kempston</value>
</data>
diff --git a/wpspec/wpspec/Settings.cs b/wpspec/wpspec/Settings.cs
index 90be72d..6c6a06c 100644
--- a/wpspec/wpspec/Settings.cs
+++ b/wpspec/wpspec/Settings.cs
@@ -40,24 +40,6 @@ namespace wpspec
}
/// <summary>
- /// Get/set whether Kempston joystick emulation is enabled.
- /// </summary>
- public bool KempstonJoystick
- {
- get {return kempstonJoystick.Setting;}
- set {kempstonJoystick.Setting = value;}
- }
-
- /// <summary>
- /// Get/set whether Fuller joystick emulation is enabled.
- /// </summary>
- public bool FullerJoystick
- {
- get {return fullerJoystick.Setting;}
- set {fullerJoystick.Setting = value;}
- }
-
- /// <summary>
/// Get/set whether a keyboard-based joystick emulation is enabled.
/// </summary>
public bool KeyboardJoystick
@@ -144,8 +126,6 @@ namespace wpspec
private Settings()
{
sound = new SettingValue<bool>("Sound", true);
- kempstonJoystick = new SettingValue<bool>("KempstonJoystick", true);
- fullerJoystick = new SettingValue<bool>("FullerJoystick", true);
keyboardJoystick = new SettingValue<bool>("KeyboardJoystick", false);
joystickKeyUp = new SettingValue<SpectrumKeySymbol>("JoystickKeyUp", SpectrumKeySymbol.Key7);
joystickKeyDown = new SettingValue<SpectrumKeySymbol>("JoystickKeyDown", SpectrumKeySymbol.Key6);
diff --git a/wpspec/wpspec/SettingsPage.xaml b/wpspec/wpspec/SettingsPage.xaml
index a3857b1..9ad95cb 100644
--- a/wpspec/wpspec/SettingsPage.xaml
+++ b/wpspec/wpspec/SettingsPage.xaml
@@ -35,24 +35,15 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<toolkit:ListPicker Header="{Binding SettingsJoystickLock, Source={StaticResource Strings}}"
ItemsSource="{Binding JoystickLockValues, Mode=OneWay}"
SelectedIndex="{Binding JoystickLock, Mode=TwoWay, Converter={StaticResource IntToEnum}}"
Grid.Row="0" />
- <CheckBox IsChecked="{Binding KempstonJoystick, Mode=TwoWay}"
- Content="{Binding SettingsKempstonJoystick, Source={StaticResource Strings}}"
- Grid.Row="1" />
- <CheckBox IsChecked="{Binding FullerJoystick, Mode=TwoWay}"
- Content="{Binding SettingsFullerJoystick, Source={StaticResource Strings}}"
- Grid.Row="2" />
<CheckBox IsChecked="{Binding KeyboardJoystick, Mode=TwoWay}"
Content="{Binding SettingsKeyboardJoystick, Source={StaticResource Strings}}"
- Grid.Row="3" />
- <Grid Grid.Row="4" Visibility="{Binding KeyboardJoystick, Mode=OneWay, Converter={StaticResource BoolToVisibility}}">
+ Grid.Row="1" />
+ <Grid Grid.Row="2" Visibility="{Binding KeyboardJoystick, Mode=OneWay, Converter={StaticResource BoolToVisibility}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
@@ -90,16 +81,9 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
<Button Content="{Binding SettingsCursorJoystick, Source={StaticResource Strings}}"
- Grid.Row="0" Grid.Column="0"
+ Grid.Row="0"
Click="CursorClick"/>
- <Button Content="{Binding SettingsManicJoystick, Source={StaticResource Strings}}"
- Grid.Row="0" Grid.Column="1"
- Click="MinerWillyClick" />
</Grid>
</Grid>
</Grid>
diff --git a/wpspec/wpspec/SoundManager.cs b/wpspec/wpspec/SoundManager.cs
index aeb0ee6..c84e3e6 100644
--- a/wpspec/wpspec/SoundManager.cs
+++ b/wpspec/wpspec/SoundManager.cs
@@ -24,7 +24,10 @@ namespace wpspec
/// </summary>
static public void StartSoundManager()
{
- sfx = new DynamicSoundEffectInstance(48000, AudioChannels.Mono);
+ if (sfx == null)
+ {
+ sfx = new DynamicSoundEffectInstance(48000, AudioChannels.Mono);
+ }
}
/// <summary>
@@ -32,9 +35,12 @@ namespace wpspec
/// </summary>
static public void StopSoundManager()
{
- sfx.Stop();
- sfx.Dispose();
- sfx = null;
+ if (sfx != null)
+ {
+ sfx.Stop();
+ sfx.Dispose();
+ sfx = null;
+ }
}
// Play a sound buffer. The buffer must be in 16-bit PCM, mono.
diff --git a/wpspec/wpspec/Spectrum/Emulation.cs b/wpspec/wpspec/Spectrum/Emulation.cs
index ac01a31..9d1bbef 100644
--- a/wpspec/wpspec/Spectrum/Emulation.cs
+++ b/wpspec/wpspec/Spectrum/Emulation.cs
@@ -124,11 +124,6 @@ namespace wpspec.Spectrum
private bool soundPlayed = false;
private int soundLineCount = 0;
- // Joystick
- //
- private DigitalJoystickState joystickState;
- private bool[] joystickButtons;
-
#endregion
#region Private Members
@@ -408,12 +403,6 @@ namespace wpspec.Spectrum
b = matrix[8];
break;
- // Fuller joystick
- //
- case 0x7f:
- b = matrix[8];
- break;
-
// ULA
//
default:
@@ -582,10 +571,6 @@ namespace wpspec.Spectrum
{
matrix[8] |= 0x10;
}
-
- if (Settings.Instance.KeyboardJoystick)
- {
- }
}
/// <summary>
diff --git a/wpspec/wpspec/ViewModels/SettingsViewModel.cs b/wpspec/wpspec/ViewModels/SettingsViewModel.cs
index fd03223..c7df925 100644
--- a/wpspec/wpspec/ViewModels/SettingsViewModel.cs
+++ b/wpspec/wpspec/ViewModels/SettingsViewModel.cs
@@ -93,28 +93,6 @@ namespace wpspec.ViewModels
private string tapeUrl = Settings.Instance.TapeUrl;
/// <summary>
- /// Get/set whether Kempston joystick emulation is enabled.
- /// </summary>
- public bool KempstonJoystick
- {
- get {return kempstonJoystick;}
- set {SetValue(ref kempstonJoystick, value, "KempstonJoystick"); Settings.Instance.KempstonJoystick = value;}
- }
-
- private bool kempstonJoystick = Settings.Instance.KempstonJoystick;
-
- /// <summary>
- /// Get/set whether Fuller joystick emulation is enabled.
- /// </summary>
- public bool FullerJoystick
- {
- get {return fullerJoystick;}
- set {SetValue(ref fullerJoystick, value, "FullerJoystick"); Settings.Instance.FullerJoystick = value;}
- }
-
- private bool fullerJoystick = Settings.Instance.FullerJoystick;
-
- /// <summary>
/// Get/set whether a keyboard-based joystick emulation is enabled.
/// </summary>
public bool KeyboardJoystick