├── .gitignore ├── icon.png ├── img ├── chart_bar.png └── chart_line.png ├── CHANGELOG ├── thunderstore.toml ├── Makefile ├── LICENSE ├── Plugin.cs ├── Patches └── AlphaDLSSEnablerPatches.cs ├── README.md ├── .github └── workflows │ └── ci.yml └── AlphaDLSSEnabler.csproj /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | bin/ 3 | obj/ 4 | .vs 5 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Captain-Of-Coit/cs2-alpha-dlss-enabler/HEAD/icon.png -------------------------------------------------------------------------------- /img/chart_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Captain-Of-Coit/cs2-alpha-dlss-enabler/HEAD/img/chart_bar.png -------------------------------------------------------------------------------- /img/chart_line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Captain-Of-Coit/cs2-alpha-dlss-enabler/HEAD/img/chart_line.png -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | # 0.2.0 + 0.2.1 2 | 3 | - Build infrastructure improvements 4 | - Publishing to Thunderstore 5 | 6 | # 0.1.0 7 | 8 | Initial Release -------------------------------------------------------------------------------- /thunderstore.toml: -------------------------------------------------------------------------------- 1 | [config] 2 | schemaVersion = "0.0.1" 3 | 4 | [package] 5 | namespace = "CaptainOfCoit" 6 | name = "AlphaDLSSEnabler" 7 | versionNumber = "0.2.0" 8 | description = "Enables experimental NVIDIA DLSS" 9 | websiteUrl = "https://thunderstore.io" 10 | containsNsfwContent = false 11 | 12 | [package.dependencies] 13 | BepInEx-BepInExPack = "5.4.2100" 14 | 15 | [build] 16 | icon = "./icon.png" 17 | readme = "./README.md" 18 | outdir = "./ts-build" 19 | 20 | [publish] 21 | repository = "https://thunderstore.io" 22 | communities = [ "cities-skylines-ii", ] 23 | categories = [ "mods" ] -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: build 2 | BEPINEX_VERSION = 6 3 | 4 | clean: 5 | @dotnet clean 6 | 7 | restore: 8 | @dotnet restore 9 | 10 | build: clean restore 11 | @dotnet build /p:BepInExVersion=$(BEPINEX_VERSION) 12 | 13 | package-win: 14 | @mkdir dist 15 | @cmd /c copy /y "bin\Debug\netstandard2.1\0Harmony.dll" "dist\" 16 | @cmd /c copy /y "bin\Debug\netstandard2.1\AlphaDLSSEnabler.dll" "dist\" 17 | @echo Packaged to dist/ 18 | 19 | package-unix: build 20 | @mkdir dist 21 | @cp bin/Debug/netstandard2.1/0Harmony.dll dist 22 | @cp bin/Debug/netstandard2.1/AlphaDLSSEnabler.dll dist 23 | @echo Packaged to dist/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2023 Captain-Of-Coit 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Plugin.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Reflection; 3 | using BepInEx; 4 | using HarmonyLib; 5 | 6 | #if BEPINEX_V6 7 | using BepInEx.Unity.Mono; 8 | #endif 9 | 10 | namespace AlphaDLSSEnabler 11 | { 12 | [BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)] 13 | public class Plugin : BaseUnityPlugin 14 | { 15 | private void Awake() 16 | { 17 | Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!"); 18 | 19 | var harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), MyPluginInfo.PLUGIN_GUID + "_Cities2Harmony"); 20 | var patchedMethods = harmony.GetPatchedMethods().ToArray(); 21 | 22 | Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} made patches! Patched methods: " + patchedMethods.Length); 23 | 24 | foreach (var patchedMethod in patchedMethods) { 25 | Logger.LogInfo($"Patched method: {patchedMethod.Module.Name}:{patchedMethod.Name}"); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Patches/AlphaDLSSEnablerPatches.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using UnityEngine; 3 | using Game.Rendering.Utilities; 4 | using UnityEngine.Rendering.HighDefinition; 5 | 6 | namespace AlphaDLSSEnabler.Patches { 7 | [HarmonyPatch(typeof(AdaptiveDynamicResolutionScale), "SetParams")] 8 | internal class AdaptiveDynamicResolutionScale_SetParamsPatch { 9 | static void Prefix(ref AdaptiveDynamicResolutionScale.DynResUpscaleFilter filter, Camera camera) { 10 | filter = AdaptiveDynamicResolutionScale.DynResUpscaleFilter.DLSS; 11 | var hdcam = camera.GetComponent(); 12 | hdcam.allowDeepLearningSuperSampling = true; 13 | hdcam.allowDynamicResolution = true; 14 | hdcam.deepLearningSuperSamplingQuality = 1; 15 | hdcam.deepLearningSuperSamplingSharpening = 0.5f; 16 | hdcam.deepLearningSuperSamplingUseCustomAttributes = true; 17 | hdcam.deepLearningSuperSamplingUseOptimalSettings = true; 18 | UnityEngine.Debug.Log("DL Super Sampling enabled"); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cities: Skylines 2 - Alpha DLSS Enabler 2 | 3 | This mods enables the experimental DLSS support. WARNING! When I say experimental, I mean it. Bunch of graphical artifacts are introduced when you activate this mod, as it's not properly implemented yet. 4 | 5 | Personally I experienced ~10 FPS on average increase. However, performance when viewing citizens is still abysmall and this doesn't seem to help a lot with that particular problem. 6 | 7 | ![Bar Chart](img/chart_bar.png) 8 | 9 | ![Line Chart](img/chart_line.png) 10 | 11 | The benchmark was made by animating the camera from outside the city to zoomed in one a meeting point of two metro stations with lots of pedestrians. 12 | 13 | # Requirements 14 | 15 | - [Cities: Skylines 2](https://store.steampowered.com/app/949230/Cities_Skylines_II/) (duh) 16 | - [BepInEx 5.4.22](https://github.com/BepInEx/BepInEx/releases) or later 17 | 18 | # Installation 19 | 20 | - Make sure BepInEx 5 is installed 21 | - Download latest release from GitHub - [https://github.com/Captain-Of-Coit/cs2-alpha-dlss-enabler/releases](https://github.com/Captain-Of-Coit/cs2-alpha-dlss-enabler/releases) 22 | - Extract the ZIP archive and place the `AlphaDLSSEnabler` directory in `BepInEx\Plugins` 23 | - Launch the game. DLSS will automatically be activated, and can only be disabled by removing the mod. 24 | 25 | # Community 26 | 27 | Looking to discuss Cities: Skylines 2 Unofficial modding together with other modders? You're welcome to join our "Cities 2 Modding" Discord, which you can find here: https://discord.gg/vd7HXnpPJf -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: alphadlssenabler-ci 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | tags: [ "v*" ] 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | bepinex-version: [5, 6] 14 | steps: 15 | - name: Checkout source 16 | uses: actions/checkout@v3 17 | - name: Checkout libcs2 18 | uses: actions/checkout@v3 19 | with: 20 | repository: Captain-Of-Coit/libcs2 21 | token: ${{ secrets.GH_PAT }} 22 | path: libcs2/ 23 | - name: Install .NET Core 24 | uses: actions/setup-dotnet@v3 25 | with: 26 | dotnet-version: 6.0.x 27 | - name: Build (BepInEx ${{ matrix.bepinex-version }}) 28 | run: make package-unix BEPINEX_VERSION=${{ matrix.bepinex-version }} 29 | - name: Upload Artifact (BepInEx ${{ matrix.bepinex-version }}) 30 | uses: actions/upload-artifact@v3 31 | with: 32 | name: built-code-${{ matrix.bepinex-version }} 33 | path: dist/*.dll 34 | publish: 35 | needs: build 36 | if: startsWith(github.ref, 'refs/tags/v') 37 | runs-on: ubuntu-latest 38 | steps: 39 | - name: Checkout source 40 | uses: actions/checkout@v3 41 | - name: Download built artifact 42 | uses: actions/download-artifact@v3 43 | with: 44 | name: built-code-5 45 | path: dist/ 46 | - name: Debug 47 | run: ls && ls dist/ 48 | - name: Download tcli 49 | run: | 50 | curl -L https://github.com/thunderstore-io/thunderstore-cli/releases/download/0.2.1/tcli-0.2.1-linux-x64.tar.gz -o tcli.tar.gz 51 | tar -xzf tcli.tar.gz 52 | - name: Publish with tcli 53 | run: ./tcli-0.2.1-linux-x64/tcli publish --token=${{ secrets.TS_TOKEN }} -------------------------------------------------------------------------------- /AlphaDLSSEnabler.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | netstandard2.1 12 | AlphaDLSSEnabler 13 | Use at own risk! Enables DLSS in Cities Skylines 2 14 | 0.2.0 15 | true 16 | latest 17 | 18 | https://api.nuget.org/v3/index.json; 19 | https://nuget.bepinex.dev/v3/index.json; 20 | https://nuget.samboy.dev/v3/index.json 21 | 22 | AlphaDLSSEnabler 23 | true 24 | 25 | 26 | 30 | 31 | C:\Program Files (x86)\Steam\steamapps\common\Cities Skylines II 32 | 33 | 34 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 50 | 51 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 5 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | $(DefineConstants);BEPINEX_V6 85 | 86 | 87 | 88 | 89 | 90 | 91 | 95 | 96 | 97 | 98 | --------------------------------------------------------------------------------