Fix offsets for chart converters.

This commit is contained in:
2022-12-16 14:36:10 +08:00
parent 6e0f41c7fd
commit 645c4af2f2
2 changed files with 4 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ namespace Cryville.Crtr.Extensions.Malody {
public class MalodyChartConverter : ResourceConverter {
static readonly string[] SUPPORTED_FORMATS = { ".mc", ".mcz" };
static readonly string[] MODES = { "key", "step", "dj", "catch", "pad", "taiko", "ring", "slide", "live" };
const double OGG_OFFSET = 0.05;
public override string[] GetSupportedFormats() {
return SUPPORTED_FORMATS;
@@ -107,7 +108,7 @@ namespace Cryville.Crtr.Extensions.Malody {
chart.sounds.Add(new Chart.Sound {
time = new BeatTime(0, 0, 1),
id = res.Name,
offset = -tev.offset / 1000f,
offset = (float)(-tev.offset / 1000f + (tev.sound.EndsWith(".ogg", StringComparison.OrdinalIgnoreCase) ? OGG_OFFSET : 0)),
});
}
else throw new NotImplementedException();

View File

@@ -9,6 +9,7 @@ using System.IO;
namespace Cryville.Crtr.Extensions.Quaver {
public class QuaverChartConverter : ResourceConverter {
static readonly string[] SUPPORTED_FORMATS = { ".qua" };
const double OFFSET = 0.05;
public override string[] GetSupportedFormats() {
return SUPPORTED_FORMATS;
@@ -35,7 +36,7 @@ namespace Cryville.Crtr.Extensions.Quaver {
ruleset = ruleset,
sigs = new List<Chart.Signature>(),
sounds = new List<Chart.Sound> {
new Chart.Sound { time = new BeatTime(0, 0, 1), id = src.Title, offset = -src.TimingPoints[0].StartTime / 1e3f }
new Chart.Sound { time = new BeatTime(0, 0, 1), id = src.Title, offset = (float)(src.TimingPoints[0].StartTime / 1e3 + OFFSET) }
},
motions = new List<Chart.Motion>(),
groups = new List<Chart.Group>(),