@rian8337/osu-droid-replay-analyzer 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RefreshRateChecker = void 0;
4
+ /**
5
+ * Utility to measure the refresh rate of a device through a replay.
6
+ *
7
+ * Keep in mind that this is not the exact refresh rate of the device.
8
+ * This is merely an estimation from detection.
9
+ */
10
+ class RefreshRateChecker {
11
+ /**
12
+ * @param data The replay that will be checked.
13
+ */
14
+ constructor(data) {
15
+ this.data = data;
16
+ }
17
+ /**
18
+ * Estimates the refresh rate of the device through the replay.
19
+ *
20
+ * @returns The estimated refresh rate.
21
+ */
22
+ estimate() {
23
+ let minTimeDiff = Number.POSITIVE_INFINITY;
24
+ for (let i = 0; i < this.data.cursorMovement.length; ++i) {
25
+ const cursorData = this.data.cursorMovement[i];
26
+ for (let j = 1; j < cursorData.size; ++j) {
27
+ const timeDiff = cursorData.time[j] - cursorData.time[j - 1];
28
+ if (timeDiff > 0) {
29
+ minTimeDiff = Math.min(minTimeDiff, timeDiff);
30
+ }
31
+ }
32
+ }
33
+ console.log(`Minimum hit time difference:`, minTimeDiff);
34
+ return 1000 / minTimeDiff;
35
+ }
36
+ }
37
+ exports.RefreshRateChecker = RefreshRateChecker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-droid-replay-analyzer",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A replay analyzer for analyzing osu!droid replay files.",
5
5
  "keywords": [
6
6
  "osu",
@@ -31,9 +31,9 @@
31
31
  "url": "https://github.com/Rian8337/osu-droid-module/issues"
32
32
  },
33
33
  "dependencies": {
34
- "@rian8337/osu-base": "^1.0.5",
35
- "@rian8337/osu-difficulty-calculator": "^1.2.0",
36
- "@rian8337/osu-rebalance-difficulty-calculator": "^1.2.0",
34
+ "@rian8337/osu-base": "^1.2.1",
35
+ "@rian8337/osu-difficulty-calculator": "^1.2.1",
36
+ "@rian8337/osu-rebalance-difficulty-calculator": "^1.2.1",
37
37
  "java-deserialization": "^0.1.0",
38
38
  "unzipper": "^0.10.11"
39
39
  },
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "745e369ae1c5895e7a58188cb522eaecac618966"
48
+ "gitHead": "8c08cf8f2c3af4b9a306f9fe9ffedfe339b9b046"
49
49
  }