local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) function BackButtonAction( f1_arg0, f1_arg1 ) local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) f1_arg0:dispatchEventToRoot( { name = "check_show_apply", immediate = true } ) if f1_local0.showApplySettings then if Engine.ShowLowTextureResolutionWarning() then if f1_local0.vidRestart then LUI.FlowManager.RequestPopupMenu( f1_arg0, "show_low_texture_res_warning_restart_popmenu", false, f1_arg1.controller, false ) else LUI.FlowManager.RequestPopupMenu( f1_arg0, "show_low_texture_res_warning_popmenu", false, f1_arg1.controller, false ) end elseif f1_local0.vidRestart then LUI.FlowManager.RequestPopupMenu( f1_arg0, "apply_settings_restart_popmenu", false, f1_arg1.controller, false ) else LUI.FlowManager.RequestPopupMenu( f1_arg0, "apply_settings_popmenu", false, f1_arg1.controller, false ) end end LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) end function PicmipDisabledFunc() return Engine.GetDvarInt( "ui_r_picmip_manual" ) == 0 end f0_local0 = nil function NVidiaButtonOver( f3_arg0, f3_arg1 ) f0_local0 = f3_arg0.id f3_arg0:dispatchEventToRoot( { name = "show_nvidia_subtitle", immediate = true } ) end function NVidiaButtonUp( f4_arg0, f4_arg1 ) if f0_local0 == f4_arg0.id then f0_local0 = nil f4_arg0:dispatchEventToRoot( { name = "hide_nvidia_subtitle", immediate = true } ) end end function OptionsWindowRefresh( f5_arg0, f5_arg1 ) if f5_arg1.source_input == "button_action" or f5_arg1.source_input == "key_bound" or f5_arg1.source_input == "button_right" or f5_arg1.source_input == "button_left" then f5_arg0:processEvent( { name = "menu_refresh" } ) f5_arg0:processEvent( { name = "refresh_content" } ) end end function OptionsWindowTriggerRefresh( f6_arg0, f6_arg1 ) f6_arg0:dispatchEventToRoot( { name = "options_window_refresh", source_input = f6_arg1.name, immediate = true } ) end function GetFOV( f7_arg0 ) return (Engine.GetDvarFloat( "ui_cg_fov" ) - f7_arg0.Min) / (f7_arg0.Max - f7_arg0.Min) end function SliderChange( f8_arg0, f8_arg1, f8_arg2, f8_arg3 ) Engine.SetDvarFloat( f8_arg3, math.min( f8_arg1, math.max( f8_arg0, Engine.GetDvarFloat( f8_arg3 ) + f8_arg2 ) ) ) end function OptionFactory( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_arg4, f9_arg5, f9_arg6, f9_arg7, f9_arg8, f9_arg9, f9_arg10, f9_arg11 ) local f9_local0 = nil local f9_local1 = 1 local f9_local2 = Engine.GetDvarType( f9_arg0 ) local f9_local3 = nil if f9_arg9 then f9_local3 = { variant = GenericButtonSettings.Variants.Slider, button_text = Engine.Localize( f9_arg1 ), button_display_func = function ( f10_arg0, f10_arg1 ) return f9_arg11( f9_arg10 ) end, button_left_func = function ( f11_arg0, f11_arg1 ) SliderChange( f9_arg10.Min, f9_arg10.Max, -f9_arg10.Step, f9_arg0 ) end, button_right_func = function ( f12_arg0, f12_arg1 ) SliderChange( f9_arg10.Min, f9_arg10.Max, f9_arg10.Step, f9_arg0 ) end } else if f9_local2 == DvarTypeTable.DvarString or f9_local2 == DvarTypeTable.DvarEnum then f9_local0 = Engine.GetDvarString( f9_arg0 ) elseif f9_local2 == DvarTypeTable.DvarInt then f9_local0 = Engine.GetDvarInt( f9_arg0 ) elseif f9_local2 == DvarTypeTable.DvarBool then f9_local0 = Engine.GetDvarBool( f9_arg0 ) end for f9_local7, f9_local8 in pairs( f9_arg2 ) do if f9_local8.value == f9_local0 then f9_local1 = f9_local7 break end end f9_local4 = function ( f13_arg0, f13_arg1 ) if f9_local2 == DvarTypeTable.DvarString or f9_local2 == DvarTypeTable.DvarEnum then Engine.SetDvarString( f9_arg0, f9_arg2[f9_local1].value ) elseif f9_local2 == DvarTypeTable.DvarInt then Engine.SetDvarInt( f9_arg0, f9_arg2[f9_local1].value ) elseif f9_local2 == DvarTypeTable.DvarBool then Engine.SetDvarBool( f9_arg0, f9_arg2[f9_local1].value ) end OptionsWindowTriggerRefresh( f13_arg0, f13_arg1 ) end f9_local3 = { variant = GenericButtonSettings.Variants.Select, button_text = Engine.Localize( f9_arg1 ), button_display_func = function ( f14_arg0, f14_arg1 ) return f9_arg6 and f9_arg2[f9_local1].text or Engine.Localize( f9_arg2[f9_local1].text ) end, button_left_func = function ( f15_arg0, f15_arg1 ) f9_local1 = 1 + (#f9_arg2 + f9_local1 - 1 - 1) % #f9_arg2 f9_local4( f15_arg0, f15_arg1 ) end, button_right_func = function ( f16_arg0, f16_arg1 ) f9_local1 = 1 + (f9_local1 - 1 + 1) % #f9_arg2 f9_local4( f16_arg0, f16_arg1 ) end, button_over_func = f9_arg7, button_up_func = f9_arg8 } end return { type = "UIGenericButton", id = "option_" .. f9_arg0, disabledFunc = f9_arg4 or function () return false end , states = { default = { alpha = 1 }, invisible = { alpha = 0 } }, properties = f9_local3, handlers = { check_show_apply = function ( f18_arg0, f18_arg1 ) if f9_arg3 then if f9_arg9 then local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0 ) if Engine.GetDvarFloat( f9_arg3 ) ~= Engine.GetDvarFloat( f9_arg0 ) then f18_local0.showApplySettings = true if f9_arg5 then f18_local0.vidRestart = true end end else local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0 ) local f18_local1 = nil local f18_local2 = Engine.GetDvarType( f9_arg3 ) if f18_local2 == DvarTypeTable.DvarString or f18_local2 == DvarTypeTable.DvarEnum then f18_local1 = Engine.GetDvarString( f9_arg3 ) elseif f18_local2 == DvarTypeTable.DvarInt then f18_local1 = tostring( Engine.GetDvarInt( f9_arg3 ) ) elseif f18_local2 == DvarTypeTable.DvarBool then if Engine.GetDvarBool( f9_arg3 ) then local f18_local3 = "1" end f18_local1 = f18_local3 or "0" elseif f18_local2 == DvarTypeTable.DvarFloat then f18_local1 = tostring( Engine.GetDvarFloat( f9_arg3 ) ) end if f18_local1 ~= f9_arg2[f9_local1].value then f18_local0.showApplySettings = true if f9_arg5 then f18_local0.vidRestart = true end end end end end } } end function OptionsFeeder( f19_arg0 ) local f19_local0 = { [#f19_local0 + 1] = OptionFactory( "ui_r_aspectratio", "@MENU_ASPECT_RATIO", { { text = "@MENU_AUTO", value = "auto" }, { text = "@MENU_STANDARD_4_3", value = "standard" }, { text = "@MENU_WIDE_16_10", value = "wide 16:10" }, { text = "MENU_WIDE_16_9", value = "wide 16:9" } }, "r_aspectratio", nil, true ) } local f19_local1 = {} for f19_local5, f19_local6 in pairs( Engine.GetDvarEnumList( "r_displayRefresh" ) ) do f19_local1[#f19_local1 + 1] = { text = f19_local6, value = f19_local6 } end f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_displayRefresh", "@MENU_SCREEN_REFRESH_RATE", f19_local1, "r_displayRefresh", nil, true, true ) f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_vsync", "@MENU_SYNC_EVERY_FRAME", { { text = "@LUA_MENU_YES", value = "1" }, { text = "@LUA_MENU_NO", value = "0" } }, "r_vsync", nil, true ) f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_imageQuality", "@PLATFORM_UI_IMAGE_QUALITY", { { text = "@MENU_VERY_LOW", value = "1" }, { text = "@MENU_LOW", value = "2" }, { text = "@MENU_NORMAL", value = "3" }, { text = "@MENU_HIGH", value = "4" }, { text = "@MENU_EXTRA", value = "0" } }, "r_imageQuality", nil, true ) if Engine.IsMultiplayer() then f19_local2 = {} f19_local3 = SliderBounds.FOV.Max - SliderBounds.FOV.Min for f19_local4 = 0, f19_local3, 1 do local f19_local7 = tostring( SliderBounds.FOV.Min + f19_local4 ) f19_local2[f19_local4 + 1] = { text = Engine.MarkLocalized( f19_local7 ), value = f19_local7 } end f19_local0[#f19_local0 + 1] = OptionFactory( "ui_cg_fov", "@MENU_FOV", f19_local2, "cg_fov", nil, false, true, function ( f20_arg0, f20_arg1 ) f20_arg0:dispatchEventToRoot( { name = "show_fov_subtitle", immediate = true } ) end, function ( f21_arg0, f21_arg1 ) f21_arg0:dispatchEventToRoot( { name = "hide_fov_subtitle", immediate = true } ) end, false, false, false ) end f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_dof_enable", "@MENU_DOF", { { text = "@LUA_MENU_YES", value = "1" }, { text = "@LUA_MENU_NO", value = "0" } }, "r_dof_enable", nil, false ) if Engine.HBAOAvailable() then f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_ssao", "@PLATFORM_SSAO", { { text = "@MENU_OFF", value = "0_Off" }, { text = "@PLATFORM_LOW_QUALITY", value = "1_Low" }, { text = "@PLATFORM_HIGH_QUALITY", value = "2_High" }, { text = "@PLATFORM_HBAO", value = "3_HBAO" } }, "r_ssao", nil, true ) else f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_ssao", "@PLATFORM_SSAO", { { text = "@MENU_OFF", value = "0_Off" }, { text = "@PLATFORM_LOW_QUALITY", value = "1_Low" }, { text = "@PLATFORM_HIGH_QUALITY", value = "2_High" } }, "r_ssao", nil, true ) end f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_tessellation", "@MENU_TESSELLATION", { { text = "@MENU_OFF", value = "0_Off" }, { text = "@MENU_NORMAL", value = "1_Near" }, { text = "@MENU_EXTRA", value = "2_All" } }, "r_tessellation", nil, false ) f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_texFilterAnisoMin", "@LUA_MENU_ANISOTROPIC_FILTERING", { { text = "@MENU_LOW", value = "1" }, { text = "@MENU_NORMAL", value = "8" }, { text = "@MENU_HIGH", value = "16" } }, "r_texFilterAnisoMin", nil, true ) f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_mbEnableA", "@MENU_MOTION_BLUR", { { text = "@LUA_MENU_YES", value = "1" }, { text = "@LUA_MENU_NO", value = "0" } }, "r_mbEnableA", nil, true ) f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_distortion", "@MENU_DISTORTION", { { text = "@LUA_MENU_YES", value = "1" }, { text = "@LUA_MENU_NO", value = "0" } }, "r_distortion", nil, false ) if Engine.TXAAAvailable() then f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_aaMode", "@MENU_ANTIALIASING", { { text = "@MENU_OFF", value = "Off" }, { text = "@MENU_FXAA", value = "FXAA" }, { text = "@MENU_2X_MSAA", value = "2xMSAA" }, { text = "@MENU_4X_MSAA", value = "4xMSAA" }, { text = "@MENU_SMAA", value = "SMAA" }, { text = "@MENU_2X_TXAA", value = "2xTXAA" }, { text = "@MENU_4X_TXAA", value = "4xTXAA" } }, "r_aaMode", nil, true ) else f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_aaMode", "@MENU_ANTIALIASING", { { text = "@MENU_OFF", value = "Off" }, { text = "@MENU_FXAA", value = "FXAA" }, { text = "@MENU_2X_MSAA", value = "2xMSAA" }, { text = "@MENU_4X_MSAA", value = "4xMSAA" }, { text = "@MENU_SMAA", value = "SMAA" } }, "r_aaMode", nil, true ) end f19_local0[#f19_local0 + 1] = OptionFactory( "ui_sm_enable", "@MENU_SHADOWS", { { text = "@LUA_MENU_YES", value = "1" }, { text = "@LUA_MENU_NO", value = "0" } }, "sm_enable", nil, true ) f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_manual", "@MENU_TEXTURE_QUALITY", { { text = "@MENU_AUTOMATIC", value = "0" }, { text = "@MENU_MANUAL", value = "1" } }, "r_picmip_manual", nil, true ) f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip", "@MENU_TEXTURE_RESOLUTION", { { text = "@MENU_LOW", value = "3" }, { text = "@MENU_NORMAL", value = "2" }, { text = "@MENU_HIGH", value = "1" }, { text = "@MENU_EXTRA", value = "0" } }, "r_picmip", PicmipDisabledFunc, true ) f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_bump", "@MENU_NORMAL_MAP_RESOLUTION", { { text = "@MENU_LOW", value = "3" }, { text = "@MENU_NORMAL", value = "2" }, { text = "@MENU_HIGH", value = "1" }, { text = "@MENU_EXTRA", value = "0" } }, "r_picmip_bump", PicmipDisabledFunc, true ) f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_spec", "@MENU_SPECULAR_MAP_RESOLUTION", { { text = "@MENU_LOW", value = "3" }, { text = "@MENU_NORMAL", value = "2" }, { text = "@MENU_HIGH", value = "1" }, { text = "@MENU_EXTRA", value = "0" } }, "r_picmip_spec", PicmipDisabledFunc, true ) f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_water", "@MENU_WATER_MAP_RESOLUTION", { { text = "@MENU_LOW", value = "1" }, { text = "@MENU_HIGH", value = "0" } }, "r_picmip_water", PicmipDisabledFunc, true ) if Engine.FurShaderAvailable() then f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_fur_shader", "@MENU_FUR_SHADER", { { text = "@MENU_OFF", value = "0" }, { text = "@MENU_LOW", value = "1" }, { text = "@MENU_HIGH", value = "2" } }, "r_fur_shader", nil, true, nil, NVidiaButtonOver, NVidiaButtonUp ) end if Engine.APEXTurbulenceAvailable() then f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_apex_turbulence", "@MENU_APEX_TURBULENCE", { { text = "@MENU_ON", value = "1" }, { text = "@MENU_OFF", value = "0" } }, "r_apex_turbulence", nil, true, nil, NVidiaButtonOver, NVidiaButtonUp ) end return f19_local0 end function OptionsMainCreate( f22_arg0, f22_arg1 ) Engine.ExecNow( "profile_menuDvarsSetup" ) f22_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) end function OptionsMainClose( f23_arg0, f23_arg1 ) Engine.ExecNow( "profile_menuDvarsFinish" ) if Engine.GetDvarString( "r_lodScaleRigid" ) == "2" then Engine.SetDvarString( "r_lodScaleSkinned", "4" ) Engine.SetDvarString( "r_lodBiasSkinned", "-200" ) Engine.SetDvarString( "r_lodBiasRigid", "-100" ) end if Engine.GetDvarString( "r_lodScaleRigid" ) == "1" then Engine.SetDvarString( "r_lodScaleSkinned", "1" ) Engine.SetDvarString( "r_lodBiasSkinned", "0" ) Engine.SetDvarString( "r_lodBiasRigid", "0" ) end end function advanced_video_vlist() return { type = "UIScrollingVerticalList", childrenFeeder = OptionsFeeder, properties = { use_arrows = true, sendScrollEvents = true, exclusiveController = MBh.Property( "exclusiveController" ) }, states = { default = { leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = false, top = OptionsListDims.menu_top, bottom = OptionsListDims.menu_bottom, left = OptionsListDims.menu_left, right = OptionsListDims.menu_right } } } end function advanced_video() return { type = "UIElement", id = "advanced_video_id", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } }, handlers = { menu_create = OptionsMainCreate, menu_close = OptionsMainClose, options_window_refresh = OptionsWindowRefresh }, children = { { type = "generic_menu_title", properties = { menu_title = Engine.Localize( "@LUA_MENU_ADVANCED_VIDEO" ) } }, { type = "advanced_video_vlist", id = "advanced_video_vlist_id" }, { type = "button_helper_text_main", id = "button_helper_text_id" }, { type = "UIMarqueeText", id = "nvidia_option_subtitle", properties = { text = Engine.Localize( "@MENU_NVIDIA_OPTION_SUB" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = OptionsListDims.menu_bottom - CoD.TextSettings.HudIW6NormalFont.Height, bottom = OptionsListDims.menu_bottom - CoD.TextSettings.HudIW6NormalFont.Height + CoD.TextSettings.TinyFont.Height, left = 10, right = OptionsListDims.menu_right - 110, font = CoD.TextSettings.TinyFont.Font, alignment = LUI.Alignment.Right, red = 0.7, green = 0.7, blue = 0.7, alpha = 0 }, show_me = { alpha = 1 }, hide_me = { alpha = 0 } }, handlers = { show_nvidia_subtitle = function ( f26_arg0, f26_arg1 ) f26_arg0:setText( Engine.Localize( "@MENU_NVIDIA_OPTION_SUB" ) ) f26_arg0:animateToState( "show_me", 0 ) end , hide_nvidia_subtitle = function ( f27_arg0, f27_arg1 ) f27_arg0:animateToState( "hide_me", 0 ) end , show_fov_subtitle = function ( f28_arg0, f28_arg1 ) f28_arg0:setText( Engine.Localize( "@LUA_MENU_MP_FOV_OPTION_SUB" ) ) f28_arg0:animateToState( "show_me", 0 ) end , hide_fov_subtitle = function ( f29_arg0, f29_arg1 ) f29_arg0:animateToState( "hide_me", 0 ) end } }, { type = "UIBindButton", id = "back_button", handlers = { button_secondary = BackButtonAction } } } } end LUI.MenuBuilder.registerDef( "advanced_video_vlist", advanced_video_vlist ) LUI.MenuBuilder.registerDef( "advanced_video", advanced_video ) LockTable( _M )