diff --git a/Installer/setup.aip b/Installer/setup.aip index 1309ecc0..afe22b95 100644 --- a/Installer/setup.aip +++ b/Installer/setup.aip @@ -1,5 +1,5 @@ - + @@ -18,7 +18,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -3765,8 +3765,8 @@ - - + + @@ -4032,8 +4032,8 @@ - - - + + + diff --git a/Output/Readme.txt b/Output/Readme.txt index 2cdffb4b..0c30e51d 100644 --- a/Output/Readme.txt +++ b/Output/Readme.txt @@ -1,4 +1,4 @@ -Vocaluxe 0.4 README +Vocaluxe 0.4.1 README ---------------------------- ================================= @@ -168,7 +168,6 @@ Vocaluxe Homepage: https://vocaluxe.org Bug Tracker: https://github.com/Vocaluxe/Vocaluxe/issues Translations: https://www.transifex.com/projects/p/vocaluxe/ GitHub Wiki: https://github.com/Vocaluxe/Vocaluxe/wiki -Support Forum (German): http://www.ultra-star.de Song-DataBase (USDB): http://usdb.animux.de/ diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index e336d4de..f34ed0a5 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; +using VocaluxeLib.Game; using VocaluxeLib.Menu; [assembly: ComVisible(false)] @@ -430,39 +431,62 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateScores() { + //Prepare results table if (GameData.ResultTable.Count == 0) { for (int i = 0; i < GameData.NumPlayer; i++) { - var row = new CResultTableRow {PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; + var row = new CResultTableRow { PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0 }; GameData.ResultTable.Add(row); } - GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce]; + GameData.Results = new int[GameData.NumRounds, GameData.NumPlayerAtOnce]; for (int i = 0; i < GameData.NumRounds; i++) { for (int j = 0; j < GameData.NumPlayerAtOnce; j++) GameData.Results[i, j] = 0; } } - SPlayer[] results = CBase.Game.GetPlayers(); - if (results == null) - return; - if (results.Length < GameData.NumPlayerAtOnce) - return; + //Get points from game + CPoints points = CBase.Game.GetPoints(); + SPlayer[] players = CBase.Game.GetPlayers(); - for (int j = 0; j < GameData.NumPlayerAtOnce; j++) - GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); + //Go over all rounds and sum up points + for (int round = 0; round < points.NumRounds; round++) + { + SPlayer[] res = points.GetPlayer(round, GameData.NumPlayerAtOnce); - List points = _GetPointsForPlayer(results); + if (res == null || res.Length < GameData.NumPlayerAtOnce) + return; + + for (int p = 0; p < GameData.NumPlayerAtOnce; p++) + { + players[p].Points += res[p].Points; + players[p].PointsGoldenNotes += res[p].PointsGoldenNotes; + players[p].PointsLineBonus += res[p].PointsLineBonus; + } + } + //Calculate average points + for (int p = 0; p < GameData.NumPlayerAtOnce; p++) + { + players[p].Points /= points.NumRounds; + players[p].PointsGoldenNotes /= points.NumRounds; + players[p].PointsLineBonus /= points.NumRounds; + + //Save points in GameData + GameData.Results[GameData.CurrentRoundNr - 2, p] = (int)Math.Round(players[p].Points); + } + + List stats = _GetPointsForPlayer(players); for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { + //Find matching row in results table int index = -1; for (int j = 0; j < GameData.ResultTable.Count; j++) { - if (points[i].ProfileID == GameData.ResultTable[j].PlayerID) + if (stats[i].ProfileID == GameData.ResultTable[j].PlayerID) { index = j; break; @@ -473,14 +497,14 @@ namespace VocaluxeLib.PartyModes.Challenge continue; CResultTableRow row = GameData.ResultTable[index]; + //Update results entry row.NumPlayed++; - row.NumWon += points[i].Won; - row.NumSingPoints += points[i].SingPoints; - row.NumGamePoints += points[i].GamePoints; + row.NumWon += stats[i].Won; + row.NumSingPoints += stats[i].SingPoints; + row.NumGamePoints += stats[i].GamePoints; GameData.ResultTable[index] = row; } - GameData.ResultTable.Sort(); diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index 5e10bcff..77a5eb88 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -125,6 +125,7 @@ namespace VocaluxeLib.PartyModes.Challenge _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); _NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer])); _AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); + _NextPlayerStatics[_NextPlayerStatics.Count - 1].Aspect = EAspect.Crop; } _Statics[_StaticNextPlayer].Visible = false; } diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index 78da5f05..e8ec6b18 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -411,74 +411,79 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateScores() { + //Prepare results table if (GameData.ResultTable.Count == 0) { for (int i = 0; i < GameData.NumPlayer; i++) { - CResultTableRow row = new CResultTableRow {PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; + var row = new CResultTableRow { PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0 }; GameData.ResultTable.Add(row); } - GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce]; + GameData.Results = new int[GameData.NumRounds, GameData.NumPlayerAtOnce]; for (int i = 0; i < GameData.NumRounds; i++) { for (int j = 0; j < GameData.NumPlayerAtOnce; j++) GameData.Results[i, j] = 0; } } - - CPoints gamePoints = CBase.Game.GetPoints(); - if (gamePoints == null || gamePoints.NumPlayer < GameData.NumPlayerAtOnce) - return; - SPlayer[] results = gamePoints.GetPlayer(0, GameData.NumPlayerAtOnce); - if (results == null) - return; + //Get points from game + CPoints points = CBase.Game.GetPoints(); + SPlayer[] players = CBase.Game.GetPlayers(); - if (results.Length < GameData.NumPlayerAtOnce) - return; - - if (gamePoints.NumRounds == 0) - return; - - for (int i = 1; i < gamePoints.NumRounds; i++) + //Go over all rounds and sum up points + for (int round = 0; round < points.NumRounds; round++) { - SPlayer[] temp = gamePoints.GetPlayer(i, GameData.NumPlayerAtOnce); + SPlayer[] res = points.GetPlayer(round, GameData.NumPlayerAtOnce); + + if (res == null || res.Length < GameData.NumPlayerAtOnce) + return; + for (int p = 0; p < GameData.NumPlayerAtOnce; p++) - results[p].Points += temp[p].Points; + { + players[p].Points += res[p].Points; + players[p].PointsGoldenNotes += res[p].PointsGoldenNotes; + players[p].PointsLineBonus += res[p].PointsLineBonus; + } } - - for (int j = 0; j < GameData.NumPlayerAtOnce; j++) + //Calculate average points + for (int p = 0; p < GameData.NumPlayerAtOnce; p++) { - results[j].Points = results[j].Points / gamePoints.NumRounds; - GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); + players[p].Points /= points.NumRounds; + players[p].PointsGoldenNotes /= points.NumRounds; + players[p].PointsLineBonus /= points.NumRounds; + + //Save points in GameData + GameData.Results[GameData.CurrentRoundNr - 2, p] = (int)Math.Round(players[p].Points); } - List points = _GetPointsForPlayer(results); + List stats = _GetPointsForPlayer(players); for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { + //Find matching row in results table int index = -1; for (int j = 0; j < GameData.ResultTable.Count; j++) { - if (points[i].ProfileID == GameData.ResultTable[j].PlayerID) + if (stats[i].ProfileID == GameData.ResultTable[j].PlayerID) { index = j; break; } } - if (index != -1) - { - CResultTableRow row = GameData.ResultTable[index]; + if (index == -1) + continue; + CResultTableRow row = GameData.ResultTable[index]; - row.NumPlayed++; - row.NumWon += points[i].Won; - row.NumSingPoints += points[i].SingPoints; - row.NumGamePoints += points[i].GamePoints; + //Update results entry + row.NumPlayed++; + row.NumWon += stats[i].Won; + row.NumSingPoints += stats[i].SingPoints; + row.NumGamePoints += stats[i].GamePoints; - GameData.ResultTable[index] = row; - } + GameData.ResultTable[index] = row; } GameData.ResultTable.Sort(); diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 636e3cfe..e867335b 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Runtime.InteropServices; +using VocaluxeLib.Game; using VocaluxeLib.Menu; using VocaluxeLib.Songs; @@ -530,13 +531,33 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (!GameData.Rounds[GameData.FieldNr].Finished) GameData.CurrentRoundNr++; + CPoints points = CBase.Game.GetPoints(); SPlayer[] results = CBase.Game.GetPlayers(); - if (results == null) + + if (results == null || results.Length < 2) return; - if (results.Length < 2) - return; + //Sum up all points + for (int r = 0; r < points.NumRounds; r++) + { + SPlayer[] player = points.GetPlayer(r, 2); + for (int i = 0; i < 2; i++) + { + results[i].Points += player[i].Points; + results[i].PointsGoldenNotes += player[i].PointsGoldenNotes; + results[i].PointsLineBonus += player[i].PointsLineBonus; + } + } + //Calc average of points + for (int i = 0; i < 2; i++) + { + results[i].Points /= points.NumRounds; + results[i].PointsGoldenNotes /= points.NumRounds; + results[i].PointsLineBonus /= points.NumRounds; + } + + //Decide who has won GameData.Rounds[GameData.FieldNr].PointsTeam1 = (int)Math.Round(results[0].Points); GameData.Rounds[GameData.FieldNr].PointsTeam2 = (int)Math.Round(results[1].Points); GameData.Rounds[GameData.FieldNr].Finished = true; diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 35f45351..0588abeb 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -98,6 +98,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe _CreateFields(); _Buttons[_ButtonField].Visible = false; + + _Statics[_StaticAvatarT1].Aspect = EAspect.Crop; + _Statics[_StaticAvatarT2].Aspect = EAspect.Crop; } public override bool HandleInput(SKeyEvent keyEvent) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 65165cf4..19c47c19 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -51,6 +51,7 @@ namespace Vocaluxe.Base private static Task _PreviewStartHelperTask; private static int _PreviewStartWaitCounter; private const int _PreviewStartWaitMaxTries = 10; + private static readonly object _PreviewStartHelperTaskLock = new Object(); public static bool VideoEnabled { @@ -256,10 +257,16 @@ namespace Vocaluxe.Base { if (_PreviewStartHelperTask != null && ( _PreviewPlayer.Length > 0 || _PreviewStartWaitCounter++ >= _PreviewStartWaitMaxTries)) { - _PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext()); - _PreviewStartHelperTask.Dispose(); - _PreviewStartHelperTask = null; - _PreviewStartWaitCounter = 0; + lock (_PreviewStartHelperTaskLock) + { + // Recheck the condition as it cloud have change before we got the lock + if (_PreviewStartHelperTask != null && (_PreviewPlayer.Length > 0 || _PreviewStartWaitCounter++ >= _PreviewStartWaitMaxTries)) + { + _PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext()); + _PreviewStartHelperTask = null; + _PreviewStartWaitCounter = 0; + } + } } if (!IsPlaying) @@ -315,30 +322,42 @@ namespace Vocaluxe.Base //Change song position only if song is changed or near to end - if (songChanged || _CurPlayer.Position + 30 < _CurPlayer.Length) + if (songChanged || _CurPlayer.Position + 30 < _CurPlayer.Length || _PreviewStartHelperTask == null) { - _PreviewStartHelperTask = new Task(() => + lock (_PreviewStartHelperTaskLock) { - float length = _PreviewPlayer.Length; - if (length < 1) - length = 30; // If length is unknow or invalid assume a length of 30s + _PreviewStartHelperTask = new Task(() => + { + float length = _PreviewPlayer.Length; + if (length < 1) + length = 30; // If length is unknow or invalid assume a length of 30s - if (start < 0) - start = (song.Preview.Source == EDataSource.None) ? length / 4f : song.Preview.StartTime; - if (start > length - 5f) - start = Math.Max(0f, Math.Min(length / 4f, length - 5f)); - if (start >= 0.5f) - start -= 0.5f; + if (start < 0) + start = (song.Preview.Source == EDataSource.None) ? length / 4f : song.Preview.StartTime; + if (start > length - 5f) + start = Math.Max(0f, Math.Min(length / 4f, length - 5f)); + if (start >= 0.5f) + start -= 0.5f; - _PreviewPlayer.Position = start; - Play(); - }); + _PreviewPlayer.Position = start; + Play(); + }); + } _CurPlayer = _PreviewPlayer; } else { - _PreviewStartHelperTask.Dispose(); - _PreviewStartHelperTask = null; + if (_PreviewStartHelperTask != null) + { + lock (_PreviewStartHelperTaskLock) + { + // Recheck the condition as it cloud have change before we got the lock + if (_PreviewStartHelperTask != null) + { + _PreviewStartHelperTask = null; + } + } + } _PreviewPlayer.Position = _CurPlayer.Position; _CurPlayer = _PreviewPlayer; Play(); diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 7db2f250..48d9805a 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -191,13 +191,14 @@ namespace Vocaluxe.Base public static event OnSongMenuChanged SongMenuChanged; //Folders + //We need full path for folders for matching folder path with textfile path when loading public static readonly List SongFolders = new List { #if INSTALLER Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs), - CSettings.FolderNameSongs + Path.Combine(CSettings.ProgramFolder, FolderNameSongs) #elif WIN - CSettings.FolderNameSongs + Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameSongs) #elif LINUX Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs) #endif @@ -335,15 +336,8 @@ namespace Vocaluxe.Base else Config = xml.DeserializeString(""); - if (Config.Game.SongFolder.Length > 0 && Config.Game.SongFolder[0] != "") - { - SongFolders.Clear(); - SongFolders.AddRange(Config.Game.SongFolder); - } - else - { - Config.Game.SongFolder = SongFolders.ToArray(); - } + NormalizeSongPaths(); + if ((Config.Game.ScoreAnimationTime > 0 && Config.Game.ScoreAnimationTime < 1) || Config.Game.ScoreAnimationTime < 0) Config.Game.ScoreAnimationTime = 1; @@ -625,6 +619,29 @@ namespace Vocaluxe.Base return false; } + /// + /// Set song path if none is find in config and check if every path exists + /// + public static void NormalizeSongPaths() + { + //Check if there are configured songfolders + if (Config.Game.SongFolder.Length > 0 && Config.Game.SongFolder[0] != "") + { + SongFolders.Clear(); + + foreach (string folder in Config.Game.SongFolder) + { + //Check if folder exists + if (Directory.Exists(folder)) + SongFolders.Add(Path.GetFullPath(folder)); + } + } + + //Test if songfolders are still empty or now empty + if(Config.Game.SongFolder.Length == 0) + Config.Game.SongFolder = SongFolders.ToArray(); + } + /// /// Load command-line-parameters and their values to lists. /// @@ -786,4 +803,4 @@ namespace Vocaluxe.Base } } } -} \ No newline at end of file +} diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 3a131649..b8ec6bfe 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -822,7 +822,14 @@ namespace Vocaluxe.Base public void Close(ref CVideoStream stream) { - CVideo.Close(ref stream); + try + { + CVideo.Close(ref stream); + } + catch (NotSupportedException e) + { + CLog.LogError($"Clould not close the background video: {e.Message}"); + } } public void SetLoop(CVideoStream stream, bool loop = true) @@ -832,12 +839,26 @@ namespace Vocaluxe.Base public void Pause(CVideoStream stream) { - CVideo.Pause(stream); + try + { + CVideo.Pause(stream); + } + catch (NotSupportedException e) + { + CLog.LogError($"Clould not pause the background video: {e.Message}"); + } } public void Resume(CVideoStream stream) { - CVideo.Resume(stream); + try + { + CVideo.Resume(stream); + } + catch (NotSupportedException e) + { + CLog.LogError($"Clould not resume the background video: {e.Message}"); + } } } diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index d9400cc8..d9af124b 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -15,6 +15,7 @@ // along with Vocaluxe. If not, see . #endregion +using System; using Vocaluxe.Lib.Video; using VocaluxeLib; @@ -61,6 +62,10 @@ namespace Vocaluxe.Base public static CVideoStream Load(string videoFileName) { + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } return _VideoDecoder.Load(videoFileName); } @@ -73,41 +78,109 @@ namespace Vocaluxe.Base public static float GetLength(CVideoStream stream) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + return _VideoDecoder.GetLength(stream); } public static bool GetFrame(CVideoStream stream, float time) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + return _VideoDecoder.GetFrame(stream, time); } public static bool Skip(CVideoStream stream, float start, float gap) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + return _VideoDecoder.Skip(stream, start, gap); } public static void SetLoop(CVideoStream stream, bool loop) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + _VideoDecoder.SetLoop(stream, loop); } public static void Pause(CVideoStream stream) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + _VideoDecoder.Pause(stream); } public static void Resume(CVideoStream stream) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + _VideoDecoder.Resume(stream); } public static bool Finished(CVideoStream stream) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + return _VideoDecoder.Finished(stream); } public static void Update() { + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + _VideoDecoder.Update(); } #endregion Interface diff --git a/Vocaluxe/Base/CVideoPlayer.cs b/Vocaluxe/Base/CVideoPlayer.cs index 3e0762f6..1f451396 100644 --- a/Vocaluxe/Base/CVideoPlayer.cs +++ b/Vocaluxe/Base/CVideoPlayer.cs @@ -53,6 +53,10 @@ namespace Vocaluxe.Base { _VideoTimer.Reset(); _Finished = false; + if (_VideoStream == null) + { + return; + } //CVideo.VdSkip(_VideoStream, 0f, 0f); _VideoTimer.Start(); CVideo.Resume(_VideoStream); @@ -60,12 +64,19 @@ namespace Vocaluxe.Base public void Pause() { - CVideo.Pause(_VideoStream); + if (_VideoStream != null) + { + CVideo.Pause(_VideoStream); + } _VideoTimer.Stop(); } public void Resume() { + if (_VideoStream == null) + { + return; + } CVideo.Resume(_VideoStream); _VideoTimer.Start(); } @@ -92,7 +103,7 @@ namespace Vocaluxe.Base public void PreLoad() { - if (!_Loaded) + if (!_Loaded || _VideoStream == null) { return; } @@ -111,7 +122,10 @@ namespace Vocaluxe.Base public void Close() { - CVideo.Close(ref _VideoStream); + if (_VideoStream != null) + { + CVideo.Close(ref _VideoStream); + } _Loaded = false; _Finished = false; _VideoTimer.Reset(); diff --git a/Vocaluxe/Lib/Database/CHighscoreDB.cs b/Vocaluxe/Lib/Database/CHighscoreDB.cs index 35e9fe87..c6683788 100644 --- a/Vocaluxe/Lib/Database/CHighscoreDB.cs +++ b/Vocaluxe/Lib/Database/CHighscoreDB.cs @@ -463,10 +463,19 @@ namespace Vocaluxe.Lib.Database if (reader != null && reader.HasRows) { reader.Read(); - artist = reader.GetString(0); - title = reader.GetString(1); - numPlayed = reader.GetInt32(2); - dateAdded = new DateTime(reader.GetInt64(3)); + + if (!reader.IsDBNull(0)) + artist = reader.GetString(0); + + if (!reader.IsDBNull(1)) + title = reader.GetString(1); + + if (!reader.IsDBNull(2)) + numPlayed = reader.GetInt32(2); + + if (!reader.IsDBNull(3)) + dateAdded = new DateTime(reader.GetInt64(3)); + reader.Dispose(); return true; } @@ -604,7 +613,7 @@ namespace Vocaluxe.Lib.Database { //Check for USDX 1.1 DB _CreateHighscoreDBV1(filePath); - result &= !_ConvertFrom110(filePath); + result &= _ConvertFrom110(filePath); result &= _UpdateDatabase(1, connection); result &= _UpdateDatabase(2, connection); } @@ -733,13 +742,22 @@ namespace Vocaluxe.Lib.Database transaction.Commit(); //Delete old tables after conversion - command.CommandText = "DROP TABLE US_Scores;"; + command.CommandText = "DROP TABLE IF EXISTS us_scores;"; command.ExecuteNonQuery(); - command.CommandText = "DROP TABLE US_Songs;"; + command.CommandText = "DROP TABLE IF EXISTS us_songs;"; command.ExecuteNonQuery(); - command.CommandText = "DROP TABLE us_statistics_info;"; + command.CommandText = "DROP TABLE IF EXISTS us_statistics_info;"; + command.ExecuteNonQuery(); + + command.CommandText = "DROP TABLE IF EXISTS us_users_info;"; + command.ExecuteNonQuery(); + + command.CommandText = "DROP TABLE IF EXISTS us_webs;"; + command.ExecuteNonQuery(); + + command.CommandText = "DROP TABLE IF EXISTS us_webs_stats;"; command.ExecuteNonQuery(); //This versioning is not used in Vocaluxe so reset it to 0 @@ -918,7 +936,7 @@ namespace Vocaluxe.Lib.Database if (currentVersion < 2) updated &= _ConvertV1toV2(connection); - if (currentVersion < 3) + else if (currentVersion < 3) updated &= _ConvertV2toV3(connection); return updated; diff --git a/Vocaluxe/Lib/Sound/CPortAudioHandle.cs b/Vocaluxe/Lib/Sound/CPortAudioHandle.cs index 217afafa..81c4d9b0 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioHandle.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioHandle.cs @@ -74,12 +74,23 @@ namespace Vocaluxe.Lib.Sound } lock (_Mutex) { + if (_Disposed) + return; Debug.Assert(_RefCount > 0); _RefCount--; if (_RefCount == 0) - PortAudio.Pa_Terminate(); + { + try + { + PortAudio.Pa_Terminate(); + } + catch (Exception ex) + { + CLog.LogError(errorText: $"Error disposing PortAudio: {ex.Message}", e: ex); + } + } + _Disposed = true; } - _Disposed = true; } public void Dispose() @@ -100,11 +111,11 @@ namespace Vocaluxe.Lib.Sound double sampleRate, uint framesPerBuffer, PortAudio.PaStreamFlags streamFlags, PortAudio.PaStreamCallbackDelegate streamCallback, IntPtr userData) { - if (_Disposed) - throw new ObjectDisposedException("PortAudioHandle already disposed"); - lock (_Mutex) { + if (_Disposed) + throw new ObjectDisposedException("PortAudioHandle already disposed"); + PortAudio.PaError res = PortAudio.Pa_OpenStream(out stream, ref inputParameters, ref outputParameters, sampleRate, framesPerBuffer, streamFlags, streamCallback, userData); if (res == PortAudio.PaError.paNoError) @@ -157,12 +168,19 @@ namespace Vocaluxe.Lib.Sound public void CloseStream(IntPtr stream) { - if (_Disposed) - throw new ObjectDisposedException("PortAudioHandle already disposed"); - lock (_Mutex) { - PortAudio.Pa_CloseStream(stream); + if (_Disposed) + throw new ObjectDisposedException("PortAudioHandle already disposed"); + + try + { + PortAudio.Pa_CloseStream(stream); + } + catch (Exception ex) + { + CLog.LogError(errorText:$"Error closing stream: {ex.Message}", e:ex); + } _Streams.Remove(stream); } } diff --git a/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs b/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs index 0808b506..452056d0 100644 --- a/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs +++ b/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs @@ -70,14 +70,20 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp { get { - if (_Element != null) + + if (_Element == null || (_Element.CurrentState == State.Paused && _Element.PendingState != State.VoidPending)) { - long position; - if (!_Element.QueryPosition(Format.Time, out position)) - CLog.LogError("Could not query position"); - else - _Position = ((float)position / Constants.SECOND); + return _Position; } + + + long position; + if (!_Element.QueryPosition(Format.Time, out position)) + CLog.LogError("Could not query position"); + else + _Position = ((float)position / Constants.SECOND); + + return _Position; } set diff --git a/Vocaluxe/Lib/Sound/Record/PortAudio/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/Record/PortAudio/CPortAudioRecord.cs index 4702e400..cfc8818c 100644 --- a/Vocaluxe/Lib/Sound/Record/PortAudio/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/Record/PortAudio/CPortAudioRecord.cs @@ -16,6 +16,8 @@ #endregion using System; +using System.Collections.Generic; +using System.Linq; using System.Runtime.InteropServices; using System.Threading; using Vocaluxe.Base; @@ -142,9 +144,13 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio foreach (IntPtr handle in _RecHandle) { - PortAudioSharp.PortAudio.Pa_StopStream(handle); - PortAudioSharp.PortAudio.Pa_CloseStream(handle); + if (handle != IntPtr.Zero) + { + PortAudioSharp.PortAudio.Pa_StopStream(handle); + PortAudioSharp.PortAudio.Pa_CloseStream(handle); + } } + _RecHandle = new IntPtr[_Devices.Count]; return true; } @@ -153,13 +159,17 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio /// public override void Close() { - if (_RecHandle != null) + if (_RecHandle != null && _RecHandle.Length > 0) { foreach (IntPtr handle in _RecHandle) { if (handle != IntPtr.Zero) + { _PaHandle.CloseStream(handle); + } } + + _RecHandle = new IntPtr[_Devices.Count]; } if (_PaHandle != null) { diff --git a/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs b/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs index 38275210..3d7229d0 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs @@ -429,7 +429,18 @@ namespace Vocaluxe.Lib.Video.Acinerella private bool _CopyDecodedFrameToBuffer() { bool result; - var decoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder)); + SACDecoder decoder; + + try + { + decoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder)); + } + catch (Exception e) + { + CLog.LogError("Couldn't copy the frame to the managed environment.", false, false, e); + return false; + } + if (decoder.Buffer != IntPtr.Zero) { _LastDecodedTime = (float)decoder.Timecode; diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index d18660db..136508fd 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -285,23 +285,120 @@ namespace Vocaluxe try { CController.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CController)", false, false, e); + } + + try + { CVocaluxeServer.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CVocaluxeServer)", false, false, e); + } + + try + { CGraphics.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CGraphics)", false, false, e); + } + + try + { CThemes.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CThemes)", false, false, e); + } + + try + { CCover.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CCover)", false, false, e); + } + + try + { CFonts.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CFonts)", false, false, e); + } + + try + { CBackgroundMusic.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CBackgroundMusic)", false, false, e); + } + + try + { CWebcam.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CWebcam)", false, false, e); + } + + try + { CDataBase.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CDataBase)", false, false, e); + } + + try + { CVideo.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CVideo)", false, false, e); + } + + try + { CRecord.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CRecord)", false, false, e); + } + + try + { CSound.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CSound)", false, false, e); + } + + try + { CDraw.Close(); } catch (Exception e) { - CLog.LogError("Error during shutdown!", false, false, e); + CLog.LogError("Error during shutdown! (CDraw)", false, false, e); } + GC.Collect(); // Do a GC run here before we close logs to have finalizers run try { diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index 2f4f564a..249198ef 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -139,6 +139,9 @@ namespace Vocaluxe.Screens _SetVisibility(); _UpdateRatings(); _SlideShowBG.Visible = _UpdateBackground(); + + for (int p = 0; p < CGame.NumPlayers; p++) + _Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Aspect = EAspect.Crop; } public override bool UpdateGame() diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 7bf7e042..0002ce6d 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -201,8 +201,6 @@ namespace Vocaluxe.Screens CConfig.Config.Theme.PlayerInfo = (EPlayerInfo)mode; CConfig.SaveConfig(); _SetVisibility(); - if (CGame.GetSong() != null) - _SetDuetLyricsVisibility(CGame.GetSong().IsDuet); //make sure duet lyrics remain visible break; case Keys.S: @@ -596,7 +594,6 @@ namespace Vocaluxe.Screens _DynamicLyricsTop = true; } - _SetDuetLyricsVisibility(song.IsDuet); _SetNormalLyricsVisibility(); _TimerSongText.Reset(); @@ -609,37 +606,36 @@ namespace Vocaluxe.Screens _StartSong(); } - private void _SetDuetLyricsVisibility(bool isDuet) - { - _Statics[_StaticLyricsDuet].Visible = isDuet; - _Lyrics[_LyricMainDuet].Visible = isDuet; - _Lyrics[_LyricSubDuet].Visible = isDuet; - - if (isDuet) - { - _Lyrics[_LyricMainTop].Visible = false; - _Lyrics[_LyricSubTop].Visible = false; - _Statics[_StaticLyricsTop].Visible = false; - } - else - { - bool lyricsOnTop = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP - || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH - || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop); - _Lyrics[_LyricMainTop].Visible = lyricsOnTop; - _Lyrics[_LyricSubTop].Visible = lyricsOnTop; - _Statics[_StaticLyricsTop].Visible = lyricsOnTop; - } - } - private void _SetNormalLyricsVisibility() { - bool visible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM + bool bottomLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom); - _Lyrics[_LyricMain].Visible = visible; - _Lyrics[_LyricSub].Visible = visible; - _Statics[_StaticLyrics].Visible = visible; + + bool topLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP + || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH + || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop); + + bool duetLyricsVisible = false; + + if (CGame.GetSong() != null && CGame.GetSong().IsDuet) + { + bottomLyricsVisible = true; + topLyricsVisible = false; + duetLyricsVisible = true; + } + + _Lyrics[_LyricMain].Visible = bottomLyricsVisible; + _Lyrics[_LyricSub].Visible = bottomLyricsVisible; + _Statics[_StaticLyrics].Visible = bottomLyricsVisible; + + _Lyrics[_LyricMainTop].Visible = topLyricsVisible; + _Lyrics[_LyricSubTop].Visible = topLyricsVisible; + _Statics[_StaticLyricsTop].Visible = topLyricsVisible; + + _Lyrics[_LyricMainDuet].Visible = duetLyricsVisible; + _Lyrics[_LyricSubDuet].Visible = duetLyricsVisible; + _Statics[_StaticLyricsDuet].Visible = duetLyricsVisible; } private void _StartSong() @@ -655,7 +651,10 @@ namespace Vocaluxe.Screens { //Need this to set other songs to points-var while (!CGame.IsFinished()) + { CGame.NextRound(); + CGame.ResetPlayer(); + } _FinishedSinging(); } @@ -1115,7 +1114,7 @@ namespace Vocaluxe.Screens } // sub - if (currentLineSub < lines.Length - 2) + if ((currentLineSub + 1) < lines.Length) { float diff = CGame.GetTimeFromBeats(lines[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime; @@ -1372,4 +1371,4 @@ namespace Vocaluxe.Screens } } } -} \ No newline at end of file +} diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index ad8c73d0..0b1fe528 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -1067,7 +1067,7 @@ namespace Vocaluxe.Screens case ESongSorting.TR_CONFIG_FOLDER: if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Folder.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)) start = curSelected + 1; - visibleID = _FindIndex(songs, start, element => element.Folder.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); + visibleID = _FindIndex(songs, start, element => element.FolderName.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); break; } if (visibleID > -1) @@ -1380,4 +1380,4 @@ namespace Vocaluxe.Screens } #endregion Playlist Actions } -} \ No newline at end of file +} diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index 248e7a46..d7931ec1 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -31,7 +31,8 @@ 1.0.0.%2a false true - 3d91144f + + x86 @@ -542,12 +543,11 @@ - - - + + @@ -556,10 +556,9 @@ - - - + + \ No newline at end of file diff --git a/Vocaluxe/packages.config b/Vocaluxe/packages.config index 437d7321..0dbfb55c 100644 --- a/Vocaluxe/packages.config +++ b/Vocaluxe/packages.config @@ -1,15 +1,15 @@  - + - + - + diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index b0ca4a48..ee77d7aa 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -135,7 +135,7 @@ namespace VocaluxeLib.Menu MaxRect = button.MaxRect; Color = button.Color; - SelColor = button.Color; + SelColor = button.SelColor; Texture = button.Texture; SelTexture = button.SelTexture; diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs index cc01f135..063d3b12 100644 --- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs +++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs @@ -15,6 +15,7 @@ // along with Vocaluxe. If not, see . #endregion +using System; using System.Collections.Generic; using System.Windows.Forms; using VocaluxeLib.Draw; @@ -587,12 +588,15 @@ namespace VocaluxeLib.Menu } else { - _NumPlayerTeams[i] = _NumPlayer; + //Get average num players per teams as default player number + _NumPlayerTeams[i] = _NumPlayer/(_NumTeams - 1); + _NumPlayer += _NumPlayerTeams[i]; _TeamList[i] = new List(); } } } _UpdateButtonState(); + _UpdateTeamSlide(); } public void DecreaseTeamNum() @@ -603,6 +607,7 @@ namespace VocaluxeLib.Menu if (_NumTeams - 1 >= _PartyMode.MinTeams) _NumTeams--; _UpdateButtonState(); + _UpdateTeamSlide(); } public void IncreasePlayerNum(int team) @@ -691,16 +696,20 @@ namespace VocaluxeLib.Menu private void _UpdateTeamSlide() { + int sel = _SelectSlides[_SelectSlideTeams].Selection; + _SelectSlides[_SelectSlideTeams].Visible = _Teams; _SelectSlides[_SelectSlideTeams].Clear(); for (int i = 1; i <= _NumTeams; i++) _SelectSlides[_SelectSlideTeams].AddValue("Team " + i, null, i); + + _SelectSlides[_SelectSlideTeams].Selection = Math.Min(sel, _SelectSlides[_SelectSlideTeams].NumValues - 1); } private void _UpdateButtonVisibility() { - _Buttons[_ButtonIncreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; - _Buttons[_ButtonDecreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; + _Buttons[_ButtonIncreaseTeams].Visible = _AllowChangeTeamNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; + _Buttons[_ButtonDecreaseTeams].Visible = _AllowChangeTeamNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; _Buttons[_ButtonIncreasePlayer].Visible = _AllowChangePlayerNum; _Buttons[_ButtonDecreasePlayer].Visible = _AllowChangePlayerNum; } diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index 96a411cb..89b32d7d 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -554,7 +554,7 @@ namespace VocaluxeLib.Menu break; case Keys.Enter: - _StartPlaylistSong(_CurrentPlaylistElement); + _StartPlaylistSong(_CurrentPlaylistElement + _Offset); break; case Keys.Add: //move the selected song up @@ -880,7 +880,7 @@ namespace VocaluxeLib.Menu //Start selected song with double click if (mouseEvent.LD && _CurrentPlaylistElement != -1) - _StartPlaylistSong(_CurrentPlaylistElement); + _StartPlaylistSong(_CurrentPlaylistElement + _Offset); //Change order with holding LB if (mouseEvent.LBH && _CurrentPlaylistElement != -1 && _PlaylistElementContents.Count > 0 && DragAndDropSongID == -1) @@ -1259,4 +1259,4 @@ namespace VocaluxeLib.Menu } #endregion ThemeEdit } -} \ No newline at end of file +} diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index fa6310b2..f9fef6a2 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -586,6 +586,7 @@ namespace VocaluxeLib.Menu Text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _PartyModeID), Img = new CStatic(_PartyModeID) }; + el.Img.Aspect = EAspect.Crop; _VisibleElements.Add(el); } } diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs index 8bbd810a..59741a1d 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs @@ -541,7 +541,9 @@ namespace VocaluxeLib.Menu.SongMenu } _TextBG.Draw(); - CTextureRef vidtex = CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null; + CTextureRef vidtex = null; + if (CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) + vidtex = (CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null); if (vidtex != null) { @@ -683,4 +685,4 @@ namespace VocaluxeLib.Menu.SongMenu base.LoadSkin(); } } -} \ No newline at end of file +} diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index f74e81f9..7457ac52 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -515,7 +515,9 @@ namespace VocaluxeLib.Menu.SongMenu _TextBG.Draw(); - CTextureRef vidtex = CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null; + CTextureRef vidtex = null; + if (CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) + vidtex = (CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null); if (vidtex != null) { @@ -638,4 +640,4 @@ namespace VocaluxeLib.Menu.SongMenu Init(); } } -} \ No newline at end of file +} diff --git a/VocaluxeLib/Profile/CProfile.cs b/VocaluxeLib/Profile/CProfile.cs index 2e168b97..828c2f1c 100644 --- a/VocaluxeLib/Profile/CProfile.cs +++ b/VocaluxeLib/Profile/CProfile.cs @@ -67,7 +67,7 @@ namespace VocaluxeLib.Profile { Avatar = CBase.Profiles.GetAvatarByFilename(value); if (Avatar == null) - throw new Exception("Avatar '" + value + "' not found"); + CBase.Log.LogError("Avatar '" + value + "' not found"); } }