updated osu's clockrate bugfix

mania: updated to osu's clockrate bugfix

taiko: updated to osu's clockrate bugfix

fruits: updated to osu's clockrate bugfix
This commit is contained in:
MaxOhn
2021-08-09 11:39:12 +02:00
parent dc3486201f
commit cc8c893866
12 changed files with 65 additions and 55 deletions
+3
View File
@@ -2,6 +2,9 @@
- Reduced amount of required features of `async_std` and `async_tokio` - Reduced amount of required features of `async_std` and `async_tokio`
- Fixed a panic for some mania difficulty calculations on converts - Fixed a panic for some mania difficulty calculations on converts
- Updated the difficulty & pp changes from 21.07.27
- Fixed dead loop when reading empty `.osu` files ([#2] - [@Pure-Peace])
- Updated osu's clockrate bugfix for all modes
# v0.2.2 # v0.2.2
+3
View File
@@ -7,6 +7,7 @@ pub(crate) struct DifficultyObject<'o> {
pub(crate) last: &'o CatchObject, pub(crate) last: &'o CatchObject,
pub(crate) delta: f32, pub(crate) delta: f32,
pub(crate) start_time: f32,
pub(crate) normalized_pos: f32, pub(crate) normalized_pos: f32,
pub(crate) last_normalized_pos: f32, pub(crate) last_normalized_pos: f32,
@@ -24,6 +25,7 @@ impl<'o> DifficultyObject<'o> {
clock_rate: f32, clock_rate: f32,
) -> Self { ) -> Self {
let delta = (base.time - last.time) / clock_rate; let delta = (base.time - last.time) / clock_rate;
let start_time = base.time / clock_rate;
let strain_time = delta.max(40.0); let strain_time = delta.max(40.0);
let scaling_factor = NORMALIZED_HITOBJECT_RADIUS / half_catcher_width; let scaling_factor = NORMALIZED_HITOBJECT_RADIUS / half_catcher_width;
@@ -34,6 +36,7 @@ impl<'o> DifficultyObject<'o> {
base, base,
last, last,
delta, delta,
start_time,
normalized_pos, normalized_pos,
last_normalized_pos, last_normalized_pos,
strain_time, strain_time,
+4 -4
View File
@@ -227,7 +227,7 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
while h.base.time > current_section_end { while h.base.time > current_section_end {
movement.save_current_peak(); movement.save_current_peak();
movement.start_new_section_from(current_section_end); movement.start_new_section_from(current_section_end / attributes.clock_rate);
current_section_end += section_len; current_section_end += section_len;
} }
@@ -247,7 +247,7 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
while h.base.time > current_section_end { while h.base.time > current_section_end {
movement.save_current_peak(); movement.save_current_peak();
movement.start_new_section_from(current_section_end); movement.start_new_section_from(current_section_end / attributes.clock_rate);
current_section_end += section_len; current_section_end += section_len;
} }
@@ -451,7 +451,7 @@ pub fn strains(map: &Beatmap, mods: impl Mods) -> Strains {
while h.base.time > current_section_end { while h.base.time > current_section_end {
movement.save_current_peak(); movement.save_current_peak();
movement.start_new_section_from(current_section_end); movement.start_new_section_from(current_section_end / attributes.clock_rate);
current_section_end += section_len; current_section_end += section_len;
} }
@@ -471,7 +471,7 @@ pub fn strains(map: &Beatmap, mods: impl Mods) -> Strains {
while h.base.time > current_section_end { while h.base.time > current_section_end {
movement.save_current_peak(); movement.save_current_peak();
movement.start_new_section_from(current_section_end); movement.start_new_section_from(current_section_end / attributes.clock_rate);
current_section_end += section_len; current_section_end += section_len;
} }
+1 -1
View File
@@ -59,7 +59,7 @@ impl Movement {
self.current_strain *= strain_decay(current.delta); self.current_strain *= strain_decay(current.delta);
self.current_strain += self.strain_value_of(&current) * SKILL_MULTIPLIER; self.current_strain += self.strain_value_of(&current) * SKILL_MULTIPLIER;
self.current_section_peak = self.current_strain.max(self.current_section_peak); self.current_section_peak = self.current_strain.max(self.current_section_peak);
self.prev_time.replace(current.base.time); self.prev_time.replace(current.start_time);
} }
pub(crate) fn difficulty_value(&mut self) -> f32 { pub(crate) fn difficulty_value(&mut self) -> f32 {
+4 -2
View File
@@ -74,7 +74,7 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
for h in hit_objects { for h in hit_objects {
while h.base.start_time > current_section_end { while h.base.start_time > current_section_end {
strain.save_current_peak(); strain.save_current_peak();
strain.start_new_section_from(current_section_end); strain.start_new_section_from(current_section_end / clock_rate);
current_section_end += section_len; current_section_end += section_len;
} }
@@ -126,7 +126,7 @@ pub fn strains(map: &Beatmap, mods: impl Mods) -> Strains {
for h in hit_objects { for h in hit_objects {
while h.base.start_time > current_section_end { while h.base.start_time > current_section_end {
strain.save_current_peak(); strain.save_current_peak();
strain.start_new_section_from(current_section_end); strain.start_new_section_from(current_section_end / clock_rate);
current_section_end += section_len; current_section_end += section_len;
} }
@@ -147,6 +147,7 @@ pub(crate) struct DifficultyHitObject<'o> {
base: &'o HitObject, base: &'o HitObject,
column: usize, column: usize,
delta: f32, delta: f32,
start_time: f32,
} }
impl<'o> DifficultyHitObject<'o> { impl<'o> DifficultyHitObject<'o> {
@@ -159,6 +160,7 @@ impl<'o> DifficultyHitObject<'o> {
base, base,
column, column,
delta: (base.start_time - prev.start_time) / clock_rate, delta: (base.start_time - prev.start_time) / clock_rate,
start_time: base.start_time / clock_rate,
} }
} }
} }
+1 -1
View File
@@ -67,7 +67,7 @@ impl Strain {
self.current_strain *= self.strain_decay(current.delta); self.current_strain *= self.strain_decay(current.delta);
self.current_strain += self.strain_value_of(&current) * SKILL_MULTIPLIER; self.current_strain += self.strain_value_of(&current) * SKILL_MULTIPLIER;
self.current_section_peak = self.current_strain.max(self.current_section_peak); self.current_section_peak = self.current_strain.max(self.current_section_peak);
self.prev_time.replace(current.base.start_time); self.prev_time.replace(current.start_time);
} }
fn strain_value_of(&mut self, current: &DifficultyHitObject) -> f32 { fn strain_value_of(&mut self, current: &DifficultyHitObject) -> f32 {
+2
View File
@@ -8,6 +8,7 @@ pub(crate) struct DifficultyObject<'o> {
pub(crate) prev: &'o HitObject, pub(crate) prev: &'o HitObject,
pub(crate) delta: f32, pub(crate) delta: f32,
pub(crate) rhythm: &'static HitObjectRhythm, pub(crate) rhythm: &'static HitObjectRhythm,
pub(crate) start_time: f32,
} }
impl<'o> DifficultyObject<'o> { impl<'o> DifficultyObject<'o> {
@@ -28,6 +29,7 @@ impl<'o> DifficultyObject<'o> {
prev, prev,
delta, delta,
rhythm, rhythm,
start_time: base.start_time / clock_rate,
} }
} }
} }
+2 -2
View File
@@ -84,7 +84,7 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
while h.base.start_time > current_section_end { while h.base.start_time > current_section_end {
for skill in skills.iter_mut() { for skill in skills.iter_mut() {
skill.save_current_peak(); skill.save_current_peak();
skill.start_new_section_from(current_section_end); skill.start_new_section_from(current_section_end / clock_rate);
} }
current_section_end += section_len; current_section_end += section_len;
@@ -172,7 +172,7 @@ pub fn strains(map: &Beatmap, mods: impl Mods) -> Strains {
while h.base.start_time > current_section_end { while h.base.start_time > current_section_end {
for skill in skills.iter_mut() { for skill in skills.iter_mut() {
skill.save_current_peak(); skill.save_current_peak();
skill.start_new_section_from(current_section_end); skill.start_new_section_from(current_section_end / clock_rate);
} }
current_section_end += section_len; current_section_end += section_len;
+1 -1
View File
@@ -53,7 +53,7 @@ impl Skill {
self.current_strain += self.current_strain +=
self.kind.strain_value_of(&current, cheese) * self.skill_multiplier(); self.kind.strain_value_of(&current, cheese) * self.skill_multiplier();
self.current_section_peak = self.current_section_peak.max(self.current_strain); self.current_section_peak = self.current_section_peak.max(self.current_strain);
self.prev_time.replace(current.base.start_time); self.prev_time.replace(current.start_time);
} }
#[inline] #[inline]
+16 -16
View File
@@ -114,8 +114,8 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 1977380, map_id: 1977380,
mods: 256, mods: 256,
stars: 2.0564713386286573, stars: 2.053266215316665,
pp: 45.1590377326849, pp: 45.018113339112304,
}, },
MapResult { MapResult {
map_id: 1977380, map_id: 1977380,
@@ -132,8 +132,8 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 1977380, map_id: 1977380,
mods: 64, mods: 64,
stars: 3.589887228221038, stars: 3.5912721232736073,
pp: 141.14620680718699, pp: 141.25524875691985,
}, },
MapResult { MapResult {
map_id: 1977380, map_id: 1977380,
@@ -151,8 +151,8 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 1974968, map_id: 1974968,
mods: 256, mods: 256,
stars: 1.9544305373156605, stars: 1.9502416666346483,
pp: 42.91338693937752, pp: 42.729265293038324,
}, },
MapResult { MapResult {
map_id: 1974968, map_id: 1974968,
@@ -169,8 +169,8 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 1974968, map_id: 1974968,
mods: 64, mods: 64,
stars: 3.650649037957456, stars: 3.655540489429042,
pp: 139.53871429136828, pp: 139.91329907739348,
}, },
MapResult { MapResult {
map_id: 1974968, map_id: 1974968,
@@ -188,8 +188,8 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 2420076, map_id: 2420076,
mods: 256, mods: 256,
stars: 4.791039358886245, stars: 4.789614811665553,
pp: 258.46694642171224, pp: 258.3131405278226,
}, },
MapResult { MapResult {
map_id: 2420076, map_id: 2420076,
@@ -206,8 +206,8 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 2420076, map_id: 2420076,
mods: 64, mods: 64,
stars: 8.908315960310958, stars: 8.910276701845461,
pp: 1138.695343583009, pp: 1139.1968785738873,
}, },
MapResult { MapResult {
map_id: 2420076, map_id: 2420076,
@@ -225,8 +225,8 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 2206596, map_id: 2206596,
mods: 256, mods: 256,
stars: 4.767182611189798, stars: 4.7660034867565795,
pp: 300.15942914986067, pp: 300.0108412850544,
}, },
MapResult { MapResult {
map_id: 2206596, map_id: 2206596,
@@ -243,8 +243,8 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 2206596, map_id: 2206596,
mods: 64, mods: 64,
stars: 8.93391286552717, stars: 8.937404638714733,
pp: 1315.2112887084272, pp: 1316.2400280229178,
}, },
MapResult { MapResult {
map_id: 2206596, map_id: 2206596,
+12 -12
View File
@@ -114,8 +114,8 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 1355822, map_id: 1355822,
mods: 256, mods: 256,
stars: 2.2710870990702627, stars: 2.2684169993943653,
pp: 43.654638516311564, pp: 43.53325918930298,
}, },
MapResult { MapResult {
map_id: 1355822, map_id: 1355822,
@@ -126,15 +126,15 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 1355822, map_id: 1355822,
mods: 64, mods: 64,
stars: 3.748525363730352, stars: 3.7490047677821776,
pp: 140.25944202912322, pp: 140.30066841634704,
}, },
// ----- // -----
MapResult { MapResult {
map_id: 1974394, map_id: 1974394,
mods: 256, mods: 256,
stars: 3.8736942117487256, stars: 3.873141963622833,
pp: 155.79817482289727, pp: 155.74720954392703,
}, },
MapResult { MapResult {
map_id: 1974394, map_id: 1974394,
@@ -145,15 +145,15 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 1974394, map_id: 1974394,
mods: 64, mods: 64,
stars: 6.517894438878535, stars: 6.518026726802542,
pp: 508.4849982082652, pp: 508.5082744648102,
}, },
// ----- // -----
MapResult { MapResult {
map_id: 992512, map_id: 992512,
mods: 256, mods: 256,
stars: 5.29507262961579, stars: 5.282601951185166,
pp: 317.82741466200764, pp: 316.1318109880581,
}, },
MapResult { MapResult {
map_id: 992512, map_id: 992512,
@@ -164,7 +164,7 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 992512, map_id: 992512,
mods: 64, mods: 64,
stars: 8.944195050951032, stars: 8.974411542576131,
pp: 1035.4596772151892, pp: 1043.3119173151915,
}, },
]; ];
+16 -16
View File
@@ -114,8 +114,8 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 110219, map_id: 110219,
mods: 256, mods: 256,
stars: 4.090461690284154, stars: 4.08968885024159,
pp: 172.2934532692781, pp: 172.2618767481684,
}, },
MapResult { MapResult {
map_id: 110219, map_id: 110219,
@@ -126,15 +126,15 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 110219, map_id: 110219,
mods: 64, mods: 64,
stars: 6.785308286298745, stars: 6.7868926972961,
pp: 420.66337091577, pp: 420.7721479461209,
}, },
// ----- // -----
MapResult { MapResult {
map_id: 168450, map_id: 168450,
mods: 256, mods: 256,
stars: 3.9102755155437663, stars: 3.906304814419791,
pp: 159.66231311695273, pp: 159.50978823553345,
}, },
MapResult { MapResult {
map_id: 168450, map_id: 168450,
@@ -145,15 +145,15 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 168450, map_id: 168450,
mods: 64, mods: 64,
stars: 5.894260068145283, stars: 5.900723352868479,
pp: 352.08717183038954, pp: 352.4632039368069,
}, },
// ----- // -----
MapResult { MapResult {
map_id: 1097541, map_id: 1097541,
mods: 256, mods: 256,
stars: 4.0027499635116595, stars: 4.001086710846427,
pp: 181.18594125657705, pp: 181.1195995270953,
}, },
MapResult { MapResult {
map_id: 1097541, map_id: 1097541,
@@ -164,15 +164,15 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 1097541, map_id: 1097541,
mods: 64, mods: 64,
stars: 6.587467490088248, stars: 6.588219669147997,
pp: 433.97174733352375, pp: 434.0217833573784,
}, },
// ----- // -----
MapResult { MapResult {
map_id: 1432878, map_id: 1432878,
mods: 256, mods: 256,
stars: 3.5850143199594258, stars: 3.5826958150176584,
pp: 127.27033873288904, pp: 127.191831998499,
}, },
MapResult { MapResult {
map_id: 1432878, map_id: 1432878,
@@ -183,7 +183,7 @@ const RESULTS: &[MapResult] = &[
MapResult { MapResult {
map_id: 1432878, map_id: 1432878,
mods: 64, mods: 64,
stars: 5.908970879987477, stars: 5.912036178782906,
pp: 307.9875634986321, pp: 308.1608793395345,
}, },
]; ];