Skip to content

Commit

Permalink
Merge pull request #143 from ToniMacaroni/development
Browse files Browse the repository at this point in the history
Ver 2.5.2
  • Loading branch information
ToniMacaroni authored Jan 12, 2023
2 parents 4875b53 + 501aed3 commit 8fb3cd7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
17 changes: 15 additions & 2 deletions SaberFactory/Configuration/ConfigBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Reflection;
using Newtonsoft.Json;
using SaberFactory.Helpers;
using UnityEngine;
using Zenject;

namespace SaberFactory.Configuration
Expand All @@ -20,14 +21,18 @@ public abstract class ConfigBase : IInitializable, IDisposable

private readonly Dictionary<PropertyInfo, object> _originalValues = new Dictionary<PropertyInfo, object>();

private bool _didLoadingFail;

protected ConfigBase(PluginDirectories pluginDirs, string fileName)
{
ConfigFile = pluginDirs.SaberFactoryDir.GetFile(fileName);
}

public void Dispose()
{
if (SaveOnDispose)
// if loading failed, we don't want to put the original values back
// let the user fix the config file
if (SaveOnDispose && !_didLoadingFail)
{
Save();
}
Expand Down Expand Up @@ -62,7 +67,15 @@ public void Load()
return;
}

JsonConvert.PopulateObject(ConfigFile.ReadText(), this);
try
{
JsonConvert.PopulateObject(ConfigFile.ReadText(), this);
}
catch (Exception e)
{
_didLoadingFail = true;
Debug.LogError($"[Saber Factory Configs] Failed to load config file {ConfigFile.Name}");
}
}

public void Save()
Expand Down
2 changes: 1 addition & 1 deletion SaberFactory/Helpers/BeatmapHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static float GetLastNoteTime(this BeatmapData beatmapData)
{
var lastTime = 0f;

foreach (var noteData in beatmapData.GetBeatmapDataItems<NoteData>())
foreach (var noteData in beatmapData.GetBeatmapDataItems<NoteData>(0))
{
if (noteData.colorType == ColorType.None)
{
Expand Down
10 changes: 5 additions & 5 deletions SaberFactory/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"id": "SaberFactory",
"name": "Saber Factory",
"author": "Toni Macaroni",
"version": "2.5.1",
"version": "2.5.2",
"description": "A highly customizable saber mod",
"gameVersion": "1.20.0",
"gameVersion": "1.27.0",
"dependsOn": {
"BSIPA": "^4.2.0",
"SiraUtil": "^3.0.1",
"BeatSaberMarkupLanguage": "^1.5.4"
"BSIPA": "^4.2.2",
"SiraUtil": "^3.1.2",
"BeatSaberMarkupLanguage": "^1.6.8"
}
}
13 changes: 5 additions & 8 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
*(for Beat Saber 1.20)*
*(for Beat Saber 1.27)*

- Update for Beat Saber 1.20
- Made all patreon features free
- Allow mods to add sabers from memory
- Fixed auto refreshing trail when changin whitestep
- Fixed rotation offset not being mirrored
- Fixed accuracy events
- New saber creation project <https://github.com/ToniMacaroni/AssetCreationProject>
- Update for Beat Saber 1.27
- Fixed zenject error with faulty trail config
- Fixed `_UserColorLeft` and `_UserColorRight` properties not being updated (thanks to @AlexxSeven)

*this is just a small update for bug fixes in 2.x.x, v3 is still being developed in parallel*
*Needs `BeatSaberMarkupLanguage` and `SiraUtil` (available on ModAssistant)*

0 comments on commit 8fb3cd7

Please sign in to comment.