Advertisement
noradninja

Vita_Clock_Setter

Aug 10th, 2023 (edited)
781
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class VitaClockSetter : MonoBehaviour
  6. {
  7.     public enum CPUClock
  8.     {
  9.         High = 444,
  10.         Stock = 333
  11.     }
  12.  
  13.     public enum GPUClock
  14.     {
  15.         High = 222,
  16.         Medium = 166,
  17.         Stock = 111
  18.     }
  19.  
  20.     public enum BusClock
  21.     {
  22.         High = 222,
  23.         Medium = 166,
  24.         Stock = 111
  25.     }
  26.  
  27.     public enum XBarClock
  28.     {
  29.         High = 166,
  30.         Stock = 111
  31.     }
  32.  
  33.     public CPUClock cpuSpeed = CPUClock.Stock;
  34.     public GPUClock gpuSpeed = GPUClock.Stock;
  35.     public BusClock busSpeed = BusClock.Stock;
  36.     public XBarClock xbarSpeed = XBarClock.Stock;
  37.  
  38.     // Use this in any scene you want to set the clocks for
  39.     void Awake()
  40.     {
  41.         if (Application.platform == RuntimePlatform.PSP2)
  42.         {
  43.             UnityOC.ResetFrequencies(); //restore stock clocks
  44.             UnityOC.SetFrequencies((int)cpuSpeed, (int)busSpeed, (int)gpuSpeed, (int)xbarSpeed);
  45.            
  46.             UnityOC.SetFrequencies( // Pass -1 for any stock values so UnityOC disables it's internal hooks
  47.                 cpuSpeed == CPUClock.Stock ? -1 : (int)cpuSpeed,
  48.                 busSpeed == BusClock.Stock ? -1 : (int)busSpeed,
  49.                 gpuSpeed == GPUClock.Stock ? -1 : (int)gpuSpeed,
  50.                 xbarSpeed == XBarClock.Stock ? -1 : (int)xbarSpeed
  51.             );
  52.         }
  53.         else Debug.Log("This script only works on PSVita/PSTV hardware");
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement