diff --git a/Output/Readme.txt b/Output/Readme.txt index 93940687..38fc134a 100644 --- a/Output/Readme.txt +++ b/Output/Readme.txt @@ -107,8 +107,8 @@ Vocaluxe.exe -ConfigFile MyConfig.xml -ScoreFile C:\Vocaluxe\Highscores\MyHighsc [TAB] to open the background music controls (not on all screens). Songscreen -[R] to select a random song -[F3] or [CTRL]+[F] to open/close the song search menu +[CTRL] + [R] to select a random song +[F3] to open/close the song search menu [A] to sing all songs from a category diff --git a/Output/Themes/Ambient/Screens/ScreenNames.xml b/Output/Themes/Ambient/Screens/ScreenNames.xml index 3fff5c64..20a2026b 100644 --- a/Output/Themes/Ambient/Screens/ScreenNames.xml +++ b/Output/Themes/Ambient/Screens/ScreenNames.xml @@ -386,13 +386,13 @@ 40 - SelectSlideColor + Player1Dim - SelectSlideSColor + Player1Dim - SelectSlideHColor + Player1 ArrowColor @@ -404,7 +404,7 @@ TextColor - TextSColor + Player1 32,00 @@ -451,13 +451,13 @@ 40 - SelectSlideColor + Player2Dim - SelectSlideSColor + Player2Dim - SelectSlideHColor + Player2 ArrowColor @@ -469,7 +469,7 @@ TextColor - TextSColor + Player2 32,00 @@ -516,13 +516,13 @@ 40 - SelectSlideColor + Player3Dim - SelectSlideSColor + Player3Dim - SelectSlideHColor + Player3 ArrowColor @@ -534,7 +534,7 @@ TextColor - TextSColor + Player3 32,00 diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml index 33203fdf..62fefa5d 100644 --- a/Output/Themes/Ambient/Skin Blue.xml +++ b/Output/Themes/Ambient/Skin Blue.xml @@ -46,6 +46,42 @@ + + 0,000 + 0,000 + 1,000 + 0,500 + + + 1,000 + 0,000 + 0,000 + 0,500 + + + 0,000 + 1,000 + 0,000 + 0,500 + + + 0,500 + 0,000 + 1,000 + 0,500 + + + 0,000 + 0,500 + 1,000 + 0,500 + + + 1,000 + 0,000 + 0,500 + 0,500 + 0,000 0,000 diff --git a/Output/Themes/Ambient/Skin Green.xml b/Output/Themes/Ambient/Skin Green.xml index 3a59c0b6..9d6047ae 100644 --- a/Output/Themes/Ambient/Skin Green.xml +++ b/Output/Themes/Ambient/Skin Green.xml @@ -46,6 +46,42 @@ + + 0,000 + 0,000 + 1,000 + 0,500 + + + 1,000 + 0,000 + 0,000 + 0,500 + + + 0,000 + 1,000 + 0,000 + 0,500 + + + 0,500 + 0,000 + 1,000 + 0,500 + + + 0,000 + 0,500 + 1,000 + 0,500 + + + 1,000 + 0,000 + 0,500 + 0,500 + 0,000 0,000 diff --git a/Output/Themes/Ambient/Skin Red.xml b/Output/Themes/Ambient/Skin Red.xml index 25b2f9fd..b74a054b 100644 --- a/Output/Themes/Ambient/Skin Red.xml +++ b/Output/Themes/Ambient/Skin Red.xml @@ -46,6 +46,42 @@ + + 0,000 + 0,000 + 1,000 + 0,500 + + + 1,000 + 0,000 + 0,000 + 0,500 + + + 0,000 + 1,000 + 0,000 + 0,500 + + + 0,500 + 0,000 + 1,000 + 0,500 + + + 0,000 + 0,500 + 1,000 + 0,500 + + + 1,000 + 0,000 + 0,500 + 0,500 + 0,000 0,000 diff --git a/Output/Themes/Ambient/Skin Yellow.xml b/Output/Themes/Ambient/Skin Yellow.xml index 25c7bb21..5d63b033 100644 --- a/Output/Themes/Ambient/Skin Yellow.xml +++ b/Output/Themes/Ambient/Skin Yellow.xml @@ -46,6 +46,42 @@ + + 0,000 + 0,000 + 1,000 + 0,500 + + + 1,000 + 0,000 + 0,000 + 0,500 + + + 0,000 + 1,000 + 0,000 + 0,500 + + + 0,500 + 0,000 + 1,000 + 0,500 + + + 0,000 + 0,500 + 1,000 + 0,500 + + + 1,000 + 0,000 + 0,500 + 0,500 + 0,000 0,000 diff --git a/Output/x64/acinerella.dll b/Output/x64/acinerella.dll index e70d69eb..41790e99 100644 Binary files a/Output/x64/acinerella.dll and b/Output/x64/acinerella.dll differ diff --git a/Output/x64/avcodec-54.dll b/Output/x64/avcodec-54.dll index 782ea1ad..dd2af535 100644 Binary files a/Output/x64/avcodec-54.dll and b/Output/x64/avcodec-54.dll differ diff --git a/Output/x64/avformat-54.dll b/Output/x64/avformat-54.dll index 9f9f7bd8..a7d5c0c4 100644 Binary files a/Output/x64/avformat-54.dll and b/Output/x64/avformat-54.dll differ diff --git a/Output/x64/avutil-51.dll b/Output/x64/avutil-51.dll index b625de22..861e290b 100644 Binary files a/Output/x64/avutil-51.dll and b/Output/x64/avutil-51.dll differ diff --git a/Output/x64/swscale-2.dll b/Output/x64/swscale-2.dll index 307ced01..a883eacf 100644 Binary files a/Output/x64/swscale-2.dll and b/Output/x64/swscale-2.dll differ diff --git a/Output/x86/acinerella.dll b/Output/x86/acinerella.dll index 15887534..87dfc0f3 100644 Binary files a/Output/x86/acinerella.dll and b/Output/x86/acinerella.dll differ diff --git a/Output/x86/avcodec-54.dll b/Output/x86/avcodec-54.dll index 2d2baade..21d6a7b7 100644 Binary files a/Output/x86/avcodec-54.dll and b/Output/x86/avcodec-54.dll differ diff --git a/Output/x86/avformat-54.dll b/Output/x86/avformat-54.dll index eb10bcd9..0099c2cb 100644 Binary files a/Output/x86/avformat-54.dll and b/Output/x86/avformat-54.dll differ diff --git a/Output/x86/avutil-51.dll b/Output/x86/avutil-51.dll index b5559c48..0ab13c9f 100644 Binary files a/Output/x86/avutil-51.dll and b/Output/x86/avutil-51.dll differ diff --git a/Output/x86/swscale-2.dll b/Output/x86/swscale-2.dll index edee4afd..0cca8210 100644 Binary files a/Output/x86/swscale-2.dll and b/Output/x86/swscale-2.dll differ diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 6beb8278..02ad6565 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -277,6 +277,12 @@ namespace Vocaluxe.Base #region Graphics CHelper.TryGetEnumValueFromXML("//root/Graphics/Renderer", navigator, ref Renderer); CHelper.TryGetEnumValueFromXML("//root/Graphics/TextureQuality", navigator, ref TextureQuality); + CHelper.TryGetIntValueFromXML("//root/Graphics/CoverSize", navigator, ref CoverSize); + if (CoverSize > 1024) + CoverSize = 1024; + if (CoverSize < 32) + CoverSize = 32; + CHelper.TryGetIntValueFromXML("//root/Graphics/ScreenW", navigator, ref ScreenW); CHelper.TryGetIntValueFromXML("//root/Graphics/ScreenH", navigator, ref ScreenH); CHelper.TryGetEnumValueFromXML("//root/Graphics/AAMode", navigator, ref AAMode); @@ -440,7 +446,10 @@ namespace Vocaluxe.Base writer.WriteComment("TextureQuality: " + ListStrings(Enum.GetNames(typeof(ETextureQuality)))); writer.WriteElementString("TextureQuality", Enum.GetName(typeof(ETextureQuality), TextureQuality)); - + + writer.WriteComment("CoverSize (pixels): 32, 64, 128, 256, 512, 1024 (default: 128)"); + writer.WriteElementString("CoverSize", CoverSize.ToString()); + writer.WriteComment("Screen width and height (pixels)"); writer.WriteElementString("ScreenW", ScreenW.ToString()); writer.WriteElementString("ScreenH", ScreenH.ToString()); diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index fe5f4e3a..22b699d9 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -238,13 +238,13 @@ namespace Vocaluxe.Base { _Cover.Clear(); List cover = CHelper.GetValuesFromXML("Cover", navigator); - for (int i = 1; i <= cover.Count; i++) + for (int i = 0; i < cover.Count; i++) { SCover sk = new SCover(); string name = String.Empty; string value = String.Empty; - CHelper.GetValueFromXML("//root/Cover/Cover" + i + "/Name", navigator, ref name, String.Empty); - CHelper.GetValueFromXML("//root/Cover/Cover" + i + "/Path", navigator, ref value, String.Empty); + CHelper.GetValueFromXML("//root/Cover/" + cover[i] + "/Name", navigator, ref name, String.Empty); + CHelper.GetValueFromXML("//root/Cover/" + cover[i] + "/Path", navigator, ref value, String.Empty); sk.Name = name; sk.Value = Path.Combine(coverTheme.Folder,value); if (File.Exists(Path.Combine(CSettings.sFolderCover, Path.Combine(coverTheme.Folder, value)))) diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index 7c13e322..0f6d9e60 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Text; +using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Lib.Draw; @@ -21,11 +22,38 @@ namespace Vocaluxe.Base case ERenderer.TR_CONFIG_SOFTWARE: _Draw = new CDrawWinForm(); break; + case ERenderer.TR_CONFIG_OPENGL: - _Draw = new COpenGL(); + try + { + _Draw = new COpenGL(); + } + catch (Exception e) + { + MessageBox.Show(e.Message + " - Error in initializing of OpenGL. Please check whether" + + " your graphic card drivers are up to date."); + CLog.LogError(e.Message + " - Error in initializing of OpenGL. Please check whether" + + " your graphic card drivers are up to date."); + Environment.Exit(Environment.ExitCode); + } break; + case ERenderer.TR_CONFIG_DIRECT3D: - _Draw = new CDirect3D(); + try + { + _Draw = new CDirect3D(); + } + catch (Exception e) + { + MessageBox.Show(e.Message + " - Error in initializing of Direct3D. Please check if " + + "your DirectX redistributables and graphic card drivers are up to date. You can " + + "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", + CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); + CLog.LogError(e.Message + " - Error in initializing of Direct3D. Please check if " + + "your DirectX redistributables and graphic card drivers are up to date. You can " + + "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109"); + Environment.Exit(Environment.ExitCode); + } break; default: diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs index 34663b91..d75e2f36 100644 --- a/Vocaluxe/Base/CLog.cs +++ b/Vocaluxe/Base/CLog.cs @@ -56,7 +56,7 @@ namespace Vocaluxe.Base private static int _NumErrors; private static Stopwatch[] _BenchmarkTimer; - private static long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency; + private static double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency; public static void Init() { @@ -129,8 +129,8 @@ namespace Vocaluxe.Base } float ms; - if (Stopwatch.IsHighResolution) - ms = (float)(((double)nanosecPerTick * (double)_BenchmarkTimer[BenchmarkNr].ElapsedTicks) / (1000.0 * 1000.0)); + if (Stopwatch.IsHighResolution && nanosecPerTick != 0.0) + ms = (float)((nanosecPerTick * _BenchmarkTimer[BenchmarkNr].ElapsedTicks) / (1000.0 * 1000.0)); else ms = (float)_BenchmarkTimer[BenchmarkNr].ElapsedMilliseconds; diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index bba41068..ed73ed31 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -237,7 +237,7 @@ namespace Vocaluxe.Base public static bool IsGuestProfile(int ProfileNr) { if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) - return false; + return true; // this will prevent from saving dummy profiles to highscore db return _Profiles[ProfileNr].GuestProfile == EOffOn.TR_CONFIG_ON; } @@ -246,7 +246,7 @@ namespace Vocaluxe.Base { if (ProfileNr < 0 || ProfileNr >= _Profiles.Count) return false; - return _Profiles[ProfileNr].GuestProfile == EOffOn.TR_CONFIG_ON; + return _Profiles[ProfileNr].Active == EOffOn.TR_CONFIG_ON; } public static void SetAvatar(int ProfileNr, int AvatarNr) diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index ba5e667f..8446d7fa 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -45,9 +45,9 @@ namespace Vocaluxe.Base public const int iVersionMajor = 0; public const int iVersionMinor = 1; // milestones public const int iVersionSub = 0; // steps - public const ERevision VersionRevision = ERevision.Beta; + public const ERevision VersionRevision = ERevision.RC; - public const int iBuild = 56; // Increase on every published version! Never Reset! + public const int iBuild = 59; // Increase on every published version! Never Reset! public const int iDatabaseHighscoreVersion = 1; public const int iDatabaseCoverVersion = 1; diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index ff4a30ff..e7956ecb 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -497,7 +497,7 @@ namespace Vocaluxe.Base { get { - long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency; + double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency; long ticks = _Timer.ElapsedTicks; float dt = _Timer.ElapsedMilliseconds / 1000f; @@ -577,7 +577,7 @@ namespace Vocaluxe.Base { get { - long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency; + double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency; long ticks = _STimer.ElapsedTicks; float dt = _STimer.ElapsedMilliseconds / 1000f; @@ -613,7 +613,7 @@ namespace Vocaluxe.Base { _STimer.Stop(); - long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency; + double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency; long ticks = _STimer.ElapsedTicks; float dt = _STimer.ElapsedMilliseconds / 1000f; diff --git a/Vocaluxe/Base/CUtility.cs b/Vocaluxe/Base/CUtility.cs index ef4e94dd..909dc798 100644 --- a/Vocaluxe/Base/CUtility.cs +++ b/Vocaluxe/Base/CUtility.cs @@ -119,7 +119,7 @@ namespace Vocaluxe.Base { private static Stopwatch _Stopwatch = new Stopwatch(); private static float _fps = 0.0f; - private static long nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch.Frequency; + private static double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency; public static void Reset() { @@ -149,7 +149,7 @@ namespace Vocaluxe.Base { long ticks = _Stopwatch.ElapsedTicks; if (Stopwatch.IsHighResolution && ticks != 0) - return (float)(((double)nanosecPerTick * (double)ticks) / (1000.0 * 1000.0)); + return (float)((nanosecPerTick * ticks) / (1000.0 * 1000.0)); else return (float)_Stopwatch.ElapsedMilliseconds; } diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 07fb2e5c..9745fa92 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -71,7 +71,18 @@ namespace Vocaluxe.Lib.Draw _VerticesRotationMatrices = new Queue(); _Keys = new CKeys(); - _D3D = new Direct3D(); + try + { + _D3D = new Direct3D(); + } + catch (Direct3D9NotFoundException e) + { + MessageBox.Show("No DirectX runtimes were found, please download and install them " + + "from http://www.microsoft.com/download/en/details.aspx?id=8109", + CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); + CLog.LogError(e.Message + " - No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109"); + Environment.Exit(Environment.ExitCode); + } this.Paint += new PaintEventHandler(this.OnPaintEvent); this.Closing += new CancelEventHandler(this.OnClosingEvent); @@ -165,19 +176,31 @@ namespace Vocaluxe.Lib.Draw flags = CreateFlags.HardwareVertexProcessing; else flags = CreateFlags.SoftwareVertexProcessing; - _Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters); + try + { + _Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters); + } + catch (Exception e) + { + MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables " + + "and graphic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", + CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); + CLog.LogError(e.Message + " - Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109"); + Environment.Exit(Environment.ExitCode); + } + finally + { + if (_Device == null || _Device.Disposed) + { + MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables " + + "and graphic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", + CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); + CLog.LogError("Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109"); + Environment.Exit(Environment.ExitCode); + } + } this.CenterToScreen(); - - //This creates a new white texture and adds it to the texture pool - //This texture is used for the DrawRect method - Bitmap blankMap = new Bitmap(1, 1); - Graphics g = Graphics.FromImage(blankMap); - g.Clear(Color.White); - g.Dispose(); - blankTexture = AddTexture(blankMap); - - blankMap.Dispose(); } #region form events @@ -204,7 +227,6 @@ namespace Vocaluxe.Lib.Draw protected override void OnResize(EventArgs e) { base.OnResize(e); - this.ClientSize = this.ClientSize; RResize(); } @@ -399,27 +421,47 @@ namespace Vocaluxe.Lib.Draw Matrix translate = Matrix.Translation(new Vector3(-CSettings.iRenderW / 2, CSettings.iRenderH / 2, 0)); Matrix projection = Matrix.OrthoOffCenterLH(-CSettings.iRenderW / 2, CSettings.iRenderW / 2, -CSettings.iRenderH / 2, CSettings.iRenderH / 2, CSettings.zNear, CSettings.zFar); _VertexBuffer = new VertexBuffer(_Device, CSettings.iVertexBufferElements * (4 * Marshal.SizeOf(typeof(TexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic, VertexFormat.Position | VertexFormat.Texture1 | VertexFormat.Diffuse, Pool.Default); - _Device.SetStreamSource(0, _VertexBuffer, 0, Marshal.SizeOf(typeof(TexturedColoredVertex))); - _Device.VertexDeclaration = TexturedColoredVertex.GetDeclaration(_Device); - _Device.SetTransform(TransformState.Projection, projection); - _Device.SetTransform(TransformState.World, translate); - _Device.SetRenderState(RenderState.CullMode, Cull.None); - _Device.SetRenderState(RenderState.AlphaBlendEnable, true); - _Device.SetRenderState(RenderState.Lighting, false); - _Device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha); - _Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha); - if (_PresentParameters.Multisample != MultisampleType.None) - _Device.SetRenderState(RenderState.MultisampleAntialias, true); - _Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear); - _Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear); - _Device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear); - _Device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp); - _Device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp); - _Device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture); - _Device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse); - _Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate); - int[] indices = new int[6]; + if (_Device.SetStreamSource(0, _VertexBuffer, 0, Marshal.SizeOf(typeof(TexturedColoredVertex))).IsFailure) + CLog.LogError("Failed to set stream source"); + _Device.VertexDeclaration = TexturedColoredVertex.GetDeclaration(_Device); + if(_Device.SetTransform(TransformState.Projection, projection).IsFailure) + CLog.LogError("Failed to set orthogonal matrix"); + if(_Device.SetTransform(TransformState.World, translate).IsFailure) + CLog.LogError("Failed to set translation matrix"); + if(_Device.SetRenderState(RenderState.CullMode, Cull.None).IsFailure) + CLog.LogError("Failed to set cull mode"); + if(_Device.SetRenderState(RenderState.AlphaBlendEnable, true).IsFailure) + CLog.LogError("Failed to enable alpha blending"); + if(_Device.SetRenderState(RenderState.Lighting, false).IsFailure) + CLog.LogError("Failed to disable lighting"); + if(_Device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha).IsFailure) + CLog.LogError("Failed to set destination blend"); + if(_Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha).IsFailure) + CLog.LogError("Failed to set source blend"); + if (_PresentParameters.Multisample != MultisampleType.None) + { + if(_Device.SetRenderState(RenderState.MultisampleAntialias, true).IsFailure) + CLog.LogError("Failed to set antialiasing"); + } + if(_Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear).IsFailure) + CLog.LogError("Failed to set min filter"); + if(_Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear).IsFailure) + CLog.LogError("Failed to set mag filter"); + if(_Device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear).IsFailure) + CLog.LogError("Failed to set mip filter"); + if(_Device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp).IsFailure) + CLog.LogError("Failed to set clamping on u"); + if(_Device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp).IsFailure) + CLog.LogError("Failed to set claming on v"); + if(_Device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture).IsFailure) + CLog.LogError("Failed to set alpha argument 1"); + if(_Device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse).IsFailure) + CLog.LogError("Failed to set alpha argument 2"); + if(_Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate).IsFailure) + CLog.LogError("Failed to set alpha operation"); + + Int16[] indices = new Int16[6]; indices[0] = 0; indices[1] = 1; indices[2] = 2; @@ -427,12 +469,22 @@ namespace Vocaluxe.Lib.Draw indices[4] = 2; indices[5] = 3; - _IndexBuffer = new IndexBuffer(_Device, 6 * sizeof(int), Usage.WriteOnly, Pool.Managed, false); + _IndexBuffer = new IndexBuffer(_Device, 6 * sizeof(Int16), Usage.WriteOnly, Pool.Managed, true); DataStream stream = _IndexBuffer.Lock(0, 0, LockFlags.None); stream.WriteRange(indices); _IndexBuffer.Unlock(); _Device.Indices = _IndexBuffer; + + //This creates a new white texture and adds it to the texture pool + //This texture is used for the DrawRect method + Bitmap blankMap = new Bitmap(1, 1); + Graphics g = Graphics.FromImage(blankMap); + g.Clear(Color.White); + g.Dispose(); + blankTexture = AddTexture(blankMap); + + blankMap.Dispose(); return true; } else @@ -462,12 +514,14 @@ namespace Vocaluxe.Lib.Draw //Clear the previous Frame ClearScreen(); //We want to begin drawing - _Device.BeginScene(); + if (_Device.BeginScene().IsFailure) + CLog.LogError("Failed to begin scene"); CheckQueque(); _Run = _Run && CGraphics.Draw(); RenderVertexBuffer(); //We finished drawing the frame - _Device.EndScene(); + if (_Device.EndScene().IsFailure) + CLog.LogError("Failed to end scene"); _Run = CGraphics.UpdateGameLogic(_Keys, _Mouse); try { @@ -517,7 +571,8 @@ namespace Vocaluxe.Lib.Draw TexturedColoredVertex.GetDeclaration(_Device).Dispose(); _VertexBuffer.Dispose(); _IndexBuffer.Dispose(); - _Device.Reset(_PresentParameters); + if (_Device.Reset(_PresentParameters).IsFailure) + CLog.LogError("Failed to reset the device"); } /// @@ -617,11 +672,14 @@ namespace Vocaluxe.Lib.Draw for (int i = 0; i < _Vertices.Count; i += 4) { //Apply rotation - _Device.SetTransform(TransformState.World, _VerticesRotationMatrices.Dequeue()); + if (_Device.SetTransform(TransformState.World, _VerticesRotationMatrices.Dequeue()).IsFailure) + CLog.LogError("Failed to set world transformation"); //Apply texture - _Device.SetTexture(0, _VerticesTextures.Dequeue()); + if (_Device.SetTexture(0, _VerticesTextures.Dequeue()).IsFailure) + CLog.LogError("Failed to set texture"); //Draw 2 triangles from vertexbuffer - _Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, i, 0, 4, 0, 2); + if (_Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, i, 0, 4, 0, 2).IsFailure) + CLog.LogError("Failed to draw quad"); } //Clear the queues for the next frame _Vertices.Clear(); @@ -638,7 +696,8 @@ namespace Vocaluxe.Lib.Draw /// public void ClearScreen() { - _Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0); + if (_Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0).IsFailure) + CLog.LogError("Failed to clear the backbuffer"); } /// diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index 767a9fb9..4756ae06 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -394,14 +394,12 @@ namespace Vocaluxe.Lib.Video #region Threading private void DoSkip() - { - string extension = Path.GetExtension(_FileName); //just a workaround for the mkv-search-bug in ffmpeg - + { _VideoSkipTime = _Gap; _SkipTime = _Start + _Gap; _BeforeLoop = false; - if (_SkipTime > 0 && extension != ".mkv") + if (_SkipTime > 0) { _VideoDecoderTime = _SkipTime; try @@ -419,8 +417,7 @@ namespace Vocaluxe.Lib.Video _VideoDecoderTime = 0f; try { - if (extension != ".mkv") - CAcinerella.ac_seek(_videodecoder, -1, (Int64)0); + CAcinerella.ac_seek(_videodecoder, -1, (Int64)0); } catch (Exception e) { diff --git a/Vocaluxe/Menu/CSelectSlide.cs b/Vocaluxe/Menu/CSelectSlide.cs index 86e7a7c1..96235a9d 100644 --- a/Vocaluxe/Menu/CSelectSlide.cs +++ b/Vocaluxe/Menu/CSelectSlide.cs @@ -525,6 +525,19 @@ namespace Vocaluxe.Menu _Textures[selection] = NewTexture; } + public bool SetSelectionByValueIndex(int ValueIndex) + { + for (int i = 0; i < _ValueIndexes.Count; i++) + { + if (_ValueIndexes[i] == ValueIndex) + { + Selection = i; + return true; + } + } + return false; + } + public bool NextValue() { if (Selection < _ValueNames.Count - 1) diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index b66a5f79..6f499513 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -223,15 +223,7 @@ namespace Vocaluxe.Screens for (int p = 0; p < player.Length; p++) { - bool guest = true; - - if (player[p].ProfileID >= 0 && player[p].ProfileID < CProfiles.NumProfiles) - { - if (CProfiles.Profiles[player[p].ProfileID].GuestProfile == EOffOn.TR_CONFIG_OFF) - guest = false; - } - - if (player[p].Points > CSettings.MinScoreForDB && player[p].SongFinished && !guest) + if (player[p].Points > CSettings.MinScoreForDB && player[p].SongFinished && !CProfiles.IsGuestProfile(player[p].ProfileID)) _NewEntryIDs.Add(CDataBase.AddScore(player[p])); } } diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 42fb3b06..92b9820f 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -63,7 +63,7 @@ namespace Vocaluxe.Screens { JumpTo(KeyEvent.Unicode); return true; - }*/ + } */ } else { @@ -177,12 +177,12 @@ namespace Vocaluxe.Screens Texts[htTexts(TextCategory)].Text = CSongs.GetActualCategoryName(); int song = SongMenus[htSongMenus(SongMenu)].GetActualSelection(); - if ((CSongs.Category >= 0) && (song >= 0) && song < CSongs.VisibleSongs.Length) + if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Length) { Texts[htTexts(TextSelection)].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title; CBackgroundMusic.Pause(); } - else if ((CSongs.Category == -1) && (song >= 0) && song < CSongs.Categories.Length) + else if (CSongs.Category == -1 && song >= 0 && song < CSongs.Categories.Length) { Texts[htTexts(TextSelection)].Text = CSongs.Categories[song].Name; CBackgroundMusic.Play(); @@ -304,11 +304,10 @@ namespace Vocaluxe.Screens id = CSongs.VisibleSongs[song].ID; } - // here is a fault: SetSelectedSong should point to the visible index - Vocaluxe.Lib.Song.CSong s = Array.Find(CSongs.VisibleSongs, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)); - if (s != null && s.ID > -1) + int visibleID = Array.FindIndex(CSongs.VisibleSongs, element => element.Artist.StartsWith(Letter.ToString(), StringComparison.OrdinalIgnoreCase)); + if (visibleID > -1) { - id = s.ID; + id = visibleID; SongMenus[htSongMenus(SongMenu)].SetSelectedSong(id); } } @@ -345,4 +344,4 @@ namespace Vocaluxe.Screens SongMenus[htSongMenus(SongMenu)].OnShow(); } } -} +} \ No newline at end of file