Skip to content

Commit

Permalink
Add max camera distance patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
brndd committed Jul 26, 2022
1 parent f0a99f4 commit 49fe555
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ struct Args {
#[clap(long, default_value_t = 128i32, value_parser = clap::value_parser!(i32).range(1..999))]
soundchannels: i32,

/// Max camera distance LIMIT. Current max camera distance is a setting in the menu & a console command. Default game value is 50. Unchanged by default. Should be greater than 0, otherwise bad things may happen.
/// After patching, change with /console CameraDistanceMax 100
#[clap(long, value_parser)]
maxcameradistance: Option<f32>,

/// If set, do not patch FoV.
#[clap(long, default_value_t = false, value_parser)]
no_fov: bool,
Expand Down Expand Up @@ -244,6 +249,15 @@ fn main() -> ExitCode {
println!(" Success!");
}

// Max camera distance patch
if let Some(maxcameradistance) = args.maxcameradistance {
const MAXCAMERADISTANCE_OFFSET: usize = 0x4089a4;
let maxcamera_bytes: [u8; 4] = maxcameradistance.to_le_bytes();
print!("Applying patch: max camera distance...");
file[MAXCAMERADISTANCE_OFFSET..MAXCAMERADISTANCE_OFFSET+maxcamera_bytes.len()].copy_from_slice(&maxcamera_bytes);
println!(" Success!");
}

//Write out patched file
match fs::write(&outfile_path, file) {
Err(err) => {
Expand Down

0 comments on commit 49fe555

Please sign in to comment.