# Crysis 3 Remastered 1.3.0
# BID: 53EA0196A4AEB260

DECLARATIONS:
  -
    type: variable
    name: dr_target1
    value_type: float
    default_value: 28.5
    evaluate: "0.855 * FRAMETIME_TARGET"
  -
    type: variable
    name: dr_target2
    value_type: float
    default_value: 33.5
    evaluate: "1.005 * FRAMETIME_TARGET"   
  -
    type: variable
    name: dr_target3
    value_type: float
    default_value: 30.5
    evaluate: "0.915 * FRAMETIME_TARGET"
  # DON'T PUT ANYTHING BETWEEN - START
  -
    type: variable
    name: dr_target4
    value_type: float
    default_value: 32.5
    evaluate: "0.975 * FRAMETIME_TARGET"
  -
    type: variable
    name: dr_target5
    value_type: float
    default_value: 31.5
    evaluate: "0.945 * FRAMETIME_TARGET"
  -
    type: variable
    name: dr_target6
    value_type: float
    default_value: 33.25
    evaluate: "0.945 * FRAMETIME_TARGET"
  # DON'T PUT ANYTHING BETWEEN - END
MASTER_WRITE:
  # Redirect Dynamic Resolution Timings to read always not from .text
  -
    type: asm_a64
    main_offset: 0x136A51C
    instructions: [
      [nop]
    ]
  -
    type: asm_a64
    main_offset: 0x136A548
    instructions: [
      [nop],
      [nop]
    ]
# Redirect Dynamic Resolution Timings readings to MAIN+0x3608E00
  -
    type: asm_a64
    main_offset: 0x136A520
    instructions: [
      [adrp, x8, $dr_target1],
      [ldr, s0, [x8, $dr_target1]],
      [adrp, x8, $dr_target2],
      [ldr, s1, [x8, $dr_target2]],
      [adrp, x8, $dr_target3],
      [ldr, s2, [x8, $dr_target3]]
    ]
  -
    type: asm_a64
    main_offset: 0x136A554
    instructions: [
      [adrp, x9, $dr_target4],
      [add, x9, x9, $dr_target4]
    ]
ALL_FPS:
  # sys_MaxFPS
  -
    type: evaluate_write
    address: [MAIN, 0x34382D8]
    value_type: int32
    value: FPS_LOCK_TARGET
  # Renderer thread delay
  -
    type: evaluate_write
    address: [MAIN, 0x3466BB0]
    value_type: float
    value: "0.66 / FPS_TARGET"
  -
    type: block
    what: timing
