forum

Osu! Maps calculation for program - Need help...

posted
Total Posts
11
Topic Starter
TheSupremeEagle
Hello / Bonjour :3

I have a problem and i want someone to help me please
I made a programme based on the the difficulty of a map, and also other thing like the bpm and the duration
So, to calculate a map, the player have to enter manually all the characteristic of a map
But we all have thousand and thousand of beatmaps so we couldnt add them one by one like that

So i want to make a programme who get the information of the map directly in the Osu folder
But i have a probleme...
In the file (.txt) of a map, there is only the TITLE that I can use. BUT, to work, my programme need the STARS of a map, the BPM, the NUMBER of elements and also the lenght (time) of the map.
In the file, my programme can easily compte all the elements of the map, so I only have 2 informations; the NUMBER of elements and the TITLE

But I dont know how to find the TIME, the BPM and the STARS !!!
Did I have to make an division or multiplication of the ApproachRate and OverallDifficulty ?
I dont find the calcul to have these information by the file...

So i need your help :c
Thank you
SpartanPawnch
I am not sure where you found the txt files. The songs are located in AppData/Local/osu!/Songs and the individual beatmaps for each difficulty are found inside the song folders in the .osu format. The files are human readable and relatively easy to parse, you can find more information about the format here: https://osu.ppy.sh/help/wiki/osu%21_File_Formats/Osu_%28file_format%29. Most of the stuff you are looking for can be found under [Difficulty].
Topic Starter
TheSupremeEagle

SpartanPawnch wrote:

I am not sure where you found the txt files. The songs are located in AppData/Local/osu!/Songs and the individual beatmaps for each difficulty are found inside the song folders in the .osu format. The files are human readable and relatively easy to parse, you can find more information about the format here: https://osu.ppy.sh/help/wiki/osu%21_File_Formats/Osu_%28file_format%29. Most of the stuff you are looking for can be found under [Difficulty].
Thank you for the answear !

The folder "Songs" is exactly were I'm looking at the informations of the songs and I have always the same probleme. I'm searching for the number of Stars, the number of BPM, the Duration, the number of Objects (Circles, Sliders and Spinners) and the Title of the map.
In the file, the Title is easy to find, for the number of objects my program can easily count every line of obects in the "Objects" section. But for the BPM, the Stars and the Duration of the map, it's says nowere.

The link that you gave me is really good, every section is explained correctly but, again, it's not says how to calculate the BPM, the Stars and the Duration. But that gave me some idea of what I have to do to find it. I'm trying to find some calculation, like make an addition of every Difficulty's informations (and same at the Time Point for BPM), and then divid it to make an average, here the result is wrong but quite right too...

So, I'm in my way to (try to) understanding that, if you have any other idea I'll take it ! :3
Endaris
Just read everything directly from the osu!.db file:
help/wiki/osu%21_File_Formats/Db_%28file_format%29
Topic Starter
TheSupremeEagle

Endaris wrote:

Just read everything directly from the osu!.db file:
help/wiki/osu%21_File_Formats/Db_%28file_format%29
Thank you for your answear !

