local nativeSettings = nil local configFileName = "config.json" local settings = { Current = { listview = false, modautos = false, autos = true, vehicles = true, peds = true, allcrowds = true, crowditems = true, spawns = 3, lightblock = true, rimenhance = true, terrainsnap = true, moveattempts = 100, antialias = true, cas = true, statics = true, dynamics = true, bloom = true, cascades = true, distantfog = true, distantgi = true, distantshadows = true, distantvolfog = true, gi = true, ssao = true, ssheathaze = true, sspr = true, ssr = true, ssrain = true, volfog = true, async = true, vrs = true, checkerGI = true, rtao = true, rttrans = true, rtdi = true, rtSSR = true, dlssd = false }, Default = { listview = false, modautos = false, autos = true, vehicles = true, peds = true, allcrowds = true, crowditems = true, spawns = 3, lightblock = true, rimenhance = true, terrainsnap = true, moveattempts = 100, antialias = true, cas = true, statics = true, dynamics = true, bloom = true, cascades = true, distantfog = true, distantgi = true, distantshadows = true, distantvolfog = true, gi = true, ssao = true, ssheathaze = true, sspr = true, ssr = true, ssrain = true, volfog = true, async = true, vrs = true, checkerGI = true, rtao = true, rttrans = true, rtdi = true, rtSSR = true, dlssd = false } } function ModAutoSave() if settings.Current.modautos == true then local file = io.open("config.json", "w") if file ~= nil then local content = json.encode(settings.Current) file:write(content) file:close() end else return end end function Clear() nativeSettings.removeSubcategory("/JustSomeFeatureToggles/all") end function ClearMain() nativeSettings.removeSubcategory("/JustSomeFeatureToggles/main") nativeSettings.removeSubcategory("/JustSomeFeatureToggles/Compute") nativeSettings.removeSubcategory("/JustSomeFeatureToggles/Crowds") nativeSettings.removeSubcategory("/JustSomeFeatureToggles/Graphics") nativeSettings.removeSubcategory("/JustSomeFeatureToggles/Rays") end function ClearList() nativeSettings.removeSubcategory("/JustSomeFeatureToggles/Compute") nativeSettings.removeSubcategory("/JustSomeFeatureToggles/Crowds") nativeSettings.removeSubcategory("/JustSomeFeatureToggles/Graphics") nativeSettings.removeSubcategory("/JustSomeFeatureToggles/Rays") end function MainMenu() nativeSettings.addTab("/JustSomeFeatureToggles", "Feature Toggles") nativeSettings.addSubcategory("/JustSomeFeatureToggles/main", "Performance Feature Toggles -by TheManualEnhancer") nativeSettings.addSwitch("/JustSomeFeatureToggles/main", "Toggle Game Autosaving", "Toggles autosaving on/off for gameplay. This setting autosaves whether you have the 'Mod Auto Saves' switched on or off. ***Warning*** - Disabling autosaves can break quests, so enable when questing.", settings.Current.autos, settings.Default.autos, function(state) settings.Current.autos = state SetAutoSaves() SaveSettings() end) nativeSettings.addButton("/JustSomeFeatureToggles/main", "Compute Settings", "Takes you to the Compute and Shaders settings page", "Compute", 36, function() Clear() ClearMain() ComputeMenu() end) nativeSettings.addButton("/JustSomeFeatureToggles/main", "Crowd Settings", "Takes you to the crowd settings page", "Crowds", 36, function() Clear() ClearMain() CrowdMenu() end) nativeSettings.addButton("/JustSomeFeatureToggles/main", "Raster Graphics Settings", "Takes you to the Raster Graphics settings page", "Raster", 36, function() Clear() ClearMain() RasterMenu() end) nativeSettings.addButton("/JustSomeFeatureToggles/main", "RT/PT Settings", "Takes you to the Raytracing and Pathtracing settings page", "RT & PT", 36, function() Clear() ClearMain() RaysMenu() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/main", "Mod Settings Autosaving", "Toggles autosaving of the mod settings on/off. Off by default. You can always use the 'Save' buttons on each menu to save the settings at any time. Settings always apply automatically with or without autosaving.", settings.Current.modautos, settings.Default.modautos, function(state) settings.Current.modautos = state SetAutoSaves() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/main", "List View", "Shows/hides the full list of settings on this main menu. Settings change here will ignore your autsave stettings toggle. They will always save.", settings.Current.listview, settings.Default.listview, function(state) settings.Current.listview = state SaveSettings() ModAutoSave() AllMenus() end) end function ComputeMenu() nativeSettings.addSubcategory("/JustSomeFeatureToggles/all", "Performance Feature Toggles") nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "AMD FidelityFx CAS", "Contrast adaptive sharpening", settings.Current.cas, settings.Default.cas, function(state) settings.Current.cas = state SetCAS() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "ASYNC Compute", "Generally performs better disabled on RTX 20 series and older, or AMD RX 500 series and older", settings.Current.async, settings.Default.async, function(state) settings.Current.async = state SetAsync() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Variable Rate Shading", "Could perform better, could be worse, could be no change", settings.Current.vrs, settings.Default.vrs, function(state) settings.Current.vrs = state SetVrs() ModAutoSave() end) nativeSettings.addButton("/JustSomeFeatureToggles/all", "Save Current Settings", "Saves the current settings to the config file (it never autosaves, so you need to do this to save settings at all", "Save", 45, function() SaveSettings() end) nativeSettings.addButton("/JustSomeFeatureToggles/all", "Back to Main Menu", "", "Main", 45, function() Clear() MainMenu() end) end function CrowdMenu() nativeSettings.addSubcategory("/JustSomeFeatureToggles/all", "Performance Feature Toggles") nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "All Crowds", "Disables pedestrians and vehicles", settings.Current.allcrowds, settings.Default.allcrowds, function(state) settings.Current.allcrowds = state SetAllCrowds() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Pedestrians", "Disables only pedestrian crowds", settings.Current.peds, settings.Default.peds, function(state) settings.Current.peds = state SetPeds() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Vehicles", "Disables only vehicles", settings.Current.vehicles, settings.Default.vehicles, function(state) settings.Current.vehicles = state SetVehicles() ModAutoSave() end) nativeSettings.addRangeFloat("/JustSomeFeatureToggles/all", "Same Type NPC Limit", "Sets the limit of same type NPCs (clones) that are allowed to spawn around you. Higher values should improve performance", 1, 10, 1, "%0.0f", settings.Current.spawns, settings.Default.spawns, function(value) settings.Current.spawns = value SetSpawns() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Crowd Items", "Disables items from crowd members such as cell phones", settings.Current.crowditems, settings.Default.crowditems, function(state) settings.Current.crowditems = state SetCrowdItems() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Character Light Blockers", "Disables the blocking of lights by characters", settings.Current.lightblock, settings.Default.lightblock, function(state) settings.Current.lightblock = state SetLightBlock() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Character Rim Enhancement", "Disables the artificial glow on the edges of characters", settings.Current.rimenhance, settings.Default.rimenhance, function(state) settings.Current.rimenhance = state SetRimEnhance() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Snap To Terrain", "Disables the checks to make sure that NPCs stay stuck to the ground - Doesn't really break anything, but NPCs may appear to hover a bit", settings.Current.terrainsnap, settings.Default.terrainsnap, function(state) settings.Current.terrainsnap = state SetSnap() ModAutoSave() end) nativeSettings.addRangeFloat("/JustSomeFeatureToggles/all", "NPC Path Distance", "Reducing this could help reduce CPU load. 0 doesn't quite disable pathing, but makes NPCs walk in circles sometimes", 0, 100, 1, "%0.0f", settings.Current.moveattempts, settings.Default.moveattempts, function(value) settings.Current.moveattempts = value SetMoveAttempts() ModAutoSave() end) nativeSettings.addButton("/JustSomeFeatureToggles/all", "Save Current Settings", "Saves the current settings to the config file (it never autosaves, so you need to do this to save settings at all", "Save", 45, function() SaveSettings() end) nativeSettings.addButton("/JustSomeFeatureToggles/all", "Back to Main Menu", "", "Main", 45, function() Clear() MainMenu() end) end function RasterMenu() nativeSettings.addSubcategory("/JustSomeFeatureToggles/all", "Performance Feature Toggles") nativeSettings.addButton("/JustSomeFeatureToggles/all", "Back to Main Menu", "", "Main", 45, function() Clear() MainMenu() end) nativeSettings.addButton("/JustSomeFeatureToggles/all", "Save Current Settings", "Saves the current settings to the config file (it never autosaves, so you need to do this to save settings at all", "Save", 45, function() SaveSettings() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Antialiasing", "Enabled gets rid of most jagged edges - Warning, ugly when disabled", settings.Current.antialias, settings.Default.antialias, function(state) settings.Current.antialias = state SetAntiAlias() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Static Decals", "Static (non-changing) decals... Haven't tested this enough to know what all the game considers to be static decals", settings.Current.statics, settings.Default.statics, function(state) settings.Current.statics = state SetStatics() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Dynamic Decals", "Things like bullet holes and broken glass", settings.Current.dynamics, settings.Default.dynamics, function(state) settings.Current.dynamics = state SetDynamics() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Cascade Shadows", "Sun Shadows", settings.Current.cascades, settings.Default.cascades, function(state) settings.Current.cascades = state SetCascades() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Distant Shadows", "Fake shadows in the distance", settings.Current.distantshadows, settings.Default.distantshadows, function(state) settings.Current.distantshadows = state SetDistantShadows() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "SSAO", "Ambient darkening of objects close to each other or surfaces, like shadows", settings.Current.ssao, settings.Default.ssao, function(state) settings.Current.ssao = state SetSSAO() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Distant GI", "Distant global lighting - Warning, disabled is ugly", settings.Current.distantgi, settings.Default.distantgi, function(state) settings.Current.distantgi = state SetDistantGI() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "GI", "Global lighting - Warning, disabled is ugly", settings.Current.gi, settings.Default.gi, function(state) settings.Current.gi = state SetGI() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Distant Fog", "Distant horizon fog", settings.Current.distantfog, settings.Default.distantfog, function(state) settings.Current.distantfog = state SetDistantFog() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Distant Vol Fog", "Fog from the volumetric clouds - Warning, disabling is ugly", settings.Current.distantvolfog, settings.Default.distantvolfog, function(state) settings.Current.distantvolfog = state SetDistantVolFog() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Vol Fog", "Fog that fills your screen - Warning, you need this on to see rain", settings.Current.volfog, settings.Default.volfog, function(state) settings.Current.volfog = state SetVolFog() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Bloom", "Makes lights glow - Vol Fog assists it", settings.Current.bloom, settings.Default.bloom, function(state) settings.Current.bloom = state SetBloom() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Heat Haze", "The hazy glow around the city", settings.Current.ssheathaze, settings.Default.ssheathaze, function(state) settings.Current.ssheathaze = state SetHaze() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Planar Reflections", "I would try disabling this before SSR", settings.Current.sspr, settings.Default.sspr, function(state) settings.Current.sspr = state SetPlanar() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "ScreenSpace Reflections", "Good old SSR", settings.Current.ssr, settings.Default.ssr, function(state) settings.Current.ssr = state SetSSR() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "ScreenSpace Rain", "This doesn't disable rain, just makes it kinda ugly", settings.Current.ssrain, settings.Default.ssrain, function(state) settings.Current.ssrain = state SetSSRain() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Checkerboard GI", "Should perform better enabled, but could improve performance in CPU-bound scenarios", settings.Current.checkerGI, settings.Default.checkerGI, function(state) settings.Current.checkerGI = state SetCheckerGI() ModAutoSave() end) nativeSettings.addButton("/JustSomeFeatureToggles/all", "Save Current Settings", "Saves the current settings to the config file (it never autosaves, so you need to do this to save settings at all", "Save", 45, function() SaveSettings() end) nativeSettings.addButton("/JustSomeFeatureToggles/all", "Back to Main Menu", "", "Main", 45, function() Clear() MainMenu() end) end function RaysMenu() nativeSettings.addSubcategory("/JustSomeFeatureToggles/all", "Performance Feature Toggles") nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "RTAO", "See SSAO details", settings.Current.rtao, settings.Default.rtao, function(state) settings.Current.rtao = state SetRTAO() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "RT Diffuse Illumination", "This really shouldn't make a huge difference to RT lighting and should improve performance", settings.Current.rtdi, settings.Default.rtdi, function(state) settings.Current.rtdi = state SetRTDI() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "RT Transparent Reflections", "Again, shouldn't reduce visuals too much for a little performance lift", settings.Current.rttrans, settings.Default.rttrans, function(state) settings.Current.rttrans = state SetRtTrans() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "RT SSR Fallback", "Disables screenspace reflections while using RT/PT", settings.Current.rtSSR, settings.Default.rtSSR, function(state) settings.Current.rtSSR = state SetRtSSR() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/all", "Ray Reconstruction", "Force Ray REconstruction On/Off (default is off)", settings.Current.dlssd, settings.Default.dlssd, function(state) settings.Current.dlssd = state SetRtSSR() ModAutoSave() end) nativeSettings.addButton("/JustSomeFeatureToggles/all", "Save Current Settings", "Saves the current settings to the config file (it never autosaves, so you need to do this to save settings at all", "Save", 45, function() SaveSettings() end) nativeSettings.addButton("/JustSomeFeatureToggles/all", "Back to Main Menu", "", "Main", 45, function() Clear() MainMenu() end) end function AllMenus() if not settings.Current.listview == false then nativeSettings.addSubcategory("/JustSomeFeatureToggles/Compute", "Compute/Shaders") nativeSettings.addSubcategory("/JustSomeFeatureToggles/Crowds", "Crowds") nativeSettings.addSubcategory("/JustSomeFeatureToggles/Graphics", "Graphics") nativeSettings.addSubcategory("/JustSomeFeatureToggles/Rays", "Raytracing/Pathtracing") nativeSettings.addSwitch("/JustSomeFeatureToggles/Crowds", "All Crowds", "Disables pedestrians and vehicles", settings.Current.allcrowds, settings.Default.allcrowds, function(state) settings.Current.allcrowds = state SetAllCrowds() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Crowds", "Pedestrians", "Disables only pedestrian crowds", settings.Current.peds, settings.Default.peds, function(state) settings.Current.peds = state SetPeds() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Crowds", "Vehicles", "Disables only vehicles", settings.Current.vehicles, settings.Default.vehicles, function(state) settings.Current.vehicles = state SetVehicles() SaveSettings() ModAutoSave() end) nativeSettings.addRangeFloat("/JustSomeFeatureToggles/Crowds", "Same Type NPC Limit", "Sets the limit of same type NPCs (clones) that are allowed to spawn around you. Higher values should improve performance", 1, 10, 1, "%0.0f", settings.Current.spawns, settings.Default.spawns, function(value) settings.Current.spawns = value SetSpawns() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Crowds", "Crowd Items", "Disables items from crowd members such as cell phones", settings.Current.crowditems, settings.Default.crowditems, function(state) settings.Current.crowditems = state SetCrowdItems() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Crowds", "Character Light Blockers", "Disables the blocking of lights by characters", settings.Current.lightblock, settings.Default.lightblock, function(state) settings.Current.lightblock = state SetLightBlock() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Crowds", "Character Rim Enhancement", "Disables the artificial glow on the edges of characters", settings.Current.rimenhance, settings.Default.rimenhance, function(state) settings.Current.rimenhance = state SetRimEnhance() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Crowds", "Snap To Terrain", "Disables the checks to make sure that NPCs stay stuck to the ground - Doesn't really break anything, but NPCs may appear to hover a bit", settings.Current.terrainsnap, settings.Default.terrainsnap, function(state) settings.Current.terrainsnap = state SetSnap() SaveSettings() ModAutoSave() end) nativeSettings.addRangeFloat("/JustSomeFeatureToggles/Crowds", "NPC Path Distance", "Reducing this could help reduce CPU load. 0 doesn't quite disable pathing, but makes NPCs walk in circles sometimes", 0, 100, 1, "%0.0f", settings.Current.moveattempts, settings.Default.moveattempts, function(value) settings.Current.moveattempts = value SetMoveAttempts() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Antialiasing", "Enabled gets rid of most jagged edges - Warning, ugly when disabled", settings.Current.antialias, settings.Default.antialias, function(state) settings.Current.antialias = state SetAntiAlias() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Static Decals", "Static (non-changing) decals... Haven't tested this enough to know what all the game considers to be static decals", settings.Current.statics, settings.Default.statics, function(state) settings.Current.statics = state SetStatics() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Dynamic Decals", "Things like bullet holes and broken glass", settings.Current.dynamics, settings.Default.dynamics, function(state) settings.Current.dynamics = state SetDynamics() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Cascade Shadows", "Sun Shadows", settings.Current.cascades, settings.Default.cascades, function(state) settings.Current.cascades = state SetCascades() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Distant Shadows", "Fake shadows in the distance", settings.Current.distantshadows, settings.Default.distantshadows, function(state) settings.Current.distantshadows = state SetDistantShadows() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "SSAO", "Ambient darkening of objects close to each other or surfaces, like shadows", settings.Current.ssao, settings.Default.ssao, function(state) settings.Current.ssao = state SetSSAO() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Distant GI", "Distant global lighting - Warning, disabled is ugly", settings.Current.distantgi, settings.Default.distantgi, function(state) settings.Current.distantgi = state SetDistantGI() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "GI", "Global lighting - Warning, disabled is ugly", settings.Current.gi, settings.Default.gi, function(state) settings.Current.gi = state SetGI() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Distant Fog", "Distant horizon fog", settings.Current.distantfog, settings.Default.distantfog, function(state) settings.Current.distantfog = state SetDistantFog() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Distant Vol Fog", "Fog from the volumetric clouds - Warning, disabling is ugly", settings.Current.distantvolfog, settings.Default.distantvolfog, function(state) settings.Current.distantvolfog = state SetDistantVolFog() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Vol Fog", "Fog that fills your screen - Warning, you need this on to see rain", settings.Current.volfog, settings.Default.volfog, function(state) settings.Current.volfog = state SetVolFog() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Bloom", "Makes lights glow - Vol Fog assists it", settings.Current.bloom, settings.Default.bloom, function(state) settings.Current.bloom = state SetBloom() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Heat Haze", "The hazy glow around the city", settings.Current.ssheathaze, settings.Default.ssheathaze, function(state) settings.Current.ssheathaze = state SetHaze() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Planar Reflections", "I would try disabling this before SSR", settings.Current.sspr, settings.Default.sspr, function(state) settings.Current.sspr = state SetPlanar() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "ScreenSpace Reflections", "Good old SSR", settings.Current.ssr, settings.Default.ssr, function(state) settings.Current.ssr = state SetSSR() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "ScreenSpace Rain", "This doesn't disable rain, just makes it kinda ugly", settings.Current.ssrain, settings.Default.ssrain, function(state) settings.Current.ssrain = state SetSSRain() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Compute", "ASYNC Compute", "Generally performs better disabled on RTX 20 series and older, or AMD RX 500 series and older", settings.Current.async, settings.Default.async, function(state) settings.Current.async = state SetAsync() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Compute", "Variable Rate Shading", "Could perform better, could be worse, could be no change", settings.Current.vrs, settings.Default.vrs, function(state) settings.Current.vrs = state SetVrs() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Compute", "AMD FidelityFx CAS", "Contrast adaptive sharpening", settings.Current.cas, settings.Default.cas, function(state) settings.Current.cas = state SetCAS() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Graphics", "Checkerboard GI", "Should perform better enabled, but could improve performance in CPU-bound scenarios", settings.Current.checkerGI, settings.Default.checkerGI, function(state) settings.Current.checkerGI = state SetCheckerGI() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Rays", "RTAO", "See SSAO details", settings.Current.rtao, settings.Default.rtao, function(state) settings.Current.rtao = state SetRTAO() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Rays", "RT Diffuse Illumination", "This really shouldn't make a huge difference to RT lighting and should improve performance", settings.Current.rtdi, settings.Default.rtdi, function(state) settings.Current.rtdi = state SetRTDI() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Rays", "RT Transparent Reflections", "Again, shouldn't reduce visuals too much for a little performance lift", settings.Current.rttrans, settings.Default.rttrans, function(state) settings.Current.rttrans = state SetRtTrans() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Rays", "RT SSR Fallback", "Disables screenspace reflections while using RT/PT", settings.Current.rtSSR, settings.Default.rtSSR, function(state) settings.Current.rtSSR = state SetRtSSR() SaveSettings() ModAutoSave() end) nativeSettings.addSwitch("/JustSomeFeatureToggles/Rays", "Ray Reconstruction", "Force Ray REconstruction On/Off (default is off)", settings.Current.dlssd, settings.Default.dlssd, function(state) settings.Current.dlssd = state SetRtSSR() SaveSettings() ModAutoSave() end) else ClearList() end end registerForEvent("onInit", function() nativeSettings = GetMod("nativeSettings") LoadSettings() MainMenu() if not settings.Current.listview == false then AllMenus() else return end end) function SetAutoSaves() GameOptions.SetBool("SaveConfig", "AutoSaveEnabled", settings.Current.autos) end function SetAllCrowds() GameOptions.SetBool("Crowd", "Enabled", settings.Current.allcrowds) end function SetPeds() GameOptions.SetBool("Crowd", "EnablePedestrians", settings.Current.peds) end function SetVehicles() GameOptions.SetBool("Crowd", "EnableVehicles", settings.Current.vehicles) end function SetSpawns() GameOptions.SetInt("Crowd", "SpawnLimit", settings.Current.spawns) end function SetCrowdItems() GameOptions.SetBool("Crowds", "EnableItems", settings.Current.crowditems) end function SetLightBlock() GameOptions.SetBool("Developer/FeatureToggles", "CharacterLightBlockers", settings.Current.lightblock) end function SetRimEnhance() GameOptions.SetBool("Developer/FeatureToggles", "CharacterRimEnhancement", settings.Current.rimenhance) end function SetSnap() GameOptions.SetBool("SnapToTerrainIk", "Enabled", settings.Current.terrainsnap) end function SetMoveAttempts() GameOptions.SetFloat("Traffic", "MaxLocalPathLength", settings.Current.moveattempts) end function SetAntiAlias() GameOptions.SetBool("Developer/FeatureToggles", "Antialiasing", settings.Current.antialias) end function SetCAS() GameOptions.SetBool("Developer/FeatureToggles", "ConstrastAdaptiveSharpening", settings.Current.cas) end function SetStatics() GameOptions.SetBool("Streaming/Culling/StaticDecals", "Enabled", settings.Current.statics) end function SetDynamics() GameOptions.SetBool("Developer/FeatureToggles", "DynamicDecals", settings.Current.statics) end function SetCascades() GameOptions.SetBool("Developer/FeatureToggles", "CascadeShadows", settings.Current.cascades) end function SetDistantShadows() GameOptions.SetBool("Developer/FeatureToggles", "DistantShadows", settings.Current.distantshadows) end function SetSSAO() GameOptions.SetBool("Developer/FeatureToggles", "SSAO", settings.Current.ssao) end function SetDistantGI() GameOptions.SetBool("Developer/FeatureToggles", "DistantGI", settings.Current.distantgi) end function SetGI() GameOptions.SetBool("Developer/FeatureToggles", "GlobalIllumination", settings.Current.gi) end function SetDistantFog() GameOptions.SetBool("Developer/FeatureToggles", "DistantFog", settings.Current.distantfog) end function SetDistantVolFog() GameOptions.SetBool("Developer/FeatureToggles", "DistantVolFog", settings.Current.distantvolfog) end function SetVolFog() GameOptions.SetBool("Developer/FeatureToggles", "VolumetricFog", settings.Current.volfog) end function SetBloom() GameOptions.SetBool("Developer/FeatureToggles", "Bloom", settings.Current.bloom) end function SetHaze() GameOptions.SetBool("Developer/FeatureToggles", "ScreenSpaceHeatHaze", settings.Current.ssheathaze) end function SetPlanar() GameOptions.SetBool("Developer/FeatureToggles", "ScreenSpacePlanarReflection", settings.Current.sspr) end function SetSSR() GameOptions.SetBool("Developer/FeatureToggles", "ScreenSpaceReflection", settings.Current.ssr) end function SetSSRain() GameOptions.SetBool("Developer/FeatureToggles", "ScreenSpaceRain", settings.Current.ssrain) end function SetAsync() GameOptions.SetBool("Rendering/AsyncCompute", "Enable", settings.Current.async) end function SetVrs() GameOptions.SetBool("Rendering/VariableRateShading", "Enable", settings.Current.vrs) end function SetRTAO() GameOptions.SetBool("Raytracing", "EnableAmbientOcclusion", settings.Current.rtao) end function SetRTDI() GameOptions.SetBool("Raytracing", "EnableDiffuseIllumination", settings.Current.rtdi) end function SetRtTrans() GameOptions.SetBool("Raytracing", "EnableTransparentReflection", settings.Current.rttrans) end function SetCheckerGI() GameOptions.SetBool("Rendering", "CheckerboardGI", settings.Current.checkerGI) end function SetRtSSR() GameOptions.SetBool("Editor/PathTracing", "UseSSRFallback", settings.Current.rtSSR) end function SetDLSSD() GameOptions.SetBool("Developer/FeatureToggles", "DLSSD", settings.Current.dlssd) end function LoadSettings() local file = io.open(configFileName, "r") if file ~= nil then local configStr = file:read("*a") settings.Current = json.decode(configStr) file:close() end end function SaveSettings() if not settings.Current.modautos == true then local file = io.open(configFileName, "w") if file ~= nil then local content = json.encode(settings.Current) file:write(content) file:close() end else return end end --Thank you to the CET and the Native Settings UI teams (and Bing chat...lol)