From fc0dd193ba64ca2029f4f3c5f4bb40bb7b8ee324 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Mon, 19 Mar 2012 17:43:11 +0100 Subject: [PATCH 1/5] Fixed JumpTo method, JumpTo is still disabled in 0.1 --- Vocaluxe/Screens/CScreenSong.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 42fb3b06..c336e187 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -63,7 +63,7 @@ namespace Vocaluxe.Screens { JumpTo(KeyEvent.Unicode); return true; - }*/ + } */ } else { @@ -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 From 75af56d8b5e31212e19a402e9085f981aca6d1c9 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Mon, 19 Mar 2012 18:23:16 +0100 Subject: [PATCH 2/5] Log error if device creation failed --- Vocaluxe/Lib/Draw/CDirect3D.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 07fb2e5c..15842ce8 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -166,6 +166,9 @@ namespace Vocaluxe.Lib.Draw else flags = CreateFlags.SoftwareVertexProcessing; _Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters); + + if(_Device.Disposed || _D3D.Disposed || _Device == null || _D3D == null) + CLog.LogError("Something went wrong with device creating, please check if your DirectX redistributables and graficcard drivers are up to date"); this.CenterToScreen(); From 2f5cbfe066a55dc42d7474b1fb0601e621f190e3 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Tue, 20 Mar 2012 14:57:09 +0100 Subject: [PATCH 3/5] Intel GMA cannot handle 32 bit indexbuffers, please test on a GMA device please --- Vocaluxe/Lib/Draw/CDirect3D.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 15842ce8..5b9be8f3 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -171,16 +171,6 @@ namespace Vocaluxe.Lib.Draw CLog.LogError("Something went wrong with device creating, please check if your DirectX redistributables and graficcard drivers are up to date"); 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 @@ -422,7 +412,7 @@ namespace Vocaluxe.Lib.Draw _Device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse); _Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate); - int[] indices = new int[6]; + Int16[] indices = new Int16[6]; indices[0] = 0; indices[1] = 1; indices[2] = 2; @@ -430,12 +420,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(int), 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 From fd946dfcdb342d7ea2b8396dd071e637d5740666 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Wed, 21 Mar 2012 15:25:42 +0100 Subject: [PATCH 4/5] Added link to directx runtimes --- Vocaluxe/Lib/Draw/CDirect3D.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 5b9be8f3..3ec360fd 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -168,7 +168,7 @@ namespace Vocaluxe.Lib.Draw _Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters); if(_Device.Disposed || _D3D.Disposed || _Device == null || _D3D == null) - CLog.LogError("Something went wrong with device creating, please check if your DirectX redistributables and graficcard drivers are up to date"); + CLog.LogError("Something went wrong with device creating, please check if your DirectX redistributables and graficcard drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109"); this.CenterToScreen(); } @@ -197,7 +197,6 @@ namespace Vocaluxe.Lib.Draw protected override void OnResize(EventArgs e) { base.OnResize(e); - this.ClientSize = this.ClientSize; RResize(); } From b58087776cc0e596b34d244e7662cddaa7a93e5c Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Wed, 21 Mar 2012 15:56:10 +0100 Subject: [PATCH 5/5] Terminate Vocaluxe and show a message box if no DirectX runtime was found --- Vocaluxe/Lib/Draw/CDirect3D.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 3ec360fd..2a6de382 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -73,6 +73,13 @@ namespace Vocaluxe.Lib.Draw _Keys = new CKeys(); _D3D = new Direct3D(); + if (_D3D == null) + { + MessageBox.Show("No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109"); + CLog.LogError("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); this.Resize += new EventHandler(this.OnResizeEvent); @@ -166,9 +173,13 @@ namespace Vocaluxe.Lib.Draw else flags = CreateFlags.SoftwareVertexProcessing; _Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters); - - if(_Device.Disposed || _D3D.Disposed || _Device == null || _D3D == null) - CLog.LogError("Something went wrong with device creating, please check if your DirectX redistributables and graficcard drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109"); + + if (_Device.Disposed || _D3D.Disposed || _Device == null || _D3D == null) + { + MessageBox.Show("Something went wrong with 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"); + CLog.LogError("Something went wrong with 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(); }