Skip to content

Commit

Permalink
v3.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-teix committed Nov 18, 2018
1 parent a276178 commit a816e69
Show file tree
Hide file tree
Showing 95 changed files with 1,762 additions and 597 deletions.
39 changes: 32 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ This is an easy to use nsp builder that will make rediction nsps or internally b

>>>>>>> 1da8998d3d8790a08ce6cc07f9e520ff3139f75a

Whats New:
-----------
v3.2.2
-- Added: Title Ids changed to 05xxxxxxxxxx0000 format
-- Fixed: Rolling Id adjusted to new id format
-- Added: Randomize Title id button added
-- Added: Auto import .nro icon, app name, author, and version
-- Fixed: .netframework error certain people were experiancing
-- Fixed: some settings being set by default

Requirements:
-------------
- Devkitpro for Compiling libnx *newest version* https://switchbrew.org/wiki/Setting_up_Development_Environment
Expand All @@ -13,11 +24,13 @@ Requirements:

Special notes:
--------------
* To load Meta information from .nro automatically, load the .nro by clicking "romfs" and choose yes.
This will automatically load all the information from the .nro. If you want to use sdmc then select "sdmc" after and use as normal -- may incorperate import button instead if requested
* Requires Newest Devkitpro update due to changes, update before use
* Some nros are not working with romfs (newest tinfoil, dOPUS) use sdmc for now
* Icons no longer need speical size or format
* Now uses winform, can use mono for mac/linux
* Mac and linux may experiance bugs or weird issues due to mono
* Some nros are not working with romfs (old tinfoil, dOPUS) use sdmc for those for now
* Title ids now follow (05xxxxxxxxxx0000)
* Mac and linux may experiance bugs or weird issues due to mono
(First launch may take a while to load, be paitent / ui looks less pleasing as well)
* Big Changes have been made in the code, Bugs maybe be present. If found please report them.
* Linux use hasnt been tested fully, may experiance issues

Expand All @@ -32,7 +45,7 @@ Use:

ex:
AppName: TestApp
Title Id: 01000F2300000000 *Must be 16 Characters long in hex form and start with 01*
Title Id: 05000F2300000000 *Must be 16 Characters long in hex form and start with 05
Made by: Matt_Teix
Version: 1.0.0

Expand All @@ -59,24 +72,36 @@ Settings:
- Preset Author: Set the default author, speed things up if using the same one
- Rolling Title Id: Set the base Title Id and after each build it'll increase by 1
- Perserve Data: Saves exefs, contol, and nca data in ./RawData folder
- Old Style Title Id: Use old style title key format "05XXXXXXXXXXXXXX"


Credits:
--------
"Switchbrew" for the hblauncher source https://github.com/switchbrew/nx-hbloader
"The-4n" for Hacbrewpack https://github.com/The-4n/hacBrewPack
"alexzzz9" for the hblauncher source and providing useful help
"jakcron" for Nstool for extracting nro info https://github.com/jakcron/NNTools
The Whole WarezNx Discord for all the tools/information to make all of this possible

Todo:
-----
-- Clean up new code
-- fix file permissions for linux/mac to remove sudo command
-- better intergration for Mac
-- change the ui (may require some help)
-- fix certain .nros not working with romfs
-- Maybe include Devkitpro so installing wouldnt be requried
-- Maybe include Devkitpro so installing wouldnt be requried - if possible

Change log:
-----------

v3.2.2
-- Added: Title Ids changed to 05xxxxxxxxxx0000
-- Fixed: Rolling Id adjusted to new id
-- Added: Randomize Title id button added
-- Added: Auto import .nro icon, app name, author, and version
-- Fixed: .netframework error certain people were experiancing
-- Fixed: some settings being set by default

v3.2.1
-- fixed issue with newest devkitpro update *now requires latest to build*
-- added settings tab
Expand Down
Binary file added Releases/Nro2Nsp-3.2.2.zip
Binary file not shown.
Binary file modified Source/.vs/MtX.Nro2Nsp/v15/.suo
Binary file not shown.
Binary file modified Source/.vs/MtX.Nro2Nsp/v15/Browse.VC.db
Binary file not shown.
Binary file modified Source/.vs/MtX.Nro2Nsp/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified Source/.vs/MtX.Nro2Nsp/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file modified Source/.vs/MtX.Nro2Nsp/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions Source/Control/Control.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Import.cs" />
<Compile Include="Image.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
Expand Down Expand Up @@ -78,12 +79,17 @@
<None Include="Resources\lind.asc" />
<None Include="Resources\mct.asc" />
<None Include="Resources\mkf.asc" />
<None Include="Resources\nstool_linux" />
<None Include="Resources\nstool_mac" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\hacbrewpackx64.exe" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\hacbrewpackx86.exe" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\nstool.exe" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
10 changes: 10 additions & 0 deletions Source/Control/Dirc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class DircControl
logopath = @"logo/",
RootDrive = System.IO.Path.GetPathRoot(Environment.CurrentDirectory);


//Build working dirc
public static void BuildTemp()
{
try
Expand Down Expand Up @@ -66,6 +68,8 @@ public static void BuildTemp()
{ MessageBox.Show(e.Message + " -- File copying failed, make sure the file missing is int the \"Resources\" next to the Application"); }
}


//Clean Working Directory
public static void CleanTemp()
{
try
Expand All @@ -77,6 +81,8 @@ public static void CleanTemp()
catch (Exception e) { MessageBox.Show(e.Message); }
}


//Clean Log at start
public static void CleanLog()
{
try
Expand All @@ -88,6 +94,8 @@ public static void CleanLog()
catch (Exception e) { MessageBox.Show(e.Message); }
}


