diff --git a/README.md b/README.md index fb920700..aeca6394 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # Switch OC Suite -Overclocking suite for Switch **(Mariko Only)** running on Atmosphere CFW. - -Support latest Horizon OS (12.1.0) and Atmosphere (0.20.0). +Overclocking suite for Switch **(Mariko Only)** running on Atmosphere CFW. Support Horizon OS 12.1.0. @@ -38,7 +36,7 @@ Support latest Horizon OS (12.1.0) and Atmosphere (0.20.0). - Choose RAM clock with care, or your eMMC filesystem will be **corrupted**. - Once RAM overvolting is available on Mariko, we may gain more stability and reach higher clock. - Mariko variants have much lower power consumption compared to Erista, therefore **GPU clock capping is lifted for Mariko**. - - For more info, see README.md in sys-clk-OC. + - For more info, see [README.md](https://github.com/KazushiMe/Switch-OC-Suite/tree/master/Source/sys-clk-OC) in sys-clk-OC. - **Auto-Boost CPU for faster game loading** - When a game launches or is in loading screen, sys-clk will boost CPU to 1963.5 MHz (w/o charger) and 2295.0 MHz (with charger) for 20 seconds or until the loading screen ends. - Some games don't utilize `SetCpuBoostMode` at all, e.g. Overcooked 2, so Auto-Boost will be unavailable to these games. @@ -46,8 +44,8 @@ Support latest Horizon OS (12.1.0) and Atmosphere (0.20.0). - **Fan Control Optimization** at high load - Higher tolerable temperature and smoother fan curve. Set `holdable_tskin` to 56˚C. Previously it's set to 48˚C, so by default the fan would go crazy (80~100%) easily with a slight degree of OC. - **Modded sys-clk and ReverseNX**(-Tools and -RT), **no need to change clocks manually** after toggling modes in ReverseNX - - Add `/config/sys-clk/downclock_dock.flag` to use handheld(lower GPU) clocks in Docked mode when Handheld mode is set in ReverseNX. - - To **disable this feature**, simply use original version of ReverseNX rather than the one in the repo. + - Add `/config/sys-clk/downclock_dock.flag` to use handheld clocks in Docked mode when Handheld mode is set in ReverseNX. + - To **disable this feature**, use original version of ReverseNX and delete `/config/sys-clk/ReverseNX_sync.flag`. - Disable background services, less heat and power consumption in standby mode - **Remove** the "Disable Background service" part in `/atmosphere/config/system_settings.ini` if you **use Nintendo Online services**. - Profile-aware clock override for all games @@ -98,7 +96,7 @@ Support latest Horizon OS (12.1.0) and Atmosphere (0.20.0). 1. Make sure you are running targeted HOS (12.1.0), and have `prod.keys` *with latest master key (0b)* dumped by [Lockpick_RCM](https://github.com/shchmue/Lockpick_RCM). 2. Loader patches for Atmosphere: Grab from the web and apply. I won't provide them here. (Or build AMS with `ValidateAcidSignature()` stubbed.) 3. Place all the files in `SdOut` into SD card. - **See [Details](#details) sections for more info.** + **See [Details](#details) section for more info.** - Be careful of `/atmosphere/config/system_settings.ini`, **you may want to edit it manually.** - Remove all the files in previous OC Suite version before updating to avoid conflicts. 4. Dump your pcv module. diff --git a/SdOut/atmosphere/contents/00FF0000636C6BFF/exefs.nsp b/SdOut/atmosphere/contents/00FF0000636C6BFF/exefs.nsp index fc4df389..75d8a809 100644 Binary files a/SdOut/atmosphere/contents/00FF0000636C6BFF/exefs.nsp and b/SdOut/atmosphere/contents/00FF0000636C6BFF/exefs.nsp differ diff --git a/SdOut/config/sys-clk/ReverseNX_sync.flag b/SdOut/config/sys-clk/ReverseNX_sync.flag new file mode 100644 index 00000000..e69de29b diff --git a/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp b/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp index 72b158bb..16d671f3 100644 --- a/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp +++ b/Source/sys-clk-OC/sysmodule/src/clock_manager.cpp @@ -356,7 +356,7 @@ bool ClockManager::RefreshContext() this->context->applicationId = applicationId; hasChanged = true; - if (FileUtils::IsReverseNXEnabled() || recheckReverseNX) + if (FileUtils::IsReverseNXSyncEnabled() && (FileUtils::IsReverseNXToolExist() || recheckReverseNX)) { // A new game starts or the real profile changes, then we need to check if ReverseNXTool patches are applied isEnabledReverseNX = false; @@ -379,7 +379,7 @@ bool ClockManager::RefreshContext() } } - if (!tickCheckReverseNXRT || recheckReverseNX) + if (FileUtils::IsReverseNXSyncEnabled() && (!tickCheckReverseNXRT || recheckReverseNX)) { uint8_t flag = 0; checkReverseNXRT(recheckReverseNX, &flag); diff --git a/Source/sys-clk-OC/sysmodule/src/config.cpp b/Source/sys-clk-OC/sysmodule/src/config.cpp index e9ed175a..099aebed 100644 --- a/Source/sys-clk-OC/sysmodule/src/config.cpp +++ b/Source/sys-clk-OC/sysmodule/src/config.cpp @@ -84,6 +84,7 @@ bool Config::Refresh() if (!this->loaded || this->mtime != this->CheckModificationTime()) { this->Load(); + Clocks::ResetToStock(); // Reset to stock since we can't detect if user set "Do not override" for specific module return true; } return false; diff --git a/Source/sys-clk-OC/sysmodule/src/file_utils.cpp b/Source/sys-clk-OC/sysmodule/src/file_utils.cpp index 8f91a1a2..751db251 100644 --- a/Source/sys-clk-OC/sysmodule/src/file_utils.cpp +++ b/Source/sys-clk-OC/sysmodule/src/file_utils.cpp @@ -21,7 +21,8 @@ static bool g_log_enabled = false; static bool g_boost_enabled = false; static bool g_boost_start_enabled = false; static bool g_downclock_dock_enabled = false; -static bool g_reversenx_enabled = false; +static bool g_reversenx_tool_exist = false; +static bool g_reversenx_sync_enabled = false; static std::uint64_t g_last_flag_check = 0; extern "C" void __libnx_init_time(void); @@ -131,6 +132,12 @@ void FileUtils::RefreshFlags(bool force) g_log_enabled = false; } + g_last_flag_check = now; +} + +void FileUtils::InitCheckFlags() +{ + FILE *file; // Only Enable Boost for Mariko if (Clocks::isMariko) { @@ -162,7 +169,23 @@ void FileUtils::RefreshFlags(bool force) g_downclock_dock_enabled = false; } - g_last_flag_check = now; + file = fopen(FILE_REVERSENX_SYNC_FLAG_PATH, "r"); + if (file) + { + g_reversenx_sync_enabled = true; + fclose(file); + } else { + g_reversenx_sync_enabled = false; + } + + file = fopen(FILE_SALTYNX_PATH, "r"); + if (file) + { + g_reversenx_tool_exist = true; + fclose(file); + } else { + g_reversenx_tool_exist = false; + } } bool FileUtils::IsBoostEnabled() @@ -180,6 +203,16 @@ bool FileUtils::IsDownclockDockEnabled() return g_downclock_dock_enabled; } +bool FileUtils::IsReverseNXToolExist() +{ + return g_reversenx_tool_exist; +} + +bool FileUtils::IsReverseNXSyncEnabled() +{ + return g_reversenx_sync_enabled; +} + void FileUtils::InitializeAsync() { Thread initThread = {0}; @@ -216,23 +249,11 @@ Result FileUtils::Initialize() FileUtils::LogLine("=== " TARGET " " TARGET_VERSION " ==="); } - FILE *file = fopen(FILE_SALTYNX_PATH, "r"); - if (file) - { - g_reversenx_enabled = true; - fclose(file); - } else { - g_reversenx_enabled = false; - } + FileUtils::InitCheckFlags(); return rc; } -bool FileUtils::IsReverseNXEnabled() -{ - return g_reversenx_enabled; -} - void FileUtils::Exit() { if (!g_has_initialized) diff --git a/Source/sys-clk-OC/sysmodule/src/file_utils.h b/Source/sys-clk-OC/sysmodule/src/file_utils.h index 336e63b8..7cc3cac0 100644 --- a/Source/sys-clk-OC/sysmodule/src/file_utils.h +++ b/Source/sys-clk-OC/sysmodule/src/file_utils.h @@ -26,6 +26,7 @@ #define FILE_BOOST_START_FLAG_PATH FILE_CONFIG_DIR "/boost_start.flag" #define FILE_DOWNCLOCK_DOCK_FLAG_PATH FILE_CONFIG_DIR "/downclock_dock.flag" #define FILE_SALTYNX_PATH "/atmosphere/contents/0000000000534C56/flags/boot2.flag" // Just check for SaltyNX boot flag +#define FILE_REVERSENX_SYNC_FLAG_PATH FILE_CONFIG_DIR "/ReverseNX_sync.flag" #define FILE_REVERSENX_RT_CONF_PATH FILE_CONFIG_DIR "/ReverseNX-RT.conf" class FileUtils @@ -38,10 +39,12 @@ class FileUtils static bool IsBoostEnabled(); static bool IsBoostStartEnabled(); static bool IsDownclockDockEnabled(); - static bool IsReverseNXEnabled(); + static bool IsReverseNXSyncEnabled(); + static bool IsReverseNXToolExist(); static void InitializeAsync(); static void LogLine(const char *format, ...); static void WriteContextToCsv(const SysClkContext* context); protected: static void RefreshFlags(bool force); + static void InitCheckFlags(); };