Skip to content

Commit

Permalink
Video fixes, input fixes, more cores supported
Browse files Browse the repository at this point in the history
- OpenGL video now scales to the resolution on the main screen so retina displays look correct
- Swapped out control defaults for ones that work with OpenTK
- Migrated native core XCode projects from BizHawk 1.x, updated some of them to 64-bit for BizHawk 2.x.
-- Currently only blip_buf and QuickNES are added and tested
- Fixed QuickNES core, there's a windows specific floating point hack that we can safely omit porting because the problem it fixes doesn't happen on macOS / Unix.
  • Loading branch information
Sappharad committed Jan 3, 2019
1 parent 09378d4 commit 2bcc546
Show file tree
Hide file tree
Showing 17 changed files with 2,105 additions and 18 deletions.
6 changes: 5 additions & 1 deletion BizHawk.Client.Common/config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ namespace BizHawk.Client.Common
public class Config
{
public static string ControlDefaultPath
{
{
#if WINDOWS
get { return PathManager.MakeProgramRelativePath("defctrl.json"); }
#else
get { return PathManager.MakeProgramRelativePath("defctrl_opentk.json"); }
#endif
}

public void ConfigCheckAllControlDefaults()
Expand Down
2 changes: 2 additions & 0 deletions BizHawk.Client.EmuHawk/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,8 @@ public void FrameBufferResized()
int borderWidth = Size.Width - PresentationPanel.Control.Size.Width;
int borderHeight = Size.Height - PresentationPanel.Control.Size.Height;

//this.AutoScaleFactor

// start at target zoom and work way down until we find acceptable zoom
Size lastComputedSize = new Size(1, 1);
for (; zoom >= 1; zoom--)
Expand Down
2 changes: 2 additions & 0 deletions BizHawk.Client.EmuHawkMacApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Bizware.BizwareGL.Drivers.OpenTK.IGL_TK.NativeViewportScale = (int)AppKit.NSScreen.MainScreen.BackingScaleFactor;
//Note: If you have multiple monitors with different scale factors, this won't work. Known limitation.

//BizHawk.Common.TempFileCleaner.Start();

Expand Down
39 changes: 24 additions & 15 deletions BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,41 +76,50 @@ public QuickNES(CoreComm comm, byte[] file, object settings, object syncSettings
static readonly LibQuickNES QN;
static readonly DynamicLibraryImportResolver Resolver;

public IEmulatorServiceProvider ServiceProvider { get; private set; }
public IEmulatorServiceProvider ServiceProvider { get; private set; }


#region FPU precision


private class FPCtrl : IDisposable
{
{
#if WINDOWS
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern uint _control87(uint @new, uint mask);
#endif

public static void PrintCurrentFP()
{
{
#if WINDOWS
uint curr = _control87(0, 0);
Console.WriteLine("Current FP word: 0x{0:x8}", curr);
#endif
}

uint cw;

public IDisposable Save()
{
{
#if WINDOWS
cw = _control87(0, 0);
_control87(0x00000, 0x30000);
#endif
return this;
}
public void Dispose()
{
{
#if WINDOWS
_control87(cw, 0x30000);
#endif
}
}

FPCtrl FP = new FPCtrl();

#endregion

#region Controller

#endregion

#region Controller

public ControllerDefinition ControllerDefinition { get; private set; }

void SetControllerDefinition()
Expand Down Expand Up @@ -177,7 +186,7 @@ void SetPads(IController controller, out int j1, out int j2)
j2 = 0;
}

#endregion
#endregion

public void FrameAdvance(IController controller, bool render, bool rendersound = true)
{
Expand Down Expand Up @@ -233,7 +242,7 @@ public CoreComm CoreComm
private set;
}

#region bootgod
#region bootgod

public RomStatus? BootGodStatus { get; private set; }
public string BootGodName { get; private set; }
Expand Down Expand Up @@ -290,7 +299,7 @@ void ComputeBootGod()
}
}

#endregion
#endregion

public void Dispose()
{
Expand Down Expand Up @@ -330,7 +339,7 @@ byte[] FixInesHeader(byte[] file)
return file;
}

#region Blacklist
#region Blacklist

// These games are known to not work in quicknes but quicknes thinks it can run them, bail out if one of these is loaded
private static readonly HashSet<string> HashBlackList = new HashSet<string>
Expand Down Expand Up @@ -575,6 +584,6 @@ byte[] FixInesHeader(byte[] file)
"D9B1B87204E025A637821A0168475E1209CE0C8A", // Top Gun (VS)
};

#endregion
#endregion
}
}
6 changes: 4 additions & 2 deletions Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,12 @@ public Matrix4 CreateGuiViewMatrix(sd.Size dims, bool autoflip)
return ret;
}

public static int NativeViewportScale = 1;

public void SetViewport(int x, int y, int width, int height)
{
GL.Viewport(x, y, width, height);
GL.Scissor(x, y, width, height); //hack for mupen[rice]+intel: at least the rice plugin leaves the scissor rectangle scrambled, and we're trying to run it in the main graphics context for intel
GL.Viewport(x, y, width * NativeViewportScale, height * NativeViewportScale);
GL.Scissor(x, y, width * NativeViewportScale, height * NativeViewportScale); //hack for mupen[rice]+intel: at least the rice plugin leaves the scissor rectangle scrambled, and we're trying to run it in the main graphics context for intel
//BUT ALSO: new specifications.. viewport+scissor make sense together
}

Expand Down

0 comments on commit 2bcc546

Please sign in to comment.