public static LayoutFilePatch[] GetFix(string LayoutName, PatchTemplate context)
        {
            if (context.FirmName == "9.0" && context.NXThemeName == "lock")
            {
                if (LayoutName.ToLower().Contains("clear lockscreen"))
                {
                    return(JsonConvert.DeserializeObject <LayoutPatch>(ClearLock9Fix).Files);
                }
            }

            if (context.NXThemeName == "home")
            {
                if (LayoutName.ToLower().Contains("dogelayout") || LayoutName.ToLower().Contains("clearlayout"))
                {
                    return(JsonConvert.DeserializeObject <LayoutPatch>(DogeLayoutFix).Files);
                }
                else if (LayoutName.ToLower().Contains("diamond layout"))
                {
                    return(JsonConvert.DeserializeObject <LayoutPatch>(DiamondFix).Files);
                }
                else if (LayoutName.ToLower().Contains("small compact"))
                {
                    return(JsonConvert.DeserializeObject <LayoutPatch>(CompactFix).Files);
                }
            }
            return(null);
        }
        public bool PatchLayouts(LayoutPatch Patch, string PartName, PatchTemplate context)
        {
            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);

            int fixVer = 0;

            if (context != null)
            {
                if (context.NXThemeName == "home")
                {
                    fixVer = 8;
                }
                if (context.FirmName == "9.0")
                {
                    fixVer = 9;
                }
            }
            if (fixVer >= 8 && !Patch.Ready8X)
            {
                var extra = NewFirmFixes.GetFix(Patch.PatchName, context);
                if (extra != null)
                {
                    Files.AddRange(extra);
                }
            }

            foreach (var p in Files)
            {
                var res = PatchSingleLayout(p);
                if (!res)
                {
                    return(res);
                }
            }
            return(true);
        }
        public bool PatchLayouts(LayoutPatch Patch, PatchTemplate context)
        {
            int fixVer = 0;

            if (context != null)
            {
                if (context.NXThemeName == "home")
                {
                    fixVer = 8;
                }
                if (context.FirmName == "9.0")
                {
                    fixVer = 9;
                }
            }

            return(PatchLayouts(Patch, context?.NXThemeName ?? "", context?.FirmName ?? "", fixVer));
        }
Beispiel #4
0
        public static BflytFile.PatchResult PatchBgLayouts(SARCExt.SarcData sarc, PatchTemplate template)
        {
            BflytFile BflytFromSzs(string name) => new BflytFile(sarc.Files[name]);

            BflytFile MainFile = BflytFromSzs(template.MainLayoutName);
            var       res      = MainFile.PatchBgLayout(template);

            if (res == BflytFile.PatchResult.OK)
            {
                sarc.Files[template.MainLayoutName] = MainFile.SaveFile();
                foreach (var f in template.SecondaryLayouts)
                {
                    BflytFile curTarget = BflytFromSzs(f);
                    curTarget.PatchTextureName(template.MaintextureName, template.SecondaryTexReplace);
                    sarc.Files[f] = curTarget.SaveFile();
                }
            }
            return(res);
        }
Beispiel #5
0
        public static BflytFile.PatchResult PatchBgLayouts(SARCExt.SarcData sarc, PatchTemplate template)
        {
            BflytFile BflytFromSzs(string name) => new BflytFile(sarc.Files[name]);

            var layouts = sarc.Files.Keys.Where(x => x.StartsWith("blyt/") && x.EndsWith(".bflyt") && x != template.MainLayoutName).ToArray();

            foreach (var f in layouts)
            {
                BflytFile curTarget = BflytFromSzs(f);
                if (curTarget.PatchTextureName(template.MaintextureName, template.SecondaryTexReplace))
                {
                    sarc.Files[f] = curTarget.SaveFile();
                }
            }
            BflytFile MainFile = BflytFromSzs(template.MainLayoutName);
            var       res      = MainFile.PatchBgLayout(template);

            sarc.Files[template.MainLayoutName] = MainFile.SaveFile();
            return(res);
        }
Beispiel #6
0
 public static LayoutFilePatch[] GetFixLegacy(string LayoutName, PatchTemplate context) => GetFixLegacy(LayoutName, context.PatchRevision, context.NXThemeName);
Beispiel #7
0
        public static BflytFile.PatchResult PatchBntx(SARCExt.SarcData sarc, DDSEncoder.DDSLoadResult DDS, PatchTemplate targetPatch)
        {
            QuickBntx q = new QuickBntx(new BinaryDataReader(new MemoryStream(sarc.Files[@"timg/__Combined.bntx"])));

            if (q.Rlt.Length != 0x80)
            {
                return(BflytFile.PatchResult.Fail);
            }
            q.ReplaceTex(targetPatch.MaintextureName, DDS);
            DDS = null;
            sarc.Files[@"timg/__Combined.bntx"] = null;
            sarc.Files[@"timg/__Combined.bntx"] = q.Write();
            return(BflytFile.PatchResult.OK);
        }
Beispiel #8
0
 public bool PatchLayouts(LayoutPatch Patch, PatchTemplate context) =>
 PatchLayouts(Patch, context?.NXThemeName ?? "", context?.PatchRevision ?? 0);