├── .gitattributes ├── .gitignore ├── README.md ├── Universal Inject Generator.sln ├── Universal Inject Generator ├── App.config ├── CheckFileSize.cs ├── EncCheck.cs ├── ExtractFiles.cs ├── FodyWeavers.xml ├── GenExeFS.cs ├── GenRomFs.cs ├── HexText.cs ├── MainForm.Designer.cs ├── MainForm.cs ├── MainForm.resx ├── MergeExh.cs ├── ProcessFiles.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── RebuildHS.cs ├── Resources │ ├── 3dstool.exe │ ├── MergeExHeader.exe │ ├── ctrtool.exe │ ├── dummy.bin │ ├── icon.ico │ ├── ignore_3dstool.txt │ └── loading.gif ├── Splash.Designer.cs ├── Splash.cs ├── Splash.resx ├── Syncfusion.Shared.Base.dll ├── Universal Inject Generator.csproj ├── Variables.cs └── packages.config └── packages ├── Costura.Fody.1.3.3.0 ├── Content │ ├── FodyWeavers.xml.install.xdt │ └── FodyWeavers.xml.uninstall.xdt ├── Costura.Fody.1.3.3.0.nupkg ├── Costura.Fody.dll └── Tools │ ├── commands.psm1 │ └── init.ps1 └── Fody.1.28.3 ├── Content └── FodyWeavers.xml ├── Fody.1.28.3.nupkg ├── Fody.dll ├── FodyCommon.dll ├── FodyIsolated.dll ├── Mono.Cecil.Mdb.dll ├── Mono.Cecil.Pdb.dll ├── Mono.Cecil.Rocks.dll ├── Mono.Cecil.dll ├── Tools ├── install.ps1 └── uninstall.ps1 └── build └── Fody.targets /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | #build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opensdf 80 | *.sdf 81 | *.cachefile 82 | 83 | # Visual Studio profiler 84 | *.psess 85 | *.vsp 86 | *.vspx 87 | *.sap 88 | 89 | # TFS 2012 Local Workspace 90 | $tf/ 91 | 92 | # Guidance Automation Toolkit 93 | *.gpState 94 | 95 | # ReSharper is a .NET coding add-in 96 | _ReSharper*/ 97 | *.[Rr]e[Ss]harper 98 | *.DotSettings.user 99 | 100 | # JustCode is a .NET coding add-in 101 | .JustCode 102 | 103 | # TeamCity is a build add-in 104 | _TeamCity* 105 | 106 | # DotCover is a Code Coverage Tool 107 | *.dotCover 108 | 109 | # NCrunch 110 | _NCrunch_* 111 | .*crunch*.local.xml 112 | nCrunchTemp_* 113 | 114 | # MightyMoose 115 | *.mm.* 116 | AutoTest.Net/ 117 | 118 | # Web workbench (sass) 119 | .sass-cache/ 120 | 121 | # Installshield output folder 122 | [Ee]xpress/ 123 | 124 | # DocProject is a documentation generator add-in 125 | DocProject/buildhelp/ 126 | DocProject/Help/*.HxT 127 | DocProject/Help/*.HxC 128 | DocProject/Help/*.hhc 129 | DocProject/Help/*.hhk 130 | DocProject/Help/*.hhp 131 | DocProject/Help/Html2 132 | DocProject/Help/html 133 | 134 | # Click-Once directory 135 | publish/ 136 | 137 | # Publish Web Output 138 | *.[Pp]ublish.xml 139 | *.azurePubxml 140 | # TODO: Comment the next line if you want to checkin your web deploy settings 141 | # but database connection strings (with potential passwords) will be unencrypted 142 | *.pubxml 143 | *.publishproj 144 | 145 | # NuGet Packages 146 | #*.nupkg 147 | # The packages folder can be ignored because of Package Restore 148 | #**/packages/* 149 | # except build/, which is used as an MSBuild target. 150 | #!**/packages/build/ 151 | # Uncomment if necessary however generally it will be regenerated when needed 152 | #!**/packages/repositories.config 153 | 154 | # Windows Azure Build Output 155 | csx/ 156 | *.build.csdef 157 | 158 | # Windows Store app package directory 159 | AppPackages/ 160 | 161 | # Visual Studio cache files 162 | # files ending in .cache can be ignored 163 | *.[Cc]ache 164 | # but keep track of directories ending in .cache 165 | !*.[Cc]ache/ 166 | 167 | # Others 168 | ClientBin/ 169 | [Ss]tyle[Cc]op.* 170 | ~$* 171 | *~ 172 | *.dbmdl 173 | *.dbproj.schemaview 174 | *.pfx 175 | *.publishsettings 176 | node_modules/ 177 | orleans.codegen.cs 178 | 179 | # RIA/Silverlight projects 180 | Generated_Code/ 181 | 182 | # Backup & report files from converting an old project file 183 | # to a newer Visual Studio version. Backup files are not needed, 184 | # because we have git ;-) 185 | _UpgradeReport_Files/ 186 | Backup*/ 187 | UpgradeLog*.XML 188 | UpgradeLog*.htm 189 | 190 | # SQL Server files 191 | *.mdf 192 | *.ldf 193 | 194 | # Business Intelligence projects 195 | *.rdl.data 196 | *.bim.layout 197 | *.bim_*.settings 198 | 199 | # Microsoft Fakes 200 | FakesAssemblies/ 201 | 202 | # Node.js Tools for Visual Studio 203 | .ntvs_analysis.dat 204 | 205 | # Visual Studio 6 build log 206 | *.plg 207 | 208 | # Visual Studio 6 workspace options file 209 | *.opt 210 | 211 | # Visual Studio LightSwitch build output 212 | **/*.HTMLClient/GeneratedArtifacts 213 | **/*.DesktopClient/GeneratedArtifacts 214 | **/*.DesktopClient/ModelManifest.xml 215 | **/*.Server/GeneratedArtifacts 216 | **/*.Server/ModelManifest.xml 217 | _Pvt_Extensions 218 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Universal Inject Generator - Csharp Edition 2 | Csharp version of https://github.com/d0k3/Universal-Inject-Generator 3 | 4 | **Currently a work in progress...** 5 | 6 | **Requires .NET framework 4.5 and Visual Studio to compile.** 7 | 8 | **This is written and built in Visual Studio 2015 Community Edition.** 9 | 10 | Uses standard winforms controls as well as Syncfusion.Shared.Base.dll (included here) from http://syncfusion.com/products/communitylicense (Essential Studio for Windows Forms) - current version i use is v13.4.0.53. 11 | 12 | --- 13 | 14 | This will generate inject-ready apps from homebrew CIAs to inject over the Health & Safety app in the 3DS console. The package includes code by MergeExheader (by @Syphurith), CTRtool (by profi200) and 3DStool (by dnasdw). 15 | 16 | This is used in conjunction with most recent (d0k3's) Decrypt9's "Dump Health&Safety" and "Inject Health&Safety" features. You can only inject .apps smaller or equal in size to the original H&S app. Decrypt9 has a safety check build in and won't proceed with bigger ones. Per CIA, two inject apps will be created - with and without banner - the one with a banner is preferable, but may be to large to inject. 17 | 18 | This is how it works: 19 | * Put hs.app (dumped via Decrypt9) plus a homebrew CIA of your choice into the folder next to this exe. (currently only supports single cia files) 20 | * Run Universal Inject Generator.exe, you'll get two inject-ready .app files. One with original banner and one with the inject app banner. 21 | * If the last one for some reason doesn't work, you may try deep-decrypting (via Decrypt9) your CIAs first. 22 | * To inject, rename inject-ready .app to hs.app, put it into the root of your 3DS SD card and inject via Decrypt9. 23 | 24 | You should always generate your inject-ready .apps yourself and never take ones from other persons. There might be a version mismatch in the H&S app, leading to it not working otherwise. 25 | 26 | Discuss this script here: http://gbatemp.net/threads/project-injecting-any-app-into-health-and-safety.401697/ 27 | -------------------------------------------------------------------------------- /Universal Inject Generator.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Universal Inject Generator", "Universal Inject Generator\Universal Inject Generator.csproj", "{4FA6A106-605B-4340-B576-E23661F647A3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {4FA6A106-605B-4340-B576-E23661F647A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {4FA6A106-605B-4340-B576-E23661F647A3}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {4FA6A106-605B-4340-B576-E23661F647A3}.Debug|x64.ActiveCfg = Debug|Any CPU 21 | {4FA6A106-605B-4340-B576-E23661F647A3}.Debug|x64.Build.0 = Debug|Any CPU 22 | {4FA6A106-605B-4340-B576-E23661F647A3}.Debug|x86.ActiveCfg = Debug|Any CPU 23 | {4FA6A106-605B-4340-B576-E23661F647A3}.Debug|x86.Build.0 = Debug|Any CPU 24 | {4FA6A106-605B-4340-B576-E23661F647A3}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {4FA6A106-605B-4340-B576-E23661F647A3}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {4FA6A106-605B-4340-B576-E23661F647A3}.Release|x64.ActiveCfg = Release|Any CPU 27 | {4FA6A106-605B-4340-B576-E23661F647A3}.Release|x64.Build.0 = Release|Any CPU 28 | {4FA6A106-605B-4340-B576-E23661F647A3}.Release|x86.ActiveCfg = Release|Any CPU 29 | {4FA6A106-605B-4340-B576-E23661F647A3}.Release|x86.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /Universal Inject Generator/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Universal Inject Generator/CheckFileSize.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | using System.Windows.Forms; 6 | using Syncfusion.Windows.Forms; 7 | 8 | namespace Universal_Inject_Generator 9 | { 10 | /// 11 | /// http://www.somacon.com/p576.php 12 | /// http://stackoverflow.com/questions/281640/how-do-i-get-a-human-readable-file-size-in-bytes-abbreviation-using-net/11124118#11124118 13 | /// 14 | public class CheckFileSize 15 | { 16 | // Returns the human-readable file size for an arbitrary, 64-bit file size 17 | // The default format is "0.### XB", e.g. "4.2 KB" or "1.434 GB" 18 | public static string GetBytesReadable(long i) 19 | { 20 | // Get absolute value 21 | long absoluteI = i < 0 ? -i : i; 22 | // Determine the suffix and readable value 23 | string suffix; 24 | double readable; 25 | if (absoluteI >= 0x1000000000000000) // Exabyte 26 | { 27 | suffix = "EB"; 28 | readable = i >> 50; 29 | } 30 | else if (absoluteI >= 0x4000000000000) // Petabyte 31 | { 32 | suffix = "PB"; 33 | readable = i >> 40; 34 | } 35 | else if (absoluteI >= 0x10000000000) // Terabyte 36 | { 37 | suffix = "TB"; 38 | readable = i >> 30; 39 | } 40 | else if (absoluteI >= 0x40000000) // Gigabyte 41 | { 42 | suffix = "GB"; 43 | readable = i >> 20; 44 | } 45 | else if (absoluteI >= 0x100000) // Megabyte 46 | { 47 | suffix = "MB"; 48 | readable = i >> 10; 49 | } 50 | else if (absoluteI >= 0x400) // Kilobyte 51 | { 52 | suffix = "KB"; 53 | readable = i; 54 | } 55 | else 56 | { 57 | return i.ToString("0 B"); // Byte 58 | } 59 | // Divide by 1024 to get fractional value 60 | readable = readable / 1024; 61 | // Return formatted number with suffix 62 | return readable.ToString("0.### ") + suffix; 63 | } 64 | 65 | public static void FinalSizeCheck(MainForm mainForm) 66 | { 67 | //Hs app original file 68 | FileInfo[] hsAppOrig = new DirectoryInfo(Variables.CurDir).GetFiles().Where(s => Regex.IsMatch(s.Name, @"hs.(app)$")).ToArray(); 69 | long hsAppOrigSize = hsAppOrig[0].Length; 70 | 71 | //Hs Inject app no banner 72 | FileInfo[] hsAppInjNb = new DirectoryInfo(Variables.CurDir).GetFiles().Where(s => Regex.IsMatch(s.Name, @"_inject_no_banner.(app)$")).ToArray(); 73 | long hsAppInjNbSize = hsAppInjNb[0].Length; 74 | 75 | //Hs Inject app with banner 76 | FileInfo[] hsAppInjWb = new DirectoryInfo(Variables.CurDir).GetFiles().Where(s => Regex.IsMatch(s.Name, @"_inject_with_banner.(app)$")).ToArray(); 77 | long hsAppInjWbSize = hsAppInjWb[0].Length; 78 | 79 | Variables.AppendTextBox( 80 | string.Format("[+] HS APP ORIGINAL SIZE :" + "{0,14}", GetBytesReadable(hsAppOrigSize)), mainForm); 81 | Variables.AppendTextBox( 82 | string.Format("[+] HS INJECT APP (N) SIZE :" + "{0,13}", GetBytesReadable(hsAppInjNbSize)), mainForm); 83 | Variables.AppendTextBox( 84 | string.Format("[+] HS INJECT APP (B) SIZE : " + "{0,12}" + Environment.NewLine, 85 | GetBytesReadable(hsAppInjWbSize)), mainForm); 86 | 87 | if (hsAppInjNbSize > hsAppOrigSize) 88 | { 89 | MessageBoxAdv.Show(mainForm, "[!] INJECT APP (N) IS BIGGER THAN HS APP", "", MessageBoxButtons.OK, MessageBoxIcon.Error); 90 | } 91 | if (hsAppInjWbSize > hsAppOrigSize) 92 | { 93 | MessageBoxAdv.Show(mainForm, "[!] INJECT APP (B) IS BIGGER THAN HS APP", "", MessageBoxButtons.OK, MessageBoxIcon.Error); 94 | } 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /Universal Inject Generator/EncCheck.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using Syncfusion.Windows.Forms; 5 | 6 | namespace Universal_Inject_Generator 7 | { 8 | public class EncCheck 9 | { 10 | //========================================================================================== 11 | 12 | #region Encryption Check 13 | 14 | //Check if file is encrypted (it shouldn't be, but just incase). 15 | public static bool CheckEncrypted(MainForm mainForm) 16 | { 17 | bool result = false; 18 | 19 | string value = null; 20 | const string ncch = "4E434348"; 21 | 22 | #region Encrypted file values where NCCH should be. (starting at offset 100) 23 | 24 | #region OLD 3DS 25 | /* 26 | //OLD 3DS 27 | 28 | //0004001000020300 JPN 29 | 30 | v0 = 3D 05 FA 0A 31 | v1024 = 14 05 6B D8 32 | v2050 = 8C 97 E8 0D 33 | 34 | //0004001000021300 USA 35 | 36 | v0 = F9 1E 99 BD 37 | v1026 = D8 EA BA 6D 38 | v2051 = 55 F2 A8 1F 39 | 40 | //0004001000022300 EUR 41 | 42 | v0 = EE D7 A0 A3 43 | v1024 = 1F 61 5A 32 44 | v2050 = 3D 63 C2 E7 45 | v3077 = 1C 86 0C 39 46 | 47 | //0004001000026300 CHN 48 | 49 | v5 = F0 81 15 2B 50 | 51 | //0004001000027300 KOR 52 | 53 | v2 = 3E E2 2D CE 54 | 55 | //0004001000028300 TWN 56 | 57 | v5 = 5B 2F 0E 6F 58 | */ 59 | #endregion 60 | 61 | #region NEW 3DS 62 | /* 63 | //NEW 3DS 64 | 65 | //0004001020020300 JPN 66 | 67 | v2 = B2 50 58 9C 68 | v17 = C9 44 C5 DC 69 | 70 | //0004001020021300 USA 71 | 72 | v1 = 1B E0 38 06 73 | 74 | //0004001020022300 EUR 75 | 76 | v1 = C4 BE 3D 55 77 | */ 78 | #endregion 79 | 80 | #endregion 81 | 82 | string file = Variables.WPath[0] + "/" + "hs.app"; 83 | 84 | try 85 | { 86 | using (BinaryReader br = new BinaryReader(File.OpenRead(file))) 87 | { 88 | for (int i = 0x00000100; i <= 0x00000103; i++) 89 | { 90 | br.BaseStream.Position = i; 91 | value += br.ReadByte().ToString("X2"); 92 | } 93 | 94 | if (value == ncch) 95 | { 96 | result = true; 97 | Variables.AppendTextBox( 98 | @"Correct value found..." + " " + value + " = " + HexStringToString(ncch) + Environment.NewLine + 99 | Environment.NewLine, 100 | mainForm); 101 | 102 | MessageBoxAdv.Show(mainForm, 103 | @"Correct value found..." + " " + value + " = " + HexStringToString(ncch) + Environment.NewLine + 104 | Environment.NewLine + 105 | "hs.app is decrypted, click OK to continue...", @"GOOD!"); 106 | } 107 | if (value != ncch) 108 | { 109 | result = false; 110 | Variables.AppendTextBox( 111 | @"Wrong value found..." + " " + value + " = " + HexStringToString(value) + Environment.NewLine + 112 | Environment.NewLine + 113 | "Expected value: = " + ncch + " " + HexStringToString(ncch), mainForm); 114 | 115 | MessageBoxAdv.Show(mainForm, 116 | @"Wrong value found..." + " " + value + " = " + HexStringToString(value) + Environment.NewLine + 117 | Environment.NewLine + 118 | "hs.app is still encrypted!" + 119 | Environment.NewLine + Environment.NewLine + "Expected value: " + ncch + " = " + 120 | HexStringToString(ncch), @"ERROR!"); 121 | 122 | File.Copy("log.txt", "error.txt", true); 123 | } 124 | } 125 | } 126 | catch (Exception ex) 127 | { 128 | MessageBoxAdv.Show(mainForm, @"Error: " + ex, @"Error!"); 129 | } 130 | return result; 131 | } 132 | 133 | /// 134 | /// Convert hex values to readable text. 135 | /// 136 | /// 137 | /// 138 | /// 139 | public static string HexStringToString(string hexString) 140 | { 141 | return 142 | string.Join("", 143 | hexString.ToCharArray() 144 | .SelectPair((ch1, ch2) => ch1.ToString() + ch2) 145 | .Select(hexChar => (char) Convert.ToByte(hexChar, 16))); 146 | } 147 | 148 | #endregion 149 | 150 | //========================================================================================== 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /Universal Inject Generator/ExtractFiles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using Syncfusion.Windows.Forms; 4 | 5 | namespace Universal_Inject_Generator 6 | { 7 | public class ExtractFiles 8 | { 9 | //Extract HS and Inject app 10 | public static void Extractfiles(MainForm mainForm) 11 | { 12 | try 13 | { 14 | //Extract hs.app 15 | using (Process extract = new Process 16 | { 17 | StartInfo = 18 | { 19 | FileName = Variables.WPath[1] + "/" + Variables.Tools[0], 20 | CreateNoWindow = true, 21 | UseShellExecute = false, 22 | RedirectStandardOutput = true, 23 | Arguments = 24 | @" -x -f " + Variables.WPath[2] + "/" + "hs.app" + 25 | " --header " + Variables.WPath[2] + "/" + "hs_hdr.bin" + 26 | " --exh " + Variables.WPath[2] + "/" + "hs_exhdr.bin" + 27 | " --plain " + Variables.WPath[2] + "/" + "hs_plain.bin" + 28 | " --logo " + Variables.WPath[2] + "/" + "hs_logo.bin" + 29 | " --exefs " + Variables.WPath[2] + "/" + "hs_exefs.bin" 30 | } 31 | }) 32 | { 33 | extract.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 34 | extract.Start(); 35 | 36 | extract.BeginOutputReadLine(); 37 | 38 | extract.WaitForExit(); 39 | extract.Close(); 40 | } 41 | 42 | //Extract inject.app 43 | using (Process extract = new Process 44 | { 45 | StartInfo = 46 | { 47 | FileName = Variables.WPath[1] + "/" + Variables.Tools[0], 48 | CreateNoWindow = true, 49 | UseShellExecute = false, 50 | RedirectStandardOutput = true, 51 | Arguments = 52 | @" -x -f " + Variables.WPath[2] + "/" + "inject.app" + 53 | " --exh " + Variables.WPath[2] + "/" + "inject_exhdr.bin" + 54 | " --exefs " + Variables.WPath[2] + "/" + "inject_exefs.bin" + 55 | " --romfs " + Variables.WPath[2] + "/" + "inject_romfs.bin" 56 | } 57 | }) 58 | { 59 | extract.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 60 | extract.Start(); 61 | 62 | extract.BeginOutputReadLine(); 63 | 64 | extract.WaitForExit(); 65 | extract.Close(); 66 | } 67 | 68 | //Extract hs.app exefs 69 | using (Process extract = new Process 70 | { 71 | StartInfo = 72 | { 73 | FileName = Variables.WPath[1] + "/" + Variables.Tools[0], 74 | CreateNoWindow = true, 75 | UseShellExecute = false, 76 | RedirectStandardOutput = true, 77 | Arguments = 78 | @" -x -f " + Variables.WPath[2] + "/" + "hs_exefs.bin" + 79 | " --exefs-dir " + Variables.WPath[2] + "/" + "hs_exefs" 80 | } 81 | }) 82 | { 83 | extract.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 84 | extract.Start(); 85 | 86 | extract.BeginOutputReadLine(); 87 | 88 | extract.WaitForExit(); 89 | extract.Close(); 90 | } 91 | 92 | //Extract inject.app exefs 93 | using (Process extract = new Process 94 | { 95 | StartInfo = 96 | { 97 | FileName = Variables.WPath[1] + "/" + Variables.Tools[0], 98 | CreateNoWindow = true, 99 | UseShellExecute = false, 100 | RedirectStandardOutput = true, 101 | Arguments = 102 | @" -x -f " + Variables.WPath[2] + "/" + "inject_exefs.bin" + 103 | " --exefs-dir " + Variables.WPath[2] + "/" + "inject_exefs" 104 | } 105 | }) 106 | { 107 | extract.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 108 | extract.Start(); 109 | 110 | extract.BeginOutputReadLine(); 111 | 112 | extract.WaitForExit(); 113 | extract.Close(); 114 | } 115 | GenExeFs.GenexeFs(mainForm); 116 | } 117 | catch (Exception exception) 118 | { 119 | MessageBoxAdv.Show(mainForm, exception.Message); 120 | } 121 | } 122 | } 123 | } -------------------------------------------------------------------------------- /Universal Inject Generator/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Universal Inject Generator/GenExeFS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using Syncfusion.Windows.Forms; 5 | 6 | namespace Universal_Inject_Generator 7 | { 8 | public class GenExeFs 9 | { 10 | public static void GenexeFs(MainForm mainForm) 11 | { 12 | try 13 | { 14 | File.Copy(Variables.WPath[2] + "/" + "hs_exefs" + "/" + "banner.bnr", 15 | Variables.WPath[2] + "/" + "inject_exefs" + "/" + "banner.bnr", true); 16 | 17 | //Generate No Banner Exefs 18 | using (Process genExefs = new Process 19 | { 20 | StartInfo = 21 | { 22 | FileName = Variables.WPath[1] + "/" + Variables.Tools[0], 23 | CreateNoWindow = true, 24 | UseShellExecute = false, 25 | RedirectStandardOutput = true, 26 | Arguments = 27 | @" -c -z -t exefs -f " + Variables.WPath[2] + "/" + "inject_no_banner_exefs.bin" + 28 | " --exefs-dir " + Variables.WPath[2] + "/" + "inject_exefs" + 29 | " --header " + Variables.WPath[2] + "/" + "inject_exefs.bin" 30 | } 31 | }) 32 | { 33 | genExefs.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 34 | genExefs.Start(); 35 | 36 | genExefs.BeginOutputReadLine(); 37 | 38 | genExefs.WaitForExit(); 39 | genExefs.Close(); 40 | } 41 | GenRomFs.GenRomfs(mainForm); 42 | } 43 | catch (Exception exception) 44 | { 45 | MessageBoxAdv.Show(mainForm, exception.Message); 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Universal Inject Generator/GenRomFs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using Syncfusion.Windows.Forms; 5 | 6 | namespace Universal_Inject_Generator 7 | { 8 | public class GenRomFs 9 | { 10 | public static void GenRomfs(MainForm mainForm) 11 | { 12 | try 13 | { 14 | Directory.CreateDirectory(Variables.WPath[2] + "/" + "dummy_romfs"); 15 | 16 | File.Copy(Variables.WPath[1] + "/" + "dummy.bin", 17 | Variables.WPath[2] + "/" + "dummy_romfs" + "/" + "dummy.bin", true); 18 | 19 | //Generate dummy Romfs 20 | using (Process genRomfs = new Process 21 | { 22 | StartInfo = 23 | { 24 | FileName = Variables.WPath[1] + "/" + Variables.Tools[0], 25 | CreateNoWindow = true, 26 | UseShellExecute = false, 27 | RedirectStandardOutput = true, 28 | Arguments = 29 | @" -c -t romfs -f " + Variables.WPath[2] + "/" + "dummy_romfs.bin" + 30 | " --romfs-dir " + Variables.WPath[2] + "/" + "dummy_romfs" 31 | } 32 | }) 33 | { 34 | genRomfs.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 35 | genRomfs.Start(); 36 | 37 | genRomfs.BeginOutputReadLine(); 38 | 39 | genRomfs.WaitForExit(); 40 | genRomfs.Close(); 41 | } 42 | 43 | if (!File.Exists(Variables.WPath[2] + "/" + "inject_romfs.bin")) 44 | { 45 | File.Copy(Variables.WPath[2] + "/" + "dummy_romfs.bin", Variables.WPath[2] + "/" + "inject_romfs.bin", true); 46 | File.Delete(Variables.WPath[2] + "/" + "dummy_romfs.bin"); 47 | } 48 | MergeExh.MergeExheader(mainForm); 49 | } 50 | catch (Exception exception) 51 | { 52 | MessageBoxAdv.Show(mainForm, exception.Message); 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Universal Inject Generator/HexText.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Universal_Inject_Generator 5 | { 6 | public static class HexText 7 | { 8 | public static IEnumerable SelectPair(this IEnumerable list, 9 | Func onPair) 10 | { 11 | TSource odd = default(TSource); 12 | bool isOdd = true; 13 | 14 | foreach (var item in list) 15 | { 16 | if (isOdd) 17 | { 18 | odd = item; 19 | } 20 | else 21 | { 22 | yield return onPair(odd, item); 23 | } 24 | 25 | isOdd = !isOdd; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Universal Inject Generator/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | using Syncfusion.Windows.Forms; 6 | using Syncfusion.Windows.Forms.Tools; 7 | 8 | namespace Universal_Inject_Generator 9 | { 10 | partial class MainForm 11 | { 12 | /// 13 | /// Required designer variable. 14 | /// 15 | private IContainer components = null; 16 | 17 | /// 18 | /// Clean up any resources being used. 19 | /// 20 | /// true if managed resources should be disposed; otherwise, false. 21 | protected override void Dispose(bool disposing) 22 | { 23 | if (disposing && (components != null)) 24 | { 25 | components.Dispose(); 26 | } 27 | base.Dispose(disposing); 28 | } 29 | 30 | #region Windows Form Designer generated code 31 | 32 | /// 33 | /// Required method for Designer support - do not modify 34 | /// the contents of this method with the code editor. 35 | /// 36 | private void InitializeComponent() 37 | { 38 | this.components = new System.ComponentModel.Container(); 39 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); 40 | this.buttonAdv1 = new Syncfusion.Windows.Forms.ButtonAdv(); 41 | this.textBoxExt1 = new Syncfusion.Windows.Forms.Tools.TextBoxExt(); 42 | this.buttonAdv2 = new Syncfusion.Windows.Forms.ButtonAdv(); 43 | ((System.ComponentModel.ISupportInitialize)(this.textBoxExt1)).BeginInit(); 44 | this.SuspendLayout(); 45 | // 46 | // buttonAdv1 47 | // 48 | this.buttonAdv1.BackColor = System.Drawing.SystemColors.ButtonFace; 49 | this.buttonAdv1.BeforeTouchSize = new System.Drawing.Size(223, 61); 50 | this.buttonAdv1.BorderStyleAdv = Syncfusion.Windows.Forms.ButtonAdvBorderStyle.Outset; 51 | this.buttonAdv1.FlatAppearance.BorderColor = System.Drawing.Color.DeepSkyBlue; 52 | this.buttonAdv1.FlatAppearance.BorderSize = 2; 53 | this.buttonAdv1.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Cyan; 54 | this.buttonAdv1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 55 | this.buttonAdv1.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 56 | this.buttonAdv1.IsBackStageButton = false; 57 | this.buttonAdv1.Location = new System.Drawing.Point(12, 2); 58 | this.buttonAdv1.Name = "buttonAdv1"; 59 | this.buttonAdv1.Size = new System.Drawing.Size(223, 61); 60 | this.buttonAdv1.TabIndex = 5; 61 | this.buttonAdv1.Text = "GO!"; 62 | this.buttonAdv1.Click += new System.EventHandler(this.buttonAdv1_Click); 63 | // 64 | // textBoxExt1 65 | // 66 | this.textBoxExt1.BackColor = System.Drawing.Color.White; 67 | this.textBoxExt1.BeforeTouchSize = new System.Drawing.Size(323, 139); 68 | this.textBoxExt1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(209)))), ((int)(((byte)(211)))), ((int)(((byte)(212))))); 69 | this.textBoxExt1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 70 | this.textBoxExt1.CornerRadius = 10; 71 | this.textBoxExt1.Cursor = System.Windows.Forms.Cursors.IBeam; 72 | this.textBoxExt1.Location = new System.Drawing.Point(12, 69); 73 | this.textBoxExt1.Metrocolor = System.Drawing.Color.FromArgb(((int)(((byte)(209)))), ((int)(((byte)(211)))), ((int)(((byte)(212))))); 74 | this.textBoxExt1.MinimumSize = new System.Drawing.Size(24, 20); 75 | this.textBoxExt1.Multiline = true; 76 | this.textBoxExt1.Name = "textBoxExt1"; 77 | this.textBoxExt1.Size = new System.Drawing.Size(323, 139); 78 | this.textBoxExt1.Style = Syncfusion.Windows.Forms.Tools.TextBoxExt.theme.Metro; 79 | this.textBoxExt1.TabIndex = 4; 80 | this.textBoxExt1.TabStop = false; 81 | this.textBoxExt1.WordWrap = false; 82 | this.textBoxExt1.TextChanged += new System.EventHandler(this.textBoxExt1_TextChanged); 83 | // 84 | // buttonAdv2 85 | // 86 | this.buttonAdv2.BackColor = System.Drawing.SystemColors.ButtonFace; 87 | this.buttonAdv2.BeforeTouchSize = new System.Drawing.Size(94, 61); 88 | this.buttonAdv2.BorderStyleAdv = Syncfusion.Windows.Forms.ButtonAdvBorderStyle.Outset; 89 | this.buttonAdv2.FlatAppearance.BorderColor = System.Drawing.Color.DeepSkyBlue; 90 | this.buttonAdv2.FlatAppearance.BorderSize = 2; 91 | this.buttonAdv2.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Cyan; 92 | this.buttonAdv2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 93 | this.buttonAdv2.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 94 | this.buttonAdv2.IsBackStageButton = false; 95 | this.buttonAdv2.Location = new System.Drawing.Point(241, 2); 96 | this.buttonAdv2.Name = "buttonAdv2"; 97 | this.buttonAdv2.Size = new System.Drawing.Size(94, 61); 98 | this.buttonAdv2.TabIndex = 7; 99 | this.buttonAdv2.Text = "Exit"; 100 | this.buttonAdv2.Click += new System.EventHandler(this.buttonAdv2_Click); 101 | // 102 | // MainForm 103 | // 104 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 105 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 106 | this.BackColor = System.Drawing.Color.SteelBlue; 107 | this.BorderColor = System.Drawing.Color.DeepSkyBlue; 108 | this.BorderThickness = 5; 109 | this.CaptionBarColor = System.Drawing.Color.SteelBlue; 110 | this.CaptionButtonColor = System.Drawing.Color.DeepSkyBlue; 111 | this.CaptionButtonHoverColor = System.Drawing.Color.LightSkyBlue; 112 | this.ClientSize = new System.Drawing.Size(349, 215); 113 | this.Controls.Add(this.buttonAdv2); 114 | this.Controls.Add(this.textBoxExt1); 115 | this.Controls.Add(this.buttonAdv1); 116 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; 117 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 118 | this.MaximizeBox = false; 119 | this.MetroColor = System.Drawing.Color.SteelBlue; 120 | this.Name = "MainForm"; 121 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; 122 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 123 | this.Text = "Universal Inject Generator"; 124 | this.TopMost = true; 125 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); 126 | ((System.ComponentModel.ISupportInitialize)(this.textBoxExt1)).EndInit(); 127 | this.ResumeLayout(false); 128 | this.PerformLayout(); 129 | 130 | } 131 | 132 | #endregion 133 | 134 | public ButtonAdv buttonAdv1; 135 | public TextBoxExt textBoxExt1; 136 | public ButtonAdv buttonAdv2; 137 | } 138 | } 139 | 140 | -------------------------------------------------------------------------------- /Universal Inject Generator/MainForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.IO; 4 | using System.Threading; 5 | using System.Windows.Forms; 6 | using Syncfusion.Windows.Forms; 7 | 8 | namespace Universal_Inject_Generator 9 | { 10 | public partial class MainForm : MetroForm 11 | { 12 | //========================================================================================== 13 | 14 | #region Setup 15 | 16 | //========================================================================================== 17 | 18 | public MainForm() 19 | { 20 | Thread splashThread = new Thread(Splash); 21 | 22 | InitializeComponent(); 23 | Variables.MessageBoxSetup(); 24 | 25 | if (!File.Exists("hs.app") || Variables.Cia.Length == 0) 26 | { 27 | MessageBoxAdv.Show(this, 28 | @"hs.app is missing... and/or cia file(s) are missing..." + Environment.NewLine + Environment.NewLine + 29 | @"Please place hs.app and cia files(s) in this folder and restart the program...", 30 | @"File(s) Missing!"); 31 | 32 | Environment.Exit(0); 33 | } 34 | //If more than one cia file is found 35 | if (Variables.Cia.Length > 1) 36 | { 37 | MessageBoxAdv.Show(this, 38 | @"Too many cia files, currently only supports single cia files." + Environment.NewLine + Environment.NewLine + 39 | "Please remove cia files until ONE is in this folder and restart the program.", @"Error", MessageBoxButtons.OK, 40 | MessageBoxIcon.Error); 41 | 42 | Environment.Exit(0); 43 | } 44 | else 45 | { 46 | try 47 | { 48 | splashThread.Start(); 49 | 50 | Thread.Sleep(2000); 51 | 52 | Variables.CreateDirs(); 53 | Variables.CopyTools(); 54 | buttonAdv1.BackColor = Color.Yellow; 55 | textBoxExt1.BackColor = Color.LightSkyBlue; 56 | File.Copy("hs.app", Variables.WPath[0] + "/" + "hs.app", true); 57 | Variables.CopyCia(); 58 | 59 | Thread.Sleep(1000); 60 | } 61 | catch (Exception ex) 62 | { 63 | MessageBoxAdv.Show(this, @"Error" + ex, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 64 | } 65 | } 66 | splashThread.Abort(); 67 | } 68 | 69 | //Load the splash screen 70 | public void Splash() 71 | { 72 | Application.Run(new Splash()); 73 | } 74 | 75 | //Exit Button. 76 | private void buttonAdv2_Click(object sender, EventArgs e) 77 | { 78 | Close(); 79 | } 80 | 81 | //Cleanup on exit. 82 | private void Form1_FormClosing(object sender, FormClosingEventArgs e) 83 | { 84 | DialogResult response = MessageBoxAdv.Show(this, @"Are you sure you want to Exit?", @"Exit", 85 | MessageBoxButtons.YesNo); 86 | 87 | if (response == DialogResult.Yes) 88 | { 89 | //input directory 90 | if (Directory.Exists(Variables.WPath[0]) && !Variables.IsDirEmpty(Variables.WPath[0])) 91 | Directory.Delete(Variables.WPath[0], true); 92 | 93 | //tools directory 94 | if (Directory.Exists(Variables.WPath[1]) && !Variables.IsDirEmpty(Variables.WPath[1])) 95 | Directory.Delete(Variables.WPath[1], true); 96 | 97 | //work directory 98 | if (Directory.Exists(Variables.WPath[2]) || !Variables.IsDirEmpty(Variables.WPath[2])) 99 | Directory.Delete(Variables.WPath[2], true); 100 | 101 | //log.txt 102 | if (File.Exists(Variables.Logs[0])) File.Delete(Variables.Logs[0]); 103 | } 104 | if (response == DialogResult.No) 105 | { 106 | e.Cancel = true; 107 | } 108 | } 109 | 110 | //Console output text scroll to bottom. 111 | public void textBoxExt1_TextChanged(object sender, EventArgs e) 112 | { 113 | textBoxExt1.SelectionStart = textBoxExt1.Text.Length; 114 | textBoxExt1.ScrollToCaret(); 115 | File.WriteAllText(Variables.Logs[0], textBoxExt1.Text); 116 | } 117 | 118 | #endregion 119 | 120 | //========================================================================================== 121 | 122 | #region Process Command (GO Button) / Reset 123 | 124 | //GO! button. 125 | private void buttonAdv1_Click(object sender, EventArgs e) 126 | { 127 | try 128 | { 129 | if (EncCheck.CheckEncrypted(this)) 130 | { 131 | buttonAdv1.Enabled = false; 132 | buttonAdv2.Enabled = false; 133 | buttonAdv1.BackColor = Color.LimeGreen; 134 | buttonAdv1.Text = @"Decrypted"; 135 | ProcessFiles.Processfiles(this); 136 | } 137 | else 138 | { 139 | buttonAdv1.BackColor = Color.Red; 140 | buttonAdv1.Text = @"Encrypted"; 141 | Reset(this); 142 | } 143 | } 144 | catch (Exception ex) 145 | { 146 | MessageBoxAdv.Show(this, @"Error: " + ex, @"Error!"); 147 | } 148 | } 149 | 150 | //Reset when finished 151 | public void Reset(MainForm form) 152 | { 153 | buttonAdv1.BackColor = Color.Yellow; 154 | buttonAdv1.Text = @"GO!"; 155 | textBoxExt1.Clear(); 156 | } 157 | 158 | #endregion 159 | 160 | //========================================================================================== 161 | } 162 | } -------------------------------------------------------------------------------- /Universal Inject Generator/MergeExh.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using Syncfusion.Windows.Forms; 4 | 5 | namespace Universal_Inject_Generator 6 | { 7 | public class MergeExh 8 | { 9 | public static void MergeExheader(MainForm mainForm) 10 | { 11 | try 12 | { 13 | //Merge Exheader 14 | using (Process mergeExh = new Process 15 | { 16 | StartInfo = 17 | { 18 | FileName = Variables.WPath[1] + "/" + Variables.Tools[2], 19 | CreateNoWindow = true, 20 | UseShellExecute = false, 21 | RedirectStandardOutput = true, 22 | Arguments = 23 | Variables.WPath[2] + "/" + "inject_exhdr.bin " + 24 | Variables.WPath[2] + "/" + "hs_exhdr.bin " + 25 | Variables.WPath[2] + "/" + "merge_exhdr.bin" 26 | } 27 | }) 28 | { 29 | mergeExh.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 30 | mergeExh.Start(); 31 | 32 | mergeExh.BeginOutputReadLine(); 33 | 34 | mergeExh.WaitForExit(); 35 | mergeExh.Close(); 36 | } 37 | RebuildHs.RebuildHnS_1(mainForm); 38 | } 39 | catch (Exception exception) 40 | { 41 | MessageBoxAdv.Show(mainForm, exception.Message); 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Universal Inject Generator/ProcessFiles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Linq; 5 | using Syncfusion.Windows.Forms; 6 | 7 | namespace Universal_Inject_Generator 8 | { 9 | public class ProcessFiles 10 | { 11 | //Initial content processing 12 | public static void Processfiles(MainForm mainForm) 13 | { 14 | try 15 | { 16 | File.Copy(Variables.WPath[0] + "/" + "hs.app", Variables.WPath[2] + "/" + "hs.app"); 17 | 18 | foreach (Process ctx in Variables.Cia.Select(file => new Process 19 | { 20 | StartInfo = 21 | { 22 | FileName = Variables.WPath[1] + "/" + Variables.Tools[1], 23 | CreateNoWindow = true, 24 | UseShellExecute = false, 25 | RedirectStandardOutput = true, 26 | Arguments = @" -x --contents work\ciacnt " + file 27 | } 28 | })) 29 | { 30 | ctx.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 31 | ctx.Start(); 32 | 33 | ctx.BeginOutputReadLine(); 34 | 35 | ctx.WaitForExit(); 36 | ctx.Close(); 37 | } 38 | 39 | //Rename extracted content to inject.app 40 | //Delete the extracted content 41 | string[] ciacnt = Directory.GetFiles(Variables.WPath[2], "ciacnt.0000.*"); 42 | foreach (string Out in ciacnt) 43 | { 44 | File.Copy(Out, Variables.WPath[2] + "/" + "inject.app", false); 45 | File.Delete(Out); 46 | } 47 | ExtractFiles.Extractfiles(mainForm); 48 | } 49 | catch (Exception exception) 50 | { 51 | MessageBoxAdv.Show(mainForm, exception.Message); 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Universal Inject Generator/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace Universal_Inject_Generator 5 | { 6 | internal static class Program 7 | { 8 | //public static Splash SplashForm; 9 | 10 | /// 11 | /// The main entry point for the application. 12 | /// 13 | [STAThread] 14 | private static void Main() 15 | { 16 | Application.EnableVisualStyles(); 17 | Application.SetCompatibleTextRenderingDefault(false); 18 | Application.Run(new MainForm()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Universal Inject Generator/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("Universal Inject Generator")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Universal Inject Generator")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 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("4fa6a106-605b-4340-b576-e23661f647a3")] 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 | -------------------------------------------------------------------------------- /Universal Inject Generator/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Universal_Inject_Generator.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Universal_Inject_Generator.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Byte[]. 65 | /// 66 | internal static byte[] _3dstool { 67 | get { 68 | object obj = ResourceManager.GetObject("_3dstool", resourceCulture); 69 | return ((byte[])(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Byte[]. 75 | /// 76 | internal static byte[] ctrtool { 77 | get { 78 | object obj = ResourceManager.GetObject("ctrtool", resourceCulture); 79 | return ((byte[])(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Byte[]. 85 | /// 86 | internal static byte[] dummy { 87 | get { 88 | object obj = ResourceManager.GetObject("dummy", resourceCulture); 89 | return ((byte[])(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 95 | /// 96 | internal static System.Drawing.Icon icon { 97 | get { 98 | object obj = ResourceManager.GetObject("icon", resourceCulture); 99 | return ((System.Drawing.Icon)(obj)); 100 | } 101 | } 102 | 103 | /// 104 | /// Looks up a localized string similar to // regex: ECMAScript grammar and case insensitive. 105 | /// 106 | internal static string ignore_3dstool { 107 | get { 108 | return ResourceManager.GetString("ignore_3dstool", resourceCulture); 109 | } 110 | } 111 | 112 | /// 113 | /// Looks up a localized resource of type System.Drawing.Bitmap. 114 | /// 115 | internal static System.Drawing.Bitmap loading { 116 | get { 117 | object obj = ResourceManager.GetObject("loading", resourceCulture); 118 | return ((System.Drawing.Bitmap)(obj)); 119 | } 120 | } 121 | 122 | /// 123 | /// Looks up a localized resource of type System.Byte[]. 124 | /// 125 | internal static byte[] MergeExHeader { 126 | get { 127 | object obj = ResourceManager.GetObject("MergeExHeader", resourceCulture); 128 | return ((byte[])(obj)); 129 | } 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /Universal Inject Generator/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 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 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\ctrtool.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 123 | 124 | 125 | ..\Resources\MergeExHeader.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 126 | 127 | 128 | ..\Resources\3dstool.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 129 | 130 | 131 | ..\Resources\icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 132 | 133 | 134 | ..\Resources\ignore_3dstool.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 135 | 136 | 137 | ..\Resources\dummy.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 138 | 139 | 140 | ..\Resources\loading.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 141 | 142 | -------------------------------------------------------------------------------- /Universal Inject Generator/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Universal_Inject_Generator.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Universal Inject Generator/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Universal Inject Generator/RebuildHS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Linq; 5 | using Syncfusion.Windows.Forms; 6 | 7 | namespace Universal_Inject_Generator 8 | { 9 | public class RebuildHs 10 | { 11 | //Rebuild HS Inject App - No Banner 12 | public static void RebuildHnS_1(MainForm mainForm) 13 | { 14 | try 15 | { 16 | string[] files = 17 | Directory.GetFiles(Variables.WPath[0], "*.cia").Select(Path.GetFileNameWithoutExtension).ToArray(); 18 | 19 | if (File.Exists(Variables.WPath[2] + "/" + "hs_logo.bin")) 20 | { 21 | foreach (Process rebuildHnS in files.Select(file => new Process 22 | { 23 | StartInfo = 24 | { 25 | FileName = Variables.WPath[1] + "/" + Variables.Tools[0], 26 | CreateNoWindow = true, 27 | UseShellExecute = false, 28 | RedirectStandardOutput = true, 29 | Arguments = 30 | @" -c -t cxi -f " + file + "_inject_no_banner.app" + 31 | " --header " + Variables.WPath[2] + "/" + "hs_hdr.bin" + 32 | " --exh " + Variables.WPath[2] + "/" + "merge_exhdr.bin" + 33 | " --plain " + Variables.WPath[2] + "/" + "hs_plain.bin" + 34 | " --logo " + Variables.WPath[2] + "/" + "hs_logo.bin" + 35 | " --exefs " + Variables.WPath[2] + "/" + "inject_no_banner_exefs.bin" + 36 | " --romfs " + Variables.WPath[2] + "/" + "inject_romfs.bin" 37 | } 38 | })) 39 | { 40 | rebuildHnS.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 41 | rebuildHnS.Start(); 42 | 43 | rebuildHnS.BeginOutputReadLine(); 44 | 45 | rebuildHnS.WaitForExit(); 46 | rebuildHnS.Close(); 47 | } 48 | } 49 | else 50 | { 51 | foreach (Process rebuildHnS in files.Select(file => new Process 52 | { 53 | StartInfo = 54 | { 55 | FileName = Variables.WPath[1] + "/" + Variables.Tools[0], 56 | CreateNoWindow = true, 57 | UseShellExecute = false, 58 | RedirectStandardOutput = true, 59 | Arguments = 60 | @" -c -t cxi -f " + file + "_inject_no_banner.app" + 61 | " --header " + Variables.WPath[2] + "/" + "hs_hdr.bin" + 62 | " --exh " + Variables.WPath[2] + "/" + "merge_exhdr.bin" + 63 | " --plain " + Variables.WPath[2] + "/" + "hs_plain.bin" + 64 | " --exefs " + Variables.WPath[2] + "/" + "inject_no_banner_exefs.bin" + 65 | " --romfs " + Variables.WPath[2] + "/" + "inject_romfs.bin" 66 | } 67 | })) 68 | { 69 | rebuildHnS.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 70 | rebuildHnS.Start(); 71 | 72 | rebuildHnS.BeginOutputReadLine(); 73 | 74 | rebuildHnS.WaitForExit(); 75 | rebuildHnS.Close(); 76 | } 77 | } 78 | RebuildHnS_2(mainForm); 79 | } 80 | catch (Exception exception) 81 | { 82 | MessageBoxAdv.Show(mainForm, exception.ToString()); 83 | } 84 | } 85 | 86 | //Rebuild HS Inject App - Banner 87 | public static void RebuildHnS_2(MainForm mainForm) 88 | { 89 | try 90 | { 91 | string[] files = 92 | Directory.GetFiles(Variables.WPath[0], "*.cia").Select(Path.GetFileNameWithoutExtension).ToArray(); 93 | 94 | if (File.Exists(Variables.WPath[2] + "/" + "hs_logo.bin")) 95 | { 96 | foreach (string file in files) 97 | { 98 | //Rebuild ?? banner 1 99 | using (Process rebuildHnS = new Process 100 | { 101 | StartInfo = 102 | { 103 | FileName = Variables.WPath[1] + "/" + Variables.Tools[0], 104 | CreateNoWindow = true, 105 | UseShellExecute = false, 106 | RedirectStandardOutput = true, 107 | Arguments = 108 | @" -c -t cxi -f " + file + "_inject_with_banner.app" + 109 | " --header " + Variables.WPath[2] + "/" + "hs_hdr.bin" + 110 | " --exh " + Variables.WPath[2] + "/" + "merge_exhdr.bin" + 111 | " --plain " + Variables.WPath[2] + "/" + "hs_plain.bin" + 112 | " --logo " + Variables.WPath[2] + "/" + "hs_logo.bin" + 113 | " --exefs " + Variables.WPath[2] + "/" + "inject_exefs.bin" + 114 | " --romfs " + Variables.WPath[2] + "/" + "inject_romfs.bin" 115 | } 116 | }) 117 | { 118 | rebuildHnS.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 119 | rebuildHnS.Start(); 120 | 121 | rebuildHnS.BeginOutputReadLine(); 122 | 123 | rebuildHnS.WaitForExit(); 124 | rebuildHnS.Close(); 125 | } 126 | } 127 | } 128 | else 129 | { 130 | foreach (string file in files) 131 | { 132 | //Rebuild ?? banner 2 133 | using (Process rebuildHnS = new Process 134 | { 135 | StartInfo = 136 | { 137 | FileName = Variables.WPath[1] + "/" + Variables.Tools[0], 138 | CreateNoWindow = true, 139 | UseShellExecute = false, 140 | RedirectStandardOutput = true, 141 | Arguments = 142 | @" -c -t cxi -f " + file + "_inject_with_banner.app" + 143 | " --header " + Variables.WPath[2] + "/" + "hs_hdr.bin" + 144 | " --exh " + Variables.WPath[2] + "/" + "merge_exhdr.bin" + 145 | " --plain " + Variables.WPath[2] + "/" + "hs_plain.bin" + 146 | " --exefs " + Variables.WPath[2] + "/" + "inject_exefs.bin" + 147 | " --romfs " + Variables.WPath[2] + "/" + "inject_romfs.bin" 148 | } 149 | }) 150 | { 151 | rebuildHnS.OutputDataReceived += (o, args) => Variables.SortOutputHandler(o, args, mainForm); 152 | rebuildHnS.Start(); 153 | 154 | rebuildHnS.BeginOutputReadLine(); 155 | 156 | rebuildHnS.WaitForExit(); 157 | rebuildHnS.Close(); 158 | } 159 | } 160 | } 161 | //Reset after process complete. 162 | Variables.CompleteProgress(mainForm); 163 | } 164 | catch (Exception exception) 165 | { 166 | MessageBoxAdv.Show(mainForm, exception.Message); 167 | } 168 | } 169 | } 170 | } -------------------------------------------------------------------------------- /Universal Inject Generator/Resources/3dstool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/Universal Inject Generator/Resources/3dstool.exe -------------------------------------------------------------------------------- /Universal Inject Generator/Resources/MergeExHeader.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/Universal Inject Generator/Resources/MergeExHeader.exe -------------------------------------------------------------------------------- /Universal Inject Generator/Resources/ctrtool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/Universal Inject Generator/Resources/ctrtool.exe -------------------------------------------------------------------------------- /Universal Inject Generator/Resources/dummy.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/Universal Inject Generator/Resources/dummy.bin -------------------------------------------------------------------------------- /Universal Inject Generator/Resources/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/Universal Inject Generator/Resources/icon.ico -------------------------------------------------------------------------------- /Universal Inject Generator/Resources/ignore_3dstool.txt: -------------------------------------------------------------------------------- 1 | // regex: ECMAScript grammar and case insensitive -------------------------------------------------------------------------------- /Universal Inject Generator/Resources/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/Universal Inject Generator/Resources/loading.gif -------------------------------------------------------------------------------- /Universal Inject Generator/Splash.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Universal_Inject_Generator 2 | { 3 | partial class Splash 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 33 | this.timer1 = new System.Windows.Forms.Timer(this.components); 34 | this.timer2 = new System.Windows.Forms.Timer(this.components); 35 | this.timer3 = new System.Windows.Forms.Timer(this.components); 36 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 37 | this.SuspendLayout(); 38 | // 39 | // pictureBox1 40 | // 41 | this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; 42 | this.pictureBox1.Image = global::Universal_Inject_Generator.Properties.Resources.loading; 43 | this.pictureBox1.Location = new System.Drawing.Point(0, 0); 44 | this.pictureBox1.Name = "pictureBox1"; 45 | this.pictureBox1.Size = new System.Drawing.Size(361, 142); 46 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; 47 | this.pictureBox1.TabIndex = 0; 48 | this.pictureBox1.TabStop = false; 49 | // 50 | // timer1 51 | // 52 | this.timer1.Interval = 10; 53 | this.timer1.Tick += new System.EventHandler(this.timer1_Tick); 54 | // 55 | // timer2 56 | // 57 | this.timer2.Interval = 500; 58 | this.timer2.Tick += new System.EventHandler(this.timer2_Tick); 59 | // 60 | // timer3 61 | // 62 | this.timer3.Interval = 10; 63 | this.timer3.Tick += new System.EventHandler(this.timer3_Tick); 64 | // 65 | // Splash 66 | // 67 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; 68 | this.BackColor = System.Drawing.Color.SteelBlue; 69 | this.BorderColor = System.Drawing.Color.DeepSkyBlue; 70 | this.BorderThickness = 5; 71 | this.ClientSize = new System.Drawing.Size(361, 142); 72 | this.ControlBox = false; 73 | this.Controls.Add(this.pictureBox1); 74 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 75 | this.MaximizeBox = false; 76 | this.MinimizeBox = false; 77 | this.Name = "Splash"; 78 | this.ShowIcon = false; 79 | this.ShowInTaskbar = false; 80 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 81 | this.Text = "Splash"; 82 | this.TopMost = true; 83 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 84 | this.ResumeLayout(false); 85 | 86 | } 87 | 88 | #endregion 89 | 90 | private System.Windows.Forms.PictureBox pictureBox1; 91 | private System.Windows.Forms.Timer timer1; 92 | private System.Windows.Forms.Timer timer2; 93 | private System.Windows.Forms.Timer timer3; 94 | } 95 | } -------------------------------------------------------------------------------- /Universal Inject Generator/Splash.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Syncfusion.Windows.Forms; 3 | 4 | namespace Universal_Inject_Generator 5 | { 6 | public partial class Splash : MetroForm 7 | { 8 | private int _count; 9 | private int _buffer; 10 | 11 | public Splash() 12 | { 13 | InitializeComponent(); 14 | Opacity = 0; 15 | timer1.Start(); 16 | } 17 | 18 | private void timer1_Tick(object sender, EventArgs e) 19 | { 20 | if (Math.Abs(Opacity - 1) < double.Epsilon) 21 | { 22 | timer2.Start(); 23 | timer1.Stop(); 24 | } 25 | else 26 | { 27 | _count++; 28 | Opacity = _count*0.01; 29 | } 30 | } 31 | 32 | private void timer2_Tick(object sender, EventArgs e) 33 | { 34 | if (_buffer == 3) 35 | { 36 | timer3.Start(); 37 | timer2.Stop(); 38 | } 39 | else 40 | { 41 | _buffer++; 42 | } 43 | } 44 | 45 | private void timer3_Tick(object sender, EventArgs e) 46 | { 47 | if (Math.Abs(Opacity - 0) < double.Epsilon) 48 | { 49 | timer3.Stop(); 50 | } 51 | else 52 | { 53 | _count--; 54 | Opacity = _count*0.01; 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Universal Inject Generator/Splash.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 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 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 104, 17 125 | 126 | 127 | 191, 17 128 | 129 | -------------------------------------------------------------------------------- /Universal Inject Generator/Syncfusion.Shared.Base.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/Universal Inject Generator/Syncfusion.Shared.Base.dll -------------------------------------------------------------------------------- /Universal Inject Generator/Universal Inject Generator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4FA6A106-605B-4340-B576-E23661F647A3} 8 | WinExe 9 | Properties 10 | Universal_Inject_Generator 11 | Universal Inject Generator 12 | v4.5 13 | 512 14 | true 15 | 16 | 17 | 18 | 19 | 20 | 21 | AnyCPU 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | AnyCPU 32 | pdbonly 33 | true 34 | bin\Release\ 35 | TRACE 36 | prompt 37 | 4 38 | 39 | 40 | Resources\icon.ico 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | False 49 | .\Syncfusion.Shared.Base.dll 50 | True 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Form 66 | 67 | 68 | MainForm.cs 69 | 70 | 71 | 72 | 73 | 74 | 75 | True 76 | True 77 | Resources.resx 78 | 79 | 80 | 81 | Form 82 | 83 | 84 | Splash.cs 85 | 86 | 87 | 88 | MainForm.cs 89 | 90 | 91 | ResXFileCodeGenerator 92 | Designer 93 | Resources.Designer.cs 94 | 95 | 96 | Splash.cs 97 | 98 | 99 | 100 | SettingsSingleFileGenerator 101 | Settings.Designer.cs 102 | 103 | 104 | True 105 | Settings.settings 106 | True 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 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 137 | 138 | 139 | 140 | 147 | -------------------------------------------------------------------------------- /Universal Inject Generator/Variables.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Drawing; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text.RegularExpressions; 7 | using System.Windows.Forms; 8 | using Syncfusion.Windows.Forms; 9 | using Universal_Inject_Generator.Properties; 10 | 11 | namespace Universal_Inject_Generator 12 | { 13 | public class Variables 14 | { 15 | //========================================================================================== 16 | 17 | #region Global Variables 18 | 19 | public static IntPtr MainForm { get; set; } 20 | 21 | public static string CurDir = Directory.GetCurrentDirectory(); 22 | 23 | public static readonly string[] WPath = {"input", "tools", "work"}; // 0 - 2. 24 | 25 | public static string[] Tools = 26 | { 27 | "3dstool.exe", "ctrtool.exe", "MergeExHeader.exe", "ignore_3dstool.txt", "dummy.bin", "log.txt" 28 | }; // 0 - 5. 29 | 30 | //log files 0 - 1 31 | public static string[] Logs = {"log.txt", "log_done.txt"}; 32 | 33 | //cia file check. 34 | public static FileInfo[] Cia = new DirectoryInfo(CurDir).GetFiles().Where(s => Regex.IsMatch(s.Name, @"\.(cia)$")).ToArray(); 35 | 36 | #endregion 37 | 38 | //========================================================================================== 39 | 40 | #region Message Box Design Setup 41 | 42 | public static void MessageBoxSetup() 43 | { 44 | MetroStyleColorTable metroColorTable = new MetroStyleColorTable(); 45 | MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Metro; 46 | MessageBoxAdv.MetroColorTable = metroColorTable; 47 | metroColorTable.BackColor = Color.SteelBlue; 48 | metroColorTable.CaptionBarColor = Color.SteelBlue; 49 | metroColorTable.BorderColor = Color.DeepSkyBlue; 50 | } 51 | 52 | #endregion 53 | 54 | //========================================================================================== 55 | 56 | #region Create Directories, Copy Tools, Copy Cia/s 57 | 58 | //Create all our directories if they don't exist already. 59 | public static void CreateDirs() 60 | { 61 | if (Directory.Exists(WPath[0]) || Directory.Exists(WPath[1])) return; 62 | foreach (string dir in WPath) 63 | { 64 | Directory.CreateDirectory(dir); 65 | } 66 | } 67 | 68 | //Copy all our tools from embedded resources to tools folder if they don't already exist. 69 | public static void CopyTools() 70 | { 71 | //3dstool.exe 72 | if (!File.Exists(WPath[1] + "/" + Tools[0])) 73 | File.WriteAllBytes(WPath[1] + "/" + Tools[0], Resources._3dstool); 74 | 75 | //ctrtool.exe 76 | if (!File.Exists(WPath[1] + "/" + Tools[1])) 77 | File.WriteAllBytes(WPath[1] + "/" + Tools[1], Resources.ctrtool); 78 | 79 | //MergeExheader.exe 80 | if (!File.Exists(WPath[1] + "/" + Tools[2])) 81 | File.WriteAllBytes(WPath[1] + "/" + Tools[2], Resources.MergeExHeader); 82 | 83 | //ignore_3dstool.txt 84 | if (!File.Exists(CurDir + "/" + Tools[3])) 85 | File.WriteAllText(WPath[1] + "/" + Tools[3], Resources.ignore_3dstool); 86 | 87 | //dummy.bin 88 | if (!File.Exists(CurDir + "/" + Tools[4])) File.WriteAllBytes(WPath[1] + "/" + Tools[4], Resources.dummy); 89 | } 90 | 91 | //Copy cia files from root directory to input directory on startup. 92 | public static void CopyCia() 93 | { 94 | foreach (FileInfo file in Cia) 95 | { 96 | string destfile = WPath[0] + "/" + Path.GetFileName(file.ToString()); 97 | 98 | File.Copy(file.ToString(), destfile, true); 99 | } 100 | } 101 | 102 | //Check if directory is empty or not. 103 | public static bool IsDirEmpty(string path) 104 | { 105 | return !Directory.EnumerateFileSystemEntries(path).Any(); 106 | } 107 | 108 | #endregion 109 | 110 | //========================================================================================== 111 | 112 | #region Textbox Control 113 | 114 | //Handle console redirection. 115 | public static void SortOutputHandler(object sender, DataReceivedEventArgs e, MainForm mainForm) 116 | { 117 | Trace.WriteLine(e.Data); 118 | mainForm.BeginInvoke(new MethodInvoker(() => AppendTextBox(e.Data, mainForm))); 119 | } 120 | 121 | //Handle console redirection. 122 | public static void AppendTextBox(string value, MainForm mainForm) 123 | { 124 | if (mainForm.textBoxExt1.InvokeRequired) 125 | { 126 | mainForm.textBoxExt1.BeginInvoke(new Action(AppendTextBox), value); 127 | return; 128 | } 129 | mainForm.textBoxExt1.Text += value + Environment.NewLine; 130 | } 131 | 132 | #endregion 133 | 134 | //========================================================================================== 135 | 136 | public static void CompleteProgress(MainForm mainForm) 137 | { 138 | //Reset after process complete. 139 | //================================================= 140 | mainForm.buttonAdv1.BackColor = Color.Aqua; 141 | mainForm.buttonAdv1.Text = @"DONE!"; 142 | 143 | MessageBoxAdv.Show(mainForm, @"Work Complete!", @"DONE!"); 144 | CheckFileSize.FinalSizeCheck(mainForm); 145 | File.Copy(Logs[0], Logs[1], true); 146 | 147 | mainForm.Reset(mainForm); 148 | 149 | File.Delete(Logs[0]); 150 | 151 | mainForm.buttonAdv1.Enabled = true; 152 | mainForm.buttonAdv2.Enabled = true; 153 | } 154 | } 155 | } -------------------------------------------------------------------------------- /Universal Inject Generator/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/Costura.Fody.1.3.3.0/Content/FodyWeavers.xml.install.xdt: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/Costura.Fody.1.3.3.0/Content/FodyWeavers.xml.uninstall.xdt: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/Costura.Fody.1.3.3.0/Costura.Fody.1.3.3.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/packages/Costura.Fody.1.3.3.0/Costura.Fody.1.3.3.0.nupkg -------------------------------------------------------------------------------- /packages/Costura.Fody.1.3.3.0/Costura.Fody.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/packages/Costura.Fody.1.3.3.0/Costura.Fody.dll -------------------------------------------------------------------------------- /packages/Costura.Fody.1.3.3.0/Tools/commands.psm1: -------------------------------------------------------------------------------- 1 | function Resolve-ProjectName { 2 | param( 3 | [parameter(ValueFromPipelineByPropertyName = $true)] 4 | [string[]]$ProjectName 5 | ) 6 | 7 | if($ProjectName) { 8 | $projects = Get-Project $ProjectName 9 | } 10 | else { 11 | # All projects by default 12 | $projects = Get-Project 13 | } 14 | 15 | $projects 16 | } 17 | 18 | function Get-MSBuildProject { 19 | param( 20 | [parameter(ValueFromPipelineByPropertyName = $true)] 21 | [string[]]$ProjectName 22 | ) 23 | Process { 24 | (Resolve-ProjectName $ProjectName) | % { 25 | $path = $_.FullName 26 | @([Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($path))[0] 27 | } 28 | } 29 | } 30 | 31 | function Install-CleanReferencesTarget() 32 | { 33 | $buildProject = Get-MSBuildProject 34 | 35 | if ($buildProject.Xml.Targets | Where-Object { "CleanReferenceCopyLocalPaths" -contains $_.Name }) 36 | { 37 | Write-Host "Target CleanReferenceCopyLocalPaths already exists." -foregroundcolor Black -backgroundcolor Yellow 38 | 39 | return 40 | } 41 | 42 | $usingTask = $buildProject.Xml.AddUsingTask("CosturaCleanup", "`$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll", "") 43 | $usingTask.TaskFactory = "CodeTaskFactory" 44 | $parameterGroup = $usingTask.AddParameterGroup() 45 | $configParam = $parameterGroup.AddParameter("Config", "false", "true", "Microsoft.Build.Framework.ITaskItem") 46 | $filesParam = $parameterGroup.AddParameter("Files", "false", "true", "Microsoft.Build.Framework.ITaskItem[]") 47 | $taskBody = $usingTask.AddUsingTaskBody("true", " 48 | 49 | 50 | 51 | 52 | 53 | (); 59 | var attribute = config.Attribute(`"ExcludeAssemblies`"); 60 | if (attribute != null) 61 | foreach (var item in attribute.Value.Split('|').Select(x => x.Trim()).Where(x => x != string.Empty)) 62 | excludedAssemblies.Add(item); 63 | var element = config.Element(`"ExcludeAssemblies`"); 64 | if (element != null) 65 | foreach (var item in element.Value.Split(new[] { `"\r\n`", `"\n`" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).Where(x => x != string.Empty)) 66 | excludedAssemblies.Add(item); 67 | 68 | var filesToCleanup = Files.Select(f => f.ItemSpec).Where(f => !excludedAssemblies.Contains(Path.GetFileNameWithoutExtension(f), StringComparer.InvariantCultureIgnoreCase)); 69 | 70 | foreach (var item in filesToCleanup) 71 | File.Delete(item); 72 | ]]> 73 | ") 74 | 75 | $target = $buildProject.Xml.AddTarget("CleanReferenceCopyLocalPaths") 76 | $target.AfterTargets = "AfterBuild;NonWinFodyTarget" 77 | $deleteTask = $target.AddTask("CosturaCleanup") 78 | $deleteTask.SetParameter("Config", "FodyWeavers.xml") 79 | $deleteTask.SetParameter("Files", "@(ReferenceCopyLocalPaths->`'`$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)`')") 80 | 81 | $buildProject.Save() 82 | 83 | Write-Host "Added target CleanReferenceCopyLocalPaths." 84 | } 85 | 86 | function Uninstall-CleanReferencesTarget() 87 | { 88 | $buildProject = Get-MSBuildProject 89 | 90 | $target = $buildProject.Xml.Targets | Where-Object { "CleanReferenceCopyLocalPaths" -contains $_.Name } 91 | $usingTask = $buildProject.Xml.UsingTasks | Where-Object { "CosturaCleanup" -contains $_.TaskName } 92 | 93 | if (!$target) 94 | { 95 | Write-Host "Target CleanReferenceCopyLocalPaths did not exist." -foregroundcolor Black -backgroundcolor Yellow 96 | 97 | return 98 | } 99 | 100 | $buildProject.Xml.RemoveChild($usingTask) 101 | $buildProject.Xml.RemoveChild($target) 102 | 103 | $buildProject.Save() 104 | 105 | Write-Host "Removed target CleanReferenceCopyLocalPaths." 106 | } -------------------------------------------------------------------------------- /packages/Costura.Fody.1.3.3.0/Tools/init.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | Import-Module (Join-Path $toolsPath commands.psm1) -------------------------------------------------------------------------------- /packages/Fody.1.28.3/Content/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/Fody.1.28.3/Fody.1.28.3.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/packages/Fody.1.28.3/Fody.1.28.3.nupkg -------------------------------------------------------------------------------- /packages/Fody.1.28.3/Fody.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/packages/Fody.1.28.3/Fody.dll -------------------------------------------------------------------------------- /packages/Fody.1.28.3/FodyCommon.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/packages/Fody.1.28.3/FodyCommon.dll -------------------------------------------------------------------------------- /packages/Fody.1.28.3/FodyIsolated.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/packages/Fody.1.28.3/FodyIsolated.dll -------------------------------------------------------------------------------- /packages/Fody.1.28.3/Mono.Cecil.Mdb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/packages/Fody.1.28.3/Mono.Cecil.Mdb.dll -------------------------------------------------------------------------------- /packages/Fody.1.28.3/Mono.Cecil.Pdb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/packages/Fody.1.28.3/Mono.Cecil.Pdb.dll -------------------------------------------------------------------------------- /packages/Fody.1.28.3/Mono.Cecil.Rocks.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/packages/Fody.1.28.3/Mono.Cecil.Rocks.dll -------------------------------------------------------------------------------- /packages/Fody.1.28.3/Mono.Cecil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shadowtrance/Universal-Inject-Generator-Csharp/1ea0328414b0079ce72a5fe184699ef3538f6d08/packages/Fody.1.28.3/Mono.Cecil.dll -------------------------------------------------------------------------------- /packages/Fody.1.28.3/Tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | 3 | 4 | # Need to load MSBuild assembly if it's not loaded yet. 5 | Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 6 | 7 | # Grab the loaded MSBuild project for the project 8 | $buildProject = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1 9 | 10 | $fodyPathProperty = $buildProject.GetProperty("FodyPath") 11 | 12 | # Dont do a null check since is seems evaluating the value causes powershit to have a conniption 13 | try 14 | { 15 | $buildProject.RemoveProperty($fodyPathProperty); 16 | } 17 | catch{} 18 | 19 | $project.Save() 20 | 21 | -------------------------------------------------------------------------------- /packages/Fody.1.28.3/Tools/uninstall.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | -------------------------------------------------------------------------------- /packages/Fody.1.28.3/build/Fody.targets: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | $(NCrunchOriginalSolutionDir) 7 | 8 | 9 | 10 | 11 | $(SolutionDir) 12 | 13 | 14 | 15 | 16 | $(MSBuildProjectDirectory)..\..\..\ 17 | 18 | 19 | 20 | 21 | 22 | 23 | $(KeyOriginatorFile) 24 | 25 | 26 | 27 | 28 | $(AssemblyOriginatorKeyFile) 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | $(ProjectDir)$(IntermediateOutputPath) 39 | $(SignAssembly) 40 | $(MSBuildThisFileDirectory)..\ 41 | 42 | 45 | 49 | 50 | 61 | 62 | 63 | 64 | 67 | 71 | 72 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | --------------------------------------------------------------------------------