paavohtl Claude Opus 4.6 commited on
Commit
8191e6e
·
1 Parent(s): dfc6e85

feat: add Options__GetCrashReportURL hook

Browse files

Reads CrashReportURL from HKCU Options registry key into static buffer.
Completes the 7-function configuration system port to Rust.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

crates/openwa-types/src/address.rs CHANGED
@@ -388,6 +388,9 @@ pub mod va {
388
  /// Stream volume byte
389
  pub const G_STREAM_VOLUME: u32 = 0x0088_AEDD;
390
 
 
 
 
391
  // === Game context (DDGame struct offsets) ===
392
  // These are offsets from the DDGame base pointer, not absolute addresses.
393
  // DDGame pointer is obtained from hookConstructDDGameWrapper param.
 
388
  /// Stream volume byte
389
  pub const G_STREAM_VOLUME: u32 = 0x0088_AEDD;
390
 
391
+ /// CrashReportURL static buffer (0x400 bytes)
392
+ pub const G_CRASH_REPORT_URL: u32 = 0x0079_FFD8;
393
+
394
  // === Game context (DDGame struct offsets) ===
395
  // These are offsets from the DDGame base pointer, not absolute addresses.
396
  // DDGame pointer is obtained from hookConstructDDGameWrapper param.
crates/openwa-wormkit/src/replacements/config.rs CHANGED
@@ -7,6 +7,7 @@
7
  //! - Registry__DeleteKeyRecursive (0x4E4D10): recursive registry deletion
8
  //! - Registry__CleanAll (0x4C90D0): full registry cleanup
9
  //! - GameInfo__LoadOptions (0x460AC0): game options from registry
 
10
 
11
  use openwa_types::address::va;
12
  use crate::log_line;
@@ -286,6 +287,31 @@ unsafe extern "stdcall" fn hook_load_options(gi: u32) {
286
  let _ = log_line("[Config] LoadOptions completed (Rust)");
287
  }
288
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  // ============================================================
290
  // Hook installation
291
  // ============================================================
@@ -327,6 +353,12 @@ pub fn install() -> Result<(), String> {
327
  va::GAMEINFO_LOAD_OPTIONS,
328
  hook_load_options as *const (),
329
  )?;
 
 
 
 
 
 
330
  }
331
 
332
  Ok(())
 
7
  //! - Registry__DeleteKeyRecursive (0x4E4D10): recursive registry deletion
8
  //! - Registry__CleanAll (0x4C90D0): full registry cleanup
9
  //! - GameInfo__LoadOptions (0x460AC0): game options from registry
10
+ //! - Options__GetCrashReportURL (0x5A63F0): crash report URL from registry
11
 
12
  use openwa_types::address::va;
13
  use crate::log_line;
 
287
  let _ = log_line("[Config] LoadOptions completed (Rust)");
288
  }
289
 
290
+ // ============================================================
291
+ // Options__GetCrashReportURL replacement (0x5A63F0)
292
+ // ============================================================
293
+
294
+ /// Rust replacement for Options__GetCrashReportURL.
295
+ /// cdecl() -> *const u8 (pointer to static buffer, or null)
296
+ unsafe extern "cdecl" fn hook_get_crash_report_url() -> u32 {
297
+ let buf = rb(va::G_CRASH_REPORT_URL) as *mut u8;
298
+ let buf_slice = core::slice::from_raw_parts_mut(buf, 0x400);
299
+
300
+ let len = openwa_lib::wa::registry::read_profile_string(
301
+ "Options",
302
+ "CrashReportURL",
303
+ buf_slice,
304
+ );
305
+
306
+ if len > 0 {
307
+ // Null-terminate
308
+ *buf.add(len) = 0;
309
+ buf as u32
310
+ } else {
311
+ 0 // null pointer = not found
312
+ }
313
+ }
314
+
315
  // ============================================================
316
  // Hook installation
317
  // ============================================================
 
353
  va::GAMEINFO_LOAD_OPTIONS,
354
  hook_load_options as *const (),
355
  )?;
356
+
357
+ let _ = crate::hook::install(
358
+ "Options__GetCrashReportURL",
359
+ va::OPTIONS_GET_CRASH_REPORT_URL,
360
+ hook_get_crash_report_url as *const (),
361
+ )?;
362
  }
363
 
364
  Ok(())