public static TitleInfo Resolve(char[] productChars, char[] developerChars) { var info = new TitleInfo(); //CTR-P-#$$% //0123456789 info.ProductCode = new string(productChars); if (productChars != null) { var type = productChars[6]; switch (type) { case 'A': info.Type = "Application"; break; case 'C': info.Type = "CTR"; break; case 'H': info.Type = "Dev"; break; } var regionCode = productChars[9]; switch (regionCode) { case 'E': info.Region = "USA"; break; case 'P': info.Region = "EUR"; break; case 'J': info.Region = "JPN"; break; case 'F': info.Region = "FRA"; break; case 'Z': info.Region = "ENG"; break; } var productCode = productChars[7].ToString() + productChars[8]; info.Title = type == 'A' ? TitleDatabase.Get("ProductCodes", productCode) : productCode; } if (developerChars != null) { var developerCode = developerChars[0].ToString() + developerChars[1]; info.Developer = TitleDatabase.Get("MakerCodes", developerCode); } return info; }
public bool Open(Stream fs) { PlainRegion = new CXIPlaingRegion(); byte[] plainRegionBuffer; OffsetInNCSD = fs.Position; Header = MarshalUtil.ReadStruct<CXIHeader>(fs); // get Plaing Region fs.Seek(OffsetInNCSD + Header.PlainRegionOffset * 0x200, SeekOrigin.Begin); plainRegionBuffer = new byte[Header.PlainRegionSize * 0x200]; fs.Read(plainRegionBuffer, 0, plainRegionBuffer.Length); PlainRegion = CXIHeader.getPlainRegionStringsFrom(plainRegionBuffer); GetNCCHDetails(); // byte[] exhBytes = new byte[2048]; // fs.Read(exhBytes, 0, exhBytes.Length); //TODO: read extended header // Array.Reverse(exh); TitleInfo = TitleInfo.Resolve(Header.ProductCode, Header.MakerCode); return true; }