//Copy completed nsp to working dirc
public void OutputCopy()
{
string nspsource = @buildpath;
Expand All @@ -113,6 +121,8 @@ public void OutputCopy()
{ MessageBox.Show(e.Message + System.Environment.NewLine + "It appears building the nsp failed, please verify the proper keys are in keys.dat file -- refer to Keys.dat template.txt");}
}


//Save data if set
void PerseveCopy(string sourceDir, string targetDir)
{
Directory.CreateDirectory(targetDir);
Expand Down
148 changes: 148 additions & 0 deletions Source/Control/Import.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace MtX.Control
{
public class ImportMeta
{

// Build folders and copy required files
public static void SetRequiredComponents()
{
if (Directory.Exists(DircControl.buildpath + "Extract")) { }
else { System.IO.Directory.CreateDirectory(DircControl.buildpath + "Extract"); }

switch (Tools.RunningPlatform())
{
case Tools.Platform.Linux:
File.WriteAllBytes(DircControl.buildpath + "nstool", Properties.Resources.nstool_linux);
break;

case Tools.Platform.Mac:
File.WriteAllBytes(DircControl.buildpath + "nstool", Properties.Resources.nstool_mac);
break;

case Tools.Platform.Windows:
if (Environment.Is64BitOperatingSystem) { File.WriteAllBytes(DircControl.buildpath + "nstool.exe", Properties.Resources.nstool); }
else { File.WriteAllBytes(DircControl.buildpath + "nstool.exe", Properties.Resources.nstool); }
break;
default:
MessageBox.Show("Couldnt Detect Operating System, This is probably a bug, please report it");
break;
}
}


// Win command to extact .nro
public static void ExtractNroWin(string Args, bool Input, bool Window)
{
ProcessStartInfo info = new ProcessStartInfo()
{
FileName = @"CMD.EXE",
Arguments = Args,
CreateNoWindow = Window,
RedirectStandardInput = Input,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
};
Process p = Process.Start(info);
Tools.Logger(p.StandardOutput.ReadToEnd());
Tools.Logger(p.StandardError.ReadToEnd());
p.WaitForExit();
}

// unix command to extact .nro
public static void ExtractNroUni(String NroName)
{

String[] Args = { "sudo chmod -R g+rwx " + DircControl.root, SetCommand(NroName) };

Process p = new Process();
ProcessStartInfo info = new ProcessStartInfo
{
FileName = "/bin/bash",
RedirectStandardInput = true,
UseShellExecute = false,
};
p.StartInfo = info;
p.Start();
using (StreamWriter sw = p.StandardInput)
{
for (int x = 0; x < Args.Length; x++)
{ sw.WriteLine(Args[x]); }
for (int i = 0; !File.Exists(DircControl.buildpath + "Extract/Control.nacp") && i <= 10; i++)
{
Thread.Sleep(2000);
if (i == 10 && !File.Exists(DircControl.buildpath + "Extract/Control.nacp"))
{ MessageBox.Show("Importing Nro data failed, an issue occured with nstool -- refer to logs"); }
}

}
}


// Get Author from extracted Nacp
public static string GetMeta(int Selection)
{
long Patch;
if (Selection == 0) { Patch = 0x0000; } //AppName
else if (Selection == 1) { Patch = 0x0200; } //Author
else if (Selection == 2) { Patch = 0x3060; } //Version
else { Patch = 0x0100; } //Some how failed?

try {
string FilePath = DircControl.buildpath + "Extract/Control.nacp";
bool Complete = false;
int Runs = 0;
byte[] data = new byte[400];
BinaryReader reader = new BinaryReader(new FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.None));
reader.BaseStream.Position = Patch;
while (Complete == false)
{
data[Runs] = reader.ReadByte();
if (data[Runs] == 0x00)
{ Complete = true; }
Runs++;
}
reader.Close();
string result = Encoding.ASCII.GetString(data, 0, Runs - 1);
return result;
}
catch (Exception f)
{ MessageBox.Show(f.Message); return null; }
}


//Pull image and covert as needed
public static void GetIcon()
{ IconImport.IconConvert(DircControl.buildpath + "Extract/Icon.jpg"); }


// Nro Extraction string per OS
public static string SetCommand(string NroName)
{
string Command;
switch (Tools.RunningPlatform())
{
case Tools.Platform.Mac:
Command = DircControl.buildpath + "nstool ";
break;

case Tools.Platform.Linux:
Command = DircControl.buildpath + "nstool ";
break;
default:
Command = DircControl.buildpath + "nstool.exe ";
break;
}
Command += " --type nro --icon " + DircControl.buildpath + "Extract/Icon.jpg --nacp " + DircControl.buildpath + "Extract/Control.nacp " + "\"" + NroName + "\"";
return Command;
}

}
}
1 change: 1 addition & 0 deletions Source/Control/Nacp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace MtX.Control
{
// Makes .nacp from entered information
public class Nacp
{
public string AppName { get; set; }
Expand Down
30 changes: 30 additions & 0 deletions Source/Control/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions Source/Control/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@
<data name="hacbrewpack" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\hacbrewpack;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="hacbrewpackx64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\hacbrewpackx64.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="hacbrewpackx86" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\hacbrewpackx86.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
Expand All @@ -142,4 +139,16 @@
<data name="hacbrewpack_mac" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\hacbrewpack_mac;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="hacbrewpackx64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\hacbrewpackx64.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="nstool" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\nstool.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="nstool_linux" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\nstool_linux;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="nstool_mac" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\nstool_mac;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
Loading

0 comments on commit a816e69

Please sign in to comment.