├── .gitignore ├── ConfigurationTool_Rewrite.sln ├── GensConfigTool ├── App.xaml ├── App.xaml.cs ├── ConfigurationTool.csproj ├── ConfigurationTool.ico ├── FodyWeavers.xml ├── FodyWeavers.xsd ├── Handlers │ ├── ConfigurationHandler.cs │ ├── DevicesHandler.cs │ ├── NvidiaHandler.cs │ └── RegistryHandler.cs ├── Helpers │ ├── EnumOrder.cs │ ├── Extensions.cs │ ├── GraphicsDeviceTypes.cs │ ├── ThemeHelper.cs │ └── UacHelper.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Model │ ├── Configuration.cs │ ├── Configurations │ │ ├── AnalyticsConfiguration.cs │ │ ├── AudioConfiguration.cs │ │ ├── GraphicsConfiguration.cs │ │ ├── IConfiguration.cs │ │ ├── InputConfiguration.cs │ │ └── RegistryConfiguration.cs │ ├── Devices │ │ ├── AudioDevice.cs │ │ ├── GraphicsAdapter.cs │ │ ├── InputDevice.cs │ │ ├── Keyboard.cs │ │ └── XinputController.cs │ ├── Input │ │ ├── AxisMap.cs │ │ └── ButtonConfiguration.cs │ └── Settings │ │ ├── DepthFormat.cs │ │ ├── DisplayMode.cs │ │ ├── HighLow.cs │ │ ├── Language.cs │ │ ├── OnOff.cs │ │ ├── RefreshRate.cs │ │ └── Resolution.cs └── Resources │ ├── ConfigurationTool.ico │ ├── Dictionary.xaml │ ├── Images │ ├── Buttons │ │ ├── A.png │ │ ├── B.png │ │ ├── Back.png │ │ ├── LB.png │ │ ├── LT.png │ │ ├── RB.png │ │ ├── RT.png │ │ ├── Start.png │ │ ├── Stick.png │ │ ├── Stick_Down.png │ │ ├── Stick_Left.png │ │ ├── Stick_Right.png │ │ ├── Stick_Up.png │ │ ├── X.png │ │ └── Y.png │ ├── Display.png │ ├── FXAA.png │ ├── Icon.png │ ├── Misc.png │ ├── None.png │ ├── Res.png │ ├── Shadows.png │ └── Vsync.png │ └── Themes │ ├── Dark.xaml │ ├── Light.xaml │ └── ThemeBase.xaml ├── Images ├── Config.png ├── Config_Dark.png ├── Input.png └── Input_Dark.png ├── README.md └── appveyor.yml /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | 352 | *.cfg 353 | *.config 354 | *.psd -------------------------------------------------------------------------------- /ConfigurationTool_Rewrite.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30804.86 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigurationTool", "GensConfigTool\ConfigurationTool.csproj", "{06895F66-C403-4845-8CD9-711B839F52F0}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x86 = Debug|x86 12 | Release|Any CPU = Release|Any CPU 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {06895F66-C403-4845-8CD9-711B839F52F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {06895F66-C403-4845-8CD9-711B839F52F0}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {06895F66-C403-4845-8CD9-711B839F52F0}.Debug|x86.ActiveCfg = Debug|x86 19 | {06895F66-C403-4845-8CD9-711B839F52F0}.Debug|x86.Build.0 = Debug|x86 20 | {06895F66-C403-4845-8CD9-711B839F52F0}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {06895F66-C403-4845-8CD9-711B839F52F0}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {06895F66-C403-4845-8CD9-711B839F52F0}.Release|x86.ActiveCfg = Release|x86 23 | {06895F66-C403-4845-8CD9-711B839F52F0}.Release|x86.Build.0 = Release|x86 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {001EEC94-DC53-4ADF-9631-A76311B5F954} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /GensConfigTool/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /GensConfigTool/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using ConfigurationTool.Handlers; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows; 5 | 6 | namespace ConfigurationTool 7 | { 8 | /// 9 | /// Interaction logic for App.xaml 10 | /// 11 | public partial class App : Application 12 | { 13 | public App() 14 | { 15 | CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); 16 | string[] args = Environment.GetCommandLineArgs(); 17 | if (args.Length > 1) 18 | { 19 | RegistryHandler.FixRegistry(int.Parse(args[1])); 20 | Application.Current.Shutdown(); 21 | } 22 | NvidiaHandler.InitializeDedicatedGraphics(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /GensConfigTool/ConfigurationTool.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net472 6 | true 7 | ConfigurationTool.ico 8 | ConfigurationTool.App 9 | Sonic Generations 10 | Sonic Generations 11 | Sonic Generations Configuration Tool 12 | 13 | PTKickass 14 | AnyCPU;x86 15 | ConfigurationTool 16 | ConfigurationTool 17 | 18 | 19 | 20 | true 21 | AnyCPU 22 | 23 | none 24 | false 25 | 26 | 27 | 28 | true 29 | AnyCPU 30 | 31 | 32 | 33 | AnyCPU 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | all 65 | runtime; build; native; contentfiles; analyzers; buildtransitive 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | $(DefaultXamlRuntime) 104 | Designer 105 | Never 106 | 107 | 108 | 109 | Never 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /GensConfigTool/ConfigurationTool.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PTKay/GenerationsConfigTool_Rewrite/c31706b3295d0fd14ec2f53643a1f36ddeea5f79/GensConfigTool/ConfigurationTool.ico -------------------------------------------------------------------------------- /GensConfigTool/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /GensConfigTool/FodyWeavers.xsd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks 13 | 14 | 15 | 16 | 17 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. 18 | 19 | 20 | 21 | 22 | A list of (.NET Core) runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks 23 | 24 | 25 | 26 | 27 | A list of (.NET Core) runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. 28 | 29 | 30 | 31 | 32 | A list of unmanaged 32 bit assembly names to include, delimited with line breaks. 33 | 34 | 35 | 36 | 37 | A list of unmanaged 64 bit assembly names to include, delimited with line breaks. 38 | 39 | 40 | 41 | 42 | The order of preloaded assemblies, delimited with line breaks. 43 | 44 | 45 | 46 | 47 | 48 | This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. 49 | 50 | 51 | 52 | 53 | Controls if .pdbs for reference assemblies are also embedded. 54 | 55 | 56 | 57 | 58 | Controls if (.NET Core) runtime assemblies are also embedded. 59 | 60 | 61 | 62 | 63 | Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. 64 | 65 | 66 | 67 | 68 | As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. 69 | 70 | 71 | 72 | 73 | Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. 74 | 75 | 76 | 77 | 78 | Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. 79 | 80 | 81 | 82 | 83 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | 84 | 85 | 86 | 87 | 88 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. 89 | 90 | 91 | 92 | 93 | A list of (.NET Core) runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | 94 | 95 | 96 | 97 | 98 | A list of (.NET Core) runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. 99 | 100 | 101 | 102 | 103 | A list of unmanaged 32 bit assembly names to include, delimited with |. 104 | 105 | 106 | 107 | 108 | A list of unmanaged 64 bit assembly names to include, delimited with |. 109 | 110 | 111 | 112 | 113 | The order of preloaded assemblies, delimited with |. 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. 122 | 123 | 124 | 125 | 126 | A comma-separated list of error codes that can be safely ignored in assembly verification. 127 | 128 | 129 | 130 | 131 | 'false' to turn off automatic generation of the XML Schema file. 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /GensConfigTool/Handlers/ConfigurationHandler.cs: -------------------------------------------------------------------------------- 1 | using ConfigurationTool.Model; 2 | using ConfigurationTool.Model.Configurations; 3 | 4 | namespace ConfigurationTool.Handlers 5 | { 6 | class ConfigurationHandler 7 | { 8 | private readonly IConfiguration RegistryConfiguration; 9 | private readonly IConfiguration GraphicsConfiguration; 10 | private readonly IConfiguration AudioConfiguration; 11 | private readonly IConfiguration AnalyticsConfiguration; 12 | private readonly IConfiguration InputConfiguration; 13 | 14 | public ConfigurationHandler() 15 | { 16 | RegistryConfiguration = new RegistryConfiguration(); 17 | GraphicsConfiguration = new GraphicsConfiguration(); 18 | AudioConfiguration = new AudioConfiguration(); 19 | AnalyticsConfiguration = new AnalyticsConfiguration(); 20 | InputConfiguration = new InputConfiguration(); 21 | } 22 | 23 | public Configuration LoadConfiguration() 24 | { 25 | Configuration config = new Configuration(); 26 | 27 | RegistryConfiguration.LoadConfiguration(config); 28 | GraphicsConfiguration.LoadConfiguration(config); 29 | AudioConfiguration.LoadConfiguration(config); 30 | AnalyticsConfiguration.LoadConfiguration(config); 31 | InputConfiguration.LoadConfiguration(config); 32 | 33 | return config; 34 | } 35 | 36 | public bool SaveConfiguration(Configuration config) 37 | { 38 | try 39 | { 40 | RegistryConfiguration.SaveConfiguration(config); 41 | GraphicsConfiguration.SaveConfiguration(config); 42 | AudioConfiguration.SaveConfiguration(config); 43 | AnalyticsConfiguration.SaveConfiguration(config); 44 | InputConfiguration.SaveConfiguration(config); 45 | } 46 | catch 47 | { 48 | return false; 49 | } 50 | return true; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /GensConfigTool/Handlers/DevicesHandler.cs: -------------------------------------------------------------------------------- 1 | using ConfigurationTool.Helpers; 2 | using ConfigurationTool.Model.Devices; 3 | using ConfigurationTool.Model.Settings; 4 | using ConfigurationTool.Settings.Model; 5 | using SharpDX.Direct3D9; 6 | using SharpDX.DirectSound; 7 | using System.Collections.Generic; 8 | using System.Runtime.InteropServices; 9 | using static ConfigurationTool.Helpers.GraphicsDeviceTypes; 10 | 11 | namespace ConfigurationTool.Handlers 12 | { 13 | class DevicesHandler 14 | { 15 | public static List GetGraphicsAdapters() 16 | { 17 | List toReturn = new List(); 18 | 19 | Direct3D d3d = new Direct3D(); 20 | foreach (AdapterInformation adapter in d3d.Adapters) 21 | { 22 | GraphicsAdapter currAdapter = new GraphicsAdapter() 23 | { 24 | Name = adapter.Details.DeviceName, 25 | Description = adapter.Details.Description, 26 | GUID = adapter.Details.DeviceIdentifier.ToString(), 27 | Index = adapter.Adapter 28 | }; 29 | 30 | // Get the monitor ID 31 | var monitor = new DISPLAYDEV(); 32 | monitor.cb = Marshal.SizeOf(monitor); 33 | EnumDisplayDevices(currAdapter.Name, 0, ref monitor, 0); 34 | 35 | if (!string.IsNullOrEmpty(monitor.DeviceName)) 36 | { 37 | currAdapter.MonitorID = monitor.DeviceID; 38 | } 39 | 40 | toReturn.InsertElementAscending(currAdapter); 41 | 42 | foreach (SharpDX.Direct3D9.DisplayMode mode in adapter.GetDisplayModes(adapter.CurrentDisplayMode.Format)) 43 | { 44 | Resolution res = new Resolution() 45 | { 46 | Width = mode.Width, 47 | Height = mode.Height 48 | }; 49 | RefreshRate refreshRate = new RefreshRate(mode.RefreshRate); 50 | 51 | int idx = currAdapter.Resolutions.IndexOf(res); 52 | if (idx >= 0) 53 | { 54 | currAdapter.Resolutions[idx].RefreshRates.InsertElementDescending(refreshRate); 55 | } 56 | else 57 | { 58 | res.RefreshRates.Add(refreshRate); 59 | currAdapter.Resolutions.InsertElementDescending(res); 60 | } 61 | } 62 | } 63 | 64 | return toReturn; 65 | } 66 | 67 | public static IEnumerable GetAudioDevices() 68 | { 69 | List toReturn = new List 70 | { 71 | new AudioDevice(), 72 | new AudioDevice() 73 | { 74 | Name = "None", 75 | GUID = "00000000-0000-0000-0000-000000000000" 76 | } 77 | }; 78 | foreach (DeviceInformation device in DirectSound.GetDevices()) 79 | { 80 | AudioDevice toAdd = new AudioDevice() 81 | { 82 | Name = device.Description, 83 | GUID = device.DriverGuid.ToString() 84 | }; 85 | 86 | // Ignore repeated devices (will also skip default output due to having the same GUID as None) 87 | if (!toReturn.Contains(toAdd)) 88 | { 89 | toReturn.Add(toAdd); 90 | } 91 | } 92 | return toReturn; 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /GensConfigTool/Handlers/NvidiaHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ConfigurationTool.Handlers 4 | { 5 | class NvidiaHandler 6 | { 7 | [System.Runtime.InteropServices.DllImport("nvapi64.dll", EntryPoint = "fake")] 8 | static extern int LoadNvApi64(); 9 | 10 | [System.Runtime.InteropServices.DllImport("nvapi.dll", EntryPoint = "fake")] 11 | static extern int LoadNvApi32(); 12 | 13 | public static void InitializeDedicatedGraphics() 14 | { 15 | try 16 | { 17 | if (Environment.Is64BitProcess) 18 | LoadNvApi64(); 19 | else 20 | LoadNvApi32(); 21 | } 22 | catch { } // will always fail since 'fake' entry point doesn't exists 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /GensConfigTool/Handlers/RegistryHandler.cs: -------------------------------------------------------------------------------- 1 | using ConfigurationTool.Model.Configurations; 2 | using ConfigurationTool.Model.Settings; 3 | using Microsoft.Win32; 4 | 5 | namespace ConfigurationTool.Handlers 6 | { 7 | class RegistryHandler 8 | { 9 | public static void FixRegistry(int fixtype) 10 | { 11 | RegistryKey registryKey = null; 12 | bool fixAll = false; 13 | 14 | switch (fixtype) 15 | { 16 | case -1: 17 | registryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).CreateSubKey(RegistryConfiguration.ConfigLocation); 18 | fixAll = true; 19 | goto case 1; 20 | case 1: 21 | registryKey = registryKey ?? RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(RegistryConfiguration.ConfigLocation, true); 22 | registryKey.SetValue(RegistryConfiguration.REGDATA_LOCALE, ((int)Language.English).ToString()); 23 | if (fixAll) goto case 2; 24 | break; 25 | case 2: 26 | registryKey = registryKey ?? RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(RegistryConfiguration.ConfigLocation, true); 27 | registryKey.SetValue(RegistryConfiguration.REGDATA_SAVELOCATION, "My Games\\Sonic Generations\\Saved Games"); 28 | break; 29 | } 30 | registryKey?.Close(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /GensConfigTool/Helpers/EnumOrder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace ConfigurationTool.Helpers 5 | { 6 | public class EnumOrder where TEnum : struct 7 | { 8 | public static readonly TEnum[] Values; 9 | 10 | static EnumOrder() 11 | { 12 | var fields = typeof(TEnum).GetFields(BindingFlags.Static | BindingFlags.Public); 13 | Values = Array.ConvertAll(fields, x => (TEnum)x.GetValue(null)); 14 | } 15 | 16 | public static int IndexOf(TEnum value) 17 | { 18 | return Array.IndexOf(Values, value); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /GensConfigTool/Helpers/Extensions.cs: -------------------------------------------------------------------------------- 1 | using ConfigurationTool.Model.Settings; 2 | using SharpDX.DirectInput; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Windows; 6 | 7 | namespace ConfigurationTool.Helpers 8 | { 9 | public static class Extensions 10 | { 11 | // Key extensions 12 | public static string GetStringValue(this Key value) 13 | { 14 | switch ((int)value) 15 | { 16 | case -1: 17 | return Application.Current.TryFindResource("Null").ToString(); 18 | case 0: 19 | return Application.Current.TryFindResource("Undefined").ToString(); 20 | default: 21 | return value.ToString(); 22 | } 23 | } 24 | 25 | public static void InsertElementDescending(this List source, 26 | T toAdd) where T : IComparable 27 | { 28 | int index = source.FindLastIndex(elem => elem.CompareTo(toAdd) > 0); 29 | source.Insert(index + 1, toAdd); 30 | } 31 | 32 | public static void InsertElementAscending(this List source, 33 | T toAdd) where T : IComparable 34 | { 35 | int index = source.FindIndex(elem => elem.CompareTo(toAdd) < 0); 36 | source.Insert(index + 1, toAdd); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /GensConfigTool/Helpers/GraphicsDeviceTypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace ConfigurationTool.Helpers 5 | { 6 | public class GraphicsDeviceTypes 7 | { 8 | [DllImport("user32.dll", CharSet = CharSet.Unicode)] 9 | public static extern bool EnumDisplayDevices(string lpDevice, uint iDevNum, ref DISPLAYDEV lpDisplayDevice, uint dwFlags); 10 | 11 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] 12 | public struct DISPLAYDEV 13 | { 14 | [MarshalAs(UnmanagedType.U4)] 15 | public int cb; 16 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] 17 | public string DeviceName; 18 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] 19 | public string DeviceString; 20 | [MarshalAs(UnmanagedType.U4)] 21 | public DisplayDeviceStateFlags StateFlags; 22 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] 23 | public string DeviceID; 24 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] 25 | public string DeviceKey; 26 | } 27 | 28 | [StructLayout(LayoutKind.Sequential)] 29 | public struct DeviceMode 30 | { 31 | private const int CCHDEVICENAME = 0x20; 32 | private const int CCHFORMNAME = 0x20; 33 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)] 34 | public string dmDeviceName; 35 | public short dmSpecVersion; 36 | public short dmDriverVersion; 37 | public short dmSize; 38 | public short dmDriverExtra; 39 | public int dmFields; 40 | public int dmPositionX; 41 | public int dmPositionY; 42 | public int dmDisplayOrientation; 43 | public int dmDisplayFixedOutput; 44 | public short dmColor; 45 | public short dmDuplex; 46 | public short dmYResolution; 47 | public short dmTTOption; 48 | public short dmCollate; 49 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)] 50 | public string dmFormName; 51 | public short dmLogPixels; 52 | public int dmBitsPerPel; 53 | public int dmPelsWidth; 54 | public int dmPelsHeight; 55 | public int dmDisplayFlags; 56 | public int dmDisplayFrequency; 57 | public int dmICMMethod; 58 | public int dmICMIntent; 59 | public int dmMediaType; 60 | public int dmDitherType; 61 | public int dmReserved1; 62 | public int dmReserved2; 63 | public int dmPanningWidth; 64 | public int dmPanningHeight; 65 | } 66 | 67 | [Flags()] 68 | public enum DisplayDeviceStateFlags : int 69 | { 70 | /// The device is part of the desktop. 71 | AttachedToDesktop = 0x1, 72 | MultiDriver = 0x2, 73 | /// The device is part of the desktop. 74 | PrimaryDevice = 0x4, 75 | /// Represents a pseudo device used to mirror application drawing for remoting or other purposes. 76 | MirroringDriver = 0x8, 77 | /// The device is VGA compatible. 78 | VGACompatible = 0x10, 79 | /// The device is removable; it cannot be the primary display. 80 | Removable = 0x20, 81 | /// The device has more display modes than its output devices support. 82 | ModesPruned = 0x8000000, 83 | Remote = 0x4000000, 84 | Disconnect = 0x2000000 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /GensConfigTool/Helpers/ThemeHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Win32; 2 | using System; 3 | using System.Globalization; 4 | using System.Management; 5 | using System.Security.Principal; 6 | 7 | namespace ConfigurationTool.Helpers 8 | { 9 | class ThemeHelper 10 | { 11 | private const string RegistryKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"; 12 | private const string RegistryValueName = "AppsUseLightTheme"; 13 | private readonly string Query = String.Format( 14 | CultureInfo.InvariantCulture, 15 | @"SELECT * FROM RegistryValueChangeEvent WHERE Hive = 'HKEY_USERS' AND KeyPath = '{0}\\{1}' AND ValueName = '{2}'", 16 | WindowsIdentity.GetCurrent().User.Value, 17 | RegistryKeyPath.Replace(@"\", @"\\"), 18 | RegistryValueName); 19 | 20 | public enum WindowsTheme 21 | { Light, Dark } 22 | 23 | private readonly Action ThemeListener; 24 | 25 | public ThemeHelper(Action themeListener) 26 | { 27 | this.ThemeListener = themeListener; 28 | } 29 | 30 | public void WatchTheme() 31 | { 32 | try 33 | { 34 | var watcher = new ManagementEventWatcher(Query); 35 | 36 | watcher.EventArrived += (sender, args) => 37 | { 38 | ThemeListener(GetWindowsTheme()); 39 | }; 40 | 41 | watcher.Start(); 42 | } 43 | catch {} 44 | 45 | ThemeListener(GetWindowsTheme()); 46 | } 47 | 48 | private static WindowsTheme GetWindowsTheme() 49 | { 50 | using (RegistryKey key = Registry.CurrentUser.OpenSubKey(RegistryKeyPath)) 51 | { 52 | object registryValueObject = key?.GetValue(RegistryValueName); 53 | if (registryValueObject == null) 54 | { 55 | return WindowsTheme.Light; 56 | } 57 | 58 | int registryValue = (int)registryValueObject; 59 | 60 | return registryValue > 0 ? WindowsTheme.Light : WindowsTheme.Dark; 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /GensConfigTool/Helpers/UacHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Drawing; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | using System.Windows.Media.Imaging; 7 | 8 | namespace ConfigurationTool.Helpers 9 | { 10 | class UacHelper 11 | { 12 | [DllImport("Shell32.dll", SetLastError = false)] 13 | public static extern Int32 SHGetStockIconInfo(SHSTOCKICONID siid, SHGSI uFlags, ref SHSTOCKICONINFO psii); 14 | 15 | [DllImport("user32.dll", SetLastError = true)] 16 | static extern bool DestroyIcon(IntPtr hIcon); 17 | 18 | [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 19 | public struct SHSTOCKICONINFO 20 | { 21 | public UInt32 cbSize; 22 | public IntPtr hIcon; 23 | public Int32 iSysIconIndex; 24 | public Int32 iIcon; 25 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] 26 | public string szPath; 27 | } 28 | 29 | [Flags] 30 | public enum SHGSI : uint 31 | { 32 | SHGSI_ICONLOCATION = 0, 33 | SHGSI_ICON = 0x000000100, 34 | SHGSI_SYSICONINDEX = 0x000004000, 35 | SHGSI_LINKOVERLAY = 0x000008000, 36 | SHGSI_SELECTED = 0x000010000, 37 | SHGSI_LARGEICON = 0x000000000, 38 | SHGSI_SMALLICON = 0x000000001, 39 | SHGSI_SHELLICONSIZE = 0x000000004 40 | } 41 | 42 | public enum SHSTOCKICONID : uint 43 | { 44 | SIID_DOCNOASSOC = 0, 45 | SIID_DOCASSOC = 1, 46 | SIID_APPLICATION = 2, 47 | SIID_FOLDER = 3, 48 | SIID_FOLDEROPEN = 4, 49 | SIID_DRIVE525 = 5, 50 | SIID_DRIVE35 = 6, 51 | SIID_DRIVEREMOVE = 7, 52 | SIID_DRIVEFIXED = 8, 53 | SIID_DRIVENET = 9, 54 | SIID_DRIVENETDISABLED = 10, 55 | SIID_DRIVECD = 11, 56 | SIID_DRIVERAM = 12, 57 | SIID_WORLD = 13, 58 | SIID_SERVER = 15, 59 | SIID_PRINTER = 16, 60 | SIID_MYNETWORK = 17, 61 | SIID_FIND = 22, 62 | SIID_HELP = 23, 63 | SIID_SHARE = 28, 64 | SIID_LINK = 29, 65 | SIID_SLOWFILE = 30, 66 | SIID_RECYCLER = 31, 67 | SIID_RECYCLERFULL = 32, 68 | SIID_MEDIACDAUDIO = 40, 69 | SIID_LOCK = 47, 70 | SIID_AUTOLIST = 49, 71 | SIID_PRINTERNET = 50, 72 | SIID_SERVERSHARE = 51, 73 | SIID_PRINTERFAX = 52, 74 | SIID_PRINTERFAXNET = 53, 75 | SIID_PRINTERFILE = 54, 76 | SIID_STACK = 55, 77 | SIID_MEDIASVCD = 56, 78 | SIID_STUFFEDFOLDER = 57, 79 | SIID_DRIVEUNKNOWN = 58, 80 | SIID_DRIVEDVD = 59, 81 | SIID_MEDIADVD = 60, 82 | SIID_MEDIADVDRAM = 61, 83 | SIID_MEDIADVDRW = 62, 84 | SIID_MEDIADVDR = 63, 85 | SIID_MEDIADVDROM = 64, 86 | SIID_MEDIACDAUDIOPLUS = 65, 87 | SIID_MEDIACDRW = 66, 88 | SIID_MEDIACDR = 67, 89 | SIID_MEDIACDBURN = 68, 90 | SIID_MEDIABLANKCD = 69, 91 | SIID_MEDIACDROM = 70, 92 | SIID_AUDIOFILES = 71, 93 | SIID_IMAGEFILES = 72, 94 | SIID_VIDEOFILES = 73, 95 | SIID_MIXEDFILES = 74, 96 | SIID_FOLDERBACK = 75, 97 | SIID_FOLDERFRONT = 76, 98 | SIID_SHIELD = 77, 99 | SIID_WARNING = 78, 100 | SIID_INFO = 79, 101 | SIID_ERROR = 80, 102 | SIID_KEY = 81, 103 | SIID_SOFTWARE = 82, 104 | SIID_RENAME = 83, 105 | SIID_DELETE = 84, 106 | SIID_MEDIAAUDIODVD = 85, 107 | SIID_MEDIAMOVIEDVD = 86, 108 | SIID_MEDIAENHANCEDCD = 87, 109 | SIID_MEDIAENHANCEDDVD = 88, 110 | SIID_MEDIAHDDVD = 89, 111 | SIID_MEDIABLURAY = 90, 112 | SIID_MEDIAVCD = 91, 113 | SIID_MEDIADVDPLUSR = 92, 114 | SIID_MEDIADVDPLUSRW = 93, 115 | SIID_DESKTOPPC = 94, 116 | SIID_MOBILEPC = 95, 117 | SIID_USERS = 96, 118 | SIID_MEDIASMARTMEDIA = 97, 119 | SIID_MEDIACOMPACTFLASH = 98, 120 | SIID_DEVICECELLPHONE = 99, 121 | SIID_DEVICECAMERA = 100, 122 | SIID_DEVICEVIDEOCAMERA = 101, 123 | SIID_DEVICEAUDIOPLAYER = 102, 124 | SIID_NETWORKCONNECT = 103, 125 | SIID_INTERNET = 104, 126 | SIID_ZIPFILE = 105, 127 | SIID_SETTINGS = 106, 128 | SIID_DRIVEHDDVD = 132, 129 | SIID_DRIVEBD = 133, 130 | SIID_MEDIAHDDVDROM = 134, 131 | SIID_MEDIAHDDVDR = 135, 132 | SIID_MEDIAHDDVDRAM = 136, 133 | SIID_MEDIABDROM = 137, 134 | SIID_MEDIABDR = 138, 135 | SIID_MEDIABDRE = 139, 136 | SIID_CLUSTEREDDRIVE = 140, 137 | SIID_MAX_ICONS = 175 138 | } 139 | 140 | public static BitmapSource GetUacIcon() 141 | { 142 | BitmapSource shieldSource = null; 143 | 144 | if (Environment.OSVersion.Version.Major >= 6) 145 | { 146 | SHSTOCKICONINFO sii = new SHSTOCKICONINFO(); 147 | sii.cbSize = (UInt32)Marshal.SizeOf(typeof(SHSTOCKICONINFO)); 148 | 149 | Marshal.ThrowExceptionForHR(SHGetStockIconInfo(SHSTOCKICONID.SIID_SHIELD, 150 | SHGSI.SHGSI_ICON | SHGSI.SHGSI_SMALLICON, 151 | ref sii)); 152 | 153 | shieldSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon( 154 | sii.hIcon, 155 | Int32Rect.Empty, 156 | BitmapSizeOptions.FromEmptyOptions()); 157 | 158 | DestroyIcon(sii.hIcon); 159 | } 160 | else 161 | { 162 | shieldSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon( 163 | SystemIcons.Shield.Handle, 164 | Int32Rect.Empty, 165 | BitmapSizeOptions.FromEmptyOptions()); 166 | } 167 | 168 | return shieldSource; 169 | } 170 | 171 | public static void RestartAsAdmin(string args = null) 172 | { 173 | var psi = new ProcessStartInfo 174 | { 175 | UseShellExecute = true, 176 | FileName = Process.GetCurrentProcess().MainModule.FileName, 177 | Verb = "runas" 178 | }; 179 | if (args != null) psi.Arguments = args; 180 | 181 | var process = new Process 182 | { 183 | StartInfo = psi 184 | }; 185 | try 186 | { 187 | process.Start(); 188 | Application.Current.Shutdown(); 189 | } 190 | catch 191 | { 192 | 193 | } 194 | } 195 | 196 | public static void RestartAsAdminAndWait(string args = null) 197 | { 198 | var psi = new ProcessStartInfo 199 | { 200 | UseShellExecute = true, 201 | FileName = Process.GetCurrentProcess().MainModule.FileName, 202 | Verb = "runas" 203 | }; 204 | if (args != null) psi.Arguments = args; 205 | 206 | var process = new Process 207 | { 208 | StartInfo = psi 209 | }; 210 | try 211 | { 212 | process.Start(); 213 | process.WaitForExit(); 214 | } 215 | catch 216 | { 217 | 218 | } 219 | } 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /GensConfigTool/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 |