From 656911fb6ac18e23bcb71369646b00766fd93300 Mon Sep 17 00:00:00 2001 From: TotallyEvil Developers Date: Tue, 25 Jun 2013 21:32:46 -0700 Subject: [PATCH] fixes for xbox 360 --- cocos2d-xna.XBox360.sln | 68 ++----------------------- cocos2d/actions/CCActionManager.cs | 2 +- cocos2d/platform/CCArrayPool.cs | 4 +- cocos2d/platform/CCRawList.cs | 10 ++-- cocos2d/support/zip_support/ZipUtils.cs | 13 +++++ cocos2d/textures/CCTexture2D.cs | 4 +- 6 files changed, 26 insertions(+), 75 deletions(-) diff --git a/cocos2d-xna.XBox360.sln b/cocos2d-xna.XBox360.sln index 6c4018fc..f06c25bd 100644 --- a/cocos2d-xna.XBox360.sln +++ b/cocos2d-xna.XBox360.sln @@ -45,42 +45,6 @@ Global {FBE4633D-00D1-4391-8184-63B91DA28D4B}.Release|x86.Build.0 = Release|x86 {FBE4633D-00D1-4391-8184-63B91DA28D4B}.Release|Xbox 360.ActiveCfg = Release|x86 {FBE4633D-00D1-4391-8184-63B91DA28D4B}.Release|Xbox 360.Build.0 = Release|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Debug|Any CPU.ActiveCfg = Debug|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Debug|Windows Phone.ActiveCfg = Debug|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Debug|Windows Phone.Build.0 = Debug|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Debug|x86.ActiveCfg = Debug|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Debug|x86.Build.0 = Debug|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Debug|Xbox 360.ActiveCfg = Debug|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Debug|Xbox 360.Build.0 = Debug|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Release|Any CPU.ActiveCfg = Release|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Release|Mixed Platforms.Build.0 = Release|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Release|Windows Phone.ActiveCfg = Release|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Release|Windows Phone.Build.0 = Release|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Release|x86.ActiveCfg = Release|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Release|x86.Build.0 = Release|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Release|Xbox 360.ActiveCfg = Release|x86 - {0C0AFDFF-A4E4-49F4-B6DB-A761B0DB64A8}.Release|Xbox 360.Build.0 = Release|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Debug|Any CPU.ActiveCfg = Debug|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Debug|Windows Phone.ActiveCfg = Debug|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Debug|Windows Phone.Build.0 = Debug|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Debug|x86.ActiveCfg = Debug|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Debug|x86.Build.0 = Debug|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Debug|Xbox 360.ActiveCfg = Debug|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Debug|Xbox 360.Build.0 = Debug|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Release|Any CPU.ActiveCfg = Release|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Release|Mixed Platforms.Build.0 = Release|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Release|Windows Phone.ActiveCfg = Release|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Release|Windows Phone.Build.0 = Release|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Release|x86.ActiveCfg = Release|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Release|x86.Build.0 = Release|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Release|Xbox 360.ActiveCfg = Release|x86 - {8877C885-BEC4-4165-8A19-9C07FF9EC026}.Release|Xbox 360.Build.0 = Release|x86 {2CE0B38F-5C9C-4088-8FEC-D3B58EE48E35}.Debug|Any CPU.ActiveCfg = Debug|Windows Phone {2CE0B38F-5C9C-4088-8FEC-D3B58EE48E35}.Debug|Mixed Platforms.ActiveCfg = Debug|Windows Phone {2CE0B38F-5C9C-4088-8FEC-D3B58EE48E35}.Debug|Mixed Platforms.Build.0 = Debug|Windows Phone @@ -94,6 +58,7 @@ Global {2CE0B38F-5C9C-4088-8FEC-D3B58EE48E35}.Release|Xbox 360.ActiveCfg = Release|Windows Phone {D551499A-180B-40DA-BEB0-97E42B38BF95}.Debug|Any CPU.ActiveCfg = Debug|Xbox 360 {D551499A-180B-40DA-BEB0-97E42B38BF95}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360 + {D551499A-180B-40DA-BEB0-97E42B38BF95}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360 {D551499A-180B-40DA-BEB0-97E42B38BF95}.Debug|Windows Phone.ActiveCfg = Debug|Xbox 360 {D551499A-180B-40DA-BEB0-97E42B38BF95}.Debug|Windows Phone.Build.0 = Debug|Xbox 360 {D551499A-180B-40DA-BEB0-97E42B38BF95}.Debug|x86.ActiveCfg = Debug|Xbox 360 @@ -109,6 +74,7 @@ Global {D551499A-180B-40DA-BEB0-97E42B38BF95}.Release|Xbox 360.Build.0 = Release|Xbox 360 {CABEE593-BC24-49D8-8969-0CE97D437E0F}.Debug|Any CPU.ActiveCfg = Debug|Xbox 360 {CABEE593-BC24-49D8-8969-0CE97D437E0F}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360 + {CABEE593-BC24-49D8-8969-0CE97D437E0F}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360 {CABEE593-BC24-49D8-8969-0CE97D437E0F}.Debug|Windows Phone.ActiveCfg = Debug|Xbox 360 {CABEE593-BC24-49D8-8969-0CE97D437E0F}.Debug|Windows Phone.Build.0 = Debug|Xbox 360 {CABEE593-BC24-49D8-8969-0CE97D437E0F}.Debug|x86.ActiveCfg = Debug|Xbox 360 @@ -125,24 +91,9 @@ Global {CABEE593-BC24-49D8-8969-0CE97D437E0F}.Release|Xbox 360.ActiveCfg = Release|Xbox 360 {CABEE593-BC24-49D8-8969-0CE97D437E0F}.Release|Xbox 360.Build.0 = Release|Xbox 360 {CABEE593-BC24-49D8-8969-0CE97D437E0F}.Release|Xbox 360.Deploy.0 = Release|Xbox 360 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Debug|Any CPU.ActiveCfg = Debug|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Debug|Windows Phone.ActiveCfg = Debug|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Debug|Windows Phone.Build.0 = Debug|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Debug|x86.ActiveCfg = Debug|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Debug|x86.Build.0 = Debug|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Debug|Xbox 360.ActiveCfg = Debug|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Release|Any CPU.ActiveCfg = Release|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Release|Mixed Platforms.Build.0 = Release|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Release|Windows Phone.ActiveCfg = Release|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Release|Windows Phone.Build.0 = Release|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Release|x86.ActiveCfg = Release|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Release|x86.Build.0 = Release|x86 - {B81B6701-7A78-4846-BF6F-04E0591F0F38}.Release|Xbox 360.ActiveCfg = Release|x86 {2429512B-C898-49C5-84BE-E4A659FC1647}.Debug|Any CPU.ActiveCfg = Debug|Xbox 360 {2429512B-C898-49C5-84BE-E4A659FC1647}.Debug|Mixed Platforms.ActiveCfg = Debug|Xbox 360 + {2429512B-C898-49C5-84BE-E4A659FC1647}.Debug|Mixed Platforms.Build.0 = Debug|Xbox 360 {2429512B-C898-49C5-84BE-E4A659FC1647}.Debug|Windows Phone.ActiveCfg = Debug|Xbox 360 {2429512B-C898-49C5-84BE-E4A659FC1647}.Debug|Windows Phone.Build.0 = Debug|Xbox 360 {2429512B-C898-49C5-84BE-E4A659FC1647}.Debug|x86.ActiveCfg = Debug|Xbox 360 @@ -156,19 +107,6 @@ Global {2429512B-C898-49C5-84BE-E4A659FC1647}.Release|x86.ActiveCfg = Release|Xbox 360 {2429512B-C898-49C5-84BE-E4A659FC1647}.Release|Xbox 360.ActiveCfg = Release|Xbox 360 {2429512B-C898-49C5-84BE-E4A659FC1647}.Release|Xbox 360.Build.0 = Release|Xbox 360 - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Debug|Any CPU.ActiveCfg = Debug|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Debug|Mixed Platforms.ActiveCfg = Debug|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Debug|Windows Phone.ActiveCfg = Debug|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Debug|Windows Phone.Build.0 = Debug|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Debug|x86.ActiveCfg = Debug|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Debug|Xbox 360.ActiveCfg = Debug|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Release|Any CPU.ActiveCfg = Release|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Release|Mixed Platforms.ActiveCfg = Release|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Release|Mixed Platforms.Build.0 = Release|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Release|Windows Phone.ActiveCfg = Release|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Release|Windows Phone.Build.0 = Release|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Release|x86.ActiveCfg = Release|Windows Phone - {8165599E-6F37-41B7-91CD-C7C66232B5F2}.Release|Xbox 360.ActiveCfg = Release|Windows Phone EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/cocos2d/actions/CCActionManager.cs b/cocos2d/actions/CCActionManager.cs index dc02445a..6e71346f 100644 --- a/cocos2d/actions/CCActionManager.cs +++ b/cocos2d/actions/CCActionManager.cs @@ -245,7 +245,7 @@ public void RemoveAllActionsFromTarget(CCNode target) public void RemoveAction(CCAction action) { - if (action == null) + if (action == null || action.OriginalTarget == null) { return; } diff --git a/cocos2d/platform/CCArrayPool.cs b/cocos2d/platform/CCArrayPool.cs index b6a880aa..5e973223 100644 --- a/cocos2d/platform/CCArrayPool.cs +++ b/cocos2d/platform/CCArrayPool.cs @@ -10,7 +10,7 @@ public static class ArrayPool { private static readonly Dictionary> _unused = new Dictionary>(); -#if WINDOWS_PHONE +#if WINDOWS_PHONE || XBOX public static T[] Create(int length) { return (Create(length, true)); @@ -45,7 +45,7 @@ public static T[] Create(int length, bool pow = true) return new T[length]; } -#if WINDOWS_PHONE +#if WINDOWS_PHONE || XBOX public static void Resize(ref T[] array, int length) { Resize(ref array, length, true); diff --git a/cocos2d/platform/CCRawList.cs b/cocos2d/platform/CCRawList.cs index 388d147e..6709150f 100644 --- a/cocos2d/platform/CCRawList.cs +++ b/cocos2d/platform/CCRawList.cs @@ -25,15 +25,15 @@ public class CCRawList : IList /// /// Constructs an empty list. /// -#if WINDOWS_PHONE +#if WINDOWS_PHONE || XBOX public CCRawList() : this(false) { } public CCRawList(bool useArrayPool) -#else +#elif !XBOX public CCRawList(bool useArrayPool = false) #endif - { + { UseArrayPool = useArrayPool; if (useArrayPool) @@ -53,7 +53,7 @@ public CCRawList(bool useArrayPool = false) /// ///Initial capacity to allocate for the list. ///Thrown when the initial capacity is zero or negative. -#if WINDOWS_PHONE +#if WINDOWS_PHONE || XBOX public CCRawList(int initialCapacity) : this(initialCapacity, false) { @@ -75,7 +75,7 @@ public CCRawList(int initialCapacity, bool useArrayPool = false) /// Constructs a raw list from another list. /// ///List to copy. -#if WINDOWS_PHONE +#if WINDOWS_PHONE || XBOX public CCRawList(IList elements) : this(elements, false) { } diff --git a/cocos2d/support/zip_support/ZipUtils.cs b/cocos2d/support/zip_support/ZipUtils.cs index 6c41dd5e..87fee848 100644 --- a/cocos2d/support/zip_support/ZipUtils.cs +++ b/cocos2d/support/zip_support/ZipUtils.cs @@ -62,7 +62,20 @@ public static int InflateMemory(byte[] parameterin, uint inLength, byte[] parame try { GZipStream gs = new GZipStream(new MemoryStream(parameterin, false)); // , CompressionMode.Decompress, false); +#if XBOX + byte[] b = new byte[8096]; + while (gs.CanRead) + { + int amt = gs.Read(b, 0, b.Length); + if (amt <= 0) + { + break; + } + ms.Write(b, 0, amt); + } +#else gs.CopyTo(ms); +#endif return ((int)ms.Length); } catch (Exception) diff --git a/cocos2d/textures/CCTexture2D.cs b/cocos2d/textures/CCTexture2D.cs index 38733acf..223a49e6 100644 --- a/cocos2d/textures/CCTexture2D.cs +++ b/cocos2d/textures/CCTexture2D.cs @@ -141,7 +141,7 @@ public uint BitsPerPixelForFormat switch (m_ePixelFormat) { case SurfaceFormat.Dxt1: -#if !WINDOWS && !WINDOWS_PHONE +#if !WINDOWS && !WINDOWS_PHONE && !XBOX case SurfaceFormat.Dxt1a: case SurfaceFormat.RgbPvrtc2Bpp: case SurfaceFormat.RgbaPvrtc2Bpp: @@ -152,7 +152,7 @@ public uint BitsPerPixelForFormat case SurfaceFormat.Dxt3: case SurfaceFormat.Dxt5: -#if !WINDOWS && !WINDOWS_PHONE +#if !WINDOWS && !WINDOWS_PHONE && !XBOX case SurfaceFormat.RgbPvrtc4Bpp: case SurfaceFormat.RgbaPvrtc4Bpp: #endif