# The Legend of Zelda: Breath of the Wild 1.6.0
# BID: 8E9978D50BDD20B4
# Time Struct pointer: *(MAIN+0x2D1E170), global speed offset: 0x30

unsafeCheck: true

MASTER_WRITE:
  # Remove double buffer
  -
    type: bytes
    main_offset: 0xE557D4
    value_type: uint32
    value: 0x52800029
  -
    type: bytes
    main_offset: 0xE557E0
    value_type: uint32
    value: 
      - 0x3902F6A9
      - 0x52800069
      - 0xD503201F
  # Block updating time struct when in menus
  -
    type: bytes
    main_offset: 0xF8BA58
    value_type: uint32
    value: 0xD503201F
  # Change pointer of GPU time factor for DR calculations to MAIN + 0x2D65C80
  -
    type: bytes
    main_offset: 0x150AB50
    value_type: uint32
    value: 
      - 0xF000C2C8
      - 0xBD4C8101
  # Default DR GPU time factor
  -
    type: bytes
    main_offset: 0x2D65C80
    value_type: float
    value: 0.001
  # Pass Global Engine Speed to UI speed
  -
    type: bytes
    main_offset: 0x18522EC
    value_type: uint32
    value: 
     - 0xD503201F
     - 0xD503201F
     - 0xD503201F
     - 0xD503201F
     - 0xD503201F
     - 0xBC5FC100
  # Pass Global Engine Speed to some other speed
  -
    type: bytes
    main_offset: 0x1821568
    value_type: uint32
    value: 
     - 0xD503201F
     - 0xD503201F
     - 0xD503201F
     - 0xD503201F
  -
    type: bytes
    main_offset: 0x1821588
    value_type: uint32
    value: 0xBC5FC100
  # Fix weird ragdolls physics calculation
  -
    type: bytes
    main_offset: 0x1618480
    value_type: uint32
    value: 0x1E2E1009
  # Fix Thunderblight Ganon positioning (some of its animations got broken, but at least it's now beatable)
  -
    type: bytes
    main_offset: 0x18B8DD4
    value_type: uint32
    value:
      - 0x9421C3B4
      - 0xD503201F
      - 0xD503201F
  # CODE CAVE
  -
    type: bytes
    main_offset: 0x2129BA4
    value_type: uint32
    value: 
      - 0xF90003E1
      - 0xD63F0100
      - 0x97FFF935
      - 0x97FFF99C
      - 0x900061E1
      - 0xF9464422
      - 0xF9064420
      - 0xCB020000
      - 0xD503201F
      - 0xB94D0822
      - 0x52881541
      - 0x72A07F21
      - 0xEB01001F
      - 0x5400018D
      - 0xAA0103E0
      - 0x1E601000
      - 0x1E630001
      - 0x1E630022
      - 0x1E621821
      - 0x1E610800
      - 0xB0005FA0
      - 0xF940B800
      - 0x1E624000
      - 0xBD003000
      - 0x14000015
      - 0xEB02001F
      - 0x54FFFEAA
      - 0xAA0203E0
      - 0x17FFFFF3
      - 0xBC68D920
      - 0xB0005FA9
      - 0xF940B929
      - 0xBD403121
      - 0x1E210800
      - 0x17B054DA
      - 0x97FFF99C
      - 0x900061E0
      - 0x52800021
      - 0xB90C9001
      - 0x17BA1888
      - 0x97FFF997
      - 0x900061E0
      - 0x52800041
      - 0xB90C9001
      - 0x17BA1677
      - 0x900061E0
      - 0xB94C9000
      - 0x340000E0
      - 0x370800E0
      - 0xF94003E0
      - 0x12800021
      - 0xD0006028
      - 0xF9406908
      - 0xD63F0100
      - 0x17C494D4
      - 0x900061E1
      - 0xB94C9421
      - 0xF94003E0
      - 0xD0006028
      - 0xF9406908
      - 0xD63F0100
      - 0x900061E0
      - 0xB90C901F
      - 0x17C494CB
      - 0xF94077E8
      - 0xCB0803C8
      - 0xD28DA100
      - 0xF2A00060
      - 0xEB08001F
      - 0x540000A0
      - 0xF0005FA8
      - 0xF9479508
      - 0xBD406501
      - 0xD65F03C0
      - 0x90002728
      - 0xBD478901
      - 0xD65F03C0
  # Connect dynamic speed to game's code
  -
    type: bytes
    main_offset: 0x124EFC8
    value_type: uint32
    value: 0x143B6AF7
  # Connect fixing aiming to game's code
  -
    type: bytes
    main_offset: 0xD3EF90
    value_type: uint32
    value: 0x144FAB22
  # Connect AMV FPS locking
  -
    type: bytes
    main_offset: 0xFAFE5C
    value_type: uint32
    value: 0x1445E775
  -
    type: bytes
    main_offset: 0xFAF62C
    value_type: uint32
    value: 0x1445E986
  # Default interval
  -
    type: bytes
    main_offset: 0x2D65C94
    value_type: int32
    value: -2
  # Default min delta
  -
    type: bytes
    main_offset: 0x2D65D08
    value_type: int32
    value: 33333333
ALL_FPS:
  # DR GPU Time Factor
  -
    type: evaluate_write
    address: [MAIN, 0x2D65C80]
    value_type: float
    value: "(FPS_TARGET / 30) * 0.001"
  # Set Min delta
  -
    type: evaluate_write
    address: [MAIN, 0x2D65D08]
    value_type: uint32
    value: "FRAMETIME_TARGET * 1000000"
  # Default vsync
  -
    type: evaluate_write
    address: [MAIN, 0x2D65C94]
    value_type: int32
    value: "VSYNC_TARGET * -1"
  # Prerendered cutscenes must be played at 30 FPS
  -
    type: compare
    compare_address: [MAIN, 0x2D65C90]
    compare_type: "=="
    compare_value_type: uint32
    compare_value: 1
    address: [MAIN]
    value_type: refresh_rate
    value: 30
