From e9ba842e21503c00686e468729ad1f57ae96241b Mon Sep 17 00:00:00 2001 From: Orangerot Date: Sat, 28 Dec 2024 23:41:36 +0100 Subject: feat: display beats as arrows with correct time offset --- lib/simfile.dart | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/simfile.dart') diff --git a/lib/simfile.dart b/lib/simfile.dart index 20e79e8..2174de9 100644 --- a/lib/simfile.dart +++ b/lib/simfile.dart @@ -1,3 +1,4 @@ +import 'dart:ffi'; import 'dart:io'; enum Difficulty { Beginner, Easy, Medium, Hard, Challenge, Edit } @@ -42,6 +43,9 @@ class Simfile { Chart? chartSimplest; + Map bpms = {}; + double offset = 0; + Simfile(this.path); void load() { @@ -55,6 +59,22 @@ class Simfile { List keys = fieldData[1]!.split(':').map((key) => key.trim()).toList(); String value = fieldData[2]!; + if (keys[0] == "BPMS") { + for (final pairRaw in value.split(',')) { + List pair = pairRaw.split('='); + if (pair.length != 2) { + continue; + } + double time = double.parse(pair[0]); + double bpm = double.parse(pair[1]); + bpms[time] = bpm; + } + } + + if (keys[0] == "OFFSET") { + offset = double.parse(value); + } + if (keys[0] != "NOTES") { tags[keys[0]] = value; continue; -- cgit v1.2.3