- Sys-clk Fix: "Do not override" in overlay now works as intended

- Sys-clk Fix: Now you can completely disable ReverseNX profile syncing by removing "ReverseNX_sync.flag"
This commit is contained in:
KazushiM
2021-08-31 23:24:17 +08:00
parent 2724faf980
commit de9f7b7478
7 changed files with 48 additions and 25 deletions

View File

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

View File

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

View File

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

View File

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