# Don't Starve Together 1.22.0
# BID: 8F26DEF435008AE2

DECLARATIONS:
  -
    type: const
    name: min_delta
    value: 0x3c088889
  -
    type: variable
    name: min_delta_var
    value_type: float
    default_value: 0.033333333
    evaluate: "1 / FPS_TARGET"
  -
    type: code
    name: deltaReplacer
    instructions: [
      [adrp, x8, $min_delta_var],
      [ldr, s9, [x8, $min_delta_var]],
      [ret]
    ]
MASTER_WRITE:
  # Replace speed for UI that is read for each element separately
  # REF: 69 AA 40 BD 20 21 28 1E
  -
    type: asm_a64
    main_offset: 0x119F18
    instructions: [
      [bl, _deltaReplacer()]
    ]
  # REF: search for instructions with 0x3d088889, ignore very first one
  -
    type: asm_a64
    main_offset: 0x14A98
    instructions: [
      [mov, w8, $min_delta],
      [movk, w8, $min_delta, 16]
    ]
  -
    type: asm_a64
    main_offset: 0x15298
    instructions: [
      [mov, w8, $min_delta],
      [movk, w8, $min_delta, 16]
    ]
  -
    type: asm_a64
    main_offset: 0xF59F4
    instructions: [
      [adrp, x9, $min_delta_var],
      [ldr, w9, [x9, $min_delta_var]]
    ]
  # Bring back original 30 FPS lock
  -
    type: asm_a64
    main_offset: 0x248CBC
    instructions: [
      [mov, w1, 2]
    ]
  -
    type: asm_a64
    main_offset: 0x249B50
    instructions: [
      [mov, w1, 2]
    ]