hoc-sys/loader/config-pc/config-device - move unsafe freqs setting to hoc-sys

This allows stuff to be changed on the fly
This commit is contained in:
souldbminersmwc
2025-10-23 15:54:20 -04:00
parent e14fed0be9
commit 708be969cb
28 changed files with 309 additions and 450 deletions

45
.clang-format Normal file
View File

@@ -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 <ryan.m.jeong@hotmail.com>
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

View File

@@ -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<EristaMtcTable *>(&EristaMtcTablePlaceholder),
//.marikoMtcTable = const_cast<MarikoMtcTable *>(&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 } },
},
};
}

View File

@@ -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);

View File

@@ -94,14 +94,8 @@ void SafetyCheck() {
R_SUCCEED();
}
};
u32 eristaCpuDvfsMaxFreq;
if (C.enableEristaCpuUnsafeFreqs) {
eristaCpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaCpuDvfsTableUnsafeFreqs)->freq);
} else {
eristaCpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq);
}
u32 eristaCpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq);
u32 marikoCpuDvfsMaxFreq;
if(!C.enableMarikoCpuUnsafeFreqs) {
if (C.marikoCpuUV) {
marikoCpuDvfsMaxFreq = static_cast<u32>(
GetDvfsTableLastEntry(C.marikoCpuDvfsTableSLT)->freq
@@ -111,9 +105,6 @@ void SafetyCheck() {
GetDvfsTableLastEntry(C.marikoCpuDvfsTable)->freq
);
}
} else {
marikoCpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoCpuDvfsTableUnsafeFreqs)->freq);
}
u32 eristaGpuDvfsMaxFreq;
switch (C.eristaGpuUV)
{
@@ -124,17 +115,8 @@ void SafetyCheck() {
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableSLT)->freq);
break;
case 2:
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableHigh)->freq);
break;
case 3:
if(C.enableEristaGpuUnsafeFreqs)
{
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableUv3UnsafeFreqs)->freq);
}
else
{
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq);
}
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableHigh)->freq);
break;
default:
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq);
@@ -150,17 +132,8 @@ void SafetyCheck() {
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableSLT)->freq);
break;
case 2:
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq);
break;
case 3:
if(C.enableMarikoGpuUnsafeFreqs)
{
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableUv3UnsafeFreqs)->freq);
}
else
{
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq);
}
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq);
break;
default:
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq);

View File

@@ -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<cvb_entry_t *>(C.marikoCpuDvfsTableUnsafeFreqs);
if (C.marikoCpuUV) {
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTableSLT);
} else {
if (C.marikoCpuUV) {
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTableSLT);
} else {
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTable);
}
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTable);
}
} else {
if (C.enableEristaCpuUnsafeFreqs) {
customize_table = const_cast<cvb_entry_t *>(C.eristaCpuDvfsTableUnsafeFreqs);
} else {
customize_table = const_cast<cvb_entry_t *>(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<cvb_entry_t *>(C.marikoGpuDvfsTableSLT);
break;
case 2:
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTableHiOPT);
break;
case 3:
if(C.enableMarikoGpuUnsafeFreqs)
{
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTableUv3UnsafeFreqs);
}
else
{
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTable);
}
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTableHiOPT);
break;
default:
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTable);
@@ -374,17 +357,8 @@ namespace ams::ldr::oc::pcv
customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTableSLT);
break;
case 2:
customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTableHigh);
break;
case 3:
if(C.enableEristaGpuUnsafeFreqs)
{
customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTableUv3UnsafeFreqs);
}
else
{
customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTable);
}
customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTableHigh);
break;
default:
customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTable);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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,

View File

@@ -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

View File

@@ -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")

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -111,8 +111,6 @@ void UI::renderGPUMenu() {
auto& data = kipHandler->getData();
std::vector<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> 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;

View File

@@ -36,6 +36,8 @@ typedef enum
SysClkModule_CPU = 0,
SysClkModule_GPU,
SysClkModule_MEM,
HocClkModule_CPUUndervolt,
HocClkModule_GPUUndervolt,
SysClkModule_EnumMax
} SysClkModule;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -18,4 +18,5 @@ typedef enum
SysClkError_Generic = 0,
SysClkError_ConfigNotLoaded = 1,
SysClkError_ConfigSaveFailed = 2,
HocClkError_SocThermFail = 3,
} SysClkError;

View File

@@ -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;

View File

@@ -46,7 +46,8 @@ void AppProfileGui::openFreqChoiceGui(tsl::elm::ListItem* listItem, SysClkProfil
}
return true;
});
}, true
);
}
void AppProfileGui::addModuleListItem(SysClkProfile profile, SysClkModule module)

View File

@@ -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;

View File

@@ -11,7 +11,7 @@
#pragma once
#include <list>
#include <functional>
#include "base_menu_gui.h"
using FreqChoiceListener = std::function<bool(std::uint32_t hz)>;
@@ -20,16 +20,25 @@ using FreqChoiceListener = std::function<bool(std::uint32_t hz)>;
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;
};

View File

@@ -44,7 +44,7 @@ void GlobalOverrideGui::openFreqChoiceGui(SysClkModule module)
this->context->overrideFreqs[module] = hz;
return true;
});
}, true);
}
void GlobalOverrideGui::addModuleListItem(SysClkModule module)

View File

@@ -3,7 +3,7 @@
#include "../format.h"
#include <cstdio>
#include <cstring>
//#include <sstream>
#include <vector>
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<FreqChoiceGui>(
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);
}
}
}

View File

@@ -3,23 +3,27 @@
#include "base_menu_gui.h"
#include <unordered_map>
#include <string>
#include <vector>
#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<SysClkConfigValue, tsl::elm::ToggleListItem*> configToggles;
void addConfigToggle(SysClkConfigValue, const char*);
void updateConfigToggles();
tsl::elm::ToggleListItem* enabledToggle;
u8 frameCounter = 60;
};
void listUI() override;
void refresh() override;
protected:
std::map<SysClkConfigValue, tsl::elm::ListItem*> configButtons;
SysClkConfigValueList* configList;
std::map<SysClkConfigValue, tsl::elm::ToggleListItem*> configToggles;
std::map<SysClkConfigValue, std::tuple<tsl::elm::TrackBar*, tsl::elm::ListItem*, std::vector<uint64_t>>> 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;
};

View File

@@ -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();
}

View File

@@ -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];