diff --git a/README.md b/README.md index fbc0ef55..724d03d9 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ This project will not be actively maintained by me and I'm looking for collabora - Anything above that are not in the table of official module. ([issue #4](https://github.com/KazushiMe/Switch-OC-Suite/issues/4)) - **Recommended RAM clock: 1862.4 MHz**. - - **RAM clock is set permanently** via patching ptm module, rather than sys-clk. + - Only 1331.2 and MAX MHz could be selected in sys-clk. - Apply thermal paste on RAM chips and test with emuNAND before long-term usage. - DRAM Timing Table Adjustment: - 2131.2 MHz should be usable and stable for all, with throughput reached about 24.7GiB/s. (theoretical bandwidth: 31.76GiB/s @ 2131.2 MHz) @@ -82,14 +82,19 @@ This project will not be actively maintained by me and I'm looking for collabora [A111111111111111] docked_cpu= docked_gpu= + docked_mem= handheld_charging_cpu= handheld_charging_gpu= + handheld_charging_mem= handheld_charging_usb_cpu= handheld_charging_usb_gpu= + handheld_charging_usb_mem= handheld_charging_official_cpu= handheld_charging_official_gpu= + handheld_charging_official_mem= handheld_cpu= handheld_gpu= + handheld_mem= ``` - Disable background services, less heat and power consumption in standby mode diff --git a/SdOut/atmosphere/contents/00FF0000636C6BFF/exefs.nsp b/SdOut/atmosphere/contents/00FF0000636C6BFF/exefs.nsp index c632ad73..7fa9818e 100644 Binary files a/SdOut/atmosphere/contents/00FF0000636C6BFF/exefs.nsp and b/SdOut/atmosphere/contents/00FF0000636C6BFF/exefs.nsp differ diff --git a/SdOut/switch/.overlays/sys-clk-overlay.ovl b/SdOut/switch/.overlays/sys-clk-overlay.ovl index 01b080c0..9706dee0 100644 Binary files a/SdOut/switch/.overlays/sys-clk-overlay.ovl and b/SdOut/switch/.overlays/sys-clk-overlay.ovl differ diff --git a/SdOut/switch/sys-clk-manager.nro b/SdOut/switch/sys-clk-manager.nro index a7fa84a5..680dc456 100644 Binary files a/SdOut/switch/sys-clk-manager.nro and b/SdOut/switch/sys-clk-manager.nro differ diff --git a/Source/Atmosphere/stratosphere/loader/source/ldr_patcher.cpp b/Source/Atmosphere/stratosphere/loader/source/ldr_patcher.cpp index 80fcde90..9218bb62 100644 --- a/Source/Atmosphere/stratosphere/loader/source/ldr_patcher.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/ldr_patcher.cpp @@ -279,16 +279,16 @@ namespace ams::ldr { } } - u32 PtmEmcClock = GetEmcClock() * 1000; + // u32 PtmEmcClock = GetEmcClock() * 1000; u32 CpuBoostClock = GetCpuBoostClock() * 1000; for (u32 i = 0; i < sizeof(PtmModuleId)/sizeof(ro::ModuleId); i++) { if (std::memcmp(std::addressof(PtmModuleId[i]), std::addressof(module_id), sizeof(module_id)) == 0) { - for (u32 j = 0; j < 16; j++) { - std::memcpy(reinterpret_cast(mapped_nso + ptm::EmcOffsetStart[i] + ptm::OffsetInterval * j), &PtmEmcClock, sizeof(PtmEmcClock)); - std::memcpy(reinterpret_cast(mapped_nso + ptm::EmcOffsetStart[i] + ptm::OffsetInterval * j + 0x4), &PtmEmcClock, sizeof(PtmEmcClock)); - } + // for (u32 j = 0; j < 16; j++) { + // std::memcpy(reinterpret_cast(mapped_nso + ptm::EmcOffsetStart[i] + ptm::OffsetInterval * j), &PtmEmcClock, sizeof(PtmEmcClock)); + // std::memcpy(reinterpret_cast(mapped_nso + ptm::EmcOffsetStart[i] + ptm::OffsetInterval * j + 0x4), &PtmEmcClock, sizeof(PtmEmcClock)); + // } for (u32 j = 0; j < 2; j++) { std::memcpy(reinterpret_cast(mapped_nso + ptm::EmcOffsetStart[i] + ptm::CpuBoostOffset + ptm::OffsetInterval * j), &CpuBoostClock, sizeof(CpuBoostClock)); std::memcpy(reinterpret_cast(mapped_nso + ptm::EmcOffsetStart[i] + ptm::CpuBoostOffset + ptm::OffsetInterval * j + 0x4), &CpuBoostClock, sizeof(CpuBoostClock)); diff --git a/Source/sys-clk-OC/README.md b/Source/sys-clk-OC/README.md index 5005468e..ab5edac0 100644 --- a/Source/sys-clk-OC/README.md +++ b/Source/sys-clk-OC/README.md @@ -131,14 +131,19 @@ Presets can be customized by adding them to the ini config file located at `/con [Application Title ID] docked_cpu= docked_gpu= +docked_mem= handheld_charging_cpu= handheld_charging_gpu= +handheld_charging_mem= handheld_charging_usb_cpu= handheld_charging_usb_gpu= +handheld_charging_usb_mem= handheld_charging_official_cpu= handheld_charging_official_gpu= +handheld_charging_official_mem= handheld_cpu= handheld_gpu= +handheld_mem= ``` * Replace `Application Title ID` with the title id of the game/application you're interested in customizing. @@ -160,6 +165,7 @@ Leads to a smoother framerate overall (ex: in the korok forest) [01007EF00011E000] docked_cpu=1224 handheld_charging_cpu=1224 +handheld_mem=1600 ``` ### Example 2: Picross diff --git a/Source/sys-clk-OC/manager/src/advanced_settings_tab.cpp b/Source/sys-clk-OC/manager/src/advanced_settings_tab.cpp index 6d9725e2..9b11f643 100644 --- a/Source/sys-clk-OC/manager/src/advanced_settings_tab.cpp +++ b/Source/sys-clk-OC/manager/src/advanced_settings_tab.cpp @@ -77,7 +77,7 @@ AdvancedSettingsTab::AdvancedSettingsTab() }); // MEM - /*brls::SelectListItem *memFreqListItem = createFreqListItem(SysClkModule_MEM, context.overrideFreqs[SysClkModule_MEM] / 1000000); + brls::SelectListItem *memFreqListItem = createFreqListItem(SysClkModule_MEM, context.overrideFreqs[SysClkModule_MEM] / 1000000); memFreqListItem->getValueSelectedEvent()->subscribe([](int result) { Result rc = result == 0 ? @@ -90,7 +90,7 @@ AdvancedSettingsTab::AdvancedSettingsTab() errorResult(result == 0 ? "sysclkIpcRemoveOverride" : "sysclkIpcSetOverride", rc); // TODO: Reset selected value } - });*/ + }); this->addView(cpuFreqListItem); this->addView(gpuFreqListItem); diff --git a/Source/sys-clk-OC/manager/src/app_profile_frame.cpp b/Source/sys-clk-OC/manager/src/app_profile_frame.cpp index 0ea6af3e..4ad95451 100644 --- a/Source/sys-clk-OC/manager/src/app_profile_frame.cpp +++ b/Source/sys-clk-OC/manager/src/app_profile_frame.cpp @@ -116,7 +116,7 @@ void AppProfileFrame::addFreqs(brls::List* list, SysClkProfile profile) list->addView(gpuListItem); // MEM - /*brls::SelectListItem* memListItem = createFreqListItem(SysClkModule_MEM, this->profiles.mhzMap[profile][SysClkModule_MEM]); + brls::SelectListItem* memListItem = createFreqListItem(SysClkModule_MEM, this->profiles.mhzMap[profile][SysClkModule_MEM]); this->profiles.mhzMap[profile][SysClkModule_MEM] *= 1000000; @@ -126,7 +126,7 @@ void AppProfileFrame::addFreqs(brls::List* list, SysClkProfile profile) brls::Logger::debug("Caching freq for module %d and profile %d to %" PRIu32, SysClkModule_MEM, profile, this->profiles.mhzMap[profile][SysClkModule_MEM]); }); - list->addView(memListItem);*/ + list->addView(memListItem); } void AppProfileFrame::onProfileChanged() diff --git a/Source/sys-clk-OC/manager/src/utils.cpp b/Source/sys-clk-OC/manager/src/utils.cpp index fd27e929..0f3e66fa 100644 --- a/Source/sys-clk-OC/manager/src/utils.cpp +++ b/Source/sys-clk-OC/manager/src/utils.cpp @@ -110,7 +110,10 @@ brls::SelectListItem* createFreqListItem(SysClkModule module, uint32_t selectedF selected = i + 1; char clock[16]; - snprintf(clock, sizeof(clock), "%d MHz", freq / 1000000); + if (freq == 1600000000) + snprintf(clock, sizeof(clock), "Max MHz"); + else + snprintf(clock, sizeof(clock), "%d MHz", freq / 1000000); clocks.push_back(std::string(clock)); diff --git a/Source/sys-clk-OC/overlay/src/ui/format.h b/Source/sys-clk-OC/overlay/src/ui/format.h index f8d81101..a0f65333 100644 --- a/Source/sys-clk-OC/overlay/src/ui/format.h +++ b/Source/sys-clk-OC/overlay/src/ui/format.h @@ -20,6 +20,10 @@ static inline std::string formatListFreqMhz(std::uint32_t mhz) { return FREQ_DEFAULT_TEXT; } + else if (mhz == 1600) + { + return "Max MHz"; + } char buf[10]; return std::string(buf, snprintf(buf, sizeof(buf), "%u MHz", mhz)); diff --git a/Source/sys-clk-OC/overlay/src/ui/gui/app_profile_gui.cpp b/Source/sys-clk-OC/overlay/src/ui/gui/app_profile_gui.cpp index c467e6e9..16a9b1f0 100644 --- a/Source/sys-clk-OC/overlay/src/ui/gui/app_profile_gui.cpp +++ b/Source/sys-clk-OC/overlay/src/ui/gui/app_profile_gui.cpp @@ -62,7 +62,7 @@ void AppProfileGui::addProfileUI(SysClkProfile profile) this->listElement->addItem(new tsl::elm::CategoryHeader(sysclkFormatProfile(profile, true))); this->addModuleListItem(profile, SysClkModule_CPU, &sysclk_g_freq_table_cpu_hz[0]); this->addModuleListItem(profile, SysClkModule_GPU, &sysclk_g_freq_table_gpu_hz[0]); - //this->addModuleListItem(profile, SysClkModule_MEM, &sysclk_g_freq_table_mem_hz[0]); + this->addModuleListItem(profile, SysClkModule_MEM, &sysclk_g_freq_table_mem_hz[0]); } void AppProfileGui::listUI() diff --git a/Source/sys-clk-OC/overlay/src/ui/gui/global_override_gui.cpp b/Source/sys-clk-OC/overlay/src/ui/gui/global_override_gui.cpp index b07fa2dd..a360d87c 100644 --- a/Source/sys-clk-OC/overlay/src/ui/gui/global_override_gui.cpp +++ b/Source/sys-clk-OC/overlay/src/ui/gui/global_override_gui.cpp @@ -62,7 +62,7 @@ void GlobalOverrideGui::listUI() { this->addModuleListItem(SysClkModule_CPU, &sysclk_g_freq_table_cpu_hz[0]); this->addModuleListItem(SysClkModule_GPU, &sysclk_g_freq_table_gpu_hz[0]); - //this->addModuleListItem(SysClkModule_MEM, &sysclk_g_freq_table_mem_hz[0]); + this->addModuleListItem(SysClkModule_MEM, &sysclk_g_freq_table_mem_hz[0]); } void GlobalOverrideGui::refresh() diff --git a/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp b/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp index fcdd83e5..15deeede 100644 --- a/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp +++ b/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp @@ -214,7 +214,7 @@ void ClockManager::Tick() { std::uint32_t hz = 0; std::uint32_t hzForceOverride = 0; - for (unsigned int module = 0; module < SysClkModule_EnumMax - 1; module++) + for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { hz = this->context->overrideFreqs[module]; @@ -239,6 +239,13 @@ void ClockManager::Tick() else hz = 768'000'000; break; + case SysClkModule_MEM: + if (!isDockedReverseNX && ((FileUtils::IsDownclockDockEnabled() && RealProfile == SysClkProfile_Docked) + || RealProfile != SysClkProfile_Docked)) + hz = 1331'200'000; + else + hz = 1600'000'000; + break; } } @@ -247,6 +254,10 @@ void ClockManager::Tick() if (hz) { hz = Clocks::GetNearestHz((SysClkModule)module, isEnabledReverseNX ? RealProfile : this->context->profile, hz); + if (module == SysClkModule_MEM && hz == 1600'000'000 && this->context->freqs[module] >= hz) + { + continue; + } if (hz != this->context->freqs[module] && this->context->enabled) { @@ -442,13 +453,6 @@ bool ClockManager::RefreshContext() { hz = Clocks::GetCurrentHz((SysClkModule)module); - // Skip MEM freq check - if (module == SysClkModule_MEM) - { - this->context->freqs[module] = hz; - break; - } - // Round to MHz uint32_t cur_mhz = hz/1000'000; uint32_t be4_mhz = this->context->freqs[module]/1000'000; diff --git a/Source/sys-clk-OC/sysmodule/src/clocks.cpp b/Source/sys-clk-OC/sysmodule/src/clocks.cpp index fe02eb44..f5a98bea 100644 --- a/Source/sys-clk-OC/sysmodule/src/clocks.cpp +++ b/Source/sys-clk-OC/sysmodule/src/clocks.cpp @@ -179,10 +179,10 @@ void Clocks::ResetToStock(unsigned int module) { Clocks::SetHz(SysClkModule_GPU, apmConfiguration->gpu_hz); } - // if (module == SysClkModule_EnumMax || module == SysClkModule_MEM) - // { - // Clocks::SetHz(SysClkModule_MEM, apmConfiguration->mem_hz); - // } + if (module == SysClkModule_EnumMax || module == SysClkModule_MEM) + { + Clocks::SetHz(SysClkModule_MEM, apmConfiguration->mem_hz); + } } else { @@ -225,9 +225,6 @@ SysClkProfile Clocks::GetCurrentProfile() void Clocks::SetHz(SysClkModule module, std::uint32_t hz) { - if (module == SysClkModule_MEM) - return; - Result rc = 0; if(hosversionAtLeast(8,0,0))