Skip to content

Commit

Permalink
Change: Attempted workaround for high CPU on OS-X viewer launch
Browse files Browse the repository at this point in the history
  • Loading branch information
leezer3 committed Oct 17, 2024
1 parent 117d510 commit 68610c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/RouteViewer/LoadingR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ internal static bool Cancel
// load
internal static void Load(string RouteFile, Encoding RouteEncoding, Bitmap bitmap = null)
{
Program.currentGameWindow.TargetRenderFrequency = 0;
// reset
Game.Reset();
Program.Renderer.Loading.InitLoading(Program.FileSystem.GetDataFolder("In-game"), typeof(NewRenderer).Assembly.GetName().Version.ToString(), Interface.CurrentOptions.LoadingLogo, Interface.CurrentOptions.LoadingProgressBar);
Expand Down
1 change: 1 addition & 0 deletions source/RouteViewer/ProgramR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ internal static void keyDownEvent(object sender, KeyboardKeyEventArgs e)
{
if (Program.CurrentHost.Platform == HostPlatform.AppleOSX && IntPtr.Size != 4)
{
Program.currentGameWindow.TargetRenderFrequency = 0;
Program.Renderer.CurrentInterface = InterfaceType.Menu;
Game.Menu.PushMenu(MenuType.GameStart);
}
Expand Down
8 changes: 8 additions & 0 deletions source/RouteViewer/System/Gamewindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.ComponentModel;
using System.Threading;
using OpenBveApi;
using OpenBveApi.Hosts;
using OpenBveApi.Math;
using OpenTK;
using OpenTK.Graphics;
Expand All @@ -26,6 +27,13 @@ public RouteViewer(int width, int height, GraphicsMode currentGraphicsMode, stri
{
// Ignored- Just an icon
}

if (Program.CurrentHost.Platform == HostPlatform.AppleOSX && IntPtr.Size != 4)
{
// attempted workaround for massive CPU usage when idle
TargetRenderFrequency = 5.0;
}

}

//Default Properties
Expand Down

0 comments on commit 68610c2

Please sign in to comment.