コード例 #1
0
        public static GameListNACP ParseControlNacp(string Path)
        {
            GameListNACP res = new GameListNACP();

            byte[] NacpData = File.ReadAllBytes(Path);

            string Name      = "";
            string Publisher = "";

            int i = 0;

            foreach (byte b in NacpData)
            {
                if (b != 0x00 && i < 0x200)
                {
                    Name += (char)b;                         // Get the Title Name
                }
                if (b != 0x00 && i >= 0x200 && i < 0x300)
                {
                    Publisher += (char)b;                                       // Get the Publisher Name
                }
                if (i >= 0x300)
                {
                    break;
                }

                ++i;
            }

            res.TitleName = Name;
            res.Publisher = Publisher;

            return(res);
        }
コード例 #2
0
        public static GameListMetaData ParseGameFiles(string FolderPath, string ControlNacpPath = null)
        {
            uint   ACIoOff = 0;
            string TitleID = "";

            string NpdmPath = FolderPath + "\\main.npdm";

            byte[] NpdmData = File.ReadAllBytes(NpdmPath);

            ACIoOff = BitConverter.ToUInt32(NpdmData, 0x70);

            ulong RawTitleID = BitConverter.ToUInt64(NpdmData, (int)ACIoOff + 0x10);

            TitleID = String.Format("0{0:x2}", RawTitleID);

            GameListNACP ControlNacp = new GameListNACP();

            if (ControlNacpPath != null)
            {
                ControlNacp = ParseControlNacp(ControlNacpPath);
            }

            return(new GameListMetaData
            {
                npdm = new GameListNPDM
                {
                    ACIoOff = ACIoOff,
                    TitleID = TitleID
                },
                nacp = ControlNacp
            });
        }