rosu_memory_lib/reader/resultscreen/
mod.rs

1pub mod stable;
2pub mod common;
3use rosu_mem::process::{Process};
4use crate::reader::structs::State;
5use crate::reader::common::OsuType;
6use crate::reader::structs::Hit;
7use crate::reader::resultscreen::common::ResultScreenInfo;
8use crate::reader::common::GameMode;
9
10pub struct ResultScreenReader<'a> { pub process : &'a Process, pub state : &'a mut State, pub osu_type : OsuType}
11
12impl<'a> ResultScreenReader<'a> {
13    pub fn new(p: &'a Process, state: &'a mut State, osu_type: OsuType) -> Self {
14        Self { process: p, state, osu_type }
15    }
16
17    pub fn get_result_screen_info(&mut self) -> eyre::Result<ResultScreenInfo> {
18        match self.osu_type {
19            OsuType::Stable => stable::memory::get_result_screen_info(self.process, self.state),
20            _ => Err(eyre::eyre!("Unsupported osu type for now")),
21        }
22    }
23
24    pub fn get_result_username(&mut self) -> eyre::Result<String> {
25        match self.osu_type {
26            OsuType::Stable => stable::memory::get_result_username(self.process, self.state),
27            _ => Err(eyre::eyre!("Unsupported osu type for now")),
28        }
29    }
30
31    pub fn get_result_score(&mut self) -> eyre::Result<i32> {
32        match self.osu_type {
33            OsuType::Stable => stable::memory::get_result_score(self.process, self.state),
34            _ => Err(eyre::eyre!("Unsupported osu type for now")),
35        }
36    }
37
38    pub fn get_result_mode(&mut self) -> eyre::Result<GameMode> {
39        match self.osu_type {
40            OsuType::Stable => stable::memory::get_result_mode(self.process, self.state),
41            _ => Err(eyre::eyre!("Unsupported osu type for now")),
42        }
43    }
44
45    pub fn get_result_hit_300(&mut self) -> eyre::Result<i16> {
46        match self.osu_type {
47            OsuType::Stable => stable::memory::get_result_hit_300(self.process, self.state),
48            _ => Err(eyre::eyre!("Unsupported osu type for now")),
49        }
50    }
51
52    pub fn get_result_hit_100(&mut self) -> eyre::Result<i16> {
53        match self.osu_type {
54            OsuType::Stable => stable::memory::get_result_hit_100(self.process, self.state),
55            _ => Err(eyre::eyre!("Unsupported osu type for now")),
56        }
57    }
58
59    pub fn get_result_hit_50(&mut self) -> eyre::Result<i16> {
60        match self.osu_type {
61            OsuType::Stable => stable::memory::get_result_hit_50(self.process, self.state),
62            _ => Err(eyre::eyre!("Unsupported osu type for now")),
63        }
64    }
65
66
67    pub fn get_result_hit_miss(&mut self) -> eyre::Result<i16> {
68        match self.osu_type {
69            OsuType::Stable => stable::memory::get_result_hit_miss(self.process, self.state),
70            _ => Err(eyre::eyre!("Unsupported osu type for now")),
71        }
72    }
73
74    pub fn get_result_hit_geki(&mut self) -> eyre::Result<i16> {
75        match self.osu_type {
76            OsuType::Stable => stable::memory::get_result_hit_geki(self.process, self.state),
77            _ => Err(eyre::eyre!("Unsupported osu type for now")),
78        }
79    }
80
81    pub fn get_result_hit_katu(&mut self) -> eyre::Result<i16> {
82        match self.osu_type {
83            OsuType::Stable => stable::memory::get_result_hit_katu(self.process, self.state),
84            _ => Err(eyre::eyre!("Unsupported osu type for now")),
85        }
86    }
87    
88
89    pub fn get_result_hits(&mut self) -> eyre::Result<Hit> {
90        match self.osu_type {
91            OsuType::Stable => stable::memory::get_result_hits(self.process, self.state),
92            _ => Err(eyre::eyre!("Unsupported osu type for now")),
93        }
94    }
95    
96    pub fn get_result_accuracy(&mut self) -> eyre::Result<f64> {
97        match self.osu_type {
98            OsuType::Stable => stable::memory::get_result_accuracy(self.process, self.state),
99            _ => Err(eyre::eyre!("Unsupported osu type for now")),
100        }
101    }
102
103    pub fn get_result_max_combo(&mut self) -> eyre::Result<i16> {
104        match self.osu_type {
105            OsuType::Stable => stable::memory::get_result_max_combo(self.process, self.state),
106            _ => Err(eyre::eyre!("Unsupported osu type for now")),
107        }
108    }
109    
110    
111
112}