--[[
  Main part is done on C++ side, at least for now.
]]

local cfg = ac.INIConfig.scriptSettings():mapSection('SETTINGS', {
  ALT_CONTROLS_CONFIG = '',
  HORIZONTAL_LAYOUT = true,
  TWO_RAW_MICE = true,
})

ac.applyLiveConfigEdit('custom_rendering_modes.ini', '[MODE_SPLITSCREEN]\n\
  HORIZONTAL_LAYOUT=%d\n\
  TWO_RAW_MICE=%d' % {cfg.HORIZONTAL_LAYOUT and 1 or 0, cfg.TWO_RAW_MICE and 1 or 0})
ac.loadCarControlsConfiguration(1, #cfg.ALT_CONTROLS_CONFIG > 0 and 'controllers/'..cfg.ALT_CONTROLS_CONFIG or 'controllers/presets/X360Default.ini')

ac.disableQuickMenuPitstop(true)
setTimeout(function ()
  ac.setHeadlights(true)
  ac.setTargetCar(1)
  ac.setHeadlights(true)
  ac.setTargetCar(0)
end, 0.1)

ui.onExclusiveHUD(function (mode)
  if mode == 'game' then
    return true
  end
end)
