public static void Initialize() { // Create a new dictionary MsbtHolders = new Dictionary <Language, MsbtHolder>(); // Loop over every language foreach (Language language in BlitzUtil.SupportedLanguages) { // Load the corresponding common szs file using (Stream stream = RomResourceLoader.GetRomFile($"/Message/CommonMsg_{language.GetSeadCode()}.release.szs")) { // Get the Sarc archive Sarc sarc = new Sarc(stream); // Create a MsbtHolder MsbtHolders.Add(language, new MsbtHolder(sarc)); } } // Load MapInfo MapInfoEntries = ByamlLoader.GetByamlDeserialized <List <MapInfoEntry> >("/Mush/MapInfo.release.byml"); // Load WeaponInfo_Main WeaponInfoEntries = ByamlLoader.GetByamlDeserialized <List <WeaponInfoEntry> >("/Mush/WeaponInfo_Main.release.byml"); }
public static void Initialize() { // Get the RomConfig RomConfig romConfig = ((JelonzoBotConfiguration)Configuration.LoadedConfiguration).RomConfig; // Load the base and update NCAs NcaWrapper = new NcaWrapper(KeysetManager.GetKeyset(), romConfig.BaseNcaPath, romConfig.UpdateNcaPath); // Create a new pack files dictionary PackFiles = new Dictionary <string, byte[]>(); // Load the pack directory IDirectory packDirectory = NcaWrapper.Romfs.OpenDirectory("/Pack", OpenDirectoryMode.Files); // Read every directory entries foreach (DirectoryEntry directoryEntry in packDirectory.Read()) { // Load the SARC Sarc sarc = new Sarc(GetRomFileFromRomfs(directoryEntry.FullPath)); // Loop over every file foreach (KeyValuePair <string, byte[]> pair in sarc) { // Add this file to the pack files dictionary PackFiles.Add("/" + pair.Key, pair.Value); } } }
public MsbtHolder(Sarc commonSarc) { foreach (KeyValuePair <string, byte[]> pair in commonSarc) { // Load and add this MSBT Msbts.Add(Path.GetFileNameWithoutExtension(pair.Key), LoadMsbt(pair.Value)); } }
public Stream GetFileFromSarc(string cassetteNeme, string directoryNumber, string fileNumber, string pathInArchive) { return(Sarc.GetFileAsStream(GetDZFilePath(cassetteNeme, directoryNumber, fileNumber) + ".sarc2", pathInArchive)); }