SarcLibrary 2.0.2
See the version list below for details.
dotnet add package SarcLibrary --version 2.0.2
NuGet\Install-Package SarcLibrary -Version 2.0.2
<PackageReference Include="SarcLibrary" Version="2.0.2" />
paket add SarcLibrary --version 2.0.2
#r "nuget: SarcLibrary, 2.0.2"
// Install SarcLibrary as a Cake Addin #addin nuget:?package=SarcLibrary&version=2.0.2 // Install SarcLibrary as a Cake Tool #tool nuget:?package=SarcLibrary&version=2.0.2
SarcLibrary
Nintendo SEAD Archive Library | Based on oead/sarc by Léo Lam
SarcLibrary has been tested to parse and re-write (almost) every SARC file found in Breath of the Wild byte-perfectly.
Usage
Reading a Sarc File
// Read from File Path
SarcFile sarc = SarcFile.FromBinary("content/Pack/Bootup.pack");
// Read from a byte[]
// Do not use with File.ReadAllBytes(), use
// a Stream instead.
SarcFile sarc = SarcFile.FromBinary("content/Pack/Bootup.pack");
byte[] decompressedData = Yaz0.Decompress(sarc["GameData/gamedata.ssarc"]);
SarcFile nestedSarc = SarcFile.FromBinary(decompressedData);
// Read from a Stream
using FileStream fs = File.OpenRead("content/Pack/Bootup.pack");
SarcFile sarc = new(fs);
Writing a Sarc File
// Write to a File
sarc.ToBinary("content/Pack/Bootup.pack");
// Write to a byte[]
byte[] data = sarc.ToBinary();
// Write to a Stream
using MemoryStream ms = new();
sarc.ToBinary(ms);
Sarc Tools
// Extract to a Directory
await sarc.ExtractTodirectory("path/to/output");
// Load from a Directory
SarcFile sarc = SarcFile.LoadFromDirectory("path/to/input", searchPattern: "*.*", searchOption: SearchOption.AllDirectories)
Benchmarks
Function | Elapsed | Allocated |
---|---|---|
Read TitleBG (75MB, BigEndian) | 29.16 ms | 75,307 KB |
Read TitleBG (143MB. LittleEndian) | 51.02 ms | 143,854 KB |
Write TitleBG (75MB, BigEndian) | 40.90 ms | 110 KB |
Write TitleBG (143MB, LittleEndian) | 127.49 ms | 110 KB |
Extract TitleBG (75MB, BigEndian) | 133.18 ms | 732 KB |
Extract TitleBG (143MB, LittleEndian) | 170.64 ms | 726 KB |
Load from Folder (409 Files, ~73MB) | 40.61 ms | 73,365 KB |
Load from Folder (409 Files, ~140MB) | 68.11 ms | 143,910 KB |
Benchmarks run on an AMD Ryzen 7 3700X
CPU, 64GB (4 x 16GB) of VENGEANCE® DDR4 DRAM 3200MHz C16
memory, and a Kingston KC3000 PCIe 4.0 NVMe M.2
SSD
Byte-Perfect Exceptions
Exceptions to every file being parsed and re-written byte-perfectly are a the sbeventpack archives in content/Event
, which seems to use a mix of alignments. During tests, I found offsets of 0x100 and 0x8 that had varying reliability.<br>
These odd occurrences are also ignored in oead/sarc
. Luckily, the game does not seem to care if these files are aligned to 4-bytes, so the error is not detrimental (at least not in BOTW).
Install
NuGet
Install-Package SarcLibrary
Build From Source
git clone https://github.com/NCF-Library/SarcLibrary.git
dotnet build SarcLibrary
Credit
- ArchLeaders: Optimized C# SARC implementation based on oead by Léo Lam
- exelix: Original C# SARC implementation
- Léo Lam: C++ SARC implementation
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SarcLibrary:
Package | Downloads |
---|---|
TotkCommon
Simple primitives library for common TotK operations |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.2.0 | 89 | 10/25/2024 |
3.1.3 | 886 | 5/1/2024 |
3.1.2 | 264 | 4/6/2024 |
3.1.1 | 137 | 4/5/2024 |
3.1.0 | 139 | 3/15/2024 |
3.0.4 | 290 | 1/26/2024 |
3.0.3 | 116 | 1/19/2024 |
3.0.2 | 129 | 1/16/2024 |
3.0.1 | 117 | 1/16/2024 |
3.0.0 | 185 | 12/13/2023 |
2.0.2 | 613 | 12/31/2022 |
2.0.1 | 289 | 12/30/2022 |
2.0.0 | 296 | 12/22/2022 |
1.0.6 | 492 | 8/18/2022 |
1.0.5 | 481 | 6/20/2022 |
1.0.4 | 426 | 6/16/2022 |
1.0.3 | 422 | 6/8/2022 |
1.0.1 | 411 | 6/5/2022 |
1.0.0 | 412 | 6/5/2022 |