Improve formating
This commit is contained in:
@@ -54,18 +54,21 @@ Result MemVoltHandler(u32* ptr) {
|
|||||||
|
|
||||||
regulator* entry = nullptr;
|
regulator* entry = nullptr;
|
||||||
for (auto& i : entries) {
|
for (auto& i : entries) {
|
||||||
if (R_SUCCEEDED(validator(i)))
|
if (R_SUCCEEDED(validator(i))) {
|
||||||
entry = i;
|
entry = i;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
R_UNLESS(entry, ldr::ResultInvalidRegulatorEntry());
|
R_UNLESS(entry, ldr::ResultInvalidRegulatorEntry());
|
||||||
|
|
||||||
u32 emc_uv = C.commonEmcMemVolt;
|
u32 emc_uv = C.commonEmcMemVolt;
|
||||||
if (!emc_uv)
|
if (!emc_uv) {
|
||||||
R_SKIP();
|
R_SKIP();
|
||||||
|
}
|
||||||
|
|
||||||
if (emc_uv % uv_step)
|
if (emc_uv % uv_step) {
|
||||||
emc_uv = emc_uv / uv_step * uv_step; // rounding
|
emc_uv = emc_uv / uv_step * uv_step; // rounding
|
||||||
|
}
|
||||||
|
|
||||||
PATCH_OFFSET(ptr, emc_uv);
|
PATCH_OFFSET(ptr, emc_uv);
|
||||||
|
|
||||||
@@ -94,6 +97,7 @@ void SafetyCheck() {
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 eristaCpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq);
|
u32 eristaCpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq);
|
||||||
u32 marikoCpuDvfsMaxFreq;
|
u32 marikoCpuDvfsMaxFreq;
|
||||||
if (C.marikoCpuUVHigh) {
|
if (C.marikoCpuUVHigh) {
|
||||||
@@ -106,8 +110,7 @@ void SafetyCheck() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
u32 eristaGpuDvfsMaxFreq;
|
u32 eristaGpuDvfsMaxFreq;
|
||||||
switch (C.eristaGpuUV)
|
switch (C.eristaGpuUV) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq);
|
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq);
|
||||||
break;
|
break;
|
||||||
@@ -155,10 +158,11 @@ void SafetyCheck() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (auto& i : validators) {
|
for (auto& i : validators) {
|
||||||
if (R_FAILED(i.check()))
|
if (R_FAILED(i.check())) {
|
||||||
CRASH("Validation FAIL");
|
CRASH("Validation FAIL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||||
|
|||||||
@@ -135,9 +135,10 @@
|
|||||||
auto is_empty = [](NT* entry) {
|
auto is_empty = [](NT* entry) {
|
||||||
uint8_t* m = reinterpret_cast<uint8_t *>(entry);
|
uint8_t* m = reinterpret_cast<uint8_t *>(entry);
|
||||||
for (size_t i = 0; i < sizeof(NT); i++) {
|
for (size_t i = 0; i < sizeof(NT); i++) {
|
||||||
if (*(m + i))
|
if (*(m + i)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,15 +21,15 @@
|
|||||||
namespace ams::ldr::hoc::ptm {
|
namespace ams::ldr::hoc::ptm {
|
||||||
|
|
||||||
Result CpuPtmBoost(perf_conf_entry* entry) {
|
Result CpuPtmBoost(perf_conf_entry* entry) {
|
||||||
|
|
||||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||||
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
||||||
#else
|
#else
|
||||||
bool isMariko = true;
|
bool isMariko = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!C.eristaCpuBoostClock || !C.marikoCpuBoostClock)
|
if (!C.eristaCpuBoostClock || !C.marikoCpuBoostClock) {
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
u32 cpuPtmBoostNew = isMariko ? C.marikoCpuBoostClock * 1000 : C.eristaCpuBoostClock * 1000;
|
u32 cpuPtmBoostNew = isMariko ? C.marikoCpuBoostClock * 1000 : C.eristaCpuBoostClock * 1000;
|
||||||
|
|
||||||
@@ -47,25 +47,21 @@ Result MemPtm(perf_conf_entry* entry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PtmEntryIsValid(perf_conf_entry* entry) {
|
bool PtmEntryIsValid(perf_conf_entry* entry) {
|
||||||
return (entry->cpu_freq_1 == entry->cpu_freq_2 &&
|
return (entry->cpu_freq_1 == entry->cpu_freq_2 && entry->gpu_freq_1 == entry->gpu_freq_2 && entry->emc_freq_1 == entry->emc_freq_2);
|
||||||
entry->gpu_freq_1 == entry->gpu_freq_2 &&
|
|
||||||
entry->emc_freq_1 == entry->emc_freq_2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PtmTablePatternFn(u32* ptr) {
|
bool PtmTablePatternFn(u32* ptr) {
|
||||||
perf_conf_entry* entry = reinterpret_cast<perf_conf_entry *>(ptr);
|
perf_conf_entry* entry = reinterpret_cast<perf_conf_entry *>(ptr);
|
||||||
if (!PtmEntryIsValid(entry))
|
if (!PtmEntryIsValid(entry)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return entry->cpu_freq_1 == cpuPtmDefault;
|
return entry->cpu_freq_1 == cpuPtmDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||||
perf_conf_entry* confTable = nullptr;
|
perf_conf_entry* confTable = nullptr;
|
||||||
for (uintptr_t ptr = mapped_nso;
|
for (uintptr_t ptr = mapped_nso; ptr <= mapped_nso + nso_size - sizeof(perf_conf_entry) * entryCnt; ptr += sizeof(u32)) {
|
||||||
ptr <= mapped_nso + nso_size - sizeof(perf_conf_entry) * entryCnt;
|
|
||||||
ptr += sizeof(u32))
|
|
||||||
{
|
|
||||||
u32* ptr32 = reinterpret_cast<u32 *>(ptr);
|
u32* ptr32 = reinterpret_cast<u32 *>(ptr);
|
||||||
if (PtmTablePatternFn(ptr32)) {
|
if (PtmTablePatternFn(ptr32)) {
|
||||||
confTable = reinterpret_cast<perf_conf_entry *>(ptr);
|
confTable = reinterpret_cast<perf_conf_entry *>(ptr);
|
||||||
@@ -86,7 +82,6 @@ void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
|||||||
bool isMariko = true;
|
bool isMariko = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
for (u32 i = 0; i < entryCnt; i++) {
|
for (u32 i = 0; i < entryCnt; i++) {
|
||||||
perf_conf_entry *entry = confTable + i;
|
perf_conf_entry *entry = confTable + i;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user