From c3b65587f3b778eaa9e638963a61b739c8f210e3 Mon Sep 17 00:00:00 2001 From: Sean Fausett Date: Sat, 18 Sep 2010 00:36:42 +1200 Subject: [PATCH] Upgraded to Windows Phone 7 & XNA Game Studio 4.0 RTW. --- Library/Silverlight/ApplicationBase.cs | 8 ++++++ .../Jellyfish.Library.Silverlight.csproj | 6 ----- ...Jellyfish.Library.Silverlight.Phone.csproj | 6 ----- Library/ThreadExtensions.cs | 23 ---------------- Library/WaitHandleExtensions.cs | 20 -------------- Library/Wpf/Jellyfish.Library.Wpf.csproj | 6 ----- .../Xna/Jellyfish.Library.Xna.Phone.csproj | 6 ----- Library/Xna/Jellyfish.Library.Xna.Xbox.csproj | 9 +++---- Library/Xna/Jellyfish.Library.Xna.csproj | 26 +++++++------------ Virtu/Machine.cs | 5 +++- Virtu/MachineSettings.cs | 4 --- .../Phone/Properties/WMAppManifest.xml | 22 +++++++++------- .../Jellyfish.Virtu.Xna.Content.contentproj | 12 ++++----- Virtu/Xna/Jellyfish.Virtu.Xna.csproj | 18 ++++++------- Virtu/Xna/Properties/WMAppManifest.xml | 24 +++++++++-------- Virtu/Xna/Services/XnaStorageService.cs | 4 +-- 16 files changed, 67 insertions(+), 132 deletions(-) delete mode 100644 Library/ThreadExtensions.cs delete mode 100644 Library/WaitHandleExtensions.cs diff --git a/Library/Silverlight/ApplicationBase.cs b/Library/Silverlight/ApplicationBase.cs index 60c21b4..1cfbde0 100644 --- a/Library/Silverlight/ApplicationBase.cs +++ b/Library/Silverlight/ApplicationBase.cs @@ -23,6 +23,14 @@ public ApplicationBase(string name) UnhandledException += OnApplicationUnhandledException; //AppDomain.CurrentDomain.UnhandledException += OnAppDomainUnhandledException; + + if (Debugger.IsAttached) + { + var settings = Application.Current.Host.Settings; + settings.EnableFrameRateCounter = true; + //settings.EnableRedrawRegions = true; + //settings.EnableCacheVisualization = true; + } } #if !WINDOWS_PHONE diff --git a/Library/Silverlight/Jellyfish.Library.Silverlight.csproj b/Library/Silverlight/Jellyfish.Library.Silverlight.csproj index aa19196..2050bde 100644 --- a/Library/Silverlight/Jellyfish.Library.Silverlight.csproj +++ b/Library/Silverlight/Jellyfish.Library.Silverlight.csproj @@ -98,12 +98,6 @@ StringBuilderExtensions.cs - - ThreadExtensions.cs - - - WaitHandleExtensions.cs - WaveFormat.cs diff --git a/Library/Silverlight/Phone/Jellyfish.Library.Silverlight.Phone.csproj b/Library/Silverlight/Phone/Jellyfish.Library.Silverlight.Phone.csproj index 9cab908..cfc137b 100644 --- a/Library/Silverlight/Phone/Jellyfish.Library.Silverlight.Phone.csproj +++ b/Library/Silverlight/Phone/Jellyfish.Library.Silverlight.Phone.csproj @@ -87,12 +87,6 @@ StringBuilderExtensions.cs - - ThreadExtensions.cs - - - WaitHandleExtensions.cs - WaveFormat.cs diff --git a/Library/ThreadExtensions.cs b/Library/ThreadExtensions.cs deleted file mode 100644 index bb35ea1..0000000 --- a/Library/ThreadExtensions.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Threading; - -namespace Jellyfish.Library -{ - public static class ThreadExtensions - { - public static void IsAliveJoin(this Thread thread) - { - if (thread == null) - { - throw new ArgumentNullException("thread"); - } - -#if !XBOX - if (thread.IsAlive) -#endif - { - thread.Join(); - } - } - } -} diff --git a/Library/WaitHandleExtensions.cs b/Library/WaitHandleExtensions.cs deleted file mode 100644 index 1eedcf5..0000000 --- a/Library/WaitHandleExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Threading; - -namespace Jellyfish.Library -{ - public static class WaitHandleExtensions - { -#if XBOX - public static bool WaitOne(this WaitHandle waitHandle, int millisecondsTimeout) - { - if (waitHandle == null) - { - throw new ArgumentNullException("waitHandle"); - } - - return waitHandle.WaitOne(millisecondsTimeout, false); - } -#endif - } -} diff --git a/Library/Wpf/Jellyfish.Library.Wpf.csproj b/Library/Wpf/Jellyfish.Library.Wpf.csproj index 94921a3..b45dad7 100644 --- a/Library/Wpf/Jellyfish.Library.Wpf.csproj +++ b/Library/Wpf/Jellyfish.Library.Wpf.csproj @@ -104,12 +104,6 @@ StringBuilderExtensions.cs - - ThreadExtensions.cs - - - WaitHandleExtensions.cs - WaveFormat.cs diff --git a/Library/Xna/Jellyfish.Library.Xna.Phone.csproj b/Library/Xna/Jellyfish.Library.Xna.Phone.csproj index b70d023..39fb189 100644 --- a/Library/Xna/Jellyfish.Library.Xna.Phone.csproj +++ b/Library/Xna/Jellyfish.Library.Xna.Phone.csproj @@ -116,12 +116,6 @@ StringBuilderExtensions.cs - - ThreadExtensions.cs - - - WaitHandleExtensions.cs - XmlSerializerHelpers.cs diff --git a/Library/Xna/Jellyfish.Library.Xna.Xbox.csproj b/Library/Xna/Jellyfish.Library.Xna.Xbox.csproj index 187ba50..d5157db 100644 --- a/Library/Xna/Jellyfish.Library.Xna.Xbox.csproj +++ b/Library/Xna/Jellyfish.Library.Xna.Xbox.csproj @@ -102,6 +102,9 @@ 4.0 False + + False + @@ -128,12 +131,6 @@ StringBuilderExtensions.cs - - ThreadExtensions.cs - - - WaitHandleExtensions.cs - XmlSerializerHelpers.cs diff --git a/Library/Xna/Jellyfish.Library.Xna.csproj b/Library/Xna/Jellyfish.Library.Xna.csproj index e8fe775..289517a 100644 --- a/Library/Xna/Jellyfish.Library.Xna.csproj +++ b/Library/Xna/Jellyfish.Library.Xna.csproj @@ -55,34 +55,34 @@ ..\..\..\Jellyfish\StrongName.snk - + False - + False - + False - + False - + False - + False - + False - + False - + False - + False @@ -140,12 +140,6 @@ StringBuilderExtensions.cs - - ThreadExtensions.cs - - - WaitHandleExtensions.cs - XmlSerializerHelpers.cs diff --git a/Virtu/Machine.cs b/Virtu/Machine.cs index 1f52720..e6a6c18 100644 --- a/Virtu/Machine.cs +++ b/Virtu/Machine.cs @@ -78,7 +78,10 @@ public void Stop() { State = MachineState.Stopping; _unpauseEvent.Set(); - Thread.IsAliveJoin(); + if (Thread.IsAlive) + { + Thread.Join(); + } State = MachineState.Stopped; if (_storageService != null) diff --git a/Virtu/MachineSettings.cs b/Virtu/MachineSettings.cs index df29680..d4314fd 100644 --- a/Virtu/MachineSettings.cs +++ b/Virtu/MachineSettings.cs @@ -36,11 +36,7 @@ public MachineSettings() Button0 = 0, Button1 = 0, Button2 = 0 } }; -#if WINDOWS_PHONE - Audio = new AudioSettings { Volume = 0.85 }; -#else Audio = new AudioSettings { Volume = 0.5 }; -#endif Video = new VideoSettings { IsFullScreen = false, IsMonochrome = false, ScannerOptions = ScannerOptions.None, diff --git a/Virtu/Silverlight/Phone/Properties/WMAppManifest.xml b/Virtu/Silverlight/Phone/Properties/WMAppManifest.xml index 705ac42..9d4dcbe 100644 --- a/Virtu/Silverlight/Phone/Properties/WMAppManifest.xml +++ b/Virtu/Silverlight/Phone/Properties/WMAppManifest.xml @@ -3,18 +3,20 @@ AppIcon.png - - - - - - - - - + + + + + + + + + + + - + diff --git a/Virtu/Xna/Content/Jellyfish.Virtu.Xna.Content.contentproj b/Virtu/Xna/Content/Jellyfish.Virtu.Xna.Content.contentproj index 26d3f90..3566f98 100644 --- a/Virtu/Xna/Content/Jellyfish.Virtu.Xna.Content.contentproj +++ b/Virtu/Xna/Content/Jellyfish.Virtu.Xna.Content.contentproj @@ -19,22 +19,22 @@ AllRules.ruleset - + False - + False - + False - + False - + False - + False diff --git a/Virtu/Xna/Jellyfish.Virtu.Xna.csproj b/Virtu/Xna/Jellyfish.Virtu.Xna.csproj index 6f8b23b..35e2bd6 100644 --- a/Virtu/Xna/Jellyfish.Virtu.Xna.csproj +++ b/Virtu/Xna/Jellyfish.Virtu.Xna.csproj @@ -72,31 +72,31 @@ ..\..\..\Jellyfish\CodeSign.pfx - + False - + False - + False - + False - + False - + False - + False - + False - + False diff --git a/Virtu/Xna/Properties/WMAppManifest.xml b/Virtu/Xna/Properties/WMAppManifest.xml index 9626b18..9b050be 100644 --- a/Virtu/Xna/Properties/WMAppManifest.xml +++ b/Virtu/Xna/Properties/WMAppManifest.xml @@ -1,20 +1,22 @@  - + AppThumbnail.png - - - - - - - - - + + + + + + + + + + + - + diff --git a/Virtu/Xna/Services/XnaStorageService.cs b/Virtu/Xna/Services/XnaStorageService.cs index 7a6ce0e..7a593e5 100644 --- a/Virtu/Xna/Services/XnaStorageService.cs +++ b/Virtu/Xna/Services/XnaStorageService.cs @@ -29,7 +29,7 @@ public override void Load(string path, Action reader) { using (var storageContainer = OpenContainer()) { - using (var stream = storageContainer.OpenFile(path)) + using (var stream = storageContainer.OpenFile(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { reader(stream); } @@ -49,7 +49,7 @@ public override void Save(string path, Action writer) using (var storageContainer = OpenContainer()) { - using (var stream = storageContainer.OpenFile(path)) + using (var stream = storageContainer.OpenFile(path, FileMode.Create, FileAccess.Write, FileShare.None)) { writer(stream); }