- [Sys-clk-OC] (#31) Fix the inverted priority of per-app and global settings in clocks and patches detection

- [loader] Bump to 1.4.0-pre

- [system_settings] Add possible entries introduced in HOS 15.0.0
This commit is contained in:
KazushiM
2022-10-13 01:53:37 +08:00
parent c8587ce441
commit 1d7395da56
14 changed files with 110 additions and 109 deletions

View File

@@ -81,6 +81,7 @@ typedef struct
};
} SysClkTitleProfileList;
#define SYSCLK_GLOBAL_PROFILE_TID 0xA111111111111111
#define SYSCLK_CPU_SAFE_MAX_HZ 1963500000U
#define SYSCLK_GPU_HANDHELD_MAX_HZ 921600000U
#define SYSCLK_GPU_CHARGING_USB_MAX_HZ 1267200000U

View File

@@ -98,19 +98,19 @@ AdvancedSettingsTab::AdvancedSettingsTab()
this->addView(gpuFreqListItem);
this->addView(memFreqListItem);
// Permanent overrides
this->addView(new brls::Header("Permanent overrides"));
// Global profile
this->addView(new brls::Header("Global profile"));
// Add the ListItem to Permanent override
Title* permTitle = (Title*) malloc(sizeof(Title));
permTitle->tid = 0xA111111111111111;
// Add the ListItem to Global profile
Title* globalTitle = (Title*) malloc(sizeof(Title));
globalTitle->tid = SYSCLK_GLOBAL_PROFILE_TID;
brls::ListItem *listItem = new brls::ListItem(std::string("Permanent Override"));
listItem->getClickEvent()->subscribe([permTitle](View* view) {
AppProfileFrame* profileFrame = new AppProfileFrame(permTitle);
brls::ListItem *globalList = new brls::ListItem(std::string("Set global profile"));
globalList->getClickEvent()->subscribe([globalTitle](View* view) {
AppProfileFrame* profileFrame = new AppProfileFrame(globalTitle);
brls::Application::pushView(profileFrame, brls::ViewAnimation::SLIDE_LEFT);
});
this->addView(listItem);
this->addView(globalList);
// Config
// Broken, only accepting single digit

View File

@@ -30,9 +30,9 @@
AppProfileFrame::AppProfileFrame(Title* title) : ThumbnailFrame(), title(title)
{
bool isPermanent = (title->tid == 0xA111111111111111);
bool isGlobal = (title->tid == SYSCLK_GLOBAL_PROFILE_TID);
this->setTitle(isPermanent ? "Edit Permanent Override" : "Edit application profile");
this->setTitle(isGlobal ? "Edit global profile" : "Edit application profile");
this->setIcon(new brls::MaterialIcon("\uE315"));
// Get the freqs
@@ -42,7 +42,7 @@ AppProfileFrame::AppProfileFrame(Title* title) : ThumbnailFrame(), title(title)
errorResult("sysclkIpcGetProfiles", rc);
// Setup the right sidebar
if (!isPermanent)
if (!isGlobal)
{
this->getSidebar()->setThumbnail(title->icon, sizeof(title->icon));
this->getSidebar()->setTitle(std::string(title->name));

View File

@@ -92,7 +92,7 @@ void AppProfileGui::update()
{
BaseMenuGui::update();
if(this->context && this->applicationId != 0xA111111111111111 && this->applicationId != this->context->applicationId)
if(this->context && this->applicationId != SYSCLK_GLOBAL_PROFILE_TID && this->applicationId != this->context->applicationId)
{
tsl::changeTo<FatalGui>(
"Application changed\n\n"

View File

@@ -56,17 +56,17 @@ void MainGui::listUI()
});
this->listElement->addItem(globalOverrideItem);
tsl::elm::ListItem* globalPermanentOverrideItem = new tsl::elm::ListItem("Permanent overrides");
globalPermanentOverrideItem->setClickListener([this](u64 keys) {
tsl::elm::ListItem* globalProfileItem = new tsl::elm::ListItem("Global profile");
globalProfileItem->setClickListener([this](u64 keys) {
if((keys & HidNpadButton_A) == HidNpadButton_A && this->context)
{
AppProfileGui::changeTo(0xA111111111111111);
AppProfileGui::changeTo(SYSCLK_GLOBAL_PROFILE_TID);
return true;
}
return false;
});
this->listElement->addItem(globalPermanentOverrideItem);
this->listElement->addItem(globalProfileItem);
tsl::elm::ListItem* miscItem = new tsl::elm::ListItem("Miscellaneous");
miscItem->setClickListener([this](u64 keys) {

View File

@@ -344,7 +344,7 @@ class MiscGui : public BaseMenuGui
const char* getBatteryStateIcon() {
switch (getBatteryState()) {
case Discharging: return "\u25c0"; // ◀
case ChargingPaused: return "| |";
case ChargingPaused:return "| |";
case SlowCharging: return "\u25b6"; // ▶
case FastCharging: return "\u25b6\u25b6"; // ▶▶
default: return "?";

View File

@@ -112,14 +112,14 @@ uint32_t ClockManager::GetHz(SysClkModule module)
/* Temp override setting */
hz = this->context->overrideFreqs[module];
/* Global setting */
if (!hz)
hz = this->config->GetAutoClockHz(0xA111111111111111, module, this->context->profile);
/* Per-Game setting */
if (!hz)
hz = this->config->GetAutoClockHz(this->context->applicationId, module, this->context->profile);
/* Global profile */
if (!hz)
hz = this->config->GetAutoClockHz(SYSCLK_GLOBAL_PROFILE_TID, module, this->context->profile);
/* Return pre-set hz if ReverseNX is enabled, downclock is disabled when realProfile == Docked */
if (!hz && IsReverseNXModeValid())
{
@@ -312,14 +312,14 @@ void ClockManager::CheckReverseNXTool()
const char asmFileName[] = "_ZN2nn2oe18GetPerformanceModeEv.asm64"; // Checking one asm64 file is enough
char asmFilePath[128];
/* Check global override */
snprintf(asmFilePath, sizeof(asmFilePath), "/SaltySD/patches/%s", asmFileName);
/* Check per-game patch */
snprintf(asmFilePath, sizeof(asmFilePath), "/SaltySD/patches/%016lX/%s", this->context->applicationId, asmFileName);
getMode = ReverseNXFileHandler(asmFilePath);
if (!getMode)
{
/* Check per-game override */
snprintf(asmFilePath, sizeof(asmFilePath), "/SaltySD/patches/%016lX/%s", this->context->applicationId, asmFileName);
/* Check global patch */
snprintf(asmFilePath, sizeof(asmFilePath), "/SaltySD/patches/%s", asmFileName);
getMode = ReverseNXFileHandler(asmFilePath);
}
}