mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-22 22:22:00 +00:00
Change TickSource TickMultiplier from static to an instance variable
This commit is contained in:
parent
7815fd5746
commit
9731aedf4e
5 changed files with 14 additions and 4 deletions
|
@ -13,6 +13,11 @@ namespace Ryujinx.Cpu
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TimeSpan ElapsedTime { get; }
|
TimeSpan ElapsedTime { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clock tick multiplier, in percent points (100 = 1.0).
|
||||||
|
/// </summary>
|
||||||
|
long TickMultiplier { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Time elapsed since the counter was created, in seconds.
|
/// Time elapsed since the counter was created, in seconds.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Ryujinx.Cpu
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public ulong Counter => (ulong)(ElapsedSeconds * Frequency);
|
public ulong Counter => (ulong)(ElapsedSeconds * Frequency);
|
||||||
|
|
||||||
public static long s_tickMultiplier = 100;
|
public long TickMultiplier { get; set; } = 100;
|
||||||
private static long AcumElapsedTicks = 0;
|
private static long AcumElapsedTicks = 0;
|
||||||
private static long LastElapsedTicks = 0;
|
private static long LastElapsedTicks = 0;
|
||||||
private long Elapsedticks
|
private long Elapsedticks
|
||||||
|
@ -23,7 +23,7 @@ namespace Ryujinx.Cpu
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
long elapsedTicks = _tickCounter.ElapsedTicks;
|
long elapsedTicks = _tickCounter.ElapsedTicks;
|
||||||
AcumElapsedTicks += (elapsedTicks - LastElapsedTicks) * s_tickMultiplier / 100;
|
AcumElapsedTicks += (elapsedTicks - LastElapsedTicks) * TickMultiplier / 100;
|
||||||
LastElapsedTicks = elapsedTicks;
|
LastElapsedTicks = elapsedTicks;
|
||||||
return AcumElapsedTicks;
|
return AcumElapsedTicks;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ticksPerFrame = (Stopwatch.Frequency / TargetFps * 100) / TickSource.s_tickMultiplier;
|
_ticksPerFrame = (Stopwatch.Frequency / TargetFps * 100) / (_device.System?.TickSource?.TickMultiplier ?? 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,11 @@ namespace Ryujinx.HLE
|
||||||
return AudioDeviceDriver.Volume;
|
return AudioDeviceDriver.Volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetTickSourceMultiplier(long tickMultiplier)
|
||||||
|
{
|
||||||
|
System.TickSource.TickMultiplier = tickMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
public void EnableCheats()
|
public void EnableCheats()
|
||||||
{
|
{
|
||||||
ModLoader.EnableCheats(Processes.ActiveApplication.ProgramId, TamperMachine);
|
ModLoader.EnableCheats(Processes.ActiveApplication.ProgramId, TamperMachine);
|
||||||
|
|
|
@ -1072,7 +1072,7 @@ namespace Ryujinx.Ava
|
||||||
{
|
{
|
||||||
Device.TurboMode = !Device.TurboMode;
|
Device.TurboMode = !Device.TurboMode;
|
||||||
long turboMultiplier = Device.TurboMode ? Device.Configuration.TurboMultiplier : 100;
|
long turboMultiplier = Device.TurboMode ? Device.Configuration.TurboMultiplier : 100;
|
||||||
TickSource.s_tickMultiplier = turboMultiplier;
|
Device.SetTickSourceMultiplier(turboMultiplier);
|
||||||
}
|
}
|
||||||
switch (currentHotkeyState)
|
switch (currentHotkeyState)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue