Francesco149 / ojsama

pure javascript implementation of https://github.com/Francesco149/oppai-ng
The Unlicense
26 stars 7 forks source link

Calculation failed on big .osu file #14

Open NeroYuki opened 5 years ago

NeroYuki commented 5 years ago

so i've used ojsama for awhile, but there are some maps that it failed to calculate possibly due to beatmap's size For example i tried this map: https://osu.ppy.sh/beatmapsets/665562#osu/1413092

i've used the example code:

var readline = require("readline");
var osu = require("ojsama");

var parser = new osu.parser();
readline.createInterface({
  input: process.stdin, terminal: false
})
.on("line", parser.feed_line.bind(parser))
.on("close", function() {
  console.log(osu.ppv2({map: parser.map}).toString());
});
$ curl https://osu.ppy.sh/osu/1413092 | node test.js

It returned error

    Math.ceil(diffobjs[0].obj.time / strain_step) * strain_step
                          ^

TypeError: Cannot read property 'obj' of undefined
    at std_diff._calc_individual (D:\NeroYuki\oppaitest\node_modules\ojsama\ojsama.js:1218:27)
    at std_diff.calc (D:\NeroYuki\oppaitest\node_modules\ojsama\ojsama.js:1036:20)
    at std_ppv2.calc (D:\NeroYuki\oppaitest\node_modules\ojsama\ojsama.js:1547:30)
    at Object.ppv2 (D:\NeroYuki\oppaitest\node_modules\ojsama\ojsama.js:1776:27)
    at Interface.<anonymous> (D:\NeroYuki\oppaitest\test.js:10:19)
    at Interface.emit (events.js:187:15)
    at Interface.close (readline.js:379:8)
    at Socket.onend (readline.js:157:10)
    at Socket.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1081:12)

sorry if i sound a bit weird, not used to github and issues report but i'm trying

Francesco149 commented 5 years ago

i can't seem to reproduce with the specific map you linked, but there are some .osu files which are truncated to 1mb and missing hitobjects due to a bug with the osu site and that might be it. the error definitely looks like a map with no hitobjects