aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Common/System
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Common/System')
-rw-r--r--Ryujinx.Common/System/ForceDedicatedGpu.cs16
-rw-r--r--Ryujinx.Common/System/WindowsMultimediaTimerResolution.cs21
2 files changed, 27 insertions, 10 deletions
diff --git a/Ryujinx.Common/System/ForceDedicatedGpu.cs b/Ryujinx.Common/System/ForceDedicatedGpu.cs
new file mode 100644
index 00000000..60272f1a
--- /dev/null
+++ b/Ryujinx.Common/System/ForceDedicatedGpu.cs
@@ -0,0 +1,16 @@
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.Common.System
+{
+ public static class ForceDedicatedGpu
+ {
+ public static void Nvidia()
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ // NOTE: If the DLL exists, we can load it to force the usage of the dedicated Nvidia Gpu.
+ NativeLibrary.TryLoad("nvapi64.dll", out _);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.Common/System/WindowsMultimediaTimerResolution.cs b/Ryujinx.Common/System/WindowsMultimediaTimerResolution.cs
index fccda247..69ce145b 100644
--- a/Ryujinx.Common/System/WindowsMultimediaTimerResolution.cs
+++ b/Ryujinx.Common/System/WindowsMultimediaTimerResolution.cs
@@ -17,14 +17,14 @@ namespace Ryujinx.Common.System
public uint wPeriodMax;
};
- [DllImport("winmm.dll", SetLastError = true)]
- private static extern uint timeGetDevCaps(ref TimeCaps timeCaps, uint sizeTimeCaps);
+ [DllImport("winmm.dll", EntryPoint = "timeGetDevCaps", SetLastError = true)]
+ private static extern uint TimeGetDevCaps(ref TimeCaps timeCaps, uint sizeTimeCaps);
- [DllImport("winmm.dll")]
- private static extern uint timeBeginPeriod(uint uMilliseconds);
+ [DllImport("winmm.dll", EntryPoint = "timeBeginPeriod")]
+ private static extern uint TimeBeginPeriod(uint uMilliseconds);
- [DllImport("winmm.dll")]
- private static extern uint timeEndPeriod(uint uMilliseconds);
+ [DllImport("winmm.dll", EntryPoint = "timeEndPeriod")]
+ private static extern uint TimeEndPeriod(uint uMilliseconds);
private uint _targetResolutionInMilliseconds;
private bool _isActive;
@@ -45,7 +45,7 @@ namespace Ryujinx.Common.System
{
TimeCaps timeCaps = default;
- uint result = timeGetDevCaps(ref timeCaps, (uint)Unsafe.SizeOf<TimeCaps>());
+ uint result = TimeGetDevCaps(ref timeCaps, (uint)Unsafe.SizeOf<TimeCaps>());
if (result != 0)
{
@@ -66,7 +66,7 @@ namespace Ryujinx.Common.System
private void Activate()
{
- uint result = timeBeginPeriod(_targetResolutionInMilliseconds);
+ uint result = TimeBeginPeriod(_targetResolutionInMilliseconds);
if (result != 0)
{
@@ -82,7 +82,7 @@ namespace Ryujinx.Common.System
{
if (_isActive)
{
- uint result = timeEndPeriod(_targetResolutionInMilliseconds);
+ uint result = TimeEndPeriod(_targetResolutionInMilliseconds);
if (result != 0)
{
@@ -98,6 +98,7 @@ namespace Ryujinx.Common.System
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
@@ -108,4 +109,4 @@ namespace Ryujinx.Common.System
}
}
}
-}
+} \ No newline at end of file