diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..18c50583 --- /dev/null +++ b/.clang-format @@ -0,0 +1,45 @@ +# A .clang-format file to adhere to the K&R style +# - CLANG-FORMAT STYLE OPTIONS: https://clang.llvm.org/docs/ClangFormatStyleOptions.html +# +# Author: Munseong Jeong + +BasedOnStyle: LLVM +IndentWidth: 4 +UseTab: Never + +BreakBeforeBraces: Linux +BraceWrapping: + AfterControlStatement: false + AfterFunction: true + AfterClass: false + AfterStruct: false + AfterUnion: false + AfterNamespace: false + AfterEnum: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + +ContinuationIndentWidth: 0 +AlignAfterOpenBracket: false +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AllowShortBlocksOnASingleLine: Always +IndentCaseLabels: false +SpaceAfterCStyleCast: true +AllowShortFunctionsOnASingleLine: None +ColumnLimit: 80 +MaxEmptyLinesToKeep: 1 +Cpp11BracedListStyle: false +AlignTrailingComments: true +ReflowComments: true + +SpacesBeforeTrailingComments: 2 +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '<[[:alnum:].]+>' + Priority: 1 + - Regex: '.*' + Priority: 2 +SortIncludes: CaseSensitive +AlignEscapedNewlines: Left \ No newline at end of file diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp index a0dd288b..3b7d0c62 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp @@ -52,14 +52,6 @@ volatile CustomizeTable C = { .eristaGpuUV = 0, -.enableMarikoGpuUnsafeFreqs = DISABLED, - -.enableEristaGpuUnsafeFreqs = DISABLED, - -.enableMarikoCpuUnsafeFreqs = DISABLED, - -.enableEristaCpuUnsafeFreqs = DISABLED, - .commonGpuVoltOffset = 0, .EmcDvbShift = 0, @@ -156,6 +148,11 @@ volatile CustomizeTable C = { { 1581000, { 1130000 }, { 2889664, -122173, 1834 } }, { 1683000, { 1168000 }, { 5100873, -279186, 4747 } }, { 1785000, { 1227500 }, { 5100873, -279186, 4747 } }, + { 1887000, { 1375000 }, { 5100873, -279186, 4747 } }, + { 1963500, { 1375000 }, { 5100873, -279186, 4747 } }, + { 2091000, { 1375000 }, { 5100873, -279186, 4747 } }, + { 2193000, { 1375000 }, { 5100873, -279186, 4747 } }, + { 2295000, { 1375000 }, { 5100873, -279186, 4747 } }, }, /* - Mariko CPU DVFS Table: @@ -170,40 +167,47 @@ volatile CustomizeTable C = { { 714000, { 885768, -20215, 27 }, {} }, { 816000, { 929540, -21725, 27 }, {} }, { 918000, { 976958, -23225, 27 }, {} }, - { 1020000, { 1028021, -24725, 27 }, { } }, - { 1122000, { 1082730, -26235, 27 }, { } }, - { 1224000, { 1141084, -27735, 27 }, { } }, - { 1326000, { 1203084, -29245, 27 }, { } }, - { 1428000, { 1268729, -30745, 27 }, { } }, - { 1581000, { 1374032, -33005, 27 }, { } }, - { 1683000, { 1448791, -34505, 27 }, { } }, - { 1785000, { 1527196, -36015, 27 }, { } }, - { 1887000, { 1609246, -37515, 27 }, { } }, - { 1963500, { 1675751, -38635, 27 }, { } }, + { 1020000, { 1028021, -24725, 27 }, { 1120000 } }, + { 1122000, { 1082730, -26235, 27 }, { 1120000 } }, + { 1224000, { 1141084, -27735, 27 }, { 1120000 } }, + { 1326000, { 1203084, -29245, 27 }, { 1120000 } }, + { 1428000, { 1268729, -30745, 27 }, { 1120000 } }, + { 1581000, { 1374032, -33005, 27 }, { 1120000 } }, + { 1683000, { 1448791, -34505, 27 }, { 1120000 } }, + { 1785000, { 1527196, -36015, 27 }, { 1120000 } }, + { 1887000, { 1609246, -37515, 27 }, { 1120000 } }, + { 1963500, { 1675751, -38635, 27 }, { 1120000 } }, }, .marikoCpuDvfsTableSLT = { - { 204000, { 732856, -17335, 113 }, { } }, - { 306000, { 760024, -18195, 113 }, { } }, - { 408000, { 789258, -19055, 113 }, { } }, - { 510000, { 789258, -19915, 113 }, { } }, + // { 204000, { 732856, -17335, 113 }, { } }, + // { 306000, { 760024, -18195, 113 }, { } }, + // { 408000, { 789258, -19055, 113 }, { } }, + // { 510000, { 789258, -19915, 113 }, { } }, { 612000, { 789258, -19055, 113 }, { } }, { 714000, { 820558, -19915, 113 }, { } }, { 816000, { 853926, -20775, 113 }, { } }, { 918000, { 889361, -21625, 113 }, { } }, - { 1020000, { 926862, -22485, 113 }, { } }, - { 1122000, { 926862, -22485, 113 }, { } }, - { 1224000, { 926862, -22485, 113 }, { } }, - { 1326000, { 966431, -23345, 113 }, { } }, - { 1428000, { 1008066, -24205, 113 }, { } }, - { 1581000, { 1051768, -25065, 113 }, { } }, - { 1683000, { 1097537, -25925, 113 }, { } }, - { 1785000, { 1145373, -26785, 113 }, { } }, - { 1887000, { 1195276, -27645, 113 }, { } }, - { 1963500, { 1274006, -29795, 113 }, { } }, - { 2091000, { 1349076, -33235, 113 }, { } }, - { 2193000, { 1386213, -33235, 113 }, { } }, - { 2295000, { 1445416, -34095, 113 }, { } }, + { 1020000, { 926862, -22485, 113 }, { 1120000 } }, + { 1122000, { 926862, -22485, 113 }, { 1120000 } }, + { 1224000, { 926862, -22485, 113 }, { 1120000 } }, + { 1326000, { 966431, -23345, 113 }, { 1120000 } }, + { 1428000, { 1008066, -24205, 113 }, { 1120000 } }, + { 1581000, { 1051768, -25065, 113 }, { 1120000 } }, + { 1683000, { 1097537, -25925, 113 }, { 1120000 } }, + { 1785000, { 1145373, -26785, 113 }, { 1120000 } }, + { 1887000, { 1195276, -27645, 113 }, { 1120000 } }, + { 1963500, { 1274006, -29795, 113 }, { 1120000 } }, + { 2091000, { 1349076, -33235, 113 }, { 1375000 } }, + { 2193000, { 1386213, -33235, 113 }, { 1375000 } }, + { 2295000, { 1445416, -34095, 113 }, { 1375000 } }, + { 2397000, { 1490873, -34955, 113 }, { 1375000 } }, + { 2499000, { 1580725, -35815, 113 }, { 1375000 } }, + { 2601000, { 1702903, -36675, 113 }, { 1375000 } }, + { 2703000, { 1748360, -37535, 113 }, { 1375000 } }, + { 2805000, { 1793817, -38395, 113 }, { 1375000 } }, + { 2907000, { 1839274, -39255, 113 }, { 1375000 } }, + { 3009000, { 1884731, -40115, 113 }, { 1375000 } }, }, /* - Erista GPU DVFS Table: @@ -220,8 +224,8 @@ volatile CustomizeTable C = { { 691200, { }, { 1149425, 8144, -940, 808, -21583, 226 } }, { 768000, { }, { 1191317, 8144, -940, 808, -21583, 226 } }, { 844800, { }, { 1233208, 8144, -940, 808, -21583, 226 } }, -// { 921600, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, -// { 998400, { }, { 1316991, 8144, -940, 808, -21583, 226 } }, + { 921600, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, +// { 998400, { }, { 1316991, 8144, -940, 808, -21583, 226 } }, // { 1075200, { }, { 1358882, 8144, -940, 808, -21583, 226 } }, }, @@ -239,7 +243,7 @@ volatile CustomizeTable C = { { 768000, { }, { 1107534, 8144, -940, 808, -21583, 226 } }, { 844800, { }, { 1149426, 8144, -940, 808, -21583, 226 } }, { 921600, { }, { 1191317, 8144, -940, 808, -21583, 226 } }, -// { 998400, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, + { 998400, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, // { 1075200, { }, { 1316991, 8144, -940, 808, -21583, 226 } }, }, @@ -257,7 +261,7 @@ volatile CustomizeTable C = { { 844800, { }, { 1065643, 8144, -940, 808, -21583, 226 } }, { 921600, { }, { 1107535, 8144, -940, 808, -21583, 226 } }, { 998400, { }, { 1149426, 8144, -940, 808, -21583, 226 } }, -// { 1075200, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, + { 1075200, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, }, /* - Mariko GPU DVFS Table: @@ -279,31 +283,32 @@ volatile CustomizeTable C = { { 998400, {}, { 1098475, -13529, -497, -179, 3626, 9 } }, { 1075200, {}, { 1163644, -12688, -648, 0, 1077, 40 } }, { 1152000, {}, { 1204812, -9908, -830, 0, 1469, 110 } }, - // { 1228800, {}, { 1277303, -11675, -859, 0, 3722, 313 } }, - // { 1267200, {}, { 1335531, -12567, -867, 0, 3681, 559 } }, + { 1228800, {}, { 1277303, -11675, -859, 0, 3722, 313 } }, + { 1267200, {}, { 1335531, -12567, -867, 0, 3681, 559 } }, // Appending table //{ 1305600, {}, { 1374130, -13725, -859, 0, 4442, 576 } }, }, .marikoGpuDvfsTableSLT = { - { 76800, { }, { 610000, 0, 0, 0, 0, 0 }, }, - { 153600, { }, { 610000, 0, 0, 0, 0, 0 }, }, - { 230400, { }, { 610000, 0, 0, 0, 0, 0 }, }, - { 307200, { }, { 610000, 0, 0, 0, 0, 0 }, }, - { 384000, { }, { 610000, 0, 0, 0, 0, 0 }, }, - { 460800, { }, { 610000, 0, 0, 0, 0, 0 }, }, - { 537600, { }, { 801688, -10900, -163, 298, -10599, 162 }, }, - { 614400, { }, { 824214, -5743, -452, 238, -6325, 81 }, }, - { 691200, { }, { 848830, -3903, -552, 119, -4030, -2 }, }, - { 768000, { }, { 891575, -4409, -584, 0, -2849, 39 }, }, - { 844800, { }, { 940071, -5367, -602, -60, -63, -93 }, }, - { 921600, { }, { 986765, -6637, -614, -179, 1905, -13 }, }, - { 998400, { }, { 1098475, -13529, -497, -179, 3626, 9 }, }, - { 1075200, { }, { 1163644, -12688, -648, 0, 1077, 40 }, }, - { 1152000, { }, { 1204812, -9908, -830, 0, 1469, 110 }, }, - { 1228800, { }, { 1277303, -11675, -859, 0, 3722, 313 }, }, -// { 1267200, { }, { 1335531, -12567, -867, 0, 3681, 559 }, }, + { 76800, {}, { 590000, } }, + { 153600, {}, { 590000, } }, + { 230400, {}, { 590000, } }, + { 307200, {}, { 590000, } }, + { 384000, {}, { 590000, } }, + { 460800, {}, { 795089, -11096, -163, 298, -10421, 162 } }, + { 537600, {}, { 795089, -11096, -163, 298, -10421, 162 } }, + { 614400, {}, { 820606, -6285, -452, 238, -6182, 81 } }, + { 691200, {}, { 846289, -4565, -552, 119, -3958, -2 } }, + { 768000, {}, { 888720, -5110, -584, 0, -2849, 39 } }, + { 844800, {}, { 936634, -6089, -602, -60, -99, -93 } }, + { 921600, {}, { 982562, -7373, -614, -179, 1797, -13 } }, + { 998400, {}, { 1090179, -14125, -497, -179, 3518, 9 } }, + { 1075200, {}, { 1155798, -13465, -648, 0, 1077, 40 } }, + { 1152000, {}, { 1198568, -10904, -830, 0, 1469, 110 } }, + { 1228800, {}, { 1269988, -12707, -859, 0, 3722, 313 } }, + { 1267200, {}, { 1308155, -13694, -867, 0, 3681, 559 } }, }, + .marikoGpuDvfsTableHiOPT = { { 76800, { }, { 590000, 0, 0, 0, 0, 0 }, }, { 153600, { }, { 590000, 0, 0, 0, 0, 0 }, }, @@ -322,112 +327,18 @@ volatile CustomizeTable C = { { 1152000, { }, { 1094475, -12688, -648, 0, 1077, 40 }, }, { 1228800, { }, { 1124475, -12688, -648, 0, 1077, 40 }, }, { 1267200, { }, { 1145060, -12688, -648, 0, 1077, 40 }, }, -// { 1305600, { }, { 1163644, -12688, -648, 0, 1077, 40 }, }, + { 1305600, { }, { 1163644, -12688, -648, 0, 1077, 40 }, }, + { 1344000, { }, { 1182228, -12688, -648, 0, 1077, 40 }, }, + { 1382400, { }, { 1200812, -12688, -648, 0, 1077, 40 }, }, + { 1420800, { }, { 1219396, -12688, -648, 0, 1077, 40 }, }, + { 1459200, { }, { 1237980, -12688, -648, 0, 1077, 40 }, }, + { 1497600, { }, { 1256564, -10688, -648, 0, 1077, 40 }, }, + { 1536000, { }, { 1275148, -12688, -648, 0, 1077, 40 }, }, }, //.eristaMtcTable = const_cast(&EristaMtcTablePlaceholder), //.marikoMtcTable = const_cast(&MarikoMtcTablePlaceholder), -// UV3 tables - -.eristaGpuDvfsTableUv3UnsafeFreqs = { - { 76800, { }, { 814294, 8144, -940, 808, -21583, 226 } }, - { 153600, { }, { 856185, 8144, -940, 808, -21583, 226 } }, - { 230400, { }, { 898077, 8144, -940, 808, -21583, 226 } }, - { 307200, { }, { 939968, 8144, -940, 808, -21583, 226 } }, - { 384000, { }, { 981860, 8144, -940, 808, -21583, 226 } }, - { 460800, { }, { 1023751, 8144, -940, 808, -21583, 226 } }, - { 537600, { }, { 1065642, 8144, -940, 808, -21583, 226 } }, - { 614400, { }, { 1107534, 8144, -940, 808, -21583, 226 } }, - { 691200, { }, { 1149425, 8144, -940, 808, -21583, 226 } }, - { 768000, { }, { 1191317, 8144, -940, 808, -21583, 226 } }, - { 844800, { }, { 1233208, 8144, -940, 808, -21583, 226 } }, - { 921600, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, - { 998400, { }, { 1316991, 8144, -940, 808, -21583, 226 } }, // UNSAFE - { 1075200, { }, { 1358882, 8144, -940, 808, -21583, 226 } }, // UNSAFE -// { 1152000, { }, { 1400773, 8144, -940, 808, -21583, 226 } }, // DANGEROUS -// { 1228800, { }, { 1440773, 8144, -940, 808, -21583, 226 } }, // DANGEROUS -}, - -.marikoGpuDvfsTableUv3UnsafeFreqs = { - { 76800, {}, { 590000, } }, - { 153600, {}, { 590000, } }, - { 230400, {}, { 590000, } }, - { 307200, {}, { 590000, } }, - { 384000, {}, { 590000, } }, - { 460800, {}, { 590000, } }, - { 537600, {}, { 590000, } }, - { 614400, {}, { 590000, } }, - { 691200, {}, { 838712, -7304, -552, 119, -3750, -2 } }, - { 768000, {}, { 880210, -7955, -584, 0, -2849, 39 } }, - { 844800, {}, { 926398, -8892, -602, -60, -384, -93 } }, - { 921600, {}, { 970060, -10108, -614, -179, 1508, -13 } }, - { 998400, {}, { 1065665, -16075, -497, -179, 3213, 9 } }, - { 1075200, {}, { 1132576, -16093, -648, 0, 1077, 40 } }, - { 1152000, {}, { 1180029, -14534, -830, 0, 1469, 110 } }, - { 1228800, {}, { 1248293, -16383, -859, 0, 3722, 313 } }, - { 1267200, {}, { 1286399, -17475, -867, 0, 3681, 559 } }, - { 1305600, {}, { 1286399, -17475, -867, 0, 3681, 559 } }, - { 1305600, {}, { 1324505, -17475, -867, 0, 3681, 559 } }, - { 1344000, {}, { 1362611, -17475, -867, 0, 3681, 559 } }, - { 1382400, {}, { 1400717, -17475, -867, 0, 3681, 559 } }, - { 1420800, {}, { 1438823, -17475, -867, 0, 3681, 559 } }, - { 1459200, {}, { 1476929, -17475, -867, 0, 3681, 559 } }, - { 1497600, {}, { 1515035, -17475, -867, 0, 3681, 559 } }, - { 1536000, {}, { 1553141, -17475, -867, 0, 3681, 559 } }, -}, - -.marikoCpuDvfsTableUnsafeFreqs = { - { 204000, { 732856, -17335, 113 }, {} }, // Unneeded, made to make room for new freqs - { 306000, { 760024, -18195, 113 }, {} }, - { 408000, { 789258, -19055, 113 }, { } }, - { 510000, { 789258, -19915, 113 }, { } }, - { 612000, { 789258, -19055, 113 }, { } }, - { 714000, { 820558, -19915, 113 }, { } }, - { 816000, { 853926, -20775, 113 }, { } }, - { 918000, { 889361, -21625, 113 }, { } }, - { 1020000, { 926862, -22485, 113 }, { } }, - { 1122000, { 926862, -22485, 113 }, { } }, - { 1224000, { 926862, -22485, 113 }, { } }, - { 1326000, { 966431, -23345, 113 }, { } }, - { 1428000, { 1008066, -24205, 113 }, { } }, - { 1581000, { 1051768, -25065, 113 }, { } }, - { 1683000, { 1097537, -25925, 113 }, { } }, - { 1785000, { 1145373, -26785, 113 }, { } }, - { 1887000, { 1195276, -27645, 113 }, { } }, - { 1963500, { 1274006, -29795, 113 }, { } }, - { 2091000, { 1349076, -33235, 113 }, { } }, - { 2193000, { 1386213, -33235, 113 }, { } }, - { 2295000, { 1445416, -34095, 113 }, { } }, - { 2397000, { 1490873, -34955, 113 }, { } }, - { 2499000, { 1580725, -35815, 113 }, { } }, - { 2601000, { 1702903, -36675, 113 }, { } }, - }, -.eristaCpuDvfsTableUnsafeFreqs = { - { 204000, { 721094 }, {} }, - { 306000, { 754040 }, {} }, - { 408000, { 786986 }, {} }, - { 510000, { 819932 }, {} }, - { 612000, { 852878 }, {} }, - { 714000, { 885824 }, {} }, - { 816000, { 918770 }, {} }, - { 918000, { 951716 }, {} }, - { 1020000, { 984662 }, { -2875621, 358099, -8585 } }, - { 1122000, { 1017608 }, { -52225, 104159, -2816 } }, - { 1224000, { 1050554 }, { 1076868, 8356, -727 } }, - { 1326000, { 1083500 }, { 2208191, -84659, 1240 } }, - { 1428000, { 1116446 }, { 2519460, -105063, 1611 } }, - { 1581000, { 1130000 }, { 2889664, -122173, 1834 } }, - { 1683000, { 1168000 }, { 5100873, -279186, 4747 } }, - { 1785000, { 1227500 }, { 5100873, -279186, 4747 } }, - // Appending table - { 1887000, { 1235000 }, { 5200873, -279186, 4747 } }, - { 1963500, { 1235000 }, { 5300873, -279186, 4747 } }, - { 2091000, { 1235000 }, { 5400873, -289186, 4847 } }, - { 2193000, { 1235000 }, { 5500873, -299186, 4947 } }, - { 2295000, { 1235000 }, { 5600873, -239186, 5047 } }, - // { 2397000, { 1235000 }, { 5700873, -249186, 5047 } }, - }, }; } diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp index 98dd54e2..d1f0685a 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp @@ -58,11 +58,6 @@ u32 eristaCpuUV; u32 eristaGpuUV; - u32 enableMarikoGpuUnsafeFreqs; - u32 enableEristaGpuUnsafeFreqs; - - u32 enableMarikoCpuUnsafeFreqs; - u32 enableEristaCpuUnsafeFreqs; u32 commonGpuVoltOffset; @@ -102,11 +97,6 @@ CustomizeGpuDvfsTable marikoGpuDvfsTableHiOPT; //EristaMtcTable* eristaMtcTable; //MarikoMtcTable* marikoMtcTable; - CustomizeGpuDvfsTable eristaGpuDvfsTableUv3UnsafeFreqs; - CustomizeGpuDvfsTable marikoGpuDvfsTableUv3UnsafeFreqs; - CustomizeCpuDvfsTable marikoCpuDvfsTableUnsafeFreqs; - CustomizeCpuDvfsTable eristaCpuDvfsTableUnsafeFreqs; - } CustomizeTable; //static_assert(sizeof(CustomizeTable) == sizeof(u8) * 4 + sizeof(u32) * 10 + sizeof(CustomizeCpuDvfsTable) * 5 + sizeof(void*) * 2); //static_assert(sizeof(CustomizeTable) == 7000); diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp index 0512f442..6ca4f8c6 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp @@ -94,14 +94,8 @@ void SafetyCheck() { R_SUCCEED(); } }; - u32 eristaCpuDvfsMaxFreq; - if (C.enableEristaCpuUnsafeFreqs) { - eristaCpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.eristaCpuDvfsTableUnsafeFreqs)->freq); - } else { - eristaCpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq); - } + u32 eristaCpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq); u32 marikoCpuDvfsMaxFreq; - if(!C.enableMarikoCpuUnsafeFreqs) { if (C.marikoCpuUV) { marikoCpuDvfsMaxFreq = static_cast( GetDvfsTableLastEntry(C.marikoCpuDvfsTableSLT)->freq @@ -111,9 +105,6 @@ void SafetyCheck() { GetDvfsTableLastEntry(C.marikoCpuDvfsTable)->freq ); } - } else { - marikoCpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.marikoCpuDvfsTableUnsafeFreqs)->freq); - } u32 eristaGpuDvfsMaxFreq; switch (C.eristaGpuUV) { @@ -124,17 +115,8 @@ void SafetyCheck() { eristaGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.eristaGpuDvfsTableSLT)->freq); break; case 2: - eristaGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.eristaGpuDvfsTableHigh)->freq); - break; case 3: - if(C.enableEristaGpuUnsafeFreqs) - { - eristaGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.eristaGpuDvfsTableUv3UnsafeFreqs)->freq); - } - else - { - eristaGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq); - } + eristaGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.eristaGpuDvfsTableHigh)->freq); break; default: eristaGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq); @@ -150,17 +132,8 @@ void SafetyCheck() { marikoGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.marikoGpuDvfsTableSLT)->freq); break; case 2: - marikoGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq); - break; case 3: - if(C.enableMarikoGpuUnsafeFreqs) - { - marikoGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.marikoGpuDvfsTableUv3UnsafeFreqs)->freq); - } - else - { - marikoGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq); - } + marikoGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq); break; default: marikoGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq); diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp index 7760fccc..a0834890 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp @@ -266,21 +266,13 @@ namespace ams::ldr::oc::pcv cvb_entry_t *customize_table = nullptr; // impossible to reach, there will always be a way to set a pointer if (isMariko) { - if (C.enableMarikoCpuUnsafeFreqs) { - customize_table = const_cast(C.marikoCpuDvfsTableUnsafeFreqs); + if (C.marikoCpuUV) { + customize_table = const_cast(C.marikoCpuDvfsTableSLT); } else { - if (C.marikoCpuUV) { - customize_table = const_cast(C.marikoCpuDvfsTableSLT); - } else { - customize_table = const_cast(C.marikoCpuDvfsTable); - } + customize_table = const_cast(C.marikoCpuDvfsTable); } } else { - if (C.enableEristaCpuUnsafeFreqs) { - customize_table = const_cast(C.eristaCpuDvfsTableUnsafeFreqs); - } else { customize_table = const_cast(C.eristaCpuDvfsTable); - } } u32 cpu_max_volt = isMariko ? C.marikoCpuMaxVolt : C.eristaCpuMaxVolt; u32 cpu_freq_threshold = 1020'000; @@ -346,17 +338,8 @@ namespace ams::ldr::oc::pcv customize_table = const_cast(C.marikoGpuDvfsTableSLT); break; case 2: - customize_table = const_cast(C.marikoGpuDvfsTableHiOPT); - break; case 3: - if(C.enableMarikoGpuUnsafeFreqs) - { - customize_table = const_cast(C.marikoGpuDvfsTableUv3UnsafeFreqs); - } - else - { - customize_table = const_cast(C.marikoGpuDvfsTable); - } + customize_table = const_cast(C.marikoGpuDvfsTableHiOPT); break; default: customize_table = const_cast(C.marikoGpuDvfsTable); @@ -374,17 +357,8 @@ namespace ams::ldr::oc::pcv customize_table = const_cast(C.eristaGpuDvfsTableSLT); break; case 2: - customize_table = const_cast(C.eristaGpuDvfsTableHigh); - break; case 3: - if(C.enableEristaGpuUnsafeFreqs) - { - customize_table = const_cast(C.eristaGpuDvfsTableUv3UnsafeFreqs); - } - else - { - customize_table = const_cast(C.eristaGpuDvfsTable); - } + customize_table = const_cast(C.eristaGpuDvfsTableHigh); break; default: customize_table = const_cast(C.eristaGpuDvfsTable); diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp index e4719443..e4817fa4 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp @@ -30,16 +30,7 @@ Result CpuFreqVdd(u32* ptr) { R_UNLESS(entry->step_mv == 5000, ldr::ResultInvalidCpuFreqVddEntry()); R_UNLESS(entry->max_mv == 1525'000, ldr::ResultInvalidCpuFreqVddEntry()); - if (C.eristaCpuUV) { - if(!C.enableEristaCpuUnsafeFreqs) { - PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq); - } else { - PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.eristaCpuDvfsTableUnsafeFreqs)->freq); - } - } else { - PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq); - } - + PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq); R_SUCCEED(); } Result GpuVmin(u32 *ptr) { @@ -123,14 +114,8 @@ Result GpuVmin(u32 *ptr) { max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTableSLT)->freq; break; case 2: - max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTableHigh)->freq; - break; case 3: - if(C.enableEristaGpuUnsafeFreqs) { - max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTableUv3UnsafeFreqs)->freq; - } else { - max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq; - } + max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTableHigh)->freq; break; default: max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq; diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp index 35062b6c..39c12623 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp @@ -48,24 +48,12 @@ namespace ams::ldr::oc::pcv::mariko R_UNLESS(entry->min_mv == 250'000, ldr::ResultInvalidCpuFreqVddEntry()); R_UNLESS(entry->step_mv == 5000, ldr::ResultInvalidCpuFreqVddEntry()); R_UNLESS(entry->max_mv == 1525'000, ldr::ResultInvalidCpuFreqVddEntry()); - if (C.enableMarikoCpuUnsafeFreqs) + if (C.marikoCpuUV) { + PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.marikoCpuDvfsTableSLT)->freq); + } else { PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.marikoCpuDvfsTable)->freq); } - else - { - if (C.marikoCpuUV) - { - if (!C.enableMarikoCpuUnsafeFreqs) - { - PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.marikoCpuDvfsTableSLT)->freq); - } - else - { - PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.marikoCpuDvfsTableUnsafeFreqs)->freq); - } - } - } R_SUCCEED(); } @@ -186,17 +174,8 @@ namespace ams::ldr::oc::pcv::mariko max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableSLT)->freq; break; case 2: - max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq; - break; case 3: - if (C.enableMarikoGpuUnsafeFreqs) - { - max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableUv3UnsafeFreqs)->freq; - } - else - { - max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq; - } + max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq; break; default: max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq; diff --git a/Source/Configurator/src/cpu.py b/Source/Configurator/src/cpu.py index 30376603..94263fb0 100644 --- a/Source/Configurator/src/cpu.py +++ b/Source/Configurator/src/cpu.py @@ -51,20 +51,6 @@ def populate(): small=True, tag="c_freqs_info" ) - dpg.add_combo( - items=["Disabled (0)", "Enabled (1)"], - default_value="Disabled (0)", - label="Enable CPU Unsafe Frequencies (Mariko)", - callback=k.grab_kip_storage_values_no_mult, - tag="enableMarikoCpuUnsafeFreqs" - ) - dpg.add_combo( - items=["Disabled (0)", "Enabled (1)"], - default_value="Disabled (0)", - label="Enable CPU Unsafe Frequencies (Erista)", - callback=k.grab_kip_storage_values_no_mult, - tag="enableEristaCpuUnsafeFreqs" - ) dpg.add_combo( items=freqs_mhz_cpu_label, diff --git a/Source/Configurator/src/defaults.py b/Source/Configurator/src/defaults.py index 33d683b3..0841e684 100644 --- a/Source/Configurator/src/defaults.py +++ b/Source/Configurator/src/defaults.py @@ -36,10 +36,6 @@ class Defaults: # This almost always never needs to be updated as pulling from t self.marikoGpuUV = 0 self.eristaCpuUV = 0 self.eristaGpuUV = 0 - self.enableMarikoGpuUnsafeFreqs = 0 - self.enableEristaGpuUnsafeFreqs = 0 - self.enableMarikoCpuUnsafeFreqs = 0 - self.enableEristaCpuUnsafeFreqs = 0 self.commonGpuVoltOffset = 0 self.marikoEmcDvbShift = 0 self.t1_tRCD = 0 diff --git a/Source/Configurator/src/gpu.py b/Source/Configurator/src/gpu.py index 43ce1d16..517efd88 100644 --- a/Source/Configurator/src/gpu.py +++ b/Source/Configurator/src/gpu.py @@ -85,20 +85,6 @@ def populate(): tag="freqs_info" ) dpg.add_checkbox(label="GPU Scheduling", default_value=True, tag="gpu_sched", callback=toggle_gpu_sched) - dpg.add_combo( - items=["Disabled (0)", "Enabled (1)"], - default_value="Disabled (0)", - label="Enable GPU Unsafe Frequencies (Mariko)", - callback=k.grab_kip_storage_values_no_mult, - tag="enableMarikoGpuUnsafeFreqs" - ) - dpg.add_combo( - items=["Disabled (0)", "Enabled (1)"], - default_value="Disabled (0)", - label="Enable GPU Unsafe Frequencies (Erista)", - callback=k.grab_kip_storage_values_no_mult, - tag="enableEristaGpuUnsafeFreqs" - ) dpg.add_separator(label="Voltages") diff --git a/Source/Configurator/src/settings.py b/Source/Configurator/src/settings.py index 531e732b..9044af21 100644 --- a/Source/Configurator/src/settings.py +++ b/Source/Configurator/src/settings.py @@ -71,10 +71,6 @@ variables = [ ("marikoGpuUV", "u32"), ("eristaCpuUV", "u32"), ("eristaGpuUV", "u32"), - ("enableMarikoGpuUnsafeFreqs", "u32"), - ("enableEristaGpuUnsafeFreqs", "u32"), - ("enableMarikoCpuUnsafeFreqs", "u32"), - ("enableEristaCpuUnsafeFreqs", "u32"), ("commonGpuVoltOffset", "u32"), ("marikoEmcDvbShift", "u32"), # advanced config @@ -156,10 +152,6 @@ def load_all_vars(): c.load_entry_object("marikoGpuUV", 4) c.load_entry_object("eristaCpuUV", 5) c.load_entry_object("eristaGpuUV", 4) - c.load_entry_object("enableMarikoGpuUnsafeFreqs", 0) - c.load_entry_object("enableEristaGpuUnsafeFreqs", 0) - c.load_entry_object("enableMarikoCpuUnsafeFreqs", 0) - c.load_entry_object("enableEristaCpuUnsafeFreqs", 0) c.load_entry_object("commonGpuVoltOffset", 3) c.load_entry_object("marikoEmcDvbShift", 0) diff --git a/Source/OnDeviceConfig/include/defaults.hpp b/Source/OnDeviceConfig/include/defaults.hpp index 85a760a7..2416e55e 100644 --- a/Source/OnDeviceConfig/include/defaults.hpp +++ b/Source/OnDeviceConfig/include/defaults.hpp @@ -25,10 +25,6 @@ public: data.marikoGpuUV = 0; data.eristaCpuUV = 0; data.eristaGpuUV = 0; - data.enableMarikoGpuUnsafeFreqs = 0; - data.enableEristaGpuUnsafeFreqs = 0; - data.enableMarikoCpuUnsafeFreqs = 0; - data.enableEristaCpuUnsafeFreqs = 0; data.commonGpuVoltOffset = 0; data.marikoEmcDvbShift = 0; diff --git a/Source/OnDeviceConfig/include/kip_handler.hpp b/Source/OnDeviceConfig/include/kip_handler.hpp index 888b343d..9e1b55ca 100644 --- a/Source/OnDeviceConfig/include/kip_handler.hpp +++ b/Source/OnDeviceConfig/include/kip_handler.hpp @@ -28,10 +28,6 @@ private: uint32_t marikoGpuUV; uint32_t eristaCpuUV; uint32_t eristaGpuUV; - uint32_t enableMarikoGpuUnsafeFreqs; - uint32_t enableEristaGpuUnsafeFreqs; - uint32_t enableMarikoCpuUnsafeFreqs; - uint32_t enableEristaCpuUnsafeFreqs; uint32_t commonGpuVoltOffset; uint32_t marikoEmcDvbShift; diff --git a/Source/OnDeviceConfig/source/kip_handler.cpp b/Source/OnDeviceConfig/source/kip_handler.cpp index cda730f6..60205199 100644 --- a/Source/OnDeviceConfig/source/kip_handler.cpp +++ b/Source/OnDeviceConfig/source/kip_handler.cpp @@ -60,10 +60,6 @@ bool KipHandler::readKip() { data.marikoGpuUV = readU32(); data.eristaCpuUV = readU32(); data.eristaGpuUV = readU32(); - data.enableMarikoGpuUnsafeFreqs = readU32(); - data.enableEristaGpuUnsafeFreqs = readU32(); - data.enableMarikoCpuUnsafeFreqs = readU32(); - data.enableEristaCpuUnsafeFreqs = readU32(); data.commonGpuVoltOffset = readU32(); data.marikoEmcDvbShift = readU32(); @@ -179,10 +175,6 @@ bool KipHandler::writeKip() { writeU32(data.marikoGpuUV); writeU32(data.eristaCpuUV); writeU32(data.eristaGpuUV); - writeU32(data.enableMarikoGpuUnsafeFreqs); - writeU32(data.enableEristaGpuUnsafeFreqs); - writeU32(data.enableMarikoCpuUnsafeFreqs); - writeU32(data.enableEristaCpuUnsafeFreqs); writeU32(data.commonGpuVoltOffset); writeU32(data.marikoEmcDvbShift); diff --git a/Source/OnDeviceConfig/source/ui.cpp b/Source/OnDeviceConfig/source/ui.cpp index 4efd7255..09b4730d 100644 --- a/Source/OnDeviceConfig/source/ui.cpp +++ b/Source/OnDeviceConfig/source/ui.cpp @@ -111,8 +111,6 @@ void UI::renderGPUMenu() { auto& data = kipHandler->getData(); std::vector menuItems = { - "Enable Unsafe Frequencies (Mariko): " + std::string(data.enableMarikoGpuUnsafeFreqs ? "ON" : "OFF"), - "Enable Unsafe Frequencies (Erista): " + std::string(data.enableEristaGpuUnsafeFreqs ? "ON" : "OFF"), "Mariko GPU vMin: " + (data.marikoGpuVmin == 0 ? "Disabled" : std::to_string(data.marikoGpuVmin) + "mV"), "Mariko GPU vMax: " + (data.marikoGpuVmax == 0 ? "Disabled" : std::to_string(data.marikoGpuVmax) + "mV"), "Erista GPU vMin: " + (data.eristaGpuVmin == 0 ? "Disabled" : std::to_string(data.eristaGpuVmin) + "mV"), @@ -144,8 +142,6 @@ void UI::renderCPUMenu() { auto& data = kipHandler->getData(); std::vector menuItems = { - "Enable Unsafe Frequencies (Mariko): " + std::string(data.enableMarikoCpuUnsafeFreqs ? "ON" : "OFF"), - "Enable Unsafe Frequencies (Erista): " + std::string(data.enableEristaCpuUnsafeFreqs ? "ON" : "OFF"), "CPU Boost Frequency: " + std::to_string(data.commonCpuBoostClock / 1000) + " MHz", "Mariko CPU vMin: " + (data.marikoCpuVmin == 0 ? "Default" : std::to_string(data.marikoCpuVmin) + "mV"), "Mariko CPU vMax: " + (data.marikoCpuMaxVolt == 0 ? "Disabled" : std::to_string(data.marikoCpuMaxVolt) + "mV"), @@ -346,28 +342,6 @@ void UI::handleGPUMenuInput(u64 kDown) { auto& data = kipHandler->getData(); switch (selectedIndex) { - case 0: { // Mariko GPU Unsafe Freqs - std::vector opts = {"Disabled (0)", "Enabled (1)"}; - showValueEditor("Enable Unsafe GPU Frequencies (Mariko)", EditorType::LIST, - data.enableMarikoGpuUnsafeFreqs, - [this, &data](int val) { - data.enableMarikoGpuUnsafeFreqs = val; - if (autoSave && kipHandler) kipHandler->writeKip(); - setStatus("Mariko GPU unsafe: " + std::string(val ? "ENABLED" : "DISABLED")); - }, opts); - break; - } - case 1: { // Erista GPU Unsafe Freqs - std::vector opts = {"Disabled (0)", "Enabled (1)"}; - showValueEditor("Enable Unsafe GPU Frequencies (Erista)", EditorType::LIST, - data.enableEristaGpuUnsafeFreqs, - [this, &data](int val) { - data.enableEristaGpuUnsafeFreqs = val; - if (autoSave && kipHandler) kipHandler->writeKip(); - setStatus("Erista GPU unsafe: " + std::string(val ? "ENABLED" : "DISABLED")); - }, opts); - break; - } case 5: { // Mariko GPU UV std::vector opts = {"UV0 (No Table)", "UV1 (Regular)", "UV2 (High)", "UV3 (Custom)"}; showValueEditor("Mariko GPU Undervolt Mode", EditorType::LIST, @@ -418,28 +392,6 @@ void UI::handleCPUMenuInput(u64 kDown) { auto& data = kipHandler->getData(); switch (selectedIndex) { - case 0: { // Mariko CPU Unsafe - std::vector opts = {"Disabled (0)", "Enabled (1)"}; - showValueEditor("Enable Unsafe CPU Frequencies (Mariko)", EditorType::LIST, - data.enableMarikoCpuUnsafeFreqs, - [this, &data](int val) { - data.enableMarikoCpuUnsafeFreqs = val; - if (autoSave && kipHandler) kipHandler->writeKip(); - setStatus("Mariko CPU unsafe: " + std::string(val ? "ENABLED" : "DISABLED")); - }, opts); - break; - } - case 1: { // Erista CPU Unsafe - std::vector opts = {"Disabled (0)", "Enabled (1)"}; - showValueEditor("Enable Unsafe CPU Frequencies (Erista)", EditorType::LIST, - data.enableEristaCpuUnsafeFreqs, - [this, &data](int val) { - data.enableEristaCpuUnsafeFreqs = val; - if (autoSave && kipHandler) kipHandler->writeKip(); - setStatus("Erista CPU unsafe: " + std::string(val ? "ENABLED" : "DISABLED")); - }, opts); - break; - } default: setStatus("Feature in development"); break; diff --git a/Source/sys-clk/common/include/sysclk/board.h b/Source/sys-clk/common/include/sysclk/board.h index 43849629..971023f4 100644 --- a/Source/sys-clk/common/include/sysclk/board.h +++ b/Source/sys-clk/common/include/sysclk/board.h @@ -36,6 +36,8 @@ typedef enum SysClkModule_CPU = 0, SysClkModule_GPU, SysClkModule_MEM, + HocClkModule_CPUUndervolt, + HocClkModule_GPUUndervolt, SysClkModule_EnumMax } SysClkModule; diff --git a/Source/sys-clk/common/include/sysclk/clock_manager.h b/Source/sys-clk/common/include/sysclk/clock_manager.h index 74f329bd..98c1d335 100644 --- a/Source/sys-clk/common/include/sysclk/clock_manager.h +++ b/Source/sys-clk/common/include/sysclk/clock_manager.h @@ -30,8 +30,8 @@ typedef struct typedef struct { union { - uint32_t mhz[SysClkProfile_EnumMax * SysClkModule_EnumMax]; - uint32_t mhzMap[SysClkProfile_EnumMax][SysClkModule_EnumMax]; + uint32_t mhz[(uint32_t)SysClkProfile_EnumMax * (uint32_t)SysClkModule_EnumMax]; + uint32_t mhzMap[(uint32_t)SysClkProfile_EnumMax][(uint32_t)SysClkModule_EnumMax]; }; } SysClkTitleProfileList; diff --git a/Source/sys-clk/common/include/sysclk/config.h b/Source/sys-clk/common/include/sysclk/config.h index 0753bccb..bd828caf 100644 --- a/Source/sys-clk/common/include/sysclk/config.h +++ b/Source/sys-clk/common/include/sysclk/config.h @@ -15,16 +15,15 @@ typedef enum { SysClkConfigValue_PollingIntervalMs = 0, - SysClkConfigValue_TempLogIntervalMs, - SysClkConfigValue_FreqLogIntervalMs, - SysClkConfigValue_PowerLogIntervalMs, - SysClkConfigValue_CsvWriteIntervalMs, - HocClkConfigValue_UncappedClocks, - HocClkConfigValue_OverwriteBoostMode, - HocClkConfigValue_SyncReverseNXMode, - HocClkConfigValue_DockedGovernor, - HocClkConfigValue_HandheldGovernor, - SysClkConfigValue_EnumMax, + SysClkConfigValue_TempLogIntervalMs = 1, + SysClkConfigValue_FreqLogIntervalMs = 2, + SysClkConfigValue_PowerLogIntervalMs = 3, + SysClkConfigValue_CsvWriteIntervalMs = 4, + HocClkConfigValue_UncappedClocks = 5, + HocClkConfigValue_OverwriteBoostMode = 6, + HocClkConfigValue_MaxCpuClock = 7, + HocClkConfigValue_MaxGpuClock = 8, + SysClkConfigValue_EnumMax = 9, } SysClkConfigValue; typedef struct { @@ -49,14 +48,12 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr return pretty ? "Uncapped Clocks" : "uncapped_clocks"; case HocClkConfigValue_OverwriteBoostMode: return pretty ? "Overwrite Boost Mode" : "ow_boost"; - case HocClkConfigValue_SyncReverseNXMode: - return pretty ? "ReverseNX Sync" : "rnx_sync"; - case HocClkConfigValue_DockedGovernor: - return pretty ? "Docked Governor" : "governor_d"; - case HocClkConfigValue_HandheldGovernor: - return pretty ? "Handheld Governor" : "governor_hh"; + case HocClkConfigValue_MaxCpuClock: + return pretty ? "Max CPU Clock" : "cpu_max"; + case HocClkConfigValue_MaxGpuClock: + return pretty ? "Max GPU Clock" : "gpu_max"; default: - return NULL; + return pretty ? "Null" : "null"; } } @@ -72,8 +69,11 @@ static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val) case SysClkConfigValue_CsvWriteIntervalMs: case HocClkConfigValue_UncappedClocks: case HocClkConfigValue_OverwriteBoostMode: - case HocClkConfigValue_SyncReverseNXMode: return 0ULL; + case HocClkConfigValue_MaxCpuClock: + return 1785ULL; + case HocClkConfigValue_MaxGpuClock: + return 921ULL; default: return 0ULL; } @@ -92,8 +92,10 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in return input >= 0; case HocClkConfigValue_OverwriteBoostMode: case HocClkConfigValue_UncappedClocks: - case HocClkConfigValue_SyncReverseNXMode: return (input & 0x1) == input; + case HocClkConfigValue_MaxCpuClock: + case HocClkConfigValue_MaxGpuClock: + return input > 0; default: return false; } diff --git a/Source/sys-clk/common/include/sysclk/errors.h b/Source/sys-clk/common/include/sysclk/errors.h index ed0d9a98..6d94908e 100644 --- a/Source/sys-clk/common/include/sysclk/errors.h +++ b/Source/sys-clk/common/include/sysclk/errors.h @@ -18,4 +18,5 @@ typedef enum SysClkError_Generic = 0, SysClkError_ConfigNotLoaded = 1, SysClkError_ConfigSaveFailed = 2, + HocClkError_SocThermFail = 3, } SysClkError; diff --git a/Source/sys-clk/manager/src/app_profiles_tab.cpp b/Source/sys-clk/manager/src/app_profiles_tab.cpp index 4c9bd48a..e36100b4 100644 --- a/Source/sys-clk/manager/src/app_profiles_tab.cpp +++ b/Source/sys-clk/manager/src/app_profiles_tab.cpp @@ -87,11 +87,11 @@ AppProfilesTab::AppProfilesTab() } // Name - if (!langEntry->name) - { - i++; - continue; - } + // if (!langEntry->name) + // { + // i++; + // continue; + // } Title* title = (Title*) malloc(sizeof(Title)); title->tid = tid; diff --git a/Source/sys-clk/overlay/src/ui/gui/app_profile_gui.cpp b/Source/sys-clk/overlay/src/ui/gui/app_profile_gui.cpp index cac497f9..52c2aa7c 100644 --- a/Source/sys-clk/overlay/src/ui/gui/app_profile_gui.cpp +++ b/Source/sys-clk/overlay/src/ui/gui/app_profile_gui.cpp @@ -46,7 +46,8 @@ void AppProfileGui::openFreqChoiceGui(tsl::elm::ListItem* listItem, SysClkProfil } return true; - }); + }, true + ); } void AppProfileGui::addModuleListItem(SysClkProfile profile, SysClkModule module) diff --git a/Source/sys-clk/overlay/src/ui/gui/freq_choice_gui.cpp b/Source/sys-clk/overlay/src/ui/gui/freq_choice_gui.cpp index c768a969..b7d0850a 100644 --- a/Source/sys-clk/overlay/src/ui/gui/freq_choice_gui.cpp +++ b/Source/sys-clk/overlay/src/ui/gui/freq_choice_gui.cpp @@ -13,15 +13,21 @@ #include "../format.h" #include "fatal_gui.h" - FreqChoiceGui::FreqChoiceGui(std::uint32_t selectedHz, std::uint32_t *hzList, std::uint32_t hzCount, SysClkModule module, FreqChoiceListener listener) + FreqChoiceGui::FreqChoiceGui(std::uint32_t selectedHz, std::uint32_t *hzList, std::uint32_t hzCount, SysClkModule module, FreqChoiceListener listener, bool checkMax) { this->selectedHz = selectedHz; this->hzList = hzList; this->hzCount = hzCount; - this->module = module; // Add this + this->module = module; this->listener = listener; + this->checkMax = checkMax; + this->configList = new SysClkConfigValueList {}; } - +FreqChoiceGui::~FreqChoiceGui() +{ + delete this->configList; +} + tsl::elm::ListItem* FreqChoiceGui::createFreqListItem(std::uint32_t hz, bool selected, int safety) { std::string text = formatListFreqHz(hz); @@ -61,6 +67,7 @@ void FreqChoiceGui::listUI() { + sysclkIpcGetConfigValues(this->configList); // Add CategoryHeader based on module std::string moduleName = sysclkFormatModule(this->module, false); this->listElement->addItem(new tsl::elm::CategoryHeader(moduleName)); @@ -72,6 +79,16 @@ hz = this->hzList[i]; uint32_t mhz = hz / 1000000; // Skip 204 MHz exactly + if(checkMax) { + if (this->configList->values[HocClkConfigValue_MaxCpuClock] < mhz && moduleName == "cpu") { + continue; + } + + if (this->configList->values[HocClkConfigValue_MaxGpuClock] < mhz&& moduleName == "gpu") { + continue; + } + + } if (moduleName == "mem" && mhz <= 600) { continue; diff --git a/Source/sys-clk/overlay/src/ui/gui/freq_choice_gui.h b/Source/sys-clk/overlay/src/ui/gui/freq_choice_gui.h index 5458af96..c0956007 100644 --- a/Source/sys-clk/overlay/src/ui/gui/freq_choice_gui.h +++ b/Source/sys-clk/overlay/src/ui/gui/freq_choice_gui.h @@ -11,7 +11,7 @@ #pragma once #include - +#include #include "base_menu_gui.h" using FreqChoiceListener = std::function; @@ -20,16 +20,25 @@ using FreqChoiceListener = std::function; class FreqChoiceGui : public BaseMenuGui { - protected: - std::uint32_t selectedHz; - std::uint32_t* hzList; - std::uint32_t hzCount; - SysClkModule module; // Added - FreqChoiceListener listener; - tsl::elm::ListItem* createFreqListItem(std::uint32_t hz, bool selected, int safety); +protected: + SysClkConfigValueList* configList; + std::uint32_t selectedHz; + std::uint32_t* hzList; + std::uint32_t hzCount; + SysClkModule module; // added module + FreqChoiceListener listener; + bool checkMax; // new member + tsl::elm::ListItem* createFreqListItem(std::uint32_t hz, bool selected, int safety); - public: - FreqChoiceGui(std::uint32_t selectedHz, std::uint32_t* hzList, std::uint32_t hzCount, SysClkModule module, FreqChoiceListener listener); - ~FreqChoiceGui() {} - void listUI() override; +public: + // Updated constructor with checkMaxValue + FreqChoiceGui(std::uint32_t selectedHz, + std::uint32_t* hzList, + std::uint32_t hzCount, + SysClkModule module, + FreqChoiceListener listener, + bool checkMax = true); + ~FreqChoiceGui(); + + void listUI() override; }; diff --git a/Source/sys-clk/overlay/src/ui/gui/global_override_gui.cpp b/Source/sys-clk/overlay/src/ui/gui/global_override_gui.cpp index 97104411..d36624f5 100644 --- a/Source/sys-clk/overlay/src/ui/gui/global_override_gui.cpp +++ b/Source/sys-clk/overlay/src/ui/gui/global_override_gui.cpp @@ -44,7 +44,7 @@ void GlobalOverrideGui::openFreqChoiceGui(SysClkModule module) this->context->overrideFreqs[module] = hz; return true; - }); + }, true); } void GlobalOverrideGui::addModuleListItem(SysClkModule module) diff --git a/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp b/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp index 54ed48ac..e93f11aa 100644 --- a/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp +++ b/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp @@ -3,7 +3,7 @@ #include "../format.h" #include #include -//#include +#include MiscGui::MiscGui() { @@ -14,9 +14,10 @@ MiscGui::~MiscGui() { delete this->configList; this->configToggles.clear(); + this->configTrackbars.clear(); } -void MiscGui::addConfigToggle(SysClkConfigValue configVal, const char* altName = nullptr) { +void MiscGui::addConfigToggle(SysClkConfigValue configVal, const char* altName) { const char* configName = altName ? altName : sysclkFormatConfigValue(configVal, true); tsl::elm::ToggleListItem* toggle = new tsl::elm::ToggleListItem(configName, this->configList->values[configVal]); toggle->setStateChangedListener([this, configVal](bool state) { @@ -24,13 +25,74 @@ void MiscGui::addConfigToggle(SysClkConfigValue configVal, const char* altName = Result rc = sysclkIpcSetConfigValues(this->configList); if (R_FAILED(rc)) FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc); - this->lastContextUpdate = armGetSystemTick(); }); this->listElement->addItem(toggle); this->configToggles[configVal] = toggle; } +void MiscGui::addConfigButton(SysClkConfigValue configVal, const char* altName, SysClkModule module) { + const char* configName = altName ? altName : sysclkFormatConfigValue(configVal, true); + // Create button list item + tsl::elm::ListItem* listItem = new tsl::elm::ListItem(configName); + + // Set initial label text (MHz) + uint64_t currentMHz = this->configList->values[configVal]; + char valueText[32]; + snprintf(valueText, sizeof(valueText), "%lu MHz", currentMHz); + listItem->setValue(valueText); + + // Click listener to open FreqChoiceGui + listItem->setClickListener([this, configVal, module](u64 keys) { + if ((keys & HidNpadButton_A) == 0) + return false; + + std::uint32_t hzList[SYSCLK_FREQ_LIST_MAX]; + std::uint32_t hzCount; + + // Get frequency list from sys-clk + Result rc = sysclkIpcGetFreqList(module, hzList, SYSCLK_FREQ_LIST_MAX, &hzCount); + if (R_FAILED(rc)) { + FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc); + return false; + } + + std::uint32_t currentHz = this->configList->values[configVal] * 1'000'000; + + tsl::changeTo( + currentHz, + hzList, + hzCount, + module, + [this, configVal](std::uint32_t hz) { + // Convert to MHz for config storage + uint64_t mhz = hz / 1'000'000; + this->configList->values[configVal] = mhz; + + // Push new config value + Result rc = sysclkIpcSetConfigValues(this->configList); + if (R_FAILED(rc)) { + FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc); + return false; + } + + this->lastContextUpdate = armGetSystemTick(); + return true; + }, + false + ); + + + return true; + }); + + // Add to UI and internal map for refresh updates + this->listElement->addItem(listItem); + this->configButtons[configVal] = listItem; +} + + + void MiscGui::updateConfigToggles() { for (const auto& [value, toggle] : this->configToggles) { if (toggle != nullptr) @@ -41,20 +103,28 @@ void MiscGui::updateConfigToggles() { void MiscGui::listUI() { this->listElement->addItem(new tsl::elm::CategoryHeader("Config")); - addConfigToggle(HocClkConfigValue_UncappedClocks); - addConfigToggle(HocClkConfigValue_OverwriteBoostMode); - addConfigToggle(HocClkConfigValue_SyncReverseNXMode); + addConfigToggle(HocClkConfigValue_UncappedClocks, nullptr); + addConfigToggle(HocClkConfigValue_OverwriteBoostMode, nullptr); + + addConfigButton(HocClkConfigValue_MaxCpuClock, nullptr, SysClkModule_CPU); + addConfigButton(HocClkConfigValue_MaxGpuClock, nullptr, SysClkModule_GPU); } void MiscGui::refresh() { BaseMenuGui::refresh(); - // Update the enabled toggle state - if (this->context && ++frameCounter >= 60) - { + if (this->context && ++frameCounter >= 60) { frameCounter = 0; - sysclkIpcGetConfigValues(this->configList); - updateConfigToggles(); - } + sysclkIpcGetConfigValues(this->configList); + + updateConfigToggles(); + + for (const auto& [configVal, button] : this->configButtons) { + uint64_t mhz = this->configList->values[configVal]; + char valueText[32]; + snprintf(valueText, sizeof(valueText), "%lu MHz", mhz); + button->setValue(valueText); + } + } } diff --git a/Source/sys-clk/overlay/src/ui/gui/misc_gui.h b/Source/sys-clk/overlay/src/ui/gui/misc_gui.h index 0ad9f266..8bb6e1c4 100644 --- a/Source/sys-clk/overlay/src/ui/gui/misc_gui.h +++ b/Source/sys-clk/overlay/src/ui/gui/misc_gui.h @@ -3,23 +3,27 @@ #include "base_menu_gui.h" #include #include - +#include +#include "freq_choice_gui.h" class MiscGui : public BaseMenuGui { - public: - MiscGui(); - ~MiscGui(); +public: + MiscGui(); + ~MiscGui(); - void listUI() override; - void refresh() override; - protected: - SysClkConfigValueList* configList; - - std::map configToggles; - void addConfigToggle(SysClkConfigValue, const char*); - void updateConfigToggles(); - - tsl::elm::ToggleListItem* enabledToggle; - - u8 frameCounter = 60; -}; \ No newline at end of file + void listUI() override; + void refresh() override; + +protected: + std::map configButtons; + SysClkConfigValueList* configList; + std::map configToggles; + std::map>> configTrackbars; + void addConfigToggle(SysClkConfigValue configVal, const char* altName); + void addConfigButton(SysClkConfigValue configVal, const char* altName, SysClkModule module); + + void updateConfigToggles(); + + tsl::elm::ToggleListItem* enabledToggle; + u8 frameCounter = 60; +}; diff --git a/Source/sys-clk/sysmodule/src/clock_manager.cpp b/Source/sys-clk/sysmodule/src/clock_manager.cpp index 2ecd7ec0..df481cf2 100644 --- a/Source/sys-clk/sysmodule/src/clock_manager.cpp +++ b/Source/sys-clk/sysmodule/src/clock_manager.cpp @@ -292,7 +292,7 @@ bool ClockManager::RefreshContext() // restore clocks to stock values on app or profile change if (hasChanged) { - this->rnxSync->ToggleSync(this->GetConfig()->GetConfigValue(HocClkConfigValue_SyncReverseNXMode)); + // this->rnxSync->ToggleSync(this->GetConfig()->GetConfigValue(HocClkConfigValue_SyncReverseNXMode)); Board::ResetToStock(); this->WaitForNextTick(); } diff --git a/Source/sys-clk/sysmodule/src/config.cpp b/Source/sys-clk/sysmodule/src/config.cpp index e8c40f5e..74b80d2f 100644 --- a/Source/sys-clk/sysmodule/src/config.cpp +++ b/Source/sys-clk/sysmodule/src/config.cpp @@ -419,7 +419,7 @@ bool Config::SetConfigValues(SysClkConfigValueList* configValues, bool immediate char* iniValues[SysClkConfigValue_EnumMax + 1]; // char arrays to build strings - char valuesStr[SysClkConfigValue_EnumMax * 0x20]; + char valuesStr[SysClkConfigValue_EnumMax * 0x80]; // Iteration pointers char* sv = &valuesStr[0];