Skip to content

MarcArchive/rosu-pp-jar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rosu-pp-jar

PP and star calculation for all osu! gamemodes Bindings for Java based on rosu-pp-ffi

This is a update and a maintained version of his rosu-pp-jar Libary for Java 21

Maven

<soon></soon>

Usage

try {
    // 1. Load beatmap from file path
    String beatmapPath = "testmap.osu";
    Beatmap beatmap = new Beatmap(beatmapPath);
    
    // 2. Create a Performance calculator
    Performance performance = new Performance();
    
    // 3. Optional: Set performance parameters
    performance.setAccuracy(98.5);  // 98.5% accuracy
    performance.setMisses(2);       // 2 misses
    performance.setCombo(1000);     // Max combo of 1000
    
    // Optional: Set mods (e.g., "HDDT" for Hidden + DoubleTime)
    performance.setMods("HDDT");
    
    // 4. Calculate PP
    RosuPPLib.PerformanceAttributes result = performance.calculate(beatmap);
    
    // 5. Extract PP value based on mode
    double pp = 0.0;
    Mode mode = Mode.fromValue(result.mode);
    
    switch (mode) {
        case Osu:
            if (result.osu.is_some == 1) {
                pp = result.osu.t.pp;
                System.out.println("PP: " + pp);
                System.out.println("Aim PP: " + result.osu.t.pp_aim);
                System.out.println("Speed PP: " + result.osu.t.pp_speed);
                System.out.println("Accuracy PP: " + result.osu.t.pp_acc);
                System.out.println("Star Rating: " + result.osu.t.difficulty.stars);
            }
            break;
        case Taiko:
            if (result.taiko.is_some == 1) {
                pp = result.taiko.t.pp;
                System.out.println("PP: " + pp);
                System.out.println("Star Rating: " + result.taiko.t.difficulty.stars);
            }
            break;
        case Catch:
            if (result.fruit.is_some == 1) {
                pp = result.fruit.t.pp;
                System.out.println("PP: " + pp);
                System.out.println("Star Rating: " + result.fruit.t.difficulty.stars);
            }
            break;
        case Mania:
            if (result.mania.is_some == 1) {
                pp = result.mania.t.pp;
                System.out.println("PP: " + pp);
                System.out.println("Star Rating: " + result.mania.t.difficulty.stars);
            }
            break;
    }
    
    // 6. Clean up resources
    performance.close();
    beatmap.close();
    
} catch (FFIException e) {
    System.err.println("Error: " + e.getMessage());
    e.printStackTrace();
}

About

PP and star calculation for all osu! gamemodes Bindings for Java

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages