コード例 #1
0
        public bool PatchLayouts(LayoutPatch Patch, string PartName, int PatchRevision)
        {
            if (PartName == "home" && Patch.PatchAppletColorAttrib)
            {
                PatchBntxTextureAttribs(new Tuple <string, uint>("RdtIcoPvr_00^s", 0x5050505),
                                        new Tuple <string, uint>("RdtIcoNews_00^s", 0x5050505), new Tuple <string, uint>("RdtIcoNews_01^s", 0x5050505),
                                        new Tuple <string, uint>("RdtIcoSet^s", 0x5050505), new Tuple <string, uint>("RdtIcoShop^s", 0x5050505),
                                        new Tuple <string, uint>("RdtIcoCtrl_00^s", 0x5050505), new Tuple <string, uint>("RdtIcoCtrl_01^s", 0x5050505),
                                        new Tuple <string, uint>("RdtIcoCtrl_02^s", 0x5050505), new Tuple <string, uint>("RdtIcoPwrForm^s", 0x5050505));
            }

            List <LayoutFilePatch> Files = new List <LayoutFilePatch>();

            Files.AddRange(Patch.Files);

            LayoutFilePatch[] extra;
            //Legacy fixes based on name and version
            if (PatchRevision != 0 && Patch.UsesOldFixes)
            {
                extra = NewFirmFixes.GetFixLegacy(Patch.PatchName, PatchRevision, PartName);
                if (extra != null)
                {
                    Files.AddRange(extra);
                }
            }
            //Modern fixes based on layout ID
            else if (Patch.ID != null)
            {
                extra = NewFirmFixes.GetFix(PartName, Patch.ID, PatchRevision);
                if (extra != null)
                {
                    Files.AddRange(extra);
                }
            }

            foreach (var p in Files)
            {
                var res = PatchSingleLayout(p);
                if (!res)
                {
                    return(res);
                }
            }
            return(true);
        }
コード例 #2
0
        private bool PatchLayouts(LayoutPatch Patch, string PartName)
        {
            var fw = FirmwareDetection.Detect(PartName, sarc);

            if (PartName == "home" && Patch.PatchAppletColorAttrib)
            {
                PatchBntxTextureAttribs(new Tuple <string, uint>("RdtIcoPvr_00^s", 0x5050505),
                                        new Tuple <string, uint>("RdtIcoNews_00^s", 0x5050505), new Tuple <string, uint>("RdtIcoNews_01^s", 0x5050505),
                                        new Tuple <string, uint>("RdtIcoSet^s", 0x5050505), new Tuple <string, uint>("RdtIcoShop^s", 0x5050505),
                                        new Tuple <string, uint>("RdtIcoCtrl_00^s", 0x5050505), new Tuple <string, uint>("RdtIcoCtrl_01^s", 0x5050505),
                                        new Tuple <string, uint>("RdtIcoCtrl_02^s", 0x5050505), new Tuple <string, uint>("RdtIcoPwrForm^s", 0x5050505));
            }

            List <LayoutFilePatch> Files = new List <LayoutFilePatch>();

            Files.AddRange(Patch.Files);

            LayoutFilePatch[] extra;
            //Legacy fixes based on name and version
            if (fw != FirmwareDetection.Firmware.Invariant && Patch.UsesOldFixes)
            {
                extra = NewFirmFixes.GetFixLegacy(Patch.PatchName, fw, PartName);
                if (extra != null)
                {
                    Files.AddRange(extra);
                }
            }
            //Modern fixes based on layout ID
            else if (Patch.ID != null)
            {
                extra = NewFirmFixes.GetFix(PartName, Patch.ID, fw);
                if (extra != null)
                {
                    Files.AddRange(extra);
                }
            }

            foreach (var p in Files)
            {
                var res = PatchSingleLayout(p);
                if (!res)
                {
                    return(res);
                }
            }

            List <AnimFilePatch> Anims = new List <AnimFilePatch>();

            if (Patch.Anims != null)
            {
                Anims.AddRange(Patch.Anims);
            }

            if (PartName == "home")
            {
                AnimFilePatch[] animExtra = null;
                if (Patch.HideOnlineBtn ?? true)
                {
                    animExtra = NewFirmFixes.GetNoOnlineButtonFix(fw);
                }
                else if (NewFirmFixes.ShouldApplyAppletPositionFix(Anims))
                {
                    animExtra = NewFirmFixes.GetAppletsPositionFix(fw);
                }

                if (animExtra != null)
                {
                    Anims.AddRange(animExtra);
                }
            }

            if (Anims.Any())
            {
                // The bflan version varies between firmwares, load a file from the list to detect the right one
                BflanFile b             = new BflanFile(sarc.Files[Anims[0].FileName]);
                var       TargetVersion = b.Version;
                b = null;

                foreach (var p in Anims)
                {
                    if (!sarc.Files.ContainsKey(p.FileName))
                    {
                        continue;
                    }

                    var n = BflanSerializer.FromJson(p.AnimJson);
                    n.Version              = TargetVersion;
                    n.byteOrder            = Syroot.BinaryData.ByteOrder.LittleEndian;
                    sarc.Files[p.FileName] = n.WriteFile();
                }
            }

            return(true);
        }