From 345f91d3ec82f93528ae9d1863ed98250b4cf133 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 30 Mar 2016 19:35:12 +0100 Subject: [PATCH] Remove the null renderer. --- Makefile | 15 +-- OpenRA.Game/Sound/Sound.cs | 1 - OpenRA.Platforms.Null/NullGraphicsDevice.cs | 105 ------------------ OpenRA.Platforms.Null/NullPlatform.cs | 31 ------ OpenRA.Platforms.Null/NullSound.cs | 58 ---------- .../OpenRA.Platforms.Null.csproj | 98 ---------------- OpenRA.sln | 6 - packaging/package-all.sh | 6 +- packaging/windows/OpenRA.nsi | 2 - 9 files changed, 6 insertions(+), 316 deletions(-) delete mode 100644 OpenRA.Platforms.Null/NullGraphicsDevice.cs delete mode 100644 OpenRA.Platforms.Null/NullPlatform.cs delete mode 100644 OpenRA.Platforms.Null/NullSound.cs delete mode 100644 OpenRA.Platforms.Null/OpenRA.Platforms.Null.csproj diff --git a/Makefile b/Makefile index a9600dcb0f..5639dc2df3 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,7 @@ INSTALL_PROGRAM = $(INSTALL) -m755 INSTALL_DATA = $(INSTALL) -m644 # program targets -CORE = pdefault pnull game utility server +CORE = pdefault game utility server TOOLS = gamemonitor VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`) @@ -119,14 +119,8 @@ pdefault_TARGET = OpenRA.Platforms.Default.dll pdefault_KIND = library pdefault_DEPS = $(game_TARGET) pdefault_LIBS = $(COMMON_LIBS) thirdparty/download/SDL2-CS.dll thirdparty/download/OpenAL-CS.dll $(pdefault_DEPS) - -pnull_SRCS := $(shell find OpenRA.Platforms.Null/ -iname '*.cs') -pnull_TARGET = OpenRA.Platforms.Null.dll -pnull_KIND = library -pnull_DEPS = $(game_TARGET) -pnull_LIBS = $(COMMON_LIBS) $(pnull_DEPS) -PROGRAMS += pdefault pnull -platforms: $(pdefault_TARGET) $(pnull_TARGET) +PROGRAMS += pdefault +platforms: $(pdefault_TARGET) # Mods Common mod_common_SRCS := $(shell find OpenRA.Mods.Common/ -iname '*.cs') @@ -202,9 +196,6 @@ check: utility mods @echo "Checking for code style violations in OpenRA.Platforms.Default..." @mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Default @echo - @echo "Checking for code style violations in OpenRA.Platforms.Null..." - @mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Null - @echo @echo "Checking for code style violations in OpenRA.GameMonitor..." @mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.GameMonitor @echo diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index 3b996ee329..4abfcee29b 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -94,7 +94,6 @@ namespace OpenRA { var defaultDevices = new[] { - new SoundDevice("Default", null, "Default Output"), new SoundDevice("Null", null, "Output Disabled") }; diff --git a/OpenRA.Platforms.Null/NullGraphicsDevice.cs b/OpenRA.Platforms.Null/NullGraphicsDevice.cs deleted file mode 100644 index 3535d97eeb..0000000000 --- a/OpenRA.Platforms.Null/NullGraphicsDevice.cs +++ /dev/null @@ -1,105 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2016 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using System; -using System.Drawing; -using OpenRA.Graphics; - -namespace OpenRA.Platforms.Null -{ - public sealed class NullGraphicsDevice : IGraphicsDevice - { - public Size WindowSize { get; private set; } - - public NullGraphicsDevice(Size size, WindowMode window) - { - Console.WriteLine("Using Null renderer"); - WindowSize = size; - } - - public void Dispose() { } - - public void EnableScissor(int left, int top, int width, int height) { } - public void DisableScissor() { } - - public void EnableDepthBuffer() { } - public void DisableDepthBuffer() { } - - public void SetBlendMode(BlendMode mode) { } - - public void GrabWindowMouseFocus() { } - public void ReleaseWindowMouseFocus() { } - - public void Clear() { } - public void Present() { } - public Bitmap TakeScreenshot() { return new Bitmap(1, 1); } - - public string GetClipboardText() { return ""; } - public bool SetClipboardText(string text) { return false; } - public void PumpInput(IInputHandler ih) - { - Game.HasInputFocus = false; - ih.ModifierKeys(Modifiers.None); - } - - public void DrawPrimitives(PrimitiveType pt, int firstVertex, int numVertices) { } - - public IVertexBuffer CreateVertexBuffer(int size) { return new NullVertexBuffer(); } - public ITexture CreateTexture() { return new NullTexture(); } - public ITexture CreateTexture(Bitmap bitmap) { return new NullTexture(); } - public IFrameBuffer CreateFrameBuffer(Size s) { return new NullFrameBuffer(); } - public IShader CreateShader(string name) { return new NullShader(); } - - public IHardwareCursor CreateHardwareCursor(string name, Size size, byte[] data, int2 hotspot) { return null; } - public void SetHardwareCursor(IHardwareCursor cursor) { } - - public string GLVersion { get { return "(null)"; } } - } - - public class NullShader : IShader - { - public void SetBool(string name, bool value) { } - public void SetVec(string name, float x) { } - public void SetVec(string name, float x, float y) { } - public void SetVec(string name, float[] vec, int length) { } - public void SetTexture(string param, ITexture texture) { } - public void SetMatrix(string param, float[] mtx) { } - public void Render(Action a) { } - } - - public sealed class NullTexture : ITexture - { - public TextureScaleFilter ScaleFilter { get { return TextureScaleFilter.Nearest; } set { } } - public void SetData(Bitmap bitmap) { } - public void SetData(uint[,] colors) { } - public void SetData(byte[] colors, int width, int height) { } - public byte[] GetData() { return new byte[0]; } - public Size Size { get { return new Size(0, 0); } } - public void Dispose() { } - } - - public sealed class NullFrameBuffer : IFrameBuffer - { - public void Bind() { } - public void Unbind() { } - public ITexture Texture { get { return new NullTexture(); } } - public void Dispose() { } - } - - sealed class NullVertexBuffer : IVertexBuffer - { - public void Bind() { } - public void SetData(T[] vertices, int length) { } - public void SetData(T[] vertices, int start, int length) { } - public void SetData(IntPtr data, int start, int length) { } - public void Dispose() { } - } -} diff --git a/OpenRA.Platforms.Null/NullPlatform.cs b/OpenRA.Platforms.Null/NullPlatform.cs deleted file mode 100644 index f32b783273..0000000000 --- a/OpenRA.Platforms.Null/NullPlatform.cs +++ /dev/null @@ -1,31 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2016 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using System.Drawing; -using OpenRA; - -[assembly: Platform(typeof(OpenRA.Platforms.Null.DeviceFactory))] - -namespace OpenRA.Platforms.Null -{ - public class DeviceFactory : IDeviceFactory - { - public IGraphicsDevice CreateGraphics(Size size, WindowMode windowMode) - { - return new NullGraphicsDevice(size, windowMode); - } - - public ISoundEngine CreateSound() - { - return new NullSoundEngine(); - } - } -} diff --git a/OpenRA.Platforms.Null/NullSound.cs b/OpenRA.Platforms.Null/NullSound.cs deleted file mode 100644 index 8401f216e8..0000000000 --- a/OpenRA.Platforms.Null/NullSound.cs +++ /dev/null @@ -1,58 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2016 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using System; - -namespace OpenRA.Platforms.Null -{ - sealed class NullSoundEngine : ISoundEngine - { - public SoundDevice[] AvailableDevices() - { - return new[] { new SoundDevice("Null", null, "Output Disabled") }; - } - - public NullSoundEngine() - { - Console.WriteLine("Using Null sound engine which disables SFX completely"); - } - - public ISoundSource AddSoundSourceFromMemory(byte[] data, int channels, int sampleBits, int sampleRate) - { - return new NullSoundSource(); - } - - public ISound Play2D(ISoundSource sound, bool loop, bool relative, WPos pos, float volume, bool attenuateVolume) - { - return new NullSound(); - } - - public void PauseSound(ISound sound, bool paused) { } - public void StopSound(ISound sound) { } - public void SetAllSoundsPaused(bool paused) { } - public void StopAllSounds() { } - public void SetListenerPosition(WPos position) { } - public void SetSoundVolume(float volume, ISound music, ISound video) { } - - public float Volume { get; set; } - - public void Dispose() { } - } - - class NullSoundSource : ISoundSource { } - - class NullSound : ISound - { - public float Volume { get; set; } - public float SeekPosition { get { return 0; } } - public bool Playing { get { return false; } } - } -} diff --git a/OpenRA.Platforms.Null/OpenRA.Platforms.Null.csproj b/OpenRA.Platforms.Null/OpenRA.Platforms.Null.csproj deleted file mode 100644 index 56d84e16a0..0000000000 --- a/OpenRA.Platforms.Null/OpenRA.Platforms.Null.csproj +++ /dev/null @@ -1,98 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {0C4AEC1A-E7D5-4114-8CCD-3EEC82872981} - Library - Properties - OpenRA.Platforms.Null - OpenRA.Platforms.Null - 512 - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - true - full - ..\ - DEBUG;TRACE - x86 - prompt - AllRules.ruleset - true - - - true - ..\ - TRACE - true - pdbonly - x86 - prompt - AllRules.ruleset - true - - - - - - ..\thirdparty\download\Eluant.dll - - - - - - - - - - {0DFB103F-2962-400F-8C6D-E2C28CCBA633} - OpenRA.Game - False - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - \ No newline at end of file diff --git a/OpenRA.sln b/OpenRA.sln index dd0679d53e..a1e627ecd7 100644 --- a/OpenRA.sln +++ b/OpenRA.sln @@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.Cnc", "OpenRA.M EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Utility", "OpenRA.Utility\OpenRA.Utility.csproj", "{F33337BE-CB69-4B24-850F-07D23E408DDF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Platforms.Null", "OpenRA.Platforms.Null\OpenRA.Platforms.Null.csproj", "{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Server", "OpenRA.Server\OpenRA.Server.csproj", "{76F621A1-3D8E-4A99-9F7E-B071EB657817}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.D2k", "OpenRA.Mods.D2k\OpenRA.Mods.D2k.csproj", "{C0B0465C-6BE2-409C-8770-3A9BF64C4344}" @@ -133,10 +131,6 @@ Global {76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug|x86.Build.0 = Debug|x86 {76F621A1-3D8E-4A99-9F7E-B071EB657817}.Release|x86.ActiveCfg = Release|x86 {76F621A1-3D8E-4A99-9F7E-B071EB657817}.Release|x86.Build.0 = Release|x86 - {0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|x86.ActiveCfg = Debug|x86 - {0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|x86.Build.0 = Debug|x86 - {0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Release|x86.ActiveCfg = Release|x86 - {0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Release|x86.Build.0 = Release|x86 {C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Debug|x86.ActiveCfg = Debug|x86 {C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Debug|x86.Build.0 = Debug|x86 {C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Release|x86.ActiveCfg = Release|x86 diff --git a/packaging/package-all.sh b/packaging/package-all.sh index 073477dc5d..6b2dc6fc98 100755 --- a/packaging/package-all.sh +++ b/packaging/package-all.sh @@ -31,9 +31,9 @@ markdown DOCUMENTATION.md > DOCUMENTATION.html markdown Lua-API.md > Lua-API.html # List of files that are packaged on all platforms -FILES=('OpenRA.Game.exe' 'OpenRA.Game.exe.config' 'OpenRA.Utility.exe' 'OpenRA.Server.exe' \ -'OpenRA.Platforms.Default.dll' 'OpenRA.Platforms.Null.dll' \ - 'lua' 'glsl' 'mods/common' 'mods/ra' 'mods/cnc' 'mods/d2k' 'mods/modchooser' \ +FILES=('OpenRA.Game.exe' 'OpenRA.Game.exe.config' 'OpenRA.Utility.exe' 'OpenRA.Server.exe' +'OpenRA.Platforms.Default.dll' \ +'lua' 'glsl' 'mods/common' 'mods/ra' 'mods/cnc' 'mods/d2k' 'mods/modchooser' \ 'AUTHORS' 'COPYING' 'README.html' 'CONTRIBUTING.html' 'DOCUMENTATION.html' 'CHANGELOG.html' \ 'global mix database.dat' 'GeoLite2-Country.mmdb.gz') diff --git a/packaging/windows/OpenRA.nsi b/packaging/windows/OpenRA.nsi index 0d3a1379b7..0eaffbcdc7 100644 --- a/packaging/windows/OpenRA.nsi +++ b/packaging/windows/OpenRA.nsi @@ -86,7 +86,6 @@ Section "Game" GAME File "${SRCDIR}\OpenRA.Game.exe.config" File "${SRCDIR}\OpenRA.Utility.exe" File "${SRCDIR}\OpenRA.Server.exe" - File "${SRCDIR}\OpenRA.Platforms.Null.dll" File "${SRCDIR}\OpenRA.Platforms.Default.dll" File "${SRCDIR}\ICSharpCode.SharpZipLib.dll" File "${SRCDIR}\FuzzyLogicLibrary.dll" @@ -192,7 +191,6 @@ Function ${UN}Clean Delete $INSTDIR\OpenRA.Game.exe.config Delete $INSTDIR\OpenRA.Utility.exe Delete $INSTDIR\OpenRA.Server.exe - Delete $INSTDIR\OpenRA.Platforms.Null.dll Delete $INSTDIR\OpenRA.Platforms.Default.dll Delete $INSTDIR\ICSharpCode.SharpZipLib.dll Delete $INSTDIR\FuzzyLogicLibrary.dll