forum

osu!mania osr replay file format

posted
Total Posts
7
Topic Starter
4ksrub
Hi there,

I'm trying to create a program for analyzing replays for osu!mania. I have checked https://osu.ppy.sh/wiki/Osr_(file_format) and tried to follow the file format described. However, it seems that the format described is for standard, and it seems to me that the format is fundamentally different for osu!mania files (and under modes I presume). I couldn't really figure out what was going on, and was wondering if anyone has some knowledge in this who could help me out a bit.

On another note, the wiki mentions that "remaining data contains information about mouse movement and key presses in an wikipedia:LZMA stream". I am not quite sure how to actually decompress it, since the compressed data is part of a file.

Thanks
Roan
Hello,

The format for osu!mania isn't all that different from the standard format. The only real difference is that for the mania format multiple x,y coordinates map to the same note. But someone already explained this quite nicely here: t/314918
So I'm just going to quote that:
Quote

Rei Hakurei wrote:

mania formula, is only check the [x] coordinate, or the first integer that you found.

let's say the playfield is 512 (a constant)
assume that you have nK,

it basically means, every column is separated by (512/n)px, osu always truncates the integer
for     zone
4 keys 0-127;128-255;256-383;384-511
5 keys 0-101;102-203;204-306;307-408;409-511
6 keys 0-84;85-169;170-255;256-340;341-425;426-511
and so forth

by using that logic, you could differ that the hitobject parameter (which is shown below)
x,y,time,type,hitsound
and find out which column that the note is placed one by calculating the x with the (512/n),

let's say i have a pattern like this
36,100,1000,5,0
88,150,1250,1,0
441,125,1500,1,0

if i assume it was on 6 keys chart, these note basically were placed on
Time  [1][2][3][4][5][6] Explanation
1.000 O - - - - - 36 / (512/6) < 1, first column then.
1.250 - O - - - - 88 / (512/6) < 2, second column then.
1.500 - - - - - O 441 / (512/6) < 6, last/sixth column then.

ps. that first column IS ZERO
ps II. it just the basic of placing hitobject, not about holds and other, play with bit code on type parameter
bitcode  object type
00000000 NULL
00000001 Note
00000010 Mania Slider (deprecated/only auto-converts)
00000101 New Combo Note (useless, new combo doesn't mean anything in mania)
00001000 Mania Spinner (deprecated/only auto-converts)
yxxxy1yy New Combo Manipulation (useless in mania, x is possible combination,
10010100 while y is EXCLUSIVE ONLY ONE BIT that have 1)
11010100
00111100
etc.
10000000 Hold (mania basic holds)

As for the LZMA stream, the implementation for that depends a lot on the library and programming language you're using. For my own project (which is written in Java) I am using this library but there are probably libraries for other languages aswell.

As for how to approach reading the stream, there's two main options.
1. You could read the Integer that specifies the length of the compressed data and then write that compressed data to it's own file. After that you can point your LZMA library to the file and read the data.
2. If your LZMA library supports it (mine does) you can read the compressed data directly from the .osr file (provided you skip the leading metadata somehow).

For both methods the LZMA library will give you a stream with the uncompressed data which you can then either write to a temporary file, store in memory or directly process.

I hope this was helpful to you & good luck ^^
Topic Starter
4ksrub
Thank you for your very detailed reply. Luckily I am also working in java, so I'm really hoping that library will work out. :)
Roan

4ksrub wrote:

Thank you for your very detailed reply. Luckily I am also working in java, so I'm really hoping that library will work out. :)
Nice :)

P.S. If you have anymore questions feel free to ask ^^.
abraker
You can also check out my analyzer for beatmap and replay parsing code. It's written in C++, but I don't think that's too far from Java.

https://github.com/abraker95/osu-Replay-Analyzer
Topic Starter
4ksrub
Neat, looking at your description on github it seems you've done a lot of the work I was intending to do for me. As of now I'm downloading Visual Studios to test it out, but my internet is a potato, so I'll have to wait till tomorrow before I could actually check out what you got. Thanks for sharing!

On that note, I am still quite new with github and the rules of sharing code. What are the regulations on how much code I can use from your repository? On the other hand, what about the case where I make further modifications on your program?
abraker

4ksrub wrote:

On that note, I am still quite new with github and the rules of sharing code. What are the regulations on how much code I can use from your repository? On the other hand, what about the case where I make further modifications on your program?
Yea go ahead and use it however you please. Just make sure to give credit if you plan on forking it and/or using whole source files in your own thing.

I should real put a license there...
Please sign in to reply.

New reply