mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Remove old testing code
This commit is contained in:
parent
57103c0e0b
commit
e919bcab1b
1 changed files with 0 additions and 99 deletions
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -45,12 +44,6 @@ namespace hactoolnet
|
|||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
//ListSdfs(args);
|
||||
//FileReadTest(args);
|
||||
//ReadNca();
|
||||
//ListSdfs(args);
|
||||
//ReadNcaSdfs(args);
|
||||
}
|
||||
|
||||
private static void ProcessNca(Context ctx)
|
||||
|
@ -176,82 +169,6 @@ namespace hactoolnet
|
|||
|
||||
}
|
||||
|
||||
private static void ListSdfs(string[] args)
|
||||
{
|
||||
var sdfs = LoadSdFs(args);
|
||||
|
||||
Console.WriteLine("Listing NCA files");
|
||||
ListNcas(sdfs);
|
||||
|
||||
Console.WriteLine("Listing titles");
|
||||
ListTitles(sdfs);
|
||||
|
||||
Console.WriteLine("Listing applications");
|
||||
ListApplications(sdfs);
|
||||
|
||||
//DecryptNax0(sdfs, "C0628FB07A89E9050BDA258F74868E8D");
|
||||
//DecryptTitle(sdfs, 0x010023900AEE0000);
|
||||
}
|
||||
|
||||
static void FileReadTest(string[] args)
|
||||
{
|
||||
var sdfs = LoadSdFs(args);
|
||||
var title = sdfs.Titles[0x0100E95004038000];
|
||||
var nca = title.MainNca;
|
||||
var romfsStream = nca.OpenSection(1, false);
|
||||
var romfs = new Romfs(romfsStream);
|
||||
var file = romfs.OpenFile("/stream/voice/us/127/127390101.nop");
|
||||
|
||||
using (var output = new FileStream("127390101.nop", FileMode.Create))
|
||||
{
|
||||
file.CopyTo(output);
|
||||
}
|
||||
}
|
||||
|
||||
static void ReadNca()
|
||||
{
|
||||
var keyset = ExternalKeys.ReadKeyFile("keys.txt", "titlekeys.txt");
|
||||
using (var file = new FileStream("27eeccfe5f6e7637352273bc46ab97e4.nca", FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
var nca = new Nca(keyset, file, false);
|
||||
var romfsStream = nca.OpenSection(1, false);
|
||||
|
||||
var romfs = new Romfs(romfsStream);
|
||||
var bfstm = romfs.OpenFile("/Sound/Resource/Stream/Demo149_1_SoundTrack.bfstm");
|
||||
|
||||
using (var progress = new ProgressBar())
|
||||
using (var output = new FileStream("Demo149_1_SoundTrack.bfstm", FileMode.Create))
|
||||
{
|
||||
var watch = Stopwatch.StartNew();
|
||||
bfstm.CopyStream(output, bfstm.Length, progress);
|
||||
watch.Stop();
|
||||
progress.LogMessage(watch.Elapsed.TotalSeconds.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ReadNcaSdfs(string[] args)
|
||||
{
|
||||
var sdfs = LoadSdFs(args);
|
||||
var nca = sdfs.Ncas["8EE79C7AB0F16737BC50F049DFDBB595"];
|
||||
var romfsStream = nca.OpenSection(1, false);
|
||||
var romfs = new Romfs(romfsStream);
|
||||
}
|
||||
|
||||
static void DecryptNax0(SdFs sdFs, string name)
|
||||
{
|
||||
if (!sdFs.Ncas.ContainsKey(name)) return;
|
||||
var nca = sdFs.Ncas[name];
|
||||
using (var output = new FileStream($"{nca.NcaId}.nca", FileMode.Create))
|
||||
using (var progress = new ProgressBar())
|
||||
{
|
||||
progress.LogMessage($"Title ID: {nca.Header.TitleId:X16}");
|
||||
progress.LogMessage($"Writing {nca.NcaId}.nca");
|
||||
nca.Stream.Position = 0;
|
||||
nca.Stream.CopyStream(output, nca.Stream.Length, progress);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SaveTitle(Context ctx, SdFs switchFs)
|
||||
{
|
||||
var id = ctx.Options.TitleId;
|
||||
|
@ -282,22 +199,6 @@ namespace hactoolnet
|
|||
}
|
||||
}
|
||||
|
||||
static SdFs LoadSdFs(string[] args)
|
||||
{
|
||||
var keyset = ExternalKeys.ReadKeyFile(args[0], "titlekeys.txt");
|
||||
keyset.SetSdSeed(args[1].ToBytes());
|
||||
var sdfs = new SdFs(keyset, args[2]);
|
||||
return sdfs;
|
||||
}
|
||||
|
||||
static void ListNcas(SdFs sdfs)
|
||||
{
|
||||
foreach (Nca nca in sdfs.Ncas.Values.OrderBy(x => x.Header.TitleId))
|
||||
{
|
||||
Console.WriteLine($"{nca.Header.TitleId:X16} {nca.Header.ContentType.ToString().PadRight(10, ' ')} {nca.NcaId}");
|
||||
}
|
||||
}
|
||||
|
||||
static void ListTitles(SdFs sdfs)
|
||||
{
|
||||
foreach (var title in sdfs.Titles.Values.OrderBy(x => x.Id))
|
||||
|
|
Loading…
Reference in a new issue