Skip to content

Commit

Permalink
safely unwrap values
Browse files Browse the repository at this point in the history
  • Loading branch information
Eein committed Oct 29, 2023
1 parent 2dea4b5 commit 7f0c835
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
33 changes: 16 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ async fn main() {
// TODO: Load some initial information from the process.
loop {
settings.update();
let start = start_watcher
.update(
process
.read_pointer_path64(
let start_value = match process.read_pointer_path64(
main_module_base,
&vec![0x4A2DA88, 0x20, 0x1B8, 0x110, 0x28],
)
.ok(),
)
) {
Ok(val) => Some(val),
Err(_e) => Some(0),
};
let start = start_watcher
.update(start_value)
.unwrap();

let new_start_value = match process.read_pointer_path64(
Expand All @@ -64,18 +64,17 @@ async fn main() {
let near_future_scenario_progress = near_future_scenario_progress_watcher
.update(near_future_scenario_progress_value)
.unwrap();

// asr::print_message(&near_future_scenario_progress.current.to_string());
let loading_value = match process.read_pointer_path64(
main_module_base,
&vec![0x5092A98, 0x8, 0x10, 0x50, 0x30, 0x3FA],
) {
Ok(val) => Some(val),
Err(_e) => Some(0),
};

let loading = loading_watcher
.update(
process
.read_pointer_path64(
main_module_base,
&vec![0x5092A98, 0x8, 0x10, 0x50, 0x30, 0x3FA],
)
.ok(),
)
.unwrap();
let loading = loading_watcher.update(loading_value).unwrap();

// Scenario Progress

Expand Down
4 changes: 3 additions & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#[derive(asr::settings::Gui)]
use asr::settings::Gui;

#[derive(Debug, Gui)]
pub struct Settings {
#[default = true]
/// Load Removal
Expand Down

0 comments on commit 7f0c835

Please sign in to comment.