rosu_memory_lib/reader/resultscreen/
mod.rs

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