public int GetSkinTempLevel() { int currentTempLevel = -1; try { currentTempLevel = AndroidJNI.CallIntMethod(s_GameSDKRawObjectID, s_GetSkinTempLevelID, s_NoArgs); if (AndroidJNI.ExceptionOccurred() != IntPtr.Zero) { AndroidJNI.ExceptionDescribe(); AndroidJNI.ExceptionClear(); } } catch (Exception) { GameSDKLog.Debug("[Exception] GameSDK.getSkinTempLevel() failed!"); } return(currentTempLevel); }
public void UnregisterListener() { bool success = true; try { GameSDKLog.Debug("setListener(null)"); success = s_GameSDK.Call <bool>("setListener", (Object)null); } catch (Exception) { success = false; } if (!success) { GameSDKLog.Debug("setListener(null) failed!"); } }
public bool Initialize() { bool isInitialized = false; try { Version initVersion; if (TryParseVersion(GetVersion(), out initVersion)) { if (initVersion < new Version(3, 0)) { isInitialized = s_GameSDK.Call<bool>("initialize"); } else { // There is a critical bug which can lead to overheated devices in GameSDK 3.1 so we will not initialize GameSDK or Adaptive Performance if (initVersion == new Version(3, 1)) { GameSDKLog.Debug("GameSDK 3.1 is not supported and will not be initialized, Adaptive Performance will not be used."); } else { isInitialized = s_GameSDK.Call<bool>("initialize", initVersion.ToString()); } } if (isInitialized) { isInitialized = RegisterListener(); } else { GameSDKLog.Debug("GameSDK.initialize() failed!"); } } } catch (Exception) { GameSDKLog.Debug("[Exception] GameSDK.initialize() failed!"); } return isInitialized; }
public double GetGpuFrameTime() { double gpuFrameTime = -1.0; try { gpuFrameTime = AndroidJNI.CallDoubleMethod(s_GameSDKRawObjectID, s_GetGpuFrameTimeID, s_NoArgs); if (AndroidJNI.ExceptionOccurred() != IntPtr.Zero) { AndroidJNI.ExceptionDescribe(); AndroidJNI.ExceptionClear(); } } catch (Exception) { GameSDKLog.Debug("[Exception] GameSDK.getGpuFrameTime() failed!"); } return(gpuFrameTime); }
public bool RegisterListener() { bool success = false; try { success = s_GameSDK.Call <bool>("setListener", this); } catch (Exception) { success = false; } if (!success) { GameSDKLog.Debug("failed to register listener"); } return(success); }
public void Terminate() { UnregisterListener(); bool success = true; try { var packageName = Application.identifier; GameSDKLog.Debug("GameSDK.finalize({0})", packageName); success = s_GameSDK.Call<bool>("finalize", packageName); } catch (Exception) { success = false; } if (!success) GameSDKLog.Debug("GameSDK.finalize() failed!"); }
public bool Initialize() { bool isInitialized = false; try { isInitialized = s_GameSDK.Call <bool>("initialize"); if (isInitialized) { isInitialized = RegisterListener(); } else { GameSDKLog.Debug("GameSDK.initialize() failed!"); } } catch (Exception) { GameSDKLog.Debug("[Exception] GameSDK.initialize() failed!"); } return(isInitialized); }
void onReleasedByTimeout() { GameSDKLog.Debug("Listener: onReleasedByTimeout()"); PerformanceLevelTimeoutEvent(); }
void onRefreshRateChanged() { GameSDKLog.Debug("Listener: onRefreshRateChanged()"); // Not used in 1.x.x. Available in 2.0.0 but the callback is needed to avoid that Samsung GameSDK is correctly calling other callbacks on VRR enabled devices. }
public bool SetPerformanceLevel(int cpuLevel, int gpuLevel) { if (cpuLevel < 0) { cpuLevel = 0; } else if (cpuLevel > MaxCpuPerformanceLevel) { cpuLevel = MaxCpuPerformanceLevel; } if (gpuLevel < 0) { gpuLevel = 0; } else if (gpuLevel > MaxGpuPerformanceLevel) { gpuLevel = MaxGpuPerformanceLevel; } if (m_Version == new Version(3, 2) && cpuLevel == 0) { cpuLevel = 1; } bool success = false; if (m_UseSetFreqLevels) { int result = m_Api.SetFreqLevels(cpuLevel, gpuLevel); success = result == 1; if (result == 2) { GameSDKLog.Debug($"Thermal Mitigation Logic is working and CPU({cpuLevel})/GPU({gpuLevel}) level change request was not approved."); m_Data.PerformanceLevelControlAvailable = false; m_Data.ChangeFlags |= Feature.PerformanceLevelControl; m_PerformanceLevelControlSystemChange = true; } } else { success = m_Api.SetLevelWithScene(sceneName, cpuLevel, gpuLevel); } lock (m_DataLock) { var oldCpuLevel = m_Data.CpuPerformanceLevel; var oldGpuLevel = m_Data.GpuPerformanceLevel; m_Data.CpuPerformanceLevel = success ? cpuLevel : Constants.UnknownPerformanceLevel; m_Data.GpuPerformanceLevel = success ? gpuLevel : Constants.UnknownPerformanceLevel; if (m_Data.CpuPerformanceLevel != oldCpuLevel) { m_Data.ChangeFlags |= Feature.CpuPerformanceLevel; } if (m_Data.GpuPerformanceLevel != oldGpuLevel) { m_Data.ChangeFlags |= Feature.GpuPerformanceLevel; } } return(success); }