mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-06-01 06:41:34 +00:00
Cosmetic changes.
Set svn properties on files. --HG-- extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4044493
This commit is contained in:
parent
21a9ba51dd
commit
7b713e6aaa
|
@ -67,12 +67,12 @@ private void Initialize()
|
|||
|
||||
GCHandleHelpers.Pin(new WaveFormat(_sampleRate, _sampleChannels, _sampleBits), waveFormat =>
|
||||
{
|
||||
BufferDescription description = new BufferDescription(BufferCapabilities.CtrlPositionNotify | BufferCapabilities.CtrlVolume, BlockCount * _sampleSize, waveFormat);
|
||||
var description = new BufferDescription(BufferCapabilities.CtrlPositionNotify | BufferCapabilities.CtrlVolume, BlockCount * _sampleSize, waveFormat);
|
||||
_device.CreateSoundBuffer(description, out _buffer, IntPtr.Zero);
|
||||
});
|
||||
ClearBuffer();
|
||||
|
||||
BufferPositionNotify[] positionEvents = new BufferPositionNotify[BlockCount]
|
||||
var positionEvents = new BufferPositionNotify[BlockCount]
|
||||
{
|
||||
new BufferPositionNotify(0 * _sampleSize, _position1Event), new BufferPositionNotify(1 * _sampleSize, _position2Event)
|
||||
};
|
||||
|
@ -85,10 +85,7 @@ private void Initialize()
|
|||
|
||||
private void ClearBuffer()
|
||||
{
|
||||
UpdateBuffer(0, 0, BufferLock.EntireBuffer, (buffer, bufferSize) =>
|
||||
{
|
||||
MarshalHelpers.ZeroMemory(buffer, bufferSize);
|
||||
});
|
||||
UpdateBuffer(0, 0, BufferLock.EntireBuffer, (buffer, bufferSize) => MarshalHelpers.ZeroMemory(buffer, bufferSize));
|
||||
}
|
||||
|
||||
private void RestoreBuffer()
|
||||
|
@ -106,10 +103,7 @@ private void UpdateBuffer(int block)
|
|||
EventHandler<DirectSoundUpdateEventArgs> handler = Update;
|
||||
if (handler != null)
|
||||
{
|
||||
UpdateBuffer(block * _sampleSize, _sampleSize, BufferLock.None, (buffer, bufferSize) =>
|
||||
{
|
||||
handler(this, DirectSoundUpdateEventArgs.Create(buffer, bufferSize));
|
||||
});
|
||||
UpdateBuffer(block * _sampleSize, _sampleSize, BufferLock.None, (buffer, bufferSize) => handler(this, DirectSoundUpdateEventArgs.Create(buffer, bufferSize)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,7 +148,7 @@ private void Run() // com mta thread
|
|||
{
|
||||
Initialize();
|
||||
|
||||
EventWaitHandle[] eventHandles = new EventWaitHandle[] { _position1Event, _position2Event, _stopEvent };
|
||||
var eventHandles = new EventWaitHandle[] { _position1Event, _position2Event, _stopEvent };
|
||||
int index = WaitHandle.WaitAny(eventHandles);
|
||||
|
||||
while (index < BlockCount)
|
||||
|
|
|
@ -14,7 +14,7 @@ public static void Pin(object value, Action<IntPtr> action)
|
|||
throw new ArgumentNullException("action");
|
||||
}
|
||||
|
||||
GCHandle gcHandle = new GCHandle();
|
||||
var gcHandle = new GCHandle();
|
||||
try
|
||||
{
|
||||
gcHandle = GCHandle.Alloc(value, GCHandleType.Pinned);
|
||||
|
|
|
@ -208,7 +208,7 @@ public void Persist(SafeHandle handle)
|
|||
WriteLock();
|
||||
try
|
||||
{
|
||||
AccessControlSections sectionsModified = GetAccessControlSectionsModified();
|
||||
var sectionsModified = GetAccessControlSectionsModified();
|
||||
if (sectionsModified != AccessControlSections.None)
|
||||
{
|
||||
Persist(handle, sectionsModified);
|
||||
|
@ -226,7 +226,7 @@ public void Persist(string name)
|
|||
WriteLock();
|
||||
try
|
||||
{
|
||||
AccessControlSections sectionsModified = GetAccessControlSectionsModified();
|
||||
var sectionsModified = GetAccessControlSectionsModified();
|
||||
if (sectionsModified != AccessControlSections.None)
|
||||
{
|
||||
Persist(name, sectionsModified);
|
||||
|
@ -241,7 +241,7 @@ public void Persist(string name)
|
|||
|
||||
private AccessControlSections GetAccessControlSectionsModified()
|
||||
{
|
||||
AccessControlSections sectionsModified = AccessControlSections.None;
|
||||
var sectionsModified = AccessControlSections.None;
|
||||
if (AccessRulesModified)
|
||||
{
|
||||
sectionsModified = AccessControlSections.Access;
|
||||
|
|
|
@ -19,7 +19,7 @@ public T Value
|
|||
T value = _initializer();
|
||||
if (Interlocked.CompareExchange(ref _value, value, null) != null)
|
||||
{
|
||||
IDisposable disposable = value as IDisposable; // dispose preempted instance
|
||||
var disposable = value as IDisposable; // dispose preempted instance
|
||||
if (disposable != null)
|
||||
{
|
||||
disposable.Dispose();
|
||||
|
|
|
@ -47,7 +47,7 @@ public static SafeGlobalAllocHandle Allocate(byte[] value)
|
|||
throw new ArgumentNullException("value");
|
||||
}
|
||||
|
||||
SafeGlobalAllocHandle alloc = Allocate(value.Length);
|
||||
var alloc = Allocate(value.Length);
|
||||
Marshal.Copy(value, 0, alloc.DangerousGetHandle(), value.Length);
|
||||
|
||||
return alloc;
|
||||
|
@ -61,7 +61,7 @@ protected override bool ReleaseHandle()
|
|||
|
||||
private static SafeGlobalAllocHandle Allocate(uint flags, int size)
|
||||
{
|
||||
SafeGlobalAllocHandle alloc = NativeMethods.GlobalAlloc(flags, (IntPtr)size);
|
||||
var alloc = NativeMethods.GlobalAlloc(flags, (IntPtr)size);
|
||||
if (alloc.IsInvalid)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
|
@ -110,7 +110,7 @@ public static SafeLocalAllocHandle Allocate(byte[] value)
|
|||
throw new ArgumentNullException("value");
|
||||
}
|
||||
|
||||
SafeLocalAllocHandle alloc = Allocate(value.Length);
|
||||
var alloc = Allocate(value.Length);
|
||||
Marshal.Copy(value, 0, alloc.DangerousGetHandle(), value.Length);
|
||||
|
||||
return alloc;
|
||||
|
@ -124,7 +124,7 @@ protected override bool ReleaseHandle()
|
|||
|
||||
private static SafeLocalAllocHandle Allocate(uint flags, int size)
|
||||
{
|
||||
SafeLocalAllocHandle alloc = NativeMethods.LocalAlloc(flags, (IntPtr)size);
|
||||
var alloc = NativeMethods.LocalAlloc(flags, (IntPtr)size);
|
||||
if (alloc.IsInvalid)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
|
|
|
@ -65,7 +65,7 @@ public void SetAccessControl(GeneralSecurity fileSecurity)
|
|||
private static SafeFileHandle CreateFile(string fileName, uint fileAccess, uint fileShare, uint fileMode, uint fileOptions, GeneralSecurity fileSecurity,
|
||||
bool inheritable)
|
||||
{
|
||||
SafeFileHandle file = new SafeFileHandle();
|
||||
var file = new SafeFileHandle();
|
||||
|
||||
GeneralSecurity.GetSecurityAttributes(fileSecurity, inheritable, securityAttributes =>
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ private void OnApplicationUnhandledException(object sender, ApplicationUnhandled
|
|||
|
||||
private string GetExceptionCaption(string title, bool isTerminating)
|
||||
{
|
||||
StringBuilder caption = new StringBuilder();
|
||||
var caption = new StringBuilder();
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
caption.Append(Name);
|
||||
|
@ -49,7 +49,7 @@ private string GetExceptionCaption(string title, bool isTerminating)
|
|||
|
||||
private static string GetExceptionMessage(Exception exception)
|
||||
{
|
||||
StringBuilder message = new StringBuilder();
|
||||
var message = new StringBuilder();
|
||||
if (exception != null)
|
||||
{
|
||||
message.Append(exception.Message.ToString());
|
||||
|
|
|
@ -18,7 +18,7 @@ public WaveFormat(int sampleRate, int sampleChannels, int sampleBits)
|
|||
|
||||
public string ToHexString() // little endian
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
var builder = new StringBuilder();
|
||||
|
||||
builder.AppendHex(_formatTag);
|
||||
builder.AppendHex(_channels);
|
||||
|
|
|
@ -38,7 +38,7 @@ private void OnAppDomainUnhandledException(object sender, UnhandledExceptionEven
|
|||
|
||||
private string GetExceptionCaption(string title, bool isTerminating)
|
||||
{
|
||||
StringBuilder caption = new StringBuilder();
|
||||
var caption = new StringBuilder();
|
||||
caption.AppendFormat("[{0}] ", Process.GetCurrentProcess().Id);
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ private string GetExceptionCaption(string title, bool isTerminating)
|
|||
|
||||
private static string GetExceptionMessage(Exception exception)
|
||||
{
|
||||
StringBuilder message = new StringBuilder();
|
||||
var message = new StringBuilder();
|
||||
if (exception != null)
|
||||
{
|
||||
message.Append(exception.Message.ToString());
|
||||
|
|
|
@ -16,9 +16,9 @@ public static T Deserialize<T>(Stream stream)
|
|||
[SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
|
||||
public static T Deserialize<T>(Stream stream, string defaultNamespace)
|
||||
{
|
||||
using (XmlReader reader = XmlReader.Create(stream))
|
||||
using (var reader = XmlReader.Create(stream))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(T), defaultNamespace);
|
||||
var serializer = new XmlSerializer(typeof(T), defaultNamespace);
|
||||
return (T)serializer.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ public static void Serialize<T>(Stream stream, T instance)
|
|||
|
||||
public static void Serialize<T>(Stream stream, T instance, string defaultNamespace)
|
||||
{
|
||||
using (XmlWriter writer = XmlWriter.Create(stream))
|
||||
using (var writer = XmlWriter.Create(stream))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(T), defaultNamespace);
|
||||
var serializer = new XmlSerializer(typeof(T), defaultNamespace);
|
||||
serializer.Serialize(writer, instance);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ protected override void LoadContent()
|
|||
_spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
_spriteFont = Game.Content.Load<SpriteFont>(FontName);
|
||||
|
||||
Rectangle titleSafeArea = Game.GraphicsDevice.DisplayMode.TitleSafeArea;
|
||||
var titleSafeArea = Game.GraphicsDevice.DisplayMode.TitleSafeArea;
|
||||
Position = new Vector2(titleSafeArea.X, titleSafeArea.Y);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public GameBase(string name)
|
|||
|
||||
protected override void Update(GameTime gameTime)
|
||||
{
|
||||
GamePadState gamePadState = GamePad.GetState(PlayerIndex.One);
|
||||
var gamePadState = GamePad.GetState(PlayerIndex.One);
|
||||
if (gamePadState.Buttons.Back == ButtonState.Pressed)
|
||||
{
|
||||
Exit();
|
||||
|
|
|
@ -16,7 +16,7 @@ public override void Initialize()
|
|||
_drives[0].InsertDisk("Default.dsk", StorageService.GetResourceStream("Default.dsk", 0x23000), false);
|
||||
|
||||
#if WINDOWS
|
||||
DiskIISettings settings = Machine.Settings.DiskII;
|
||||
var settings = Machine.Settings.DiskII;
|
||||
if (settings.Disk1.Name.Length > 0)
|
||||
{
|
||||
_drives[0].InsertDisk(settings.Disk1.Name, settings.Disk1.IsWriteProtected);
|
||||
|
|
|
@ -16,7 +16,7 @@ public Drive525()
|
|||
|
||||
public void InsertDisk(string fileName, bool isWriteProtected)
|
||||
{
|
||||
using (FileStream stream = File.OpenRead(fileName))
|
||||
using (var stream = File.OpenRead(fileName))
|
||||
{
|
||||
InsertDisk(fileName, stream, isWriteProtected);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public override void Initialize()
|
|||
|
||||
public bool ReadButton0()
|
||||
{
|
||||
GamePortSettings settings = Machine.Settings.GamePort;
|
||||
var settings = Machine.Settings.GamePort;
|
||||
|
||||
return (_gamePortService.IsButton0Down || _keyboardService.IsOpenAppleKeyDown ||
|
||||
(settings.UseKeyboard && (settings.Key.Button0 > 0) && _keyboardService.IsKeyDown(settings.Key.Button0)));
|
||||
|
@ -33,7 +33,7 @@ public bool ReadButton0()
|
|||
|
||||
public bool ReadButton1()
|
||||
{
|
||||
GamePortSettings settings = Machine.Settings.GamePort;
|
||||
var settings = Machine.Settings.GamePort;
|
||||
|
||||
return (_gamePortService.IsButton1Down || _keyboardService.IsCloseAppleKeyDown ||
|
||||
(settings.UseKeyboard && (settings.Key.Button1 > 0) && _keyboardService.IsKeyDown(settings.Key.Button1)));
|
||||
|
@ -41,7 +41,7 @@ public bool ReadButton1()
|
|||
|
||||
public bool ReadButton2()
|
||||
{
|
||||
GamePortSettings settings = Machine.Settings.GamePort;
|
||||
var settings = Machine.Settings.GamePort;
|
||||
|
||||
return (_gamePortService.IsButton2Down ||
|
||||
(settings.UseKeyboard && (settings.Key.Button2 > 0) && _keyboardService.IsKeyDown(settings.Key.Button2)));
|
||||
|
@ -55,7 +55,7 @@ public void TriggerTimers()
|
|||
int paddle2 = _gamePortService.Paddle2;
|
||||
int paddle3 = _gamePortService.Paddle3;
|
||||
|
||||
GamePortSettings settings = Machine.Settings.GamePort;
|
||||
var settings = Machine.Settings.GamePort;
|
||||
|
||||
if (settings.UseKeyboard) // override
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ public int ReadLatch()
|
|||
return Latch;
|
||||
}
|
||||
|
||||
KeyboardSettings settings = Machine.Settings.Keyboard;
|
||||
var settings = Machine.Settings.Keyboard;
|
||||
|
||||
if (settings.UseGamePort)
|
||||
{
|
||||
|
|
|
@ -67,20 +67,20 @@ public void Deserialize(Stream stream)
|
|||
{
|
||||
try
|
||||
{
|
||||
using (XmlReader reader = XmlReader.Create(stream))
|
||||
using (var reader = XmlReader.Create(stream))
|
||||
{
|
||||
XNamespace ns = Namespace;
|
||||
XElement root = XElement.Load(reader);
|
||||
XElement cpu = root.Element(ns + "Cpu");
|
||||
var ns = Namespace;
|
||||
var root = XElement.Load(reader);
|
||||
var cpu = root.Element(ns + "Cpu");
|
||||
Cpu = new CpuSettings
|
||||
{
|
||||
Is65C02 = (bool)cpu.Attribute("Is65C02"),
|
||||
IsThrottled = (bool)cpu.Attribute("IsThrottled"),
|
||||
Multiplier = (int)cpu.Attribute("Multiplier")
|
||||
};
|
||||
XElement diskII = root.Element(ns + "DiskII");
|
||||
XElement disk1 = diskII.Element(ns + "Disk1");
|
||||
XElement disk2 = diskII.Element(ns + "Disk2");
|
||||
var diskII = root.Element(ns + "DiskII");
|
||||
var disk1 = diskII.Element(ns + "Disk1");
|
||||
var disk2 = diskII.Element(ns + "Disk2");
|
||||
DiskII = new DiskIISettings
|
||||
{
|
||||
Disk1 = new DiskSettings
|
||||
|
@ -94,11 +94,11 @@ public void Deserialize(Stream stream)
|
|||
IsWriteProtected = (bool)disk2.Attribute("IsWriteProtected")
|
||||
},
|
||||
};
|
||||
XElement keyboard = root.Element(ns + "Keyboard");
|
||||
XElement key = keyboard.Element(ns + "Key");
|
||||
XElement joystick0 = key.Element(ns + "Joystick0");
|
||||
XElement joystick1 = key.Element(ns + "Joystick1");
|
||||
XElement buttons = key.Element(ns + "Buttons");
|
||||
var keyboard = root.Element(ns + "Keyboard");
|
||||
var key = keyboard.Element(ns + "Key");
|
||||
var joystick0 = key.Element(ns + "Joystick0");
|
||||
var joystick1 = key.Element(ns + "Joystick1");
|
||||
var buttons = key.Element(ns + "Buttons");
|
||||
Keyboard = new KeyboardSettings
|
||||
{
|
||||
UseGamePort = (bool)keyboard.Attribute("UseGamePort"),
|
||||
|
@ -131,7 +131,7 @@ public void Deserialize(Stream stream)
|
|||
Button2 = (int)buttons.Attribute("Button2")
|
||||
}
|
||||
};
|
||||
XElement gamePort = root.Element(ns + "GamePort");
|
||||
var gamePort = root.Element(ns + "GamePort");
|
||||
key = gamePort.Element(ns + "Key");
|
||||
joystick0 = key.Element(ns + "Joystick0");
|
||||
joystick1 = key.Element(ns + "Joystick1");
|
||||
|
@ -168,8 +168,8 @@ public void Deserialize(Stream stream)
|
|||
Button2 = (int)buttons.Attribute("Button2")
|
||||
}
|
||||
};
|
||||
XElement video = root.Element(ns + "Video");
|
||||
XElement color = video.Element(ns + "Color");
|
||||
var video = root.Element(ns + "Video");
|
||||
var color = video.Element(ns + "Color");
|
||||
Video = new VideoSettings
|
||||
{
|
||||
IsFullScreen = (bool)video.Attribute("IsFullScreen"),
|
||||
|
@ -205,8 +205,8 @@ public void Deserialize(Stream stream)
|
|||
|
||||
public void Serialize(Stream stream)
|
||||
{
|
||||
XNamespace ns = Namespace;
|
||||
XElement xml = new XElement(ns + "MachineSettings",
|
||||
var ns = Namespace;
|
||||
var xml = new XElement(ns + "MachineSettings",
|
||||
new XElement(ns + "Cpu",
|
||||
new XAttribute("Is65C02", Cpu.Is65C02),
|
||||
new XAttribute("IsThrottled", Cpu.IsThrottled),
|
||||
|
@ -291,7 +291,7 @@ public void Serialize(Stream stream)
|
|||
new XAttribute("White", Video.Color.White),
|
||||
new XAttribute("Monochrome", Video.Color.Monochrome))));
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(stream))
|
||||
using (var writer = XmlWriter.Create(stream))
|
||||
{
|
||||
xml.WriteTo(writer);
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ public void Serialize(Stream stream)
|
|||
public VideoSettings Video { get; set; }
|
||||
|
||||
public const string FileName = "Settings.xml";
|
||||
public const string Namespace = "http://schemas.jellyfish.co.nz/virtu/settings";
|
||||
public static readonly XNamespace Namespace = "http://schemas.jellyfish.co.nz/virtu/settings";
|
||||
}
|
||||
|
||||
public sealed class CpuSettings
|
||||
|
|
|
@ -88,7 +88,7 @@ public override void Initialize()
|
|||
_speaker = Machine.Speaker;
|
||||
_video = Machine.Video;
|
||||
|
||||
Stream romStream = StorageService.GetResourceStream("AppleIIe.rom", 0x4000);
|
||||
var romStream = StorageService.GetResourceStream("AppleIIe.rom", 0x4000);
|
||||
romStream.Seek(0x0100, SeekOrigin.Current);
|
||||
romStream.ReadBlock(_romInternalRegionC1CF, 0x0000, 0x0F00);
|
||||
romStream.ReadBlock(_romRegionD0DF, 0x0000, 0x1000);
|
||||
|
|
|
@ -21,8 +21,8 @@ public static Stream GetResourceStream(string resourceName)
|
|||
|
||||
public static Stream GetResourceStream(string resourceName, int resourceSize)
|
||||
{
|
||||
ResourceManager resourceManager = new ResourceManager("Jellyfish.Virtu.g", Assembly.GetExecutingAssembly()) { IgnoreCase = true };
|
||||
Stream resourceStream = (Stream)resourceManager.GetObject(resourceName);
|
||||
var resourceManager = new ResourceManager("Jellyfish.Virtu.g", Assembly.GetExecutingAssembly()) { IgnoreCase = true };
|
||||
var resourceStream = (Stream)resourceManager.GetObject(resourceName);
|
||||
if (resourceStream == null)
|
||||
{
|
||||
throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, SR.ResourceNotFound, resourceName));
|
||||
|
|
|
@ -52,13 +52,12 @@ private void OnCompositionTargetRendering(object sender, EventArgs e)
|
|||
|
||||
private void OnDiskButtonClick(int drive)
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.Filter = "Disk Files (*.dsk;*.nib)|*.dsk;*.nib|All Files (*.*)|*.*";
|
||||
var dialog = new OpenFileDialog() { Filter = "Disk Files (*.dsk;*.nib)|*.dsk;*.nib|All Files (*.*)|*.*" };
|
||||
|
||||
bool? result = dialog.ShowDialog();
|
||||
if (result.HasValue && result.Value)
|
||||
{
|
||||
using (FileStream stream = dialog.File.OpenRead())
|
||||
using (var stream = dialog.File.OpenRead())
|
||||
{
|
||||
_machine.Pause();
|
||||
_machine.DiskII.Drives[drive].InsertDisk(dialog.File.Name, stream, false);
|
||||
|
|
|
@ -45,7 +45,7 @@ public override void Update() // main thread
|
|||
}
|
||||
}
|
||||
|
||||
ModifierKeys modifiers = System.Windows.Input.Keyboard.Modifiers;
|
||||
var modifiers = System.Windows.Input.Keyboard.Modifiers;
|
||||
bool control = ((modifiers & ModifierKeys.Control) != 0);
|
||||
|
||||
IsOpenAppleKeyDown = ((modifiers & ModifierKeys.Alt) != 0) || IsKeyDown(Key.NumPad0);
|
||||
|
@ -85,7 +85,7 @@ private void OnPageKeyUp(object sender, KeyEventArgs e)
|
|||
_states[(int)e.Key] = false;
|
||||
_updateAnyKeyDown = true;
|
||||
|
||||
ModifierKeys modifiers = System.Windows.Input.Keyboard.Modifiers;
|
||||
var modifiers = System.Windows.Input.Keyboard.Modifiers;
|
||||
bool control = ((modifiers & ModifierKeys.Control) != 0);
|
||||
|
||||
if (e.Key == Key.CapsLock)
|
||||
|
@ -121,7 +121,7 @@ private void OnPageKeyUp(object sender, KeyEventArgs e)
|
|||
[SuppressMessage("Microsoft.Maintainability", "CA1505:AvoidUnmaintainableCode")]
|
||||
private int GetAsciiKey(Key key, int platformKeyCode)
|
||||
{
|
||||
ModifierKeys modifiers = System.Windows.Input.Keyboard.Modifiers;
|
||||
var modifiers = System.Windows.Input.Keyboard.Modifiers;
|
||||
bool control = ((modifiers & ModifierKeys.Control) != 0);
|
||||
bool shift = ((modifiers & ModifierKeys.Shift) != 0);
|
||||
bool capsLock = shift ^ _capsLock;
|
||||
|
|
|
@ -20,9 +20,9 @@ public override void Load(string path, Action<Stream> reader)
|
|||
|
||||
try
|
||||
{
|
||||
using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
|
||||
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
|
||||
{
|
||||
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, store))
|
||||
using (var stream = new IsolatedStorageFileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, store))
|
||||
{
|
||||
reader(stream);
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ public override void Save(string path, Action<Stream> writer)
|
|||
|
||||
try
|
||||
{
|
||||
using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
|
||||
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
|
||||
{
|
||||
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, store))
|
||||
using (var stream = new IsolatedStorageFileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, store))
|
||||
{
|
||||
writer(stream);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public override void Update() // main thread
|
|||
|
||||
private void SetImageSize()
|
||||
{
|
||||
Content content = Application.Current.Host.Content;
|
||||
var content = Application.Current.Host.Content;
|
||||
int uniformScale = Math.Min((int)content.ActualWidth / BitmapWidth, (int)content.ActualHeight / BitmapHeight);
|
||||
_image.Width = uniformScale * BitmapWidth;
|
||||
_image.Height = uniformScale * BitmapHeight;
|
||||
|
|
|
@ -921,7 +921,7 @@ private void ResetVSyncEvent()
|
|||
{
|
||||
UpdateSettings();
|
||||
|
||||
EventHandler handler = VSync;
|
||||
var handler = VSync;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, EventArgs.Empty);
|
||||
|
@ -937,7 +937,7 @@ private void SetPixel(int x, int y, int color)
|
|||
|
||||
private void UpdateSettings()
|
||||
{
|
||||
VideoSettings settings = Machine.Settings.Video;
|
||||
var settings = Machine.Settings.Video;
|
||||
|
||||
_colorPalette[ColorMono00] = settings.Color.Black;
|
||||
_colorPalette[ColorMono01] = settings.Color.Monochrome;
|
||||
|
|
|
@ -53,8 +53,7 @@ private void OnCompositionTargetRendering(object sender, EventArgs e)
|
|||
|
||||
private void OnDiskButtonClick(int drive)
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.Filter = "Disk Files (*.dsk;*.nib)|*.dsk;*.nib|All Files (*.*)|*.*";
|
||||
var dialog = new OpenFileDialog() { Filter = "Disk Files (*.dsk;*.nib)|*.dsk;*.nib|All Files (*.*)|*.*" };
|
||||
|
||||
bool? result = dialog.ShowDialog();
|
||||
if (result.HasValue && result.Value)
|
||||
|
|
|
@ -30,7 +30,7 @@ public override bool IsKeyDown(int key)
|
|||
|
||||
public override void Update() // main thread
|
||||
{
|
||||
KeyboardDevice keyboard = System.Windows.Input.Keyboard.PrimaryDevice;
|
||||
var keyboard = System.Windows.Input.Keyboard.PrimaryDevice;
|
||||
if (_updateAnyKeyDown)
|
||||
{
|
||||
_updateAnyKeyDown = false;
|
||||
|
|
|
@ -21,9 +21,9 @@ public override void Load(string path, Action<Stream> reader)
|
|||
|
||||
try
|
||||
{
|
||||
using (IsolatedStorageFile store = GetStore())
|
||||
using (var store = GetStore())
|
||||
{
|
||||
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, store))
|
||||
using (var stream = new IsolatedStorageFileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, store))
|
||||
{
|
||||
reader(stream);
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ public override void Save(string path, Action<Stream> writer)
|
|||
|
||||
try
|
||||
{
|
||||
using (IsolatedStorageFile store = GetStore())
|
||||
using (var store = GetStore())
|
||||
{
|
||||
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, store))
|
||||
using (var stream = new IsolatedStorageFileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, store))
|
||||
{
|
||||
writer(stream);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ static class MainApp
|
|||
{
|
||||
static void Main()
|
||||
{
|
||||
using (MainGame game = new MainGame())
|
||||
using (var game = new MainGame())
|
||||
{
|
||||
game.Run();
|
||||
}
|
||||
|
|
|
@ -32,10 +32,7 @@ protected override void Dispose(bool disposing)
|
|||
|
||||
private void OnDirectSoundUpdate(object sender, DirectSoundUpdateEventArgs e) // audio thread
|
||||
{
|
||||
Update(e.BufferSize, (source, count) =>
|
||||
{
|
||||
Marshal.Copy(source, 0, e.Buffer, count);
|
||||
});
|
||||
Update(e.BufferSize, (source, count) => Marshal.Copy(source, 0, e.Buffer, count));
|
||||
}
|
||||
|
||||
private GameBase _game;
|
||||
|
|
|
@ -17,9 +17,9 @@ public override void Update() // main thread
|
|||
|
||||
if (_state.IsConnected && (_state != _lastState))
|
||||
{
|
||||
Vector2 left = _state.ThumbSticks.Left;
|
||||
Vector2 right = _state.ThumbSticks.Right;
|
||||
GamePadDPad dpad = _state.DPad;
|
||||
var left = _state.ThumbSticks.Left;
|
||||
var right = _state.ThumbSticks.Right;
|
||||
var dpad = _state.DPad;
|
||||
|
||||
Paddle0 = (int)((1 + left.X) * PaddleScale);
|
||||
Paddle1 = (int)((1 - left.Y) * PaddleScale); // invert y
|
||||
|
|
|
@ -23,7 +23,7 @@ public override void Update() // main thread
|
|||
_lastState = _state;
|
||||
_state = Microsoft.Xna.Framework.Input.Keyboard.GetState();
|
||||
|
||||
GamePadState gamePadState = GamePad.GetState(PlayerIndex.One);
|
||||
var gamePadState = GamePad.GetState(PlayerIndex.One);
|
||||
bool gamePadControl = (gamePadState.Buttons.LeftStick == ButtonState.Pressed);
|
||||
|
||||
if (_state != _lastState)
|
||||
|
|
|
@ -28,9 +28,9 @@ public override void Load(string path, Action<Stream> reader)
|
|||
|
||||
try
|
||||
{
|
||||
using (StorageContainer storageContainer = _storageDevice.Value.OpenContainer(_game.Name))
|
||||
using (var storageContainer = _storageDevice.Value.OpenContainer(_game.Name))
|
||||
{
|
||||
using (FileStream stream = new FileStream(Path.Combine(storageContainer.Path, path), FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var stream = new FileStream(Path.Combine(storageContainer.Path, path), FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
reader(stream);
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ public override void Save(string path, Action<Stream> writer)
|
|||
throw new ArgumentNullException("writer");
|
||||
}
|
||||
|
||||
using (StorageContainer storageContainer = _storageDevice.Value.OpenContainer(_game.Name))
|
||||
using (var storageContainer = _storageDevice.Value.OpenContainer(_game.Name))
|
||||
{
|
||||
using (FileStream stream = new FileStream(Path.Combine(storageContainer.Path, path), FileMode.Create, FileAccess.Write, FileShare.None))
|
||||
using (var stream = new FileStream(Path.Combine(storageContainer.Path, path), FileMode.Create, FileAccess.Write, FileShare.None))
|
||||
{
|
||||
writer(stream);
|
||||
}
|
||||
|
|
|
@ -64,8 +64,8 @@ protected override void Dispose(bool disposing)
|
|||
|
||||
private void OnGraphicsDeviceManagerPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
|
||||
{
|
||||
DisplayMode displayMode = e.GraphicsDeviceInformation.Adapter.CurrentDisplayMode;
|
||||
PresentationParameters presentationParameters = e.GraphicsDeviceInformation.PresentationParameters;
|
||||
var displayMode = e.GraphicsDeviceInformation.Adapter.CurrentDisplayMode;
|
||||
var presentationParameters = e.GraphicsDeviceInformation.PresentationParameters;
|
||||
|
||||
#if WINDOWS
|
||||
if (presentationParameters.IsFullScreen)
|
||||
|
|
Loading…
Reference in New Issue
Block a user