.osr 文件格式解析(一) - 官方格式说明

来源:互联网 发布:淘宝买衣服怎么选码子 编辑:程序博客网 时间:2024/06/03 13:24

先上官网原文: Osr (file format) - osu!wiki

.osr is a file format containing information about an osu! replay. To use it, the beatmap specified by the file is required in “Songs” folder.

Data Types

Name Bytes Description Byte 1 A single 8 bit value. Short 2 A 2-byte little endian value. Integer 4 A 4-byte little endian value. Long 8 A 8-byte little endian value. ULEB128 Variable A variable length integer. See wikipedia:ULEB128. String Variable Has three parts; a single byte which will be either 0x00, indicating that the next two parts are not present, or 0x0b (decimal 11), indicating that the next two parts are present. If it is 0x0b, there will then be a ULEB128, representing the byte length of the following string, and then the string itself, encoded in UTF-8. See wikipedia:UTF-8

Format

Byte offsets are not included in this table due to variable length values.

Data Type Description Byte Game mode of the replay (0 = osu! Standard, 1 = Taiko, 2 = Catch the Beat, 3 = osu!mania) Integer Version of the game when the replay was created (ex. 20131216) String osu! beatmap MD5 hash String Player name String osu! replay MD5 hash (includes certain properties of the replay) Short Number of 300s Short Number of 100s in standard, 150s in Taiko, 100s in CTB, 200s in mania Short Number of 50s in standard, small fruit in CTB, 50s in mania Short Number of Gekis in standard, Max 300s in mania Short Number of Katus in standard, 100s in mania Short Number of misses Integer Total score displayed on the score report Short Greatest combo displayed on the score report Byte Perfect/full combo (1 = no misses and no slider breaks and no early finished sliders) Integer Mods used. See below for list of mod values. String Life bar graph: comma separated pairs u┃v, where u is the time in milliseconds into the song and v is a floating point value from 0 - 1 that represents the amount of life you have at the given time (0 = life bar is empty, 1= life bar is full). Long Time stamp Windows ticks Integer Length in bytes of compressed replay data Byte Array Compressed replay data

The remaining data contains information about mouse movement and key presses in an wikipedia:LZMA stream.
When decompressed, the text contains data separated by commas. Each piece denotes an action, represented by 4 numbers in the form: w | x | y | z.

Part Data Type Description w Long Time in milliseconds since the previous action x Float x-coordinate of the cursor from 0 - 512 y Float y-coordinate of the cursor from 0 - 384 z Integer Bitwise combination of keys/mouse buttons pressed (M1 = 1, M2 = 2, K1 = 5, K2 = 10)

Mods

As seen on the osu! API.

Mod Value (BitOffset) Comment None 0 NoFail 1 (0) Easy 2 (1) NoVideo 4 (2) this isn’t really a mod anymore. Hidden 8 (3) HardRock 16 (4) SuddenDeath 32 (5) DoubleTime 64 (6) Relax 128 (7) HalfTime 256 (8) Nightcore 512 (9) always used with DT : 512 + 64 = 576 Flashlight 1024 (10) Autoplay 2048 (11) SpunOut 4096 (12) Relax2 8192 (13) Autopilot Perfect 16384 (14) Key4 32768 (15) Key5 65536 (16) Key6 131072 (17 Key7 262144 (18) Key8 524288 (19) keyMod 1015808 k4+k5+k6+k7+k8 FadeIn 1048576 (20) Random 2097152 (21) LastMod 4194304 (22) Cinema TargetPractice 8388608 (23) osu!cuttingedge only Key9 16777216 (24) Coop 33554432 (25) Key1 67108864 (26) Key3 134217728 (27) Key2 268435456 (28)

ppy在官网上直接开源了文件格式,极大的方便了文件格式的解析(至少不用自己耗脑子去破解了),下一篇再开始讲如何解析

0 0