├── README.md ├── SMUC ├── SMUC │ ├── App.config │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SMUC.csproj │ └── Program.cs └── SMUC.sln ├── LICENSE.md └── .gitignore /README.md: -------------------------------------------------------------------------------- 1 | ## Replaced by [smuc_rs](https://github.com/LeagueRaINi/smuc_rs) 2 | 3 | > Zen2 SMU checker 4 | > ![InAction](https://i.imgur.com/Fbs9iRL.png) 5 | -------------------------------------------------------------------------------- /SMUC/SMUC/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2019 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /SMUC/SMUC.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29324.140 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SMUC", "SMUC\SMUC.csproj", "{33D3166C-453F-4DD1-BB93-1E188CFB1572}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {33D3166C-453F-4DD1-BB93-1E188CFB1572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {33D3166C-453F-4DD1-BB93-1E188CFB1572}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {33D3166C-453F-4DD1-BB93-1E188CFB1572}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {33D3166C-453F-4DD1-BB93-1E188CFB1572}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {800307E9-013A-4FFB-A2AA-4299E021D1C9} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /SMUC/SMUC/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SMUC")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SMUC")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("33d3166c-453f-4dd1-bb93-1e188cfb1572")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SMUC/SMUC/SMUC.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {33D3166C-453F-4DD1-BB93-1E188CFB1572} 8 | Exe 9 | SMUC 10 | SMUC 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /SMUC/SMUC/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.IO.Compression; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace SMUC 9 | { 10 | class Program 11 | { 12 | static readonly string[] zipFileBlacklist = 13 | { 14 | "/", 15 | ".txt", 16 | ".ini", 17 | ".bat", 18 | ".exe" 19 | }; 20 | 21 | static void Main(string[] args) 22 | { 23 | Console.Title = "Zen2 SMU Checker"; 24 | 25 | Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); 26 | 27 | if (args.Length == 0) 28 | { 29 | return; 30 | } 31 | 32 | foreach(var arg in args) 33 | { 34 | if (!File.Exists(arg)) 35 | { 36 | continue; 37 | } 38 | 39 | string biosName = null; 40 | byte[] biosBytes = null; 41 | 42 | if (arg.EndsWith(".zip")) 43 | { 44 | using (var zipArchive = ZipFile.OpenRead(arg)) 45 | { 46 | foreach(var zipEntry in zipArchive.Entries) 47 | { 48 | if (string.IsNullOrEmpty(zipEntry.Name) || zipFileBlacklist.Any(x => zipEntry.Name.EndsWith(x))) 49 | { 50 | continue; 51 | } 52 | 53 | biosName = zipEntry.Name; 54 | 55 | using (var byteStream = zipEntry.Open()) 56 | using (var memStream = new MemoryStream()) 57 | { 58 | byteStream.CopyTo(memStream); 59 | biosBytes = memStream.ToArray(); 60 | } 61 | break; 62 | } 63 | } 64 | 65 | if (biosName is null || biosBytes is null) 66 | { 67 | Log($"Could not retrieve bios from {arg}\n", ConsoleColor.DarkRed); 68 | continue; 69 | } 70 | } 71 | else 72 | { 73 | biosName = Path.GetFileName(arg); 74 | biosBytes = File.ReadAllBytes(arg); 75 | } 76 | 77 | Log($"Scanning: {biosName} ({BytesToKB(biosBytes.Length).ToString("N0")} KB)", newLine: false); 78 | 79 | var agesaVersion = SearchPattern(biosBytes, "3D 9B 25 70 41 47 45 53 41", 0xD) 80 | .FirstOrDefault(); 81 | if (agesaVersion != 0) 82 | { 83 | var buf = new byte[255]; 84 | Array.Copy(biosBytes, agesaVersion, buf, 0, buf.Length); 85 | 86 | var versionStr = Encoding.UTF8.GetString(buf); 87 | if (versionStr.Contains('\0')) 88 | { 89 | versionStr = versionStr.Substring(0, versionStr.IndexOf('\0')); 90 | } 91 | 92 | Log($" {versionStr}"); 93 | } 94 | else 95 | { 96 | Console.Write(Environment.NewLine); 97 | } 98 | 99 | var smuMods = SearchPattern(biosBytes, "24 50 53 31 00 00", -0x10); 100 | if (smuMods.Any()) 101 | { 102 | foreach (var smuOffset in smuMods) 103 | { 104 | var smuLen = BitConverter.ToInt32(biosBytes, smuOffset + 0x6C); 105 | var smuVer = $"{biosBytes[smuOffset + 0x62]}.{biosBytes[smuOffset + 0x61]}.{biosBytes[smuOffset + 0x60]}"; 106 | 107 | Log($" {smuVer} ({BytesToKB(smuLen).ToString("N0").PadLeft(3, ' ')} KB) " + 108 | $"[{smuOffset.ToString("X").PadLeft(8, '0')} - {(smuOffset + smuLen).ToString("X").PadLeft(8, '0')}]", ConsoleColor.DarkGreen); 109 | } 110 | } 111 | else 112 | { 113 | Log("Could not find any smu modules", ConsoleColor.DarkRed); 114 | } 115 | 116 | Console.Write(Environment.NewLine); 117 | } 118 | 119 | Log("Done.", wait: true); 120 | } 121 | 122 | static double BytesToKB(int bytes) 123 | { 124 | return bytes / 1024d; 125 | } 126 | 127 | static void Log(string message, ConsoleColor color = ConsoleColor.White, bool newLine = true, bool wait = false) 128 | { 129 | Console.ForegroundColor = color; 130 | Console.Write(newLine ? message + Environment.NewLine : message); 131 | Console.ResetColor(); 132 | 133 | if (wait) 134 | { 135 | Console.ReadLine(); 136 | } 137 | } 138 | 139 | static int[] CreateMatchingsTable((byte, bool)[] patternTuple) 140 | { 141 | var skipTable = new int[256]; 142 | var wildcards = patternTuple.Select(x => x.Item2).ToArray(); 143 | var lastIndex = patternTuple.Length - 1; 144 | 145 | var diff = lastIndex - Math.Max(Array.LastIndexOf(wildcards, false), 0); 146 | if (diff == 0) 147 | { 148 | diff = 1; 149 | } 150 | 151 | for (var i = 0; i < skipTable.Length; i++) 152 | { 153 | skipTable[i] = diff; 154 | } 155 | 156 | for (var i = lastIndex - diff; i < lastIndex; i++) 157 | { 158 | skipTable[patternTuple[i].Item1] = lastIndex - i; 159 | } 160 | 161 | return skipTable; 162 | } 163 | 164 | static List SearchPattern(byte[] data, string pattern, int offset = 0x0) 165 | { 166 | if (!data.Any() || string.IsNullOrEmpty(pattern)) 167 | { 168 | throw new ArgumentException("Data or Pattern is empty"); 169 | } 170 | 171 | var patternTuple = pattern.Split(' ') 172 | .Select(hex => hex.Contains('?') 173 | ? (byte.MinValue, false) 174 | : (Convert.ToByte(hex, 16), true)) 175 | .ToArray(); 176 | 177 | if (!patternTuple.Any()) 178 | { 179 | throw new Exception("Failed to parse Pattern"); 180 | } 181 | 182 | if (data.Length < pattern.Length) 183 | { 184 | throw new ArgumentException("Data cannot be smaller than the Pattern"); 185 | } 186 | 187 | var lastPatternIndex = patternTuple.Length - 1; 188 | var skipTable = CreateMatchingsTable(patternTuple); 189 | var adressList = new List(); 190 | 191 | for (var i = 0; i <= data.Length - patternTuple.Length; i += Math.Max(skipTable[data[i + lastPatternIndex] & 0xFF], 1)) 192 | { 193 | for (var j = lastPatternIndex; !patternTuple[j].Item2 || data[i + j] == patternTuple[j].Item1; --j) 194 | { 195 | if (j == 0) 196 | { 197 | adressList.Add(i + offset); 198 | break; 199 | } 200 | } 201 | } 202 | 203 | return adressList; 204 | } 205 | } 206 | } 207 | -------------------------------------------------------------------------------- /.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 | 33 | # Visual Studio 2015/2017 cache/options directory 34 | .vs/ 35 | # Uncomment if you have tasks that create the project's static files in wwwroot 36 | #wwwroot/ 37 | 38 | # Visual Studio 2017 auto generated files 39 | Generated\ Files/ 40 | 41 | # MSTest test Results 42 | [Tt]est[Rr]esult*/ 43 | [Bb]uild[Ll]og.* 44 | 45 | # NUnit 46 | *.VisualState.xml 47 | TestResult.xml 48 | nunit-*.xml 49 | 50 | # Build Results of an ATL Project 51 | [Dd]ebugPS/ 52 | [Rr]eleasePS/ 53 | dlldata.c 54 | 55 | # Benchmark Results 56 | BenchmarkDotNet.Artifacts/ 57 | 58 | # .NET Core 59 | project.lock.json 60 | project.fragment.lock.json 61 | artifacts/ 62 | 63 | # StyleCop 64 | StyleCopReport.xml 65 | 66 | # Files built by Visual Studio 67 | *_i.c 68 | *_p.c 69 | *_h.h 70 | *.ilk 71 | *.meta 72 | *.obj 73 | *.iobj 74 | *.pch 75 | *.pdb 76 | *.ipdb 77 | *.pgc 78 | *.pgd 79 | *.rsp 80 | *.sbr 81 | *.tlb 82 | *.tli 83 | *.tlh 84 | *.tmp 85 | *.tmp_proj 86 | *_wpftmp.csproj 87 | *.log 88 | *.vspscc 89 | *.vssscc 90 | .builds 91 | *.pidb 92 | *.svclog 93 | *.scc 94 | 95 | # Chutzpah Test files 96 | _Chutzpah* 97 | 98 | # Visual C++ cache files 99 | ipch/ 100 | *.aps 101 | *.ncb 102 | *.opendb 103 | *.opensdf 104 | *.sdf 105 | *.cachefile 106 | *.VC.db 107 | *.VC.VC.opendb 108 | 109 | # Visual Studio profiler 110 | *.psess 111 | *.vsp 112 | *.vspx 113 | *.sap 114 | 115 | # Visual Studio Trace Files 116 | *.e2e 117 | 118 | # TFS 2012 Local Workspace 119 | $tf/ 120 | 121 | # Guidance Automation Toolkit 122 | *.gpState 123 | 124 | # ReSharper is a .NET coding add-in 125 | _ReSharper*/ 126 | *.[Rr]e[Ss]harper 127 | *.DotSettings.user 128 | 129 | # JustCode is a .NET coding add-in 130 | .JustCode 131 | 132 | # TeamCity is a build add-in 133 | _TeamCity* 134 | 135 | # DotCover is a Code Coverage Tool 136 | *.dotCover 137 | 138 | # AxoCover is a Code Coverage Tool 139 | .axoCover/* 140 | !.axoCover/settings.json 141 | 142 | # Visual Studio code coverage results 143 | *.coverage 144 | *.coveragexml 145 | 146 | # NCrunch 147 | _NCrunch_* 148 | .*crunch*.local.xml 149 | nCrunchTemp_* 150 | 151 | # MightyMoose 152 | *.mm.* 153 | AutoTest.Net/ 154 | 155 | # Web workbench (sass) 156 | .sass-cache/ 157 | 158 | # Installshield output folder 159 | [Ee]xpress/ 160 | 161 | # DocProject is a documentation generator add-in 162 | DocProject/buildhelp/ 163 | DocProject/Help/*.HxT 164 | DocProject/Help/*.HxC 165 | DocProject/Help/*.hhc 166 | DocProject/Help/*.hhk 167 | DocProject/Help/*.hhp 168 | DocProject/Help/Html2 169 | DocProject/Help/html 170 | 171 | # Click-Once directory 172 | publish/ 173 | 174 | # Publish Web Output 175 | *.[Pp]ublish.xml 176 | *.azurePubxml 177 | # Note: Comment the next line if you want to checkin your web deploy settings, 178 | # but database connection strings (with potential passwords) will be unencrypted 179 | *.pubxml 180 | *.publishproj 181 | 182 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 183 | # checkin your Azure Web App publish settings, but sensitive information contained 184 | # in these scripts will be unencrypted 185 | PublishScripts/ 186 | 187 | # NuGet Packages 188 | *.nupkg 189 | # NuGet Symbol Packages 190 | *.snupkg 191 | # The packages folder can be ignored because of Package Restore 192 | **/[Pp]ackages/* 193 | # except build/, which is used as an MSBuild target. 194 | !**/[Pp]ackages/build/ 195 | # Uncomment if necessary however generally it will be regenerated when needed 196 | #!**/[Pp]ackages/repositories.config 197 | # NuGet v3's project.json files produces more ignorable files 198 | *.nuget.props 199 | *.nuget.targets 200 | 201 | # Microsoft Azure Build Output 202 | csx/ 203 | *.build.csdef 204 | 205 | # Microsoft Azure Emulator 206 | ecf/ 207 | rcf/ 208 | 209 | # Windows Store app package directories and files 210 | AppPackages/ 211 | BundleArtifacts/ 212 | Package.StoreAssociation.xml 213 | _pkginfo.txt 214 | *.appx 215 | *.appxbundle 216 | *.appxupload 217 | 218 | # Visual Studio cache files 219 | # files ending in .cache can be ignored 220 | *.[Cc]ache 221 | # but keep track of directories ending in .cache 222 | !?*.[Cc]ache/ 223 | 224 | # Others 225 | ClientBin/ 226 | ~$* 227 | *~ 228 | *.dbmdl 229 | *.dbproj.schemaview 230 | *.jfm 231 | *.pfx 232 | *.publishsettings 233 | orleans.codegen.cs 234 | 235 | # Including strong name files can present a security risk 236 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 237 | #*.snk 238 | 239 | # Since there are multiple workflows, uncomment next line to ignore bower_components 240 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 241 | #bower_components/ 242 | 243 | # RIA/Silverlight projects 244 | Generated_Code/ 245 | 246 | # Backup & report files from converting an old project file 247 | # to a newer Visual Studio version. Backup files are not needed, 248 | # because we have git ;-) 249 | _UpgradeReport_Files/ 250 | Backup*/ 251 | UpgradeLog*.XML 252 | UpgradeLog*.htm 253 | ServiceFabricBackup/ 254 | *.rptproj.bak 255 | 256 | # SQL Server files 257 | *.mdf 258 | *.ldf 259 | *.ndf 260 | 261 | # Business Intelligence projects 262 | *.rdl.data 263 | *.bim.layout 264 | *.bim_*.settings 265 | *.rptproj.rsuser 266 | *- [Bb]ackup.rdl 267 | *- [Bb]ackup ([0-9]).rdl 268 | *- [Bb]ackup ([0-9][0-9]).rdl 269 | 270 | # Microsoft Fakes 271 | FakesAssemblies/ 272 | 273 | # GhostDoc plugin setting file 274 | *.GhostDoc.xml 275 | 276 | # Node.js Tools for Visual Studio 277 | .ntvs_analysis.dat 278 | node_modules/ 279 | 280 | # Visual Studio 6 build log 281 | *.plg 282 | 283 | # Visual Studio 6 workspace options file 284 | *.opt 285 | 286 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 287 | *.vbw 288 | 289 | # Visual Studio LightSwitch build output 290 | **/*.HTMLClient/GeneratedArtifacts 291 | **/*.DesktopClient/GeneratedArtifacts 292 | **/*.DesktopClient/ModelManifest.xml 293 | **/*.Server/GeneratedArtifacts 294 | **/*.Server/ModelManifest.xml 295 | _Pvt_Extensions 296 | 297 | # Paket dependency manager 298 | .paket/paket.exe 299 | paket-files/ 300 | 301 | # FAKE - F# Make 302 | .fake/ 303 | 304 | # CodeRush personal settings 305 | .cr/personal 306 | 307 | # Python Tools for Visual Studio (PTVS) 308 | __pycache__/ 309 | *.pyc 310 | 311 | # Cake - Uncomment if you are using it 312 | # tools/** 313 | # !tools/packages.config 314 | 315 | # Tabs Studio 316 | *.tss 317 | 318 | # Telerik's JustMock configuration file 319 | *.jmconfig 320 | 321 | # BizTalk build output 322 | *.btp.cs 323 | *.btm.cs 324 | *.odx.cs 325 | *.xsd.cs 326 | 327 | # OpenCover UI analysis results 328 | OpenCover/ 329 | 330 | # Azure Stream Analytics local run output 331 | ASALocalRun/ 332 | 333 | # MSBuild Binary and Structured Log 334 | *.binlog 335 | 336 | # NVidia Nsight GPU debugger configuration file 337 | *.nvuser 338 | 339 | # MFractors (Xamarin productivity tool) working folder 340 | .mfractor/ 341 | 342 | # Local History for Visual Studio 343 | .localhistory/ 344 | 345 | # BeatPulse healthcheck temp database 346 | healthchecksdb 347 | 348 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 349 | MigrationBackup/ 350 | --------------------------------------------------------------------------------