add resolution
This commit is contained in:
@@ -50,6 +50,7 @@ typedef struct
|
|||||||
u8 dramID;
|
u8 dramID;
|
||||||
bool isDram8GB;
|
bool isDram8GB;
|
||||||
u8 fps;
|
u8 fps;
|
||||||
|
u16 resolutionHeight;
|
||||||
} SysClkContext;
|
} SysClkContext;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
|
|||||||
|
|
||||||
// All constants pre-calculated and cached
|
// All constants pre-calculated and cached
|
||||||
static constexpr const char* const labels[] = {
|
static constexpr const char* const labels[] = {
|
||||||
"App ID", "Profile", "CPU", "GPU", "MEM", "SoC", "Board", "Skin", "Now", "Avg", "BAT", "PMIC", "FAN", "DISP", "FPS"
|
"App ID", "Profile", "CPU", "GPU", "MEM", "SoC", "Board", "Skin", "Now", "Avg", "BAT", "PMIC", "FAN", "DISP", "FPS", "RES"
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr u32 dataPositions[6] = {63-3+3, 200-1, 344-1-3, 200-1, 342-1, 321-1};
|
static constexpr u32 dataPositions[6] = {63-3+3, 200-1, 344-1-3, 200-1, 342-1, 321-1};
|
||||||
@@ -169,8 +169,13 @@ void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
|
|||||||
renderer->drawString(displayStrings[23], false, positions[2] - 2, y, SMALL_TEXT_SIZE, tsl::infoTextColor); // Bat Age
|
renderer->drawString(displayStrings[23], false, positions[2] - 2, y, SMALL_TEXT_SIZE, tsl::infoTextColor); // Bat Age
|
||||||
|
|
||||||
if(this->context->isSaltyNXInstalled) {
|
if(this->context->isSaltyNXInstalled) {
|
||||||
|
|
||||||
|
renderer->drawString(labels[15], false, positions[3], y, SMALL_TEXT_SIZE, tsl::sectionTextColor); // RES label
|
||||||
|
renderer->drawString(displayStrings[27], false, dataPositions[1], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // RES
|
||||||
|
|
||||||
renderer->drawString(labels[14], false, positions[4], y, SMALL_TEXT_SIZE, tsl::sectionTextColor); // FPS label
|
renderer->drawString(labels[14], false, positions[4], y, SMALL_TEXT_SIZE, tsl::sectionTextColor); // FPS label
|
||||||
renderer->drawString(displayStrings[26], false, dataPositions[2], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // FPS
|
renderer->drawString(displayStrings[26], false, dataPositions[2], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // FPS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
y+=20;
|
y+=20;
|
||||||
@@ -295,6 +300,16 @@ void BaseMenuGui::refresh()
|
|||||||
sprintf(displayStrings[26], "%u", context->fps);
|
sprintf(displayStrings[26], "%u", context->fps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this->context->isSaltyNXInstalled) {
|
||||||
|
if(context->resolutionHeight == 0) {
|
||||||
|
strcpy(displayStrings[27], "N/A");
|
||||||
|
} else {
|
||||||
|
memset(displayStrings[27], 0, sizeof(displayStrings[27]));
|
||||||
|
sprintf(displayStrings[27], "%up", context->resolutionHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tsl::elm::Element* BaseMenuGui::baseUI()
|
tsl::elm::Element* BaseMenuGui::baseUI()
|
||||||
|
|||||||
@@ -621,7 +621,7 @@ void ClockManager::HandleGovernor(uint32_t targetHz) {
|
|||||||
isCpuGovernorEnabled = newCpuGovernorState;
|
isCpuGovernorEnabled = newCpuGovernorState;
|
||||||
isGpuGovernorEnabled = newGpuGovernorState;
|
isGpuGovernorEnabled = newGpuGovernorState;
|
||||||
isVRREnabled = newVrrGovernorState;
|
isVRREnabled = newVrrGovernorState;
|
||||||
|
|
||||||
if(newCpuGovernorState == false && lastCpuGovernorState == true) {
|
if(newCpuGovernorState == false && lastCpuGovernorState == true) {
|
||||||
svcSleepThread(50'000'000); // thread syncing. probably a cleaner way to do this but hey, it works!
|
svcSleepThread(50'000'000); // thread syncing. probably a cleaner way to do this but hey, it works!
|
||||||
Board::ResetToStockCpu();
|
Board::ResetToStockCpu();
|
||||||
@@ -1010,6 +1010,11 @@ bool ClockManager::RefreshContext()
|
|||||||
else
|
else
|
||||||
this->context->fps = 254; // N/A
|
this->context->fps = 254; // N/A
|
||||||
|
|
||||||
|
if(this->context->isSaltyNXInstalled)
|
||||||
|
this->context->resolutionHeight = saltyNXIntegration->GetResolutionHeight();
|
||||||
|
else
|
||||||
|
this->context->resolutionHeight = 0; // N/A
|
||||||
|
|
||||||
return hasChanged;
|
return hasChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ void SaltyNXIntegration::searchSharedMemoryBlock(uintptr_t base) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u64 prevTid = 0;
|
u64 prevTid = 0;
|
||||||
|
|
||||||
u8 SaltyNXIntegration::GetFPS() {
|
u8 SaltyNXIntegration::GetFPS() {
|
||||||
if (!SharedMemoryUsed)
|
if (!SharedMemoryUsed)
|
||||||
return 254;
|
return 254;
|
||||||
@@ -107,4 +108,29 @@ u8 SaltyNXIntegration::GetFPS() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NxFps ? NxFps->FPS : 254;
|
return NxFps ? NxFps->FPS : 254;
|
||||||
|
}
|
||||||
|
|
||||||
|
u16 SaltyNXIntegration::GetResolutionHeight() {
|
||||||
|
if (!SharedMemoryUsed)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
u64 tid = ProcessManagement::GetCurrentApplicationId();
|
||||||
|
if (tid == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (prevTid != tid) {
|
||||||
|
NxFps = 0;
|
||||||
|
prevTid = tid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!NxFps) {
|
||||||
|
uintptr_t base = (uintptr_t)shmemGetAddr(&_sharedmemory);
|
||||||
|
searchSharedMemoryBlock(base);
|
||||||
|
}
|
||||||
|
if(NxFps) {
|
||||||
|
NxFps -> renderCalls[0].calls = 0xFFFF;
|
||||||
|
svcSleepThread(10*1000);
|
||||||
|
return NxFps->viewportCalls[0].height;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -90,4 +90,5 @@ public:
|
|||||||
void LoadSharedMemory();
|
void LoadSharedMemory();
|
||||||
void searchSharedMemoryBlock(uintptr_t base);
|
void searchSharedMemoryBlock(uintptr_t base);
|
||||||
u8 GetFPS();
|
u8 GetFPS();
|
||||||
|
u16 GetResolutionHeight();
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user