@@ -164,13 +164,22 @@ resolutionCalls* viewportCalls_shared = 0;
164164uint32_t realCPU_Hz = 0 ;
165165uint32_t realGPU_Hz = 0 ;
166166uint32_t realRAM_Hz = 0 ;
167+ uint32_t ramLoad[SysClkRamLoad_EnumMax];
167168uint32_t realCPU_mV = 0 ;
168169uint32_t realGPU_mV = 0 ;
169170uint32_t realRAM_mV = 0 ;
170171uint32_t realSOC_mV = 0 ;
171- uint32_t ramLoad[SysClkRamLoad_EnumMax];
172172uint8_t refreshRate = 0 ;
173173
174+ // Tweaks to nvInitialize so it will take less RAM
175+ #define NVDRV_TMEM_SIZE (8 * 0x1000 )
176+ char nvdrv_tmem_data[NVDRV_TMEM_SIZE] alignas (0x1000 );
177+
178+ Result __nx_nv_create_tmem (TransferMemory *t, u32 *out_size, Permission perm) {
179+ *out_size = NVDRV_TMEM_SIZE;
180+ return tmemCreateFromMemory (t, nvdrv_tmem_data, NVDRV_TMEM_SIZE, perm);
181+ }
182+
174183int compare (const void * elem1, const void * elem2) {
175184 if ((((resolutionCalls*)(elem1)) -> calls) > (((resolutionCalls*)(elem2)) -> calls)) return -1 ;
176185 else return 1 ;
@@ -432,12 +441,12 @@ void Misc(void*) {
432441 realCPU_Hz = sysclkCTX.realFreqs [SysClkModule_CPU];
433442 realGPU_Hz = sysclkCTX.realFreqs [SysClkModule_GPU];
434443 realRAM_Hz = sysclkCTX.realFreqs [SysClkModule_MEM];
444+ ramLoad[SysClkRamLoad_All] = sysclkCTX.ramLoad [SysClkRamLoad_All];
445+ ramLoad[SysClkRamLoad_Cpu] = sysclkCTX.ramLoad [SysClkRamLoad_Cpu];
435446 realCPU_mV = sysclkCTX.realVolts [0 ];
436447 realGPU_mV = sysclkCTX.realVolts [1 ];
437448 realRAM_mV = sysclkCTX.realVolts [2 ];
438449 realSOC_mV = sysclkCTX.realVolts [3 ];
439- ramLoad[SysClkRamLoad_All] = sysclkCTX.ramLoad [SysClkRamLoad_All];
440- ramLoad[SysClkRamLoad_Cpu] = sysclkCTX.ramLoad [SysClkRamLoad_Cpu];
441450 }
442451 }
443452
@@ -503,6 +512,7 @@ void Misc(void*) {
503512 FPSmin = 254 ;
504513 FPSmax = 0 ;
505514 }
515+
506516 // Interval
507517 mutexUnlock (&mutex_Misc);
508518 svcSleepThread (TeslaFPS < 10 ? (1'000'000'000 / TeslaFPS) : 100'000'000 );
@@ -530,6 +540,60 @@ void Misc2(void*) {
530540 }
531541}
532542
543+ void Misc3 (void *) {
544+ while (!threadexit) {
545+ mutexLock (&mutex_Misc);
546+
547+ if (R_SUCCEEDED (sysclkCheck)) {
548+ SysClkContext sysclkCTX;
549+ if (R_SUCCEEDED (sysclkIpcGetCurrentContext (&sysclkCTX))) {
550+ ramLoad[SysClkRamLoad_All] = sysclkCTX.ramLoad [SysClkRamLoad_All];
551+ ramLoad[SysClkRamLoad_Cpu] = sysclkCTX.ramLoad [SysClkRamLoad_Cpu];
552+ }
553+ }
554+
555+ // Temperatures
556+ if (R_SUCCEEDED (tsCheck)) {
557+ if (hosversionAtLeast (10 ,0 ,0 )) {
558+ TsSession ts_session;
559+ Result rc = tsOpenSession (&ts_session, TsDeviceCode_LocationExternal);
560+ if (R_SUCCEEDED (rc)) {
561+ tsSessionGetTemperature (&ts_session, &SOC_temperatureF);
562+ tsSessionClose (&ts_session);
563+ }
564+ rc = tsOpenSession (&ts_session, TsDeviceCode_LocationInternal);
565+ if (R_SUCCEEDED (rc)) {
566+ tsSessionGetTemperature (&ts_session, &PCB_temperatureF);
567+ tsSessionClose (&ts_session);
568+ }
569+ }
570+ else {
571+ tsGetTemperatureMilliC (TsLocation_External, &SOC_temperatureC);
572+ tsGetTemperatureMilliC (TsLocation_Internal, &PCB_temperatureC);
573+ }
574+ }
575+ if (R_SUCCEEDED (tcCheck)) tcGetSkinTemperatureMilliC (&skin_temperaturemiliC);
576+
577+ // Fan
578+ if (R_SUCCEEDED (pwmCheck)) {
579+ double temp = 0 ;
580+ if (R_SUCCEEDED (pwmChannelSessionGetDutyCycle (&g_ICon, &temp))) {
581+ temp *= 10 ;
582+ temp = trunc (temp);
583+ temp /= 10 ;
584+ Rotation_Duty = 100.0 - temp;
585+ }
586+ }
587+
588+ // GPU Load
589+ if (R_SUCCEEDED (nvCheck)) nvIoctl (fd, NVGPU_GPU_IOCTL_PMU_GET_GPU_LOAD, &GPU_Load_u);
590+
591+ // Interval
592+ mutexUnlock (&mutex_Misc);
593+ svcSleepThread (1'000'000'000 );
594+ }
595+ }
596+
533597// Check each core for idled ticks in intervals, they cannot read info about other core than they are assigned
534598// In case of getting more than systemtickfrequency in idle, make it equal to systemtickfrequency to get 0% as output and nothing less
535599// This is because making each loop also takes time, which is not considered because this will take also additional time
@@ -656,6 +720,36 @@ void EndFPSCounterThread() {
656720 threadexit2 = false ;
657721}
658722
723+ void StartInfoThread () {
724+ threadCreate (&t1, CheckCore0, NULL , NULL , 0x1000 , 0x10 , 0 );
725+ threadCreate (&t2, CheckCore1, NULL , NULL , 0x1000 , 0x10 , 1 );
726+ threadCreate (&t3, CheckCore2, NULL , NULL , 0x1000 , 0x10 , 2 );
727+ threadCreate (&t4, CheckCore3, NULL , NULL , 0x1000 , 0x10 , 3 );
728+ threadCreate (&t7, Misc3, NULL , NULL , 0x1000 , 0x3F , -2 );
729+ threadStart (&t1);
730+ threadStart (&t2);
731+ threadStart (&t3);
732+ threadStart (&t4);
733+ threadStart (&t7);
734+ }
735+
736+ void EndInfoThread () {
737+ threadexit = true ;
738+ threadexit2 = true ;
739+ threadWaitForExit (&t1);
740+ threadWaitForExit (&t2);
741+ threadWaitForExit (&t3);
742+ threadWaitForExit (&t4);
743+ threadWaitForExit (&t7);
744+ threadClose (&t1);
745+ threadClose (&t2);
746+ threadClose (&t3);
747+ threadClose (&t4);
748+ threadClose (&t7);
749+ threadexit = false ;
750+ threadexit2 = false ;
751+ }
752+
659753
660754// String formatting functions
661755void removeSpaces (std::string& str) {
@@ -953,6 +1047,7 @@ struct MicroSettings {
9531047 uint8_t refreshRate;
9541048 bool realFrequencies;
9551049 bool realVolts;
1050+ bool showFullCPU;
9561051 size_t handheldFontSize;
9571052 size_t dockedFontSize;
9581053 uint8_t alignTo;
@@ -974,6 +1069,7 @@ struct FpsCounterSettings {
9741069};
9751070
9761071struct FpsGraphSettings {
1072+ bool showInfo;
9771073 uint8_t refreshRate;
9781074 uint16_t backgroundColor;
9791075 uint16_t fpsColor;
@@ -1048,7 +1144,7 @@ void GetConfigSettings(MiniSettings* settings) {
10481144 settings -> realVolts = !(key.compare (" TRUE" ));
10491145 }
10501146
1051- long maxFontSize = 22 ;
1147+ long maxFontSize = 32 ;
10521148 long minFontSize = 8 ;
10531149 if (parsedData[" mini" ].find (" handheld_font_size" ) != parsedData[" mini" ].end ()) {
10541150 key = parsedData[" mini" ][" handheld_font_size" ];
@@ -1120,14 +1216,15 @@ void GetConfigSettings(MiniSettings* settings) {
11201216
11211217void GetConfigSettings (MicroSettings* settings) {
11221218 settings -> realFrequencies = true ;
1123- settings -> realVolts = true ;
1124- settings -> handheldFontSize = 15 ;
1125- settings -> dockedFontSize = 15 ;
1219+ settings -> realVolts = true ;
1220+ settings -> showFullCPU = true ;
1221+ settings -> handheldFontSize = 12 ;
1222+ settings -> dockedFontSize = 12 ;
11261223 settings -> alignTo = 0 ;
11271224 convertStrToRGBA4444 (" #1113" , &(settings -> backgroundColor));
11281225 convertStrToRGBA4444 (" #BDFF" , &(settings -> catColor));
11291226 convertStrToRGBA4444 (" #FFFF" , &(settings -> textColor));
1130- settings -> show = " CPUB +GPU+RAM+BRDB+FPSE " ;
1227+ settings -> show = " CPU +GPU+RAM+BRDB+FPS+BATE " ;
11311228 settings -> showRAMLoad = true ;
11321229 settings -> setPosBottom = false ;
11331230 settings -> refreshRate = 1 ;
@@ -1170,6 +1267,11 @@ void GetConfigSettings(MicroSettings* settings) {
11701267 key = parsedData[" micro" ][" real_volts" ];
11711268 convertToUpper (key);
11721269 settings -> realVolts = !(key.compare (" TRUE" ));
1270+ }
1271+ if (parsedData[" micro" ].find (" show_full_cpu" ) != parsedData[" micro" ].end ()) {
1272+ key = parsedData[" micro" ][" show_full_cpu" ];
1273+ convertToUpper (key);
1274+ settings -> showFullCPU = key.compare (" FALSE" );
11731275 }
11741276 if (parsedData[" micro" ].find (" text_align" ) != parsedData[" micro" ].end ()) {
11751277 key = parsedData[" micro" ][" text_align" ];
@@ -1184,7 +1286,7 @@ void GetConfigSettings(MicroSettings* settings) {
11841286 settings -> alignTo = 2 ;
11851287 }
11861288 }
1187- long maxFontSize = 18 ;
1289+ long maxFontSize = 32 ;
11881290 long minFontSize = 8 ;
11891291 if (parsedData[" micro" ].find (" handheld_font_size" ) != parsedData[" micro" ].end ()) {
11901292 key = parsedData[" micro" ][" handheld_font_size" ];
@@ -1318,6 +1420,7 @@ void GetConfigSettings(FpsCounterSettings* settings) {
13181420}
13191421
13201422void GetConfigSettings (FpsGraphSettings* settings) {
1423+ settings -> showInfo = false ;
13211424 settings -> setPos = 0 ;
13221425 convertStrToRGBA4444 (" #1117" , &(settings -> backgroundColor));
13231426 convertStrToRGBA4444 (" #4444" , &(settings -> fpsColor));
@@ -1420,6 +1523,11 @@ void GetConfigSettings(FpsGraphSettings* settings) {
14201523 if (convertStrToRGBA4444 (key, &temp))
14211524 settings -> perfectLineColor = temp;
14221525 }
1526+ if (parsedData[" fps-graph" ].find (" show_info" ) != parsedData[" fps-graph" ].end ()) {
1527+ key = parsedData[" fps-graph" ][" show_info" ];
1528+ convertToUpper (key);
1529+ settings -> showInfo = !(key.compare (" TRUE" ));
1530+ }
14231531}
14241532
14251533void GetConfigSettings (FullSettings* settings) {
0 commit comments