Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse slide vertices correctly #2

Open
kyubxy opened this issue Jun 21, 2024 · 0 comments
Open

Unable to parse slide vertices correctly #2

kyubxy opened this issue Jun 21, 2024 · 0 comments

Comments

@kyubxy
Copy link

kyubxy commented Jun 21, 2024

When parsing a slide, the vertices of the slide path are incorrect.

To reproduce, take the following chart connecting buttons 1 and 2 with a straight slide.

&inote_1=1-2[4:1]

Deserialise the chart contents into chart, and use the following to extract the vertices of the single slide path's segments.

const verts = chart.noteCollections[0][0].slidePaths[0].segments[0].vertices
console.log(verts)

Firstly, we expect vert[0].index to be 0 and vert[1].index to be 1 as NoteLocation indexes the buttons starting at 0. Instead however, we get the following

[ Location { index: 1, group: 0 }, Location { index: 3, group: 0 } ]

which is different from what we were expecting.

I also tested the output of the first slide of 神威 which features a slide with multiple segments.

CanReadCompoundSlide.txt

&inote_1=8<6v4[8:3]

test file

    it("should be able to read the kamui slide", async () => {
        const chartText = await fs.readFile(path.join(testChartPath, "./CanReadCompoundSlide.txt"), "utf-8");

        const simaiFile = new SimaiFile(chartText);
        const chart = SimaiConvert.deserialize(simaiFile.getValue("inote_1")!);

        const segs = chart.noteCollections[0][0].slidePaths[0].segments

        console.log("kamui 0", segs[0])
        console.log("kamui 1", segs[1])

        const vert1 = segs[0].vertices
        const vert2 = segs[1].vertices
        assert.equal(segs.length,2)

        assert.equal(vert1.length,2)
        assert.equal(vert1[0].index , 6)
        assert.equal(vert1[1].index , 5)

        assert.equal(vert2.length,2)
        assert.equal(vert2[0].index , 5)
        assert.equal(vert2[1].index , 3)
    });

The above test did not pass and the 2 console.logs gave

kamui 0 SlideSegment {
  vertices: [ Location { index: 5, group: 0 } ],
  slideType: 2
}
kamui 1 SlideSegment {
  vertices: [ Location { index: 3, group: 0 }, Location { index: 7, group: 0 } ],
  slideType: 3
}

We can also determine that the slide types are correct (2 = RingCcw and 3 = Fold), only the vertices are wrong.

I ran the tests on a fresh copy of the simai.js repo using the existing testing framework present. I have not yet verified whether this issue persists on SimaiSharp. Whenever I get the time, I can take a closer look at solving this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant