mirror of
https://github.com/exelix11/SwitchThemeInjector.git
synced 2024-12-05 00:46:30 +00:00
11.0 patch and layout fixes for the installer
This commit is contained in:
parent
f7076ae497
commit
74aa5a737c
@ -217,14 +217,17 @@ namespace SwitchThemes.Common
|
||||
if (Patch.Anims != null)
|
||||
Anims.AddRange(Patch.Anims);
|
||||
|
||||
AnimFilePatch[] animExtra = null;
|
||||
if (Patch.HideOnlineBtn ?? true)
|
||||
animExtra = NewFirmFixes.GetNoOnlineButtonFix(fw);
|
||||
else if (!Anims.Any(x => x.FileName == "anim/RdtBase_SystemAppletPos.bflan"))
|
||||
animExtra = NewFirmFixes.GetAppletsPositionFix(fw);
|
||||
if (PartName == "home")
|
||||
{
|
||||
AnimFilePatch[] animExtra = null;
|
||||
if (Patch.HideOnlineBtn ?? true)
|
||||
animExtra = NewFirmFixes.GetNoOnlineButtonFix(fw);
|
||||
else if (!Anims.Any(x => x.FileName == "anim/RdtBase_SystemAppletPos.bflan"))
|
||||
animExtra = NewFirmFixes.GetAppletsPositionFix(fw);
|
||||
|
||||
if (animExtra != null)
|
||||
Anims.AddRange(animExtra);
|
||||
if (animExtra != null)
|
||||
Anims.AddRange(animExtra);
|
||||
}
|
||||
|
||||
if (Anims.Any())
|
||||
{
|
||||
|
Binary file not shown.
@ -5,7 +5,6 @@
|
||||
using namespace std;
|
||||
|
||||
namespace Settings {
|
||||
bool UseAnimations = true;
|
||||
bool UseIcons = true;
|
||||
bool UseCommon = true;
|
||||
};
|
||||
@ -25,9 +24,8 @@ void SettingsPage::Render(int X, int Y)
|
||||
ImGui::TextUnformatted("NXTheme settings");
|
||||
ImGui::PopFont();
|
||||
ImGui::TextWrapped("These settings only apply for installing nxthemes and are not saved, you have to switch them back every time you launch this app");
|
||||
ImGui::Checkbox("Enable animations", &Settings::UseAnimations);
|
||||
PAGE_RESET_FOCUS;
|
||||
ImGui::Checkbox("Enable custom icons", &Settings::UseIcons);
|
||||
PAGE_RESET_FOCUS;
|
||||
ImGui::Checkbox("Enable extra layouts (eg. common.szs)", &Settings::UseCommon);
|
||||
ImGui::NewLine();
|
||||
|
||||
|
@ -324,20 +324,11 @@ private:
|
||||
DialogBlocking("The provided layout is not compatible with " + PartName + "\nThe theme was not installed");
|
||||
return false;
|
||||
}
|
||||
Patcher.SetPatchAnimations(Settings::UseAnimations);
|
||||
if (!Patcher.PatchLayouts(patch, PartName))
|
||||
{
|
||||
DialogBlocking("PatchLayouts failed for " + PartName + "\nThe theme was not installed");
|
||||
return false;
|
||||
}
|
||||
if (Settings::UseAnimations)
|
||||
{
|
||||
if (!Patcher.PatchAnimations(patch.Anims))
|
||||
{
|
||||
DialogBlocking("PatchAnimations failed for " + PartName + "\nThe theme was not installed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,11 @@ using nlohmann::json;
|
||||
#define get_s(s, f) j.at(s).get_to(f)
|
||||
#define get(n) get_s(#n, p.n)
|
||||
|
||||
#define get_if_s_else(s, f, def) do { if(j.count(s)) j.at(s).get_to(f); else def; } while (0)
|
||||
#define get_if_s(s, f) if(j.count(s)) j.at(s).get_to(f)
|
||||
|
||||
#define get_if(n) get_if_s(#n, p.n)
|
||||
#define get_if_else(n, def) get_if_s_else(#n, p.n, p.n = def)
|
||||
|
||||
template<typename T>
|
||||
static inline std::optional<T> GetOptionalHelper(const json& j, const char* name)
|
||||
@ -142,13 +145,14 @@ void from_json(const json& j, AnimFilePatch& p) {
|
||||
|
||||
void from_json(const json& j, LayoutPatch& p) {
|
||||
p = {};
|
||||
get(PatchName);
|
||||
get_if(PatchName);
|
||||
get_if(AuthorName);
|
||||
get_if(Files);
|
||||
get_if(Anims);
|
||||
get_if(PatchAppletColorAttrib);
|
||||
get_if(ID);
|
||||
get_if(Obsolete_Ready8X);
|
||||
get_if_else(HideOnlineBtn, true);
|
||||
get_if_s("Ready8X", p.Obsolete_Ready8X);
|
||||
}
|
||||
|
||||
#undef get_s
|
||||
@ -177,15 +181,7 @@ vector<PatchTemplate> Patches::DefaultTemplates{
|
||||
{ "P_Bg_00" },
|
||||
"White1x1^r" },
|
||||
//Residentmenu:
|
||||
PatchTemplate{ "home menu", "ResidentMenu.szs", "0100000000001000", ">= 8.0",
|
||||
{ "blyt/IconError.bflyt", "blyt/RdtIconPromotion.bflyt" },
|
||||
{ "anim/RdtBtnShop_LimitB.bflan" },
|
||||
"blyt/BgNml.bflyt",
|
||||
"White1x1A128^s",
|
||||
"exelixBG",
|
||||
{ "P_Bg_00" },
|
||||
"White1x1A64^t" },
|
||||
PatchTemplate{ "home menu", "ResidentMenu.szs", "0100000000001000", ">= 6.0, < 8.0",
|
||||
PatchTemplate{ "home menu", "ResidentMenu.szs", "0100000000001000", ">= 6.0",
|
||||
{ "blyt/IconError.bflyt" },
|
||||
{ "anim/RdtBtnShop_LimitB.bflan" },
|
||||
"blyt/BgNml.bflyt",
|
||||
|
@ -6,6 +6,15 @@ using namespace std;
|
||||
|
||||
namespace NewFirmFixes
|
||||
{
|
||||
const static string NoOnlineButton = "{\"PatchName\":\"NoOnline11\",\"Anims\":[{\"FileName\":\"anim/RdtBase_SystemAppletPos.bflan\",\"AnimJson\":\"{\\\"LittleEndian\\\":true,\\\"Version\\\":150994944,\\\"pat1\\\":{\\\"AnimationOrder\\\":6,\\\"Name\\\":\\\"SystemAppletPos\\\",\\\"ChildBinding\\\":190,\\\"Groups\\\":[\\\"G_System\\\"],\\\"Unk_StartOfFile\\\":0,\\\"Unk_EndOfFile\\\":0,\\\"Unk_EndOfHeader\\\":\\\"AL8AAAAAAA==\\\"},\\\"pai1\\\":{\\\"FrameSize\\\":1,\\\"Flags\\\":0,\\\"Textures\\\":[],\\\"Entries\\\":[]}}\"}]}";
|
||||
|
||||
/*
|
||||
The RdtBase_SystemAppletPos animation on 11.0 will change the position and size of the applet buttons root element, to make layout developers' lives easier
|
||||
this is automatically patched away. It's possible to override this by including that file in the layout json
|
||||
*/
|
||||
const static string NoMoveApplets11 = "{\"PatchName\":\"G_SystemNoMove11.0\",\"Anims\":[{\"FileName\":\"anim/RdtBase_SystemAppletPos.bflan\",\"AnimJson\":\"{\\\"LittleEndian\\\":true,\\\"Version\\\":150994944,\\\"pat1\\\":{\\\"AnimationOrder\\\":6,\\\"Name\\\":\\\"SystemAppletPos\\\",\\\"ChildBinding\\\":190,\\\"Groups\\\":[\\\"G_System\\\"],\\\"Unk_StartOfFile\\\":0,\\\"Unk_EndOfFile\\\":0,\\\"Unk_EndOfHeader\\\":\\\"AL8AAAAAAA==\\\"},\\\"pai1\\\":{\\\"FrameSize\\\":1,\\\"Flags\\\":0,\\\"Textures\\\":[],\\\"Entries\\\":[{\\\"Name\\\":\\\"L_BtnLR\\\",\\\"Target\\\":0,\\\"Tags\\\":[{\\\"Unknown\\\":0,\\\"TagType\\\":\\\"FLVI\\\",\\\"Entries\\\":[{\\\"Index\\\":0,\\\"AnimationTarget\\\":0,\\\"DataType\\\":1,\\\"KeyFrames\\\":[{\\\"Frame\\\":0.0,\\\"Value\\\":0.0,\\\"Blend\\\":0.0},{\\\"Frame\\\":1.0,\\\"Value\\\":1.0,\\\"Blend\\\":0.0}],\\\"FLEUUnknownInt\\\":0,\\\"FLEUEntryName\\\":\\\"\\\"}]}],\\\"UnkwnownData\\\":\\\"\\\"}]}}\"}]}";
|
||||
|
||||
|
||||
const static string DogeLayoutFix = "{\"PatchName\":\"DogeLayout 8.x fix\",\"AuthorName\":\"autoDiff\",\"Files\":[{\"FileName\":\"blyt/HudTime.bflyt\",\"Patches\":[{\"PaneName\":\"N_AMPM\",\"Position\":{\"X\":30,\"Y\":-1,\"Z\":0},\"Scale\":{\"X\":0.9,\"Y\":0.9}}]},{\"FileName\":\"blyt/RdtBtnFullLauncher.bflyt\",\"Patches\":[{\"PaneName\":\"N_Tip\",\"Scale\":{\"X\":1.1,\"Y\":1.1}},{\"PaneName\":\"B_Hit\",\"Size\":{\"X\":80,\"Y\":80}}]},{\"FileName\":\"blyt/Cursor3.bflyt\",\"Patches\":[{\"PaneName\":\"P_Main\",\"UsdPatches\":[{\"PropName\":\"S_BorderSize\",\"PropValues\":[\"7\"],\"type\":2}]},{\"PaneName\":\"P_Grow\",\"UsdPatches\":[{\"PropName\":\"S_BorderSize\",\"PropValues\":[\"7\"],\"type\":2}]}]},{\"FileName\":\"blyt/RdtBtnMyPage.bflyt\",\"Patches\":[{\"PaneName\":\"N_Tip\",\"Position\":{\"X\":125,\"Y\":0,\"Z\":0}},{\"PaneName\":\"B_Hit\",\"Scale\":{\"X\":1.428571,\"Y\":1.428571},\"Size\":{\"X\":40,\"Y\":40}}]},{\"FileName\":\"blyt/RdtBtnIconGame.bflyt\",\"Patches\":[{\"PaneName\":\"RootPane\",\"Scale\":{\"X\":0.5,\"Y\":0.5}},{\"PaneName\":\"P_InnerCursor\",\"Visible\":false},{\"PaneName\":\"N_BtnFocusKey\",\"Size\":{\"X\":259,\"Y\":259}},{\"PaneName\":\"N_Tip\",\"Scale\":{\"X\":1.1,\"Y\":1.1}},{\"PaneName\":\"B_Hit\",\"Scale\":{\"X\":2,\"Y\":2},\"Size\":{\"X\":132,\"Y\":132}}]},{\"FileName\":\"blyt/RdtBase.bflyt\",\"Patches\":[{\"PaneName\":\"N_ScrollArea\",\"Position\":{\"X\":0,\"Y\":-218,\"Z\":0},\"Scale\":{\"X\":1,\"Y\":0.5},\"Size\":{\"X\":1300,\"Y\":322}},{\"PaneName\":\"N_ScrollWindow\",\"Position\":{\"X\":0,\"Y\":-218,\"Z\":0},\"Size\":{\"X\":100000,\"Y\":322}},{\"PaneName\":\"T_Blank\",\"Position\":{\"X\":0,\"Y\":197,\"Z\":0}},{\"PaneName\":\"N_GameRoot\",\"Position\":{\"X\":-530,\"Y\":-218,\"Z\":0},\"Scale\":{\"X\":0.00001,\"Y\":1}},{\"PaneName\":\"N_Game\",\"Position\":{\"X\":0,\"Y\":0,\"Z\":0},\"Scale\":{\"X\":100000,\"Y\":1}},{\"PaneName\":\"N_Icon_01\",\"Position\":{\"X\":135,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_02\",\"Position\":{\"X\":270,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_03\",\"Position\":{\"X\":405,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_04\",\"Position\":{\"X\":540,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_05\",\"Position\":{\"X\":675,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_06\",\"Position\":{\"X\":810,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_07\",\"Position\":{\"X\":945,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_08\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_09\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_10\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_11\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_12\",\"Position\":{\"X\":1080,\"Y\":0,\"Z\":0},\"Scale\":{\"X\":1,\"Y\":1}},{\"PaneName\":\"L_BtnFlc\",\"Scale\":{\"X\":0.5,\"Y\":0.5}}]},{\"FileName\":\"blyt/Hud.bflyt\",\"Patches\":[{\"PaneName\":\"N_Time\",\"Size\":{\"X\":12,\"Y\":30}},{\"PaneName\":\"L_Time\",\"Position\":{\"X\":-18,\"Y\":0,\"Z\":0}}]}]}";
|
||||
const static string DiamondFix = "{\"PatchName\":\"Diamond 8 fix\",\"AuthorName\":\"akai\",\"Files\":[{\"FileName\":\"blyt/RdtBtnFullLauncher.bflyt\",\"Patches\":[{\"PaneName\":\"N_Root\",\"Rotation\":{\"X\":0,\"Y\":0,\"Z\":45}}]},{\"FileName\":\"blyt/RdtBtnIconGame.bflyt\",\"Patches\":[{\"PaneName\":\"RootPane\",\"Scale\":{\"X\":0.37,\"Y\":0.37}},{\"PaneName\":\"B_Hit\",\"Scale\":{\"X\":3,\"Y\":3},\"Size\":{\"X\":97.68,\"Y\":97.68}}]},{\"FileName\":\"blyt/RdtBase.bflyt\",\"Patches\":[{\"PaneName\":\"N_ScrollArea\",\"Position\":{\"X\":-30,\"Y\":-200,\"Z\":0},\"Size\":{\"X\":1300,\"Y\":322}},{\"PaneName\":\"N_ScrollWindow\",\"Position\":{\"X\":-30,\"Y\":-200,\"Z\":0},\"Size\":{\"X\":1080,\"Y\":322}},{\"PaneName\":\"N_GameRoot\",\"Position\":{\"X\":200,\"Y\":-195,\"Z\":0},\"Scale\":{\"X\":0.00001,\"Y\":1}},{\"PaneName\":\"N_Game\",\"Position\":{\"X\":0,\"Y\":0,\"Z\":0},\"Scale\":{\"X\":100000,\"Y\":1}},{\"PaneName\":\"N_Icon_01\",\"Position\":{\"X\":140,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_02\",\"Position\":{\"X\":280,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_03\",\"Position\":{\"X\":68,\"Y\":73,\"Z\":0}},{\"PaneName\":\"N_Icon_04\",\"Position\":{\"X\":208,\"Y\":73,\"Z\":0}},{\"PaneName\":\"N_Icon_05\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_06\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_07\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_08\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_09\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_10\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_11\",\"Position\":{\"X\":1,\"Y\":99999,\"Z\":0}},{\"PaneName\":\"N_Icon_12\",\"Position\":{\"X\":348,\"Y\":73,\"Z\":0}},{\"PaneName\":\"L_BtnFlc\",\"Scale\":{\"X\":0.37,\"Y\":0.37}},{\"PaneName\":\"N_System\",\"Position\":{\"X\":-600,\"Y\":-250,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_00\",\"Position\":{\"X\":-247,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_01\",\"Position\":{\"X\":-175,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_02\",\"Position\":{\"X\":-103,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_03\",\"Position\":{\"X\":-31,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_04\",\"Position\":{\"X\":41,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_05\",\"Position\":{\"X\":113,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_06\",\"Position\":{\"X\":185,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_Hud\",\"Position\":{\"X\":-300,\"Y\":-325,\"Z\":0}}]},{\"FileName\":\"blyt/Hud.bflyt\",\"Patches\":[{\"PaneName\":\"N_Time\",\"Position\":{\"X\":10,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_Time\",\"Position\":{\"X\":0,\"Y\":0,\"Z\":0}}]}]}";
|
||||
const static string CompactFix = "{\"PatchName\":\"Compact 8 fix\",\"AuthorName\":\"akai\",\"Files\":[{\"FileName\":\"blyt/RdtBtnFullLauncher.bflyt\",\"Patches\":[{\"PaneName\":\"N_Root\",\"Rotation\":{\"X\":0,\"Y\":0,\"Z\":45}}]},{\"FileName\":\"blyt/RdtBtnIconGame.bflyt\",\"Patches\":[{\"PaneName\":\"RootPane\",\"Scale\":{\"X\":0.37,\"Y\":0.37}},{\"PaneName\":\"B_Hit\",\"Scale\":{\"X\":3,\"Y\":3},\"Size\":{\"X\":97.68,\"Y\":97.68}}]},{\"FileName\":\"blyt/RdtBase.bflyt\",\"Patches\":[{\"PaneName\":\"N_ScrollArea\",\"Position\":{\"X\":0,\"Y\":-280,\"Z\":0},\"Scale\":{\"X\":1,\"Y\":0.5},\"Size\":{\"X\":1300,\"Y\":322}},{\"PaneName\":\"N_ScrollWindow\",\"Position\":{\"X\":0,\"Y\":-280,\"Z\":0},\"Scale\":{\"X\":1,\"Y\":0.5},\"Size\":{\"X\":1080,\"Y\":322}},{\"PaneName\":\"N_GameRoot\",\"Position\":{\"X\":-50,\"Y\":-230,\"Z\":0},\"Scale\":{\"X\":0.000001,\"Y\":1}},{\"PaneName\":\"N_Game\",\"Position\":{\"X\":0,\"Y\":0,\"Z\":0},\"Scale\":{\"X\":1000000,\"Y\":1}},{\"PaneName\":\"N_Icon_01\",\"Position\":{\"X\":100,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_02\",\"Position\":{\"X\":200,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_03\",\"Position\":{\"X\":300,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_04\",\"Position\":{\"X\":400,\"Y\":0,\"Z\":0}},{\"PaneName\":\"N_Icon_05\",\"Position\":{\"X\":500,\"Y\":0,\"Z\":0},\"Visible\":true},{\"PaneName\":\"N_Icon_06\",\"Position\":{\"X\":1,\"Y\":-9999999,\"Z\":0}},{\"PaneName\":\"N_Icon_07\",\"Position\":{\"X\":1,\"Y\":-9999999,\"Z\":0}},{\"PaneName\":\"N_Icon_08\",\"Position\":{\"X\":1,\"Y\":-9999999,\"Z\":0}},{\"PaneName\":\"N_Icon_09\",\"Position\":{\"X\":1,\"Y\":-9999999,\"Z\":0}},{\"PaneName\":\"N_Icon_10\",\"Position\":{\"X\":1,\"Y\":-9999999,\"Z\":0}},{\"PaneName\":\"N_Icon_11\",\"Position\":{\"X\":1,\"Y\":-9999999,\"Z\":0}},{\"PaneName\":\"N_Icon_12\",\"Position\":{\"X\":600,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnFlc\",\"Scale\":{\"X\":0.37,\"Y\":0.37}},{\"PaneName\":\"L_BtnAccount_00\",\"Position\":{\"X\":-247,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_01\",\"Position\":{\"X\":-175,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_02\",\"Position\":{\"X\":-103,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_03\",\"Position\":{\"X\":-31,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_04\",\"Position\":{\"X\":41,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_05\",\"Position\":{\"X\":113,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_BtnAccount_06\",\"Position\":{\"X\":185,\"Y\":0,\"Z\":0}},{\"PaneName\":\"L_Hud\",\"Position\":{\"X\":-290,\"Y\":-325,\"Z\":0}}]},{\"FileName\":\"blyt/Hud.bflyt\",\"Patches\":[{\"PaneName\":\"N_Time\",\"Position\":{\"X\":10,\"Y\":0,\"Z\":0}}]}]}";
|
||||
@ -27,7 +36,7 @@ namespace NewFirmFixes
|
||||
{
|
||||
// Instead of patch revision here we can use the HOS version detected which may be more precise
|
||||
// TODO: is this inconsistent with the injector ?
|
||||
if (HOSVer.IsGreater({ 8,1,1 }))
|
||||
if (HOSVer > SystemVersion{8,1,1})
|
||||
{
|
||||
if (NXThemeName == "lock") {
|
||||
if (findStringIC(LayoutName, "clear lockscreen"))
|
||||
@ -35,7 +44,7 @@ namespace NewFirmFixes
|
||||
}
|
||||
}
|
||||
|
||||
if (NXThemeName == "home") {
|
||||
if (NXThemeName == "home" && HOSVer >= SystemVersion{8,0,0}) {
|
||||
if (findStringIC(LayoutName, "dogelayout") || findStringIC(LayoutName, "clearlayout"))
|
||||
return Patches::LoadLayout(DogeLayoutFix).Files;
|
||||
else if (findStringIC(LayoutName, "diamond"))
|
||||
@ -43,14 +52,31 @@ namespace NewFirmFixes
|
||||
else if (findStringIC(LayoutName, "small compact"))
|
||||
return Patches::LoadLayout(CompactFix).Files;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
vector<LayoutFilePatch> GetFix(const string& LayoutID, const string& NxPart)
|
||||
{
|
||||
if (LayoutID == "builtin_ClearLock" && HOSVer.IsGreater({ 8,1,1 }) && NxPart == "lock")
|
||||
if (LayoutID == "builtin_ClearLock" && HOSVer > SystemVersion{8,1,1} && NxPart == "lock")
|
||||
return Patches::LoadLayout(ClearLock9Fix).Files;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<AnimFilePatch> GetNoOnlineButtonFix()
|
||||
{
|
||||
if (HOSVer >= SystemVersion{ 11,0,0 })
|
||||
return Patches::LoadLayout(NoOnlineButton).Anims;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<AnimFilePatch> GetAppletsPositionFix()
|
||||
{
|
||||
if (HOSVer >= SystemVersion{ 11,0,0 })
|
||||
return Patches::LoadLayout(NoMoveApplets11).Anims;
|
||||
|
||||
return {};
|
||||
}
|
||||
}
|
@ -150,6 +150,7 @@ struct LayoutPatch
|
||||
std::vector<AnimFilePatch> Anims;
|
||||
bool PatchAppletColorAttrib = false;
|
||||
std::string ID;
|
||||
bool HideOnlineBtn;
|
||||
|
||||
bool Obsolete_Ready8X = false;
|
||||
bool UsesOldFixes() const { return ID == "" && !Obsolete_Ready8X; }
|
||||
@ -206,4 +207,8 @@ namespace NewFirmFixes
|
||||
{
|
||||
std::vector<LayoutFilePatch> GetFixLegacy(const std::string& LayoutName, const std::string& NXThemeName);
|
||||
std::vector<LayoutFilePatch> GetFix(const std::string& LayoutID, const std::string& NxPart);
|
||||
|
||||
// Since 11.0
|
||||
std::vector<AnimFilePatch> GetNoOnlineButtonFix();
|
||||
std::vector<AnimFilePatch> GetAppletsPositionFix();
|
||||
}
|
@ -17,24 +17,15 @@ struct ThemeFileManifest
|
||||
|
||||
struct SystemVersion {
|
||||
u32 major, minor, micro;
|
||||
bool IsGreater(const SystemVersion& other) const
|
||||
|
||||
constexpr auto operator<=>(const SystemVersion& other) const
|
||||
{
|
||||
if (major > other.major)
|
||||
return true;
|
||||
else if (major < other.major)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
if (minor > other.minor)
|
||||
return true;
|
||||
else if (minor < other.minor)
|
||||
return false;
|
||||
else return micro > other.micro;
|
||||
}
|
||||
}
|
||||
bool IsEqual(const SystemVersion& other) const
|
||||
{
|
||||
return other.major == major && other.minor == minor && other.micro == micro;
|
||||
auto m = major <=> other.major;
|
||||
if (m == std::strong_ordering::equal)
|
||||
m = minor <=> other.minor;
|
||||
if (m == std::strong_ordering::equal)
|
||||
m = micro <=> other.micro;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -233,7 +233,7 @@ SARC::PackedSarc SARC::Pack(SARC::SarcData &data, s32 _align)
|
||||
return PackedSarc{bw.getBuffer(), (u32)align};
|
||||
}
|
||||
|
||||
SARC::SarcData SARC::Unpack(vector<u8> &data)
|
||||
SARC::SarcData SARC::Unpack(const vector<u8> &data)
|
||||
{
|
||||
SARC::SarcData res;
|
||||
Buffer buf = Buffer(data);
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
};
|
||||
|
||||
static PackedSarc Pack(SarcData &data, s32 _align = -1);
|
||||
static SarcData Unpack(std::vector<u8> &data);
|
||||
static SarcData Unpack(const std::vector<u8> &data);
|
||||
|
||||
private:
|
||||
static u32 NameHash(const std::string &name);
|
||||
|
@ -27,7 +27,6 @@ string SwitchThemesCommon::GeneratePatchListString(const vector<PatchTemplate>&
|
||||
|
||||
SzsPatcher::SzsPatcher(SARC::SarcData&& s) : sarc(s) {}
|
||||
SzsPatcher::SzsPatcher(SARC::SarcData& s) : sarc(s) {}
|
||||
void SzsPatcher::SetPatchAnimations(bool enable) { EnableAnimations = enable; }
|
||||
|
||||
SzsPatcher::~SzsPatcher()
|
||||
{
|
||||
@ -59,30 +58,6 @@ void SzsPatcher::SaveBntx()
|
||||
bntx = nullptr;
|
||||
}
|
||||
|
||||
bool SzsPatcher::PatchAnimations(const std::vector<AnimFilePatch>& files)
|
||||
{
|
||||
u32 TargetVersion = 0;
|
||||
for (const auto& p : files)
|
||||
{
|
||||
if (!sarc.files.count(p.FileName))
|
||||
continue; //return BflytFile.PatchResult.Fail; Don't be so strict as older firmwares may not have all the animations (?)
|
||||
|
||||
if (TargetVersion == 0)
|
||||
{
|
||||
auto bflan = new Bflan(sarc.files[p.FileName]);
|
||||
TargetVersion = bflan->Version;
|
||||
delete bflan;
|
||||
}
|
||||
|
||||
auto bflan = BflanDeserializer::FromJson(p.AnimJson);
|
||||
bflan->Version = TargetVersion;
|
||||
bflan->byteOrder = Endianness::LittleEndian;
|
||||
sarc.files[p.FileName] = bflan->WriteFile();
|
||||
delete bflan;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SzsPatcher::PatchSingleLayout(const LayoutFilePatch& p)
|
||||
{
|
||||
if (!sarc.files.count(p.FileName))
|
||||
@ -132,10 +107,9 @@ bool SzsPatcher::PatchLayouts(const LayoutPatch& patch, const string &partName)
|
||||
{"RdtIcoCtrl_01^s", 0x2000000}, {"RdtIcoCtrl_02^s", 0x2000000}, {"RdtIcoPwrForm^s", 0x2000000},
|
||||
});
|
||||
|
||||
vector<LayoutFilePatch> Files;
|
||||
Files.insert(Files.end(), patch.Files.begin(), patch.Files.end());
|
||||
vector<LayoutFilePatch> Files = patch.Files;
|
||||
|
||||
if (HOSVer.IsGreater({7,9,9}) && patch.UsesOldFixes())
|
||||
if (patch.UsesOldFixes())
|
||||
{
|
||||
auto extra = NewFirmFixes::GetFixLegacy(patch.PatchName, partName);
|
||||
if (extra.size() != 0)
|
||||
@ -154,6 +128,40 @@ bool SzsPatcher::PatchLayouts(const LayoutPatch& patch, const string &partName)
|
||||
if (res != true)
|
||||
return res;
|
||||
}
|
||||
|
||||
vector<AnimFilePatch> Anims = patch.Anims;
|
||||
|
||||
vector<AnimFilePatch> extra;
|
||||
|
||||
if (partName == "home") {
|
||||
if (patch.HideOnlineBtn)
|
||||
extra = NewFirmFixes::GetNoOnlineButtonFix();
|
||||
else if (std::none_of(Anims.begin(), Anims.end(), [](const auto& a) { return a.FileName == "anim/RdtBase_SystemAppletPos.bflan"; }))
|
||||
extra == NewFirmFixes::GetAppletsPositionFix();
|
||||
|
||||
if (extra.size())
|
||||
Anims.insert(Anims.end(), extra.begin(), extra.end());
|
||||
}
|
||||
|
||||
if (Anims.size())
|
||||
{
|
||||
auto bflan = new Bflan(sarc.files[Anims[0].FileName]);
|
||||
auto TargetVersion = bflan->Version;
|
||||
delete bflan;
|
||||
|
||||
for (const auto& p : Anims)
|
||||
{
|
||||
if (!sarc.files.count(p.FileName))
|
||||
continue; //return BflytFile.PatchResult.Fail; Don't be so strict as older firmwares may not have all the animations (?)
|
||||
|
||||
auto bflan = BflanDeserializer::FromJson(p.AnimJson);
|
||||
bflan->Version = TargetVersion;
|
||||
bflan->byteOrder = Endianness::LittleEndian;
|
||||
sarc.files[p.FileName] = bflan->WriteFile();
|
||||
delete bflan;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ namespace SwitchThemesCommon {
|
||||
SzsPatcher(SARC::SarcData& s);
|
||||
~SzsPatcher();
|
||||
|
||||
bool PatchAnimations(const std::vector<AnimFilePatch>& files);
|
||||
bool PatchLayouts(const LayoutPatch& patch);
|
||||
bool PatchLayouts(const LayoutPatch& patch, const std::string& PartName);
|
||||
bool PatchMainBG(const std::vector<u8>& DDS);
|
||||
@ -36,8 +35,6 @@ namespace SwitchThemesCommon {
|
||||
PatchTemplate DetectSarc();
|
||||
static PatchTemplate DetectSarc(const SARC::SarcData&);
|
||||
|
||||
void SetPatchAnimations(bool);
|
||||
|
||||
const SARC::SarcData& GetSarc();
|
||||
SARC::SarcData& GetFinalSarc();
|
||||
|
||||
@ -53,5 +50,5 @@ namespace SwitchThemesCommon {
|
||||
bool EnableAnimations = true;
|
||||
};
|
||||
|
||||
std::string GeneratePatchListString(const std::vector < PatchTemplate >& templates);
|
||||
std::string GeneratePatchListString(const std::vector<PatchTemplate>& templates);
|
||||
}
|
@ -11,9 +11,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
static const u32 PatchSetVer = 5;
|
||||
#define LastSupportedVerSTR "10.2.0"
|
||||
//static const SystemVersion LastSupportedVer = { 10,1,1 };
|
||||
static const u32 PatchSetVer = 6;
|
||||
#define LastSupportedVerSTR "11.0"
|
||||
|
||||
#define ThemePatchesDir "NxThemesInstaller/"
|
||||
|
||||
@ -65,7 +64,7 @@ bool PatchMng::CanInstallTheme(const string& FileName)
|
||||
|
||||
const auto& ver = PartsRequiringPatch.at(FileName);
|
||||
|
||||
if (HOSVer.IsGreater(ver) || HOSVer.IsEqual(ver))
|
||||
if (HOSVer >= ver)
|
||||
return HasLatestPatches;
|
||||
else return true;
|
||||
|
||||
@ -149,12 +148,6 @@ PatchMng::ErrorPage PatchMng::EnsureInstalled()
|
||||
return { "Error", ErrorHactool };
|
||||
}
|
||||
|
||||
// TOOD: Should show a firmware warning even if compatible ?
|
||||
//if (HOSVer.IsGreater(LastSupportedVer)) {
|
||||
// HasLatestPatches = false;
|
||||
// return { "Info", WarningFWVer };
|
||||
//}
|
||||
|
||||
if (fs::path::CfwFolder() == SD_PREFIX SX_DIR)
|
||||
{
|
||||
HasLatestPatches = false;
|
||||
|
@ -312,7 +312,7 @@ static void SetupSysVer()
|
||||
HOSVer = { firmware.major,firmware.minor,firmware.micro };
|
||||
setsysExit();
|
||||
#else
|
||||
HOSVer = { 9,0,0 };
|
||||
HOSVer = { 11,0,0 };
|
||||
#endif
|
||||
if (HOSVer.major <= 5)
|
||||
{
|
||||
|
@ -58,9 +58,6 @@ namespace SwitchThemesNXTests
|
||||
auto l = Patches::LoadLayout(lyt);
|
||||
if (!p.PatchLayouts(l))
|
||||
throw std::runtime_error("");
|
||||
|
||||
if (!p.PatchAnimations(l.Anims))
|
||||
throw std::runtime_error("");
|
||||
}
|
||||
|
||||
auto fin = p.GetFinalSarc();
|
||||
|
Loading…
Reference in New Issue
Block a user