From c879ba985f16e49df1c1c4afc38fd50455c7de2e Mon Sep 17 00:00:00 2001 From: Lightos1 <124387232+Lightos1@users.noreply.github.com> Date: Wed, 7 Jan 2026 17:48:15 +0100 Subject: [PATCH] Cpu tuning fixes --- .../stratosphere/loader/source/oc/pcv/pcv.hpp | 2 +- .../loader/source/oc/pcv/pcv_mariko.cpp | 251 ++++++++---------- 2 files changed, 113 insertions(+), 140 deletions(-) diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp index 2f85af55..face5620 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp @@ -326,7 +326,7 @@ namespace ams::ldr::oc::pcv { customize_table = const_cast(C.eristaCpuDvfsTable); } } else { - customize_table = default_table;; + customize_table = default_table; } } 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 bffbd631..411c42bb 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp @@ -195,151 +195,125 @@ namespace ams::ldr::oc::pcv::mariko { R_UNLESS(entry->tune1_high == 0x3FFF7FF, ldr::ResultInvalidCpuVoltDfllEntry()); switch (C.marikoCpuUVLow) { - case 0: + case 1: + PATCH_OFFSET(&(entry->tune0_low), 0xffa0); + PATCH_OFFSET(&(entry->tune0_high), 0xffff); + PATCH_OFFSET(&(entry->tune1_low), 0x21107ff); + PATCH_OFFSET(&(entry->tune1_high), 0); + break; + case 2: + PATCH_OFFSET(&(entry->tune0_high), 0xffdf); + PATCH_OFFSET(&(entry->tune1_low), 0x21107ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27207ff); + break; + case 3: + PATCH_OFFSET(&(entry->tune0_low), 0xffdf); + PATCH_OFFSET(&(entry->tune0_high), 0xffdf); + PATCH_OFFSET(&(entry->tune1_low), 0x21107ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27307ff); + break; + case 4: + PATCH_OFFSET(&(entry->tune0_low), 0xffff); + PATCH_OFFSET(&(entry->tune0_high), 0xffdf); + PATCH_OFFSET(&(entry->tune1_low), 0x21107ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27407ff); + break; + case 5: + PATCH_OFFSET(&(entry->tune0_high), 0xffdf); + PATCH_OFFSET(&(entry->tune1_low), 0x21607ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27707ff); + break; + case 6: + PATCH_OFFSET(&(entry->tune0_high), 0xffdf); + PATCH_OFFSET(&(entry->tune1_low), 0x21607ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27807ff); + break; + case 7: + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_low), 0x21607ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff); + break; + case 8: + PATCH_OFFSET(&(entry->tune0_low), 0xdfff); + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_low), 0x21707ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff); + break; + case 9: + PATCH_OFFSET(&(entry->tune0_low), 0xdfff); + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_low), 0x21707ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27c07ff); + break; + case 10: + PATCH_OFFSET(&(entry->tune0_low), 0xdfff); + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_low), 0x21707ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27d07ff); + break; + case 11: + PATCH_OFFSET(&(entry->tune0_low), 0xdfff); + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_low), 0x21707ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27e07ff); + break; + case 12: + PATCH_OFFSET(&(entry->tune0_low), 0xdfff); + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_low), 0x21707ff); + PATCH_OFFSET(&(entry->tune1_high), 0x27f07ff); break; - case 1: { - PATCH_OFFSET(&(entry->tune0_low), 0xffa0); - PATCH_OFFSET(&(entry->tune0_high), 0xffff); - PATCH_OFFSET(&(entry->tune1_low), 0x21107ff); - PATCH_OFFSET(&(entry->tune1_high), 0x0); - break; - } - case 2: { - PATCH_OFFSET(&(entry->tune0_high), 0xffdf); - PATCH_OFFSET(&(entry->tune1_low), 0x21107ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27207ff); - break; - } - case 3: { - PATCH_OFFSET(&(entry->tune0_low), 0xffdf); - PATCH_OFFSET(&(entry->tune0_high), 0xffdf); - PATCH_OFFSET(&(entry->tune1_low), 0x21107ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27307ff); - break; - } - case 4: { - PATCH_OFFSET(&(entry->tune0_low), 0xffff); - PATCH_OFFSET(&(entry->tune0_high), 0xffdf); - PATCH_OFFSET(&(entry->tune1_low), 0x21107ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27407ff); - break; - } - case 5: { - PATCH_OFFSET(&(entry->tune0_high), 0xffdf); - PATCH_OFFSET(&(entry->tune1_low), 0x21607ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27707ff); - break; - } - case 6: { - PATCH_OFFSET(&(entry->tune0_high), 0xffdf); - PATCH_OFFSET(&(entry->tune1_low), 0x21607ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27807ff); - break; - } - case 7: { - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_low), 0x21607ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff); - break; - } - case 8: { - PATCH_OFFSET(&(entry->tune0_low), 0xdfff); - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_low), 0x21707ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff); - break; - } - case 9: { - PATCH_OFFSET(&(entry->tune0_low), 0xdfff); - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_low), 0x21707ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27c07ff); - break; - } - case 10: { - PATCH_OFFSET(&(entry->tune0_low), 0xdfff); - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_low), 0x21707ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27d07ff); - break; - } - case 11: { - PATCH_OFFSET(&(entry->tune0_low), 0xdfff); - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_low), 0x21707ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27e07ff); - break; - } - case 12: { - PATCH_OFFSET(&(entry->tune0_low), 0xdfff); - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_low), 0x21707ff); - PATCH_OFFSET(&(entry->tune1_high), 0x27f07ff); - break; - } default: break; } + switch (C.marikoCpuUVHigh) { - case 0: + case 1: + PATCH_OFFSET(&(entry->tune1_high), 0); + PATCH_OFFSET(&(entry->tune0_high), 0xffff); + break; + case 2: + PATCH_OFFSET(&(entry->tune0_high), 0xffdf); + PATCH_OFFSET(&(entry->tune1_high), 0x27207ff); + break; + case 3: + PATCH_OFFSET(&(entry->tune0_high), 0xffdf); + PATCH_OFFSET(&(entry->tune1_high), 0x27307ff); + break; + case 4: + PATCH_OFFSET(&(entry->tune0_high), 0xffdf); + PATCH_OFFSET(&(entry->tune1_high), 0x27407ff); + break; + case 5: + PATCH_OFFSET(&(entry->tune0_high), 0xffdf); + PATCH_OFFSET(&(entry->tune1_high), 0x27707ff); + break; + case 6: + PATCH_OFFSET(&(entry->tune0_high), 0xffdf); + PATCH_OFFSET(&(entry->tune1_high), 0x27807ff); break; - case 1: { - PATCH_OFFSET(&(entry->tune0_high), 0xffff); - PATCH_OFFSET(&(entry->tune1_high), 0x0); - break; - } - case 2: { - PATCH_OFFSET(&(entry->tune0_high), 0xfffd); - PATCH_OFFSET(&(entry->tune1_high), 0x27207ff); - break; - } - case 3: { - PATCH_OFFSET(&(entry->tune0_high), 0xffdf); - PATCH_OFFSET(&(entry->tune1_high), 0x27307ff;); - break; - } - case 4: { - PATCH_OFFSET(&(entry->tune0_high), 0xffdf); - PATCH_OFFSET(&(entry->tune1_high), 0x27407ff;); - break; - } - case 5: { - PATCH_OFFSET(&(entry->tune0_high), 0xffdf); - PATCH_OFFSET(&(entry->tune1_high), 0x27707ff); - break; - } - case 6: { - PATCH_OFFSET(&(entry->tune0_high), 0xffdf); - PATCH_OFFSET(&(entry->tune1_high), 0x27807ff); - break; - } case 7: - case 8: { - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff); - break; - } - case 9: { - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_high), 0x27c07ff); - break; - } - case 10: { - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_high), 0x27d07ff;); - break; - } - case 11: { - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_high), 0x27e07ff); - break; - } - case 12: { - PATCH_OFFSET(&(entry->tune0_high), 0xdfff); - PATCH_OFFSET(&(entry->tune1_high), 0x27f07ff); - break; - } + case 8: + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff); + break; + case 9: + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_high), 0x27c07ff); + break; + case 10: + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_high), 0x27d07ff); + break; + case 11: + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_high), 0x27e07ff); + break; + case 12: + PATCH_OFFSET(&(entry->tune0_high), 0xdfff); + PATCH_OFFSET(&(entry->tune1_high), 0x27f07ff); + break; default: break; } @@ -928,8 +902,7 @@ namespace ams::ldr::oc::pcv::mariko { } else if (C.marikoEmcMaxClock < 2931200) { emc_dvb_dvfs_table_t oc_table = {2665600, {DVB_VOLT(775, 750, 725)}}; std::memcpy(new_start, &oc_table, sizeof(emc_dvb_dvfs_table_t)); - } - else if (C.marikoEmcMaxClock < 3200000) { + } else if (C.marikoEmcMaxClock < 3200000) { emc_dvb_dvfs_table_t oc_table = {2931200, {DVB_VOLT(800, 775, 750)}}; std::memcpy(new_start, &oc_table, sizeof(emc_dvb_dvfs_table_t)); } else {