Giter Club home page Giter Club logo

rosu-pp's People

Contributors

maxohn avatar pure-peace avatar yentis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rosu-pp's Issues

maxCombo

i'm using the js-wrapper for rosu-pp and i'm trying to get the maxCombo value from the beatmap calculation.
is that somehow possible to recieve the maxCombo out of the .osu file with the calculate method?
because there is a documentation inside that showes maxCombo as value but when i look on the response i don't have that.
it would really help me a lot having that!
Docs
Response

Add option to change beatmaps difficulty settings

Would be cool to be able to change AR, OD etc. without editing the .osu file before parsing with rosu-pp.
Another good addition would be being able to also change the "speed rate" of the map. e.g. setting it to something like 1.2x instead of being limited to only DT/HT or 1.5x/0.75x respectively.

mods

I'm not sure about the numbers when specifying mods.
HD=8
HR=16
DT=64
I understand up to this point, but
but I don't understand the rest.
I looked around for about an hour and could not find it (maybe because I don't understand English very well).
I would be very grateful if you could help me.

PP calculation from cached attributes not working in v0.10.0

Problem

I have been using rosu-pp to calculate scores in a project of mine, where I planned to calculate difficulty attributes once and reuse them constantly. This was working great up until v0.10.0.

pub fn get_pp(attr: DifficultyAttributes, score: CScore) -> f64 {
    Beatmap::default()
        .pp()
        .attributes(attr)
        .combo(score.combo)
        .n300(score.n300)
        .n100(score.n100)
        .n50(score.n050)
        .n_misses(score.misses)
        .calculate()
        .pp()
}

It always returns 0 now.

The only way to fix this is loading the beatmap file and calculating PP from there... It'd be great to have the option to calculate PP straight from the difficulty attributes again.

Difficulty

Difficulty was being calculated this way:

pub fn get_difficulty(bytes: &[u8], mods: u32, mode: GameMode) -> Result<DifficultyAttributes, String> {
    let parse = Beatmap::from_bytes(bytes);
    return match parse {
        Ok(map) => Ok(map.stars().mods(mods).mode(mode).calculate()),
        Err(why) => Err(why.to_string())
    };
}

Workaround

Changing it so that the pp calculation is done on the beatmap itself works just fine, only problem is that can't really cache the attributes and discard the map for future PP calculations.

pub extern "C" fn GetPPFromMap(bytes: &[u8], mods: u32, mode: GameMode, score: CScore) -> f64 {
    let parse = Beatmap::from_bytes(bytes);
    return match parse {
        Ok(map) => {
            map.pp()
               .mode(mode)
               .mods(mods)
               .combo(score.combo)
               .n300(score.n300)
               .n100(score.n100)
               .n50(score.n050)
               .n_misses(score.misses)
               .calculate()
               .pp()
        }
        Err(_) => { 0.0 }
    };
}

p.s: Example code has been slightly adapted from the real thing, as seen here https://github.com/Minoxs/crosu-pp

fix end_time for sliders

HitObject::end_time currently doesn't give the correct end time for sliders since it's not used in any calculation.
Since it's a public function, it should return the correct value though.

Catch convert panics at reserving ticks vector

Attempting to calculate catch convert SR in Helix's Aleph-0 (Jack of all Trades diff) seems to lead to capacity overflow while trying to reserve ticks vector.

Stack trace
thread 'main' panicked at 'capacity overflow', library\alloc\src\raw_vec.rs:517:5
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\std\src\panicking.rs:584
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\core\src\panicking.rs:142
   2: alloc::raw_vec::capacity_overflow
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\alloc\src\raw_vec.rs:517
   3: alloc::raw_vec::handle_reserve
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\raw_vec.rs:488
   4: alloc::raw_vec::impl$1::reserve::do_reserve_and_handle<tuple$<rosu_pp::parse::pos2::Pos2,f64>,alloc::alloc::Global>
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\raw_vec.rs:285
   5: alloc::raw_vec::RawVec<tuple$<rosu_pp::parse::pos2::Pos2,f64>,alloc::alloc::Global>::reserve<tuple$<rosu_pp::parse::pos2::Pos2,f64>,alloc::alloc::Global>
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\raw_vec.rs:289
   6: alloc::vec::Vec<tuple$<rosu_pp::parse::pos2::Pos2,f64>,alloc::alloc::Global>::reserve<tuple$<rosu_pp::parse::pos2::Pos2,f64>,alloc::alloc::Global>
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\vec\mod.rs:815
   7: enum$<rosu_pp::catch::fruit_or_juice::FruitOrJuice>::new
             at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\fruit_or_juice.rs:98
   8: rosu_pp::catch::calculate_movement::closure$0
             at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\mod.rs:172
   9: core::ops::function::impls::impl$3::call_mut<tuple$<ref$<rosu_pp::parse::hitobject::HitObject> >,rosu_pp::catch::calculate_movement::closure_env$0>
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\ops\function.rs:290
  10: core::slice::iter::impl$173::find_map<rosu_pp::parse::hitobject::HitObject,enum$<rosu_pp::catch::fruit_or_juice::FruitOrJuice>,ref_mut$<rosu_pp::catch::calculate_movement::closure_env$0> >
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\slice\iter\macros.rs:276
  11: core::iter::adapters::filter_map::impl$2::next<enum$<rosu_pp::catch::fruit_or_juice::FruitOrJuice>,core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0>
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\filter_map.rs:61
  12: core::iter::adapters::fuse::impl$9::next<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0> >
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\fuse.rs:364
  13: core::iter::adapters::fuse::impl$2::next<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0> >
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\fuse.rs:70
  14: core::iter::adapters::flatten::impl$17::next<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0>,enum$<rosu_pp::catch::fruit_or_juice::FruitOrJuice> >
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\flatten.rs:299
  15: core::iter::adapters::flatten::impl$12::next<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0>,enum$<rosu_pp::catch::fruit_or_juice::FruitOrJuice> >
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\flatten.rs:192
  16: core::iter::adapters::take::impl$1::next<core::iter::adapters::flatten::Flatten<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0> > >
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\take.rs:37
  17: rosu_pp::catch::calculate_movement
             at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\mod.rs:207
  18: rosu_pp::catch::CatchStars::calculate
             at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\mod.rs:100
  19: enum$<rosu_pp::stars::AnyStars>::calculate
             at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\stars.rs:107
  20: osu_ipc_rust::osu::calculate_sr
             at .\src\osu.rs:19

// * A very lenient maximum length of a slider for ticks to be generated.
// * This exists for edge cases such as /b/1573664 where the beatmap has
// * been edited by the user, and should never be reached in normal usage.
let max_len = 100_000.0;
let len = curve.dist().min(max_len);
tick_dist = tick_dist.clamp(0.0, len);
let min_dist_from_end = velocity * 10.0;
let mut curr_dist = tick_dist;
let time_add = duration * tick_dist / (*pixel_len * span_count);
let target = *pixel_len - tick_dist / 8.0;
params.ticks.reserve((target / tick_dist) as usize);

from bytes

Why is there no option to parse a beatmap from bytes instead of a file?? so much more useful in so many scenarios

Fails on a ranked map (the map appears corrupted but the checksum matches)

This map https://osu.ppy.sh/beatmapsets/13023#osu/49374 (https://osu.ppy.sh/osu/49374) has byte 0xd1 as a storyboard command.

As the map is ranked, I think rosu-pp should support it somehow.

The error this causes is of course :

Error: failed parse

Caused by:
    0: IO error
    1: stream did not contain valid UTF-8

Not sure what would be a good solution other than not reading the file as a string, but as a byte vector.
Epic project btw, saved me from running C# on my server, thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.