# Another Crab's Treasure 1.1.100.2
# BID: 693314C08EA157F3

unsafeCheck: true

DECLARATIONS:
  -
    type: variable
    name: dr_target
    value_type: double
    default_value: 28.57142857142857
    evaluate: "1000 / (FPS_TARGET + 5)"
MASTER_WRITE:
  # Redirect updating various deltas to read frametime target from UnityEngine.Application::targetFrameRate, REF: 08 10 91 52 08 A1 A7 72
  -
    type: asm_a64
    main_offset: 0x18AE7B8
    instructions: [
      [adrp, x8, 0x5659000],
      [ldr, w8, [x8, 0x68]],
      [ucvtf, s1, w8],
      [fmov, s0, 1.0],
      [fdiv, s0, s0, s1]
    ]
  -
    type: asm_a64
    main_offset: 0x18B2570
    instructions: [
      [adrp, x8, 0x5659000],
      [ldr, w8, [x8, 0x68]],
      [ucvtf, s1, w8],
      [fmov, s0, 1.0],
      [fdiv, s0, s0, s1]
    ]
  # Default value
  -
    type: bytes
    main_offset: 0x5659068
    value_type: uint32
    value: 30
  # Redirect Dynamic Resolution GPU Timing target in DynamicResolutionScaler::Update
  -
    type: asm_a64
    main_offset: 0x389C824
    instructions: [
      [adrp, x8, $dr_target],
      [ldr, x8, [x8, $dr_target]],
      [nop],
      [nop]
    ]
  -
    type: asm_a64
    main_offset: 0x389C8A4
    instructions: [
      [adrp, x8, $dr_target],
      [ldr, x8, [x8, $dr_target]],
      [ldr, s0, [x19, 0x28]],
      [nop],
      [nop]
    ]
  -
    type: asm_a64
    main_offset: 0x389C918
    instructions: [
      [adrp, x8, $dr_target],
      [ldr, x8, [x8, $dr_target]],
      [nop],
      [nop]
    ]
ALL_FPS:
  # UnityEngine.Application::targetFrameRate
  -
    type: evaluate_write
    address: [MAIN, 0x5659068]
    value_type: uint32
    value: FPS_TARGET