Okay so, I tried to open the file osu!.db were all the informations are but the file is unreadable ...
Every characters are strange (in UTF-8, I don't know many of them) and it's pretty hard to understand how Osu! make a "translate" of all of that into octets and boolean, said before in the Beatmaps Informations.

I'm searching for how to open this type of file (Data Base file) without having to "translating" this into undreadable characters.
I'm thinking that it's probably an encrypting method like the one to hide passwords in google.
Maybe Osu! don't let me access to this informations ? It's sad, I'm not a hacker :c

Hopefully, I will find how to read this type of file (and make my program read it too).
I'll take every informations about this, so if you have one tell me !
plz.. ty
Topic Starter
TheSupremeEagle
Hello

I'm always searching for an answear, if anyone have an idea it will help a lot !
I'm searching to open a DataBase file (the osu.db file) with my program to take the profil and maps informations.
But the DataBase file (opened as a text) is unreadable ! Maybe if the program open the osu.db file and read every informations in it, it will be able to recognize the informations ?
It's a bit hard for me ... I'm terribly new in programation :c
So I will try this (but it won't work), ANY idea can be usefull at this point !!!
Thank you :3

Waiting for help ...
Evening
you can't read a binary file with a text editor, you'd have to read byte by byte

I recommend studying how to read binary files before trying to read the .db

Things that you may need:

- How to Read a Binary File
- What is Little/Big-Endian
- How to decode bytes for different data types

---

Here's a starting point

In the osu.db wiki:

Int 	    osu! version (e.g. 20150203)
Int 	    Folder Count
Bool 	    AccountUnlocked (only false when the account is locked or banned in any way)
DateTime    Date the account will be unlocked

You can find out how many bytes is each data by looking at the wiki

TYPE        LENGTH      DESCRIPTION
Int 	    4		osu! version (e.g. 20150203)
Int 	    4		Folder Count
Bool 	    1		AccountUnlocked (only false when the account is locked or banned in any way)
DateTime    8		Date the account will be unlocked

The length means the amount of bytes you have to read

The following is pseudo-code (fake code)
db = read("osu.db", "rb") // Read as Binary

verB            = db.read(4, LITTLE_ENDIAN) // osu! version (e.g. 20150203)
folderCountB    = db.read(4, LITTLE_ENDIAN) // Folder Count
accountUnlB     = db.read(1, LITTLE_ENDIAN) // AccountUnlocked
accountUnlDateB = db.read(8, LITTLE_ENDIAN) // Date the account will be unlocked

// Refer to wiki for the data representation
ver            = int.fromBytes(verB)
folderCount    = int.fromBytes(folderCountB)
accountUnl     = bool.fromBytes(accountUnlB)
accountUnlDate = datetime.fromBytes(accountUnlDateB) 

// ...
Topic Starter
TheSupremeEagle

Evening wrote:

you can't read a binary file with a text editor, you'd have to read byte by byte

I recommend studying how to read binary files before trying to read the .db

Things that you may need:

- How to Read a Binary File
- What is Little/Big-Endian
- How to decode bytes for different data types

---

Here's a starting point

In the osu.db wiki:

Int 	    osu! version (e.g. 20150203)
Int 	    Folder Count
Bool 	    AccountUnlocked (only false when the account is locked or banned in any way)
DateTime    Date the account will be unlocked

You can find out how many bytes is each data by looking at the wiki

TYPE        LENGTH      DESCRIPTION
Int 	    4		osu! version (e.g. 20150203)
Int 	    4		Folder Count
Bool 	    1		AccountUnlocked (only false when the account is locked or banned in any way)
DateTime    8		Date the account will be unlocked

The length means the amount of bytes you have to read

The following is pseudo-code (fake code)
db = read("osu.db", "rb") // Read as Binary

verB            = db.read(4, LITTLE_ENDIAN) // osu! version (e.g. 20150203)
folderCountB    = db.read(4, LITTLE_ENDIAN) // Folder Count
accountUnlB     = db.read(1, LITTLE_ENDIAN) // AccountUnlocked
accountUnlDateB = db.read(8, LITTLE_ENDIAN) // Date the account will be unlocked

// Refer to wiki for the data representation
ver            = int.fromBytes(verB)
folderCount    = int.fromBytes(folderCountB)
accountUnl     = bool.fromBytes(accountUnlB)
accountUnlDate = datetime.fromBytes(accountUnlDateB) 

// ...
HO YAAA Thank you very much !

I think that I already know how to read this type of file, I know Boolean, Int or Float and more, and I also know Binary and others like Hexadecimal.
My mistake was that I can't open the file as a text (i'm so stupid), but if my program copy every informations I will be able to do that !
I will try this, thank you very much <3 !!!
Topic Starter
TheSupremeEagle
Hellooo

So, I find how to open the file and read it, but I don't know how to decode it into readable informations. String are easy to read, like the Username or the Title of the map. But, BPM, number of hit-circles, time of the map, etc... It's impossible, the program give me the informations like this > [exemple: \x00\r\xa8l\x83_(0\xec?\], but I don't understand how to decode it !

I'm using python and there is a command (ABCD.decode) to decode file but, sadely, it don't work...

Help me plzzz !
thx u
abraker
decode encoded strings using utf-8

for binary parts you need to use struct

As an example, you can find how a replay file is read here: https://github.com/kszlim/osu-replay-parser/blob/master/osrparse/replay.py
Topic Starter
TheSupremeEagle

abraker wrote:

decode encoded strings using utf-8

for binary parts you need to use struct

As an example, you can find how a replay file is read here: https://github.com/kszlim/osu-replay-parser/blob/master/osrparse/replay.py
Thanks for your answear !

I'm going to learn how to use "struct" right now, even if it's really difficult
I will be back if I have another question :3
Please sign in to reply.

New reply