rosu_memory_lib/reader/beatmap/
mod.rs

1pub mod common;
2pub mod stable;
3
4use std::path::PathBuf;
5
6use crate::impl_osu_accessor;
7use crate::reader::beatmap::common::BeatmapInfo;
8use crate::reader::beatmap::common::BeatmapStarRating;
9use crate::reader::beatmap::common::BeatmapStats;
10use crate::reader::beatmap::common::BeatmapStatus;
11use crate::reader::common::GameMode;
12use crate::reader::common::OsuClientKind;
13use crate::reader::structs::State;
14use crate::Error;
15use rosu_mem::process::Process;
16
17pub struct BeatmapReader<'a> {
18    pub process: &'a Process,
19    pub state: &'a mut State,
20    pub osu_type: OsuClientKind,
21}
22
23impl<'a> BeatmapReader<'a> {
24    pub fn new(
25        p: &'a Process,
26        state: &'a mut State,
27        osu_type: OsuClientKind,
28    ) -> Result<Self, Error> {
29        Ok(Self {
30            process: p,
31            state,
32            osu_type,
33        })
34    }
35
36    impl_osu_accessor! {
37        fn id() -> i32 => stable::memory::id,
38        fn set_id() -> i32 => stable::memory::set_id,
39        fn tags() -> String => stable::memory::tags,
40        fn length() -> i32 => stable::memory::length,
41        fn drain_time() -> i32 => stable::memory::drain_time,
42        fn author() -> String => stable::memory::author,
43        fn creator() -> String => stable::memory::creator,
44        fn md5() -> String => stable::memory::md5,
45        fn title_romanized() -> String => stable::memory::title_romanized,
46        fn title() -> String => stable::memory::title,
47        fn difficulty() -> String => stable::memory::difficulty,
48        fn od() -> f32 => stable::memory::od,
49        fn ar() -> f32 => stable::memory::ar,
50        fn cs() -> f32 => stable::memory::cs,
51        fn hp() -> f32 => stable::memory::hp,
52        fn object_count() -> u32 => stable::memory::object_count,
53        fn slider_count() -> i32 => stable::memory::slider_count,
54        fn folder() -> String => stable::memory::folder,
55        fn filename() -> String => stable::memory::filename,
56        fn audio() -> String => stable::memory::audio,
57        fn cover() -> String => stable::memory::cover,
58        fn mode() -> GameMode => stable::memory::mode,
59        fn status() -> BeatmapStatus => stable::memory::status,
60        fn info() -> BeatmapInfo => stable::memory::info,
61        fn stats() -> BeatmapStats => stable::memory::stats,
62        fn path() -> PathBuf => stable::file::path,
63        fn audio_path() -> PathBuf => stable::file::audio_path,
64        fn star_rating() -> BeatmapStarRating => stable::file::star_rating,
65    }
66}