summaryrefslogtreecommitdiff
path: root/lib/simfile.dart
diff options
context:
space:
mode:
authorOrangerot <purple@orangerot.dev>2024-12-28 23:41:36 +0100
committerOrangerot <purple@orangerot.dev>2024-12-28 23:41:36 +0100
commite9ba842e21503c00686e468729ad1f57ae96241b (patch)
treebf61626ba13f3ae0950daf018d443a264abc3e0c /lib/simfile.dart
parent9eb8a2938271ad9855f3d72cbbf10eb9ba607cf1 (diff)
feat: display beats as arrows with correct time offset
Diffstat (limited to 'lib/simfile.dart')
-rw-r--r--lib/simfile.dart20
1 files changed, 20 insertions, 0 deletions
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<double, double> bpms = {};
+ double offset = 0;
+
Simfile(this.path);
void load() {
@@ -55,6 +59,22 @@ class Simfile {
List<String> keys =
fieldData[1]!.split(':').map((key) => key.trim()).toList();
String value = fieldData[2]!;
+ if (keys[0] == "BPMS") {
+ for (final pairRaw in value.split(',')) {
+ List<String> 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;