Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rosu-memory-lib"
version = "1.1.1"
version = "1.2.0"
edition = "2021"
description = "A library to read osu! memory"
license = "MIT"
Expand All @@ -23,6 +23,10 @@ rosu-mem = "2.0.0"
rosu-map = "0.2.1"
rosu-pp = "3.1.0"
rayon = { version = "1.10.0", optional = true }
rosu-mods = "0.3.1"

[dev-dependencies]
rosu-mods = "0.3.1"
rosu-mods = "0.3.1"

[profile.dev.package.rosu-mem]
opt-level = 3
4 changes: 2 additions & 2 deletions examples/beatmap1.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use rosu_memory_lib::init_loop;
use rosu_memory_lib::reader::beatmap::stable::memory::get_beatmap_info;
use rosu_memory_lib::reader::beatmap::stable::file::info;
use rosu_memory_lib::Error;

fn main() -> Result<(), Error> {
let (mut state, process) = init_loop(500)?;
println!("Successfully initialized!");
loop {
match get_beatmap_info(&process, &mut state) {
match info(&process, &mut state) {
Ok(beatmap_info) => println!("Current beatmap info: {beatmap_info:?}"),
Err(e) => println!("Error: {e:?}"),
}
Expand Down
2 changes: 1 addition & 1 deletion examples/beatmap2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn main() -> Result<(), Error> {
let (mut state, process) = init_loop(500)?;
let mut beatmap_reader = BeatmapReader::new(&process, &mut state, OsuClientKind::Stable)?;
loop {
match beatmap_reader.get_beatmap_info() {
match beatmap_reader.info() {
Ok(beatmap_info) => println!("Current beatmap info: {beatmap_info:?}"),
Err(e) => println!("Error: {e:?}"),
}
Expand Down
114 changes: 114 additions & 0 deletions examples/beatmap3.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
use rosu_memory_lib::init_loop;
use rosu_memory_lib::reader::beatmap::BeatmapReader;
use rosu_memory_lib::reader::common::OsuClientKind;
use rosu_memory_lib::Error;

fn main() -> Result<(), Error> {
let (mut state, process) = init_loop(500)?;
let mut beatmap_reader = BeatmapReader::new(&process, &mut state, OsuClientKind::Stable)?;
match beatmap_reader.audio_path() {
Ok(audio_path) => println!("Current beatmap audio path: {audio_path:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.path() {
Ok(path) => println!("Current beatmap path: {path:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.md5() {
Ok(md5) => println!("Current beatmap md5: {md5:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.id() {
Ok(id) => println!("Current beatmap id: {id:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.set_id() {
Ok(set_id) => println!("Current beatmap set id: {set_id:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.mode() {
Ok(mode) => println!("Current beatmap mode: {mode:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.tags() {
Ok(tags) => println!("Current beatmap tags: {tags:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.length() {
Ok(length) => println!("Current beatmap length: {length:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.drain_time() {
Ok(drain_time) => println!("Current beatmap drain time: {drain_time:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.author() {
Ok(author) => println!("Current beatmap author: {author:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.creator() {
Ok(creator) => println!("Current beatmap creator: {creator:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.title_romanized() {
Ok(title_romanized) => println!("Current beatmap title romanized: {title_romanized:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.title() {
Ok(title) => println!("Current beatmap title: {title:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.difficulty() {
Ok(difficulty) => println!("Current beatmap difficulty: {difficulty:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.od() {
Ok(od) => println!("Current beatmap od: {od:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.ar() {
Ok(ar) => println!("Current beatmap ar: {ar:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.cs() {
Ok(cs) => println!("Current beatmap cs: {cs:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.hp() {
Ok(hp) => println!("Current beatmap hp: {hp:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.object_count() {
Ok(object_count) => println!("Current beatmap object count: {object_count:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.slider_count() {
Ok(slider_count) => println!("Current beatmap slider count: {slider_count:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.folder() {
Ok(folder) => println!("Current beatmap folder: {folder:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.filename() {
Ok(filename) => println!("Current beatmap filename: {filename:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.audio() {
Ok(audio) => println!("Current beatmap audio: {audio:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.cover() {
Ok(cover) => println!("Current beatmap cover: {cover:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.status() {
Ok(status) => println!("Current beatmap status: {status:?}"),
Err(e) => println!("Error: {e:?}"),
}
match beatmap_reader.star_rating() {
Ok(star_rating) => println!("Current beatmap star rating: {star_rating:?}"),
Err(e) => println!("Error: {e:?}"),
}
Ok(())
}
76 changes: 76 additions & 0 deletions examples/gameplay.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
use rosu_memory_lib::init_loop;
use rosu_memory_lib::reader::common::OsuClientKind;
use rosu_memory_lib::reader::gameplay::GameplayReader;
use rosu_memory_lib::Error;

fn main() -> Result<(), Error> {
let (mut state, process) = init_loop(500)?;
let mut gameplay_reader = GameplayReader::new(&process, &mut state, OsuClientKind::Stable);
loop {
match gameplay_reader.combo() {
Ok(combo) => println!("Current combo: {combo}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.hp() {
Ok(hp) => println!("Current hp: {hp}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.username() {
Ok(username) => println!("Current username: {username}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.hits() {
Ok(hits) => println!("Current hits: {hits:?}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.game_time() {
Ok(game_time) => println!("Current game time: {game_time}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.retries() {
Ok(retries) => println!("Current retries: {retries}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.hits_300() {
Ok(hits_300) => println!("Current hits 300: {hits_300}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.hits_100() {
Ok(hits_100) => println!("Current hits 100: {hits_100}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.hits_50() {
Ok(hits_50) => println!("Current hits 50: {hits_50}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.hits_miss() {
Ok(hits_miss) => println!("Current hits miss: {hits_miss}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.hits_geki() {
Ok(hits_geki) => println!("Current hits geki: {hits_geki}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.hits_katu() {
Ok(hits_katu) => println!("Current hits katu: {hits_katu}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.mods() {
Ok(mods) => println!("Current mods: {mods}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.score() {
Ok(score) => println!("Current score: {score}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.max_combo() {
Ok(max_combo) => println!("Current max combo: {max_combo}"),
Err(e) => println!("Error: {e:?}"),
}
match gameplay_reader.info() {
Ok(gameplay_info) => println!("Current gameplay info: {gameplay_info:?}"),
Err(e) => println!("Error: {e:?}"),
}
std::thread::sleep(std::time::Duration::from_millis(1000));
}
}
4 changes: 2 additions & 2 deletions examples/getig.rs → examples/get_time.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use rosu_memory_lib::init_loop;
use rosu_memory_lib::reader::gameplay::stable::memory::get_ig_time;
use rosu_memory_lib::reader::common::stable::memory::game_time;
use rosu_memory_lib::Error;

fn main() -> Result<(), Error> {
let (mut state, process) = init_loop(500)?;
println!("Successfully initialized!");
loop {
match get_ig_time(&process, &mut state) {
match game_time(&process, &mut state) {
Ok(ig_time) => println!("Current ig time: {ig_time:?}"),
Err(e) => println!("Error: {e:?}"),
}
Expand Down
15 changes: 9 additions & 6 deletions examples/pp.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rosu_mem::process::Process;
use rosu_memory_lib::init_loop;
use rosu_memory_lib::reader::beatmap::stable::file::get_beatmap_path;
use rosu_memory_lib::reader::common::stable::memory::get_menu_mods;
use rosu_memory_lib::reader::beatmap::stable::file::path;
use rosu_memory_lib::reader::common::stable::memory::menu_game_mode;
use rosu_memory_lib::reader::structs::State;
use rosu_memory_lib::Error;
use rosu_mods::GameModsLegacy;
Expand Down Expand Up @@ -99,15 +99,18 @@ fn process_game_state(
calc_state: &mut CalculatorState,
) -> Result<(), Error> {
let mut mods_changed = false;
match get_beatmap_path(process, state) {
match path(process, state) {
Ok(beatmap_path) => {
// Update mods if they changed
if let Ok(new_mods) = get_menu_mods(process, state) {
mods_changed = calc_state.update_mods(new_mods);
println!("Menu game mode: {}", menu_game_mode(process, state)?);
if let Ok(new_mods) = menu_game_mode(process, state) {
mods_changed = calc_state.update_mods(new_mods as i32);
}

// Update beatmap if path changed and mods changed else it's useless to recalculate
if calc_state.update_beatmap(beatmap_path)? && mods_changed {
let beatmap_updated = calc_state.update_beatmap(beatmap_path)?;

if beatmap_updated || mods_changed {
calc_state.update_pp();
}
}
Expand Down
64 changes: 64 additions & 0 deletions examples/resultscreen.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
use rosu_memory_lib::init_loop;
use rosu_memory_lib::reader::common::OsuClientKind;
use rosu_memory_lib::reader::resultscreen::ResultScreenReader;
use rosu_memory_lib::Error;

fn main() -> Result<(), Error> {
let (mut state, process) = init_loop(500)?;
let mut resultscreen_reader =
ResultScreenReader::new(&process, &mut state, OsuClientKind::Stable);
match resultscreen_reader.accuracy() {
Ok(accuracy) => println!("Current accuracy: {accuracy}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.max_combo() {
Ok(max_combo) => println!("Current max combo: {max_combo}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.score() {
Ok(score) => println!("Current score: {score}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.username() {
Ok(username) => println!("Current username: {username}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.mode() {
Ok(mode) => println!("Current mode: {mode:?}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.hits_miss() {
Ok(hits_miss) => println!("Current hits miss: {hits_miss}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.hits_geki() {
Ok(hits_geki) => println!("Current hits geki: {hits_geki}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.hits_katu() {
Ok(hits_katu) => println!("Current hits katu: {hits_katu}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.hits_300() {
Ok(hits_300) => println!("Current hits 300: {hits_300}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.hits_100() {
Ok(hits_100) => println!("Current hits 100: {hits_100}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.hits_50() {
Ok(hits_50) => println!("Current hits 50: {hits_50}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.hits() {
Ok(hits) => println!("Current hits: {hits:?}"),
Err(e) => println!("Error: {e:?}"),
}
match resultscreen_reader.info() {
Ok(resultscreen_info) => println!("Current resultscreen info: {resultscreen_info:?}"),
Err(e) => println!("Error: {e:?}"),
}

Ok(())
}
Loading
Loading