Retargetting non-executable projects to .NET Standard (#1801)
* Retarget BizHawk.Emulation.* to .NET Standard 2.0 * Retarget BizHawk.Bizware.BizwareGL to .NET Standard 2.0 In practice this mostly involves moving classes to BizHawk.Client.EmuHawk.
This commit is contained in:
parent
fcc3ac88c0
commit
46a4d8ffa9
BizHawk.Client.Common
BizHawk.Client.EmuHawk
BizHawk.Client.EmuHawk.csproj
GraphicsImplementations
GLControlWrapper_GdiPlus.csGLControlWrapper_SlimDX9.csGraphicsControl.csGraphicsControl_TK.csIGLExtensions.csIGL_GdiPlus.csIGL_SlimDX9.csIGL_TK.csRetainedGraphicsControl.csSlimDXExtensions.cs
Program.csProjectPkgRefs.propspackages.configBizHawk.Emulation.Common
BizHawk.Emulation.Cores
BizHawk.Emulation.DiscSystem
Bizware/BizHawk.Bizware.BizwareGL
Common.props
|
@ -1,28 +0,0 @@
|
|||
using System;
|
||||
using BizHawk.Bizware.BizwareGL;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static IGuiRenderer CreateRenderer(this IGL gl)
|
||||
{
|
||||
if (gl is IGL_TK)
|
||||
{
|
||||
return new GuiRenderer(gl);
|
||||
}
|
||||
|
||||
if (gl is IGL_SlimDX9)
|
||||
{
|
||||
return new GuiRenderer(gl);
|
||||
}
|
||||
|
||||
if (gl is IGL_GdiPlus)
|
||||
{
|
||||
return new GDIPlusGuiRenderer((IGL_GdiPlus)gl);
|
||||
}
|
||||
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -96,9 +96,18 @@
|
|||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed"
|
||||
HintPath="$(SolutionDir)packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.dll"
|
||||
Private="true" />
|
||||
<!--<Reference Include="OpenTK, Version=3.0.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"
|
||||
HintPath="../packages/OpenTK.3.0.1/lib/net20/OpenTK.dll"
|
||||
Private="true" />-->
|
||||
<Reference Include="OpenTK.GLControl, Version=3.0.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"
|
||||
HintPath="../packages/OpenTK.GLControl.3.0.1/lib/net20/OpenTK.GLControl.dll"
|
||||
Private="true" />
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=1.1.0.145, Culture=neutral, PublicKeyToken=1b03e6acf1164f73"
|
||||
HintPath="$(SolutionDir)packages/SharpZipLib.1.1.0/lib/net45/ICSharpCode.SharpZipLib.dll"
|
||||
Private="true" />
|
||||
<Reference Include="System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
|
||||
HintPath="../packages/System.Drawing.Common.4.7.0/lib/net461/System.Drawing.Common.dll"
|
||||
Private="true" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="GongShell"
|
||||
|
@ -426,6 +435,11 @@
|
|||
<Compile Update="CustomControls/ToolStripEx.cs" SubType="Component" />
|
||||
<Compile Update="CustomControls/TransparentTrackbar.cs" SubType="Component" />
|
||||
<Compile Update="CustomControls/ViewportPanel.cs" SubType="Component" />
|
||||
<Compile Update="GraphicsImplementations/GLControlWrapper_GdiPlus.cs" SubType="Component" />
|
||||
<Compile Update="GraphicsImplementations/GLControlWrapper_SlimDX9.cs" SubType="Component" />
|
||||
<Compile Update="GraphicsImplementations/GraphicsControl.cs" SubType="UserControl" />
|
||||
<Compile Update="GraphicsImplementations/GraphicsControl_TK.cs" SubType="UserControl" />
|
||||
<Compile Update="GraphicsImplementations/RetainedGraphicsControl.cs" SubType="UserControl" />
|
||||
<Compile Update="LogWindow.cs" SubType="Form" />
|
||||
<Compile Update="LogWindow.Designer.cs" DependentUpon="LogWindow.cs" />
|
||||
<EmbeddedResource Update="LogWindow.resx" DependentUpon="LogWindow.cs" />
|
||||
|
|
|
@ -9,7 +9,7 @@ using System.Windows.Forms;
|
|||
using BizHawk.Bizware.BizwareGL;
|
||||
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public class GLControlWrapper_GdiPlus : Control, IGraphicsControl
|
||||
{
|
|
@ -9,7 +9,7 @@ using System.Windows.Forms;
|
|||
using BizHawk.Bizware.BizwareGL;
|
||||
using SlimDX.Direct3D9;
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public class GLControlWrapper_SlimDX9 : Control, IGraphicsControl
|
||||
{
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
using BizHawk.Bizware.BizwareGL;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
/// <summary>
|
||||
/// a base class for deriving/wrapping from a IGraphicsControl.
|
|
@ -11,7 +11,7 @@ using OpenTK;
|
|||
using OpenTK.Graphics;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
class GLControlWrapper : GLControl, IGraphicsControl
|
||||
{
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
|
||||
using BizHawk.Bizware.BizwareGL;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public static class IGLExtensions
|
||||
{
|
||||
public static IGuiRenderer CreateRenderer(this IGL gl) => gl switch
|
||||
{
|
||||
IGL_GdiPlus _ => (IGuiRenderer) new GDIPlusGuiRenderer(gl),
|
||||
IGL_SlimDX9 _ => new GuiRenderer(gl),
|
||||
IGL_TK _ => new GuiRenderer(gl),
|
||||
_ => throw new NotSupportedException()
|
||||
};
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ using swf = System.Windows.Forms;
|
|||
|
||||
//TODO - maybe a layer to cache Graphics parameters (notably, filtering) ?
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public class IGL_GdiPlus : IGL
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
|
||||
public void FreeTexture(Texture2d tex)
|
||||
{
|
||||
var tw = tex.Opaque as TextureWrapper;
|
||||
var tw = tex.Opaque as GDIPTextureWrapper;
|
||||
tw.Dispose();
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
|
||||
public void TexParameter2d(Texture2d tex, TextureParameterName pname, int param)
|
||||
{
|
||||
var tw = tex.Opaque as TextureWrapper;
|
||||
var tw = tex.Opaque as GDIPTextureWrapper;
|
||||
if (pname == TextureParameterName.TextureMinFilter)
|
||||
tw.MinFilter = (TextureMinFilter)param;
|
||||
if (pname == TextureParameterName.TextureMagFilter)
|
||||
|
@ -161,7 +161,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
public Texture2d LoadTexture(sd.Bitmap bitmap)
|
||||
{
|
||||
var sdbmp = (sd.Bitmap)bitmap.Clone();
|
||||
TextureWrapper tw = new TextureWrapper();
|
||||
GDIPTextureWrapper tw = new GDIPTextureWrapper();
|
||||
tw.SDBitmap = sdbmp;
|
||||
return new Texture2d(this, tw, bitmap.Width, bitmap.Height);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
|
||||
public void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
|
||||
{
|
||||
var tw = tex.Opaque as TextureWrapper;
|
||||
var tw = tex.Opaque as GDIPTextureWrapper;
|
||||
bmp.ToSysdrawingBitmap(tw.SDBitmap);
|
||||
}
|
||||
|
||||
|
@ -194,14 +194,14 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
{
|
||||
//definitely needed (by TextureFrugalizer at least)
|
||||
var sdbmp = bmp.ToSysdrawingBitmap();
|
||||
var tw = new TextureWrapper();
|
||||
var tw = new GDIPTextureWrapper();
|
||||
tw.SDBitmap = sdbmp;
|
||||
return new Texture2d(this, tw, bmp.Width, bmp.Height);
|
||||
}
|
||||
|
||||
public unsafe BitmapBuffer ResolveTexture2d(Texture2d tex)
|
||||
{
|
||||
var tw = tex.Opaque as TextureWrapper;
|
||||
var tw = tex.Opaque as GDIPTextureWrapper;
|
||||
var blow = new BitmapLoadOptions()
|
||||
{
|
||||
AllowWrap = false //must be an independent resource
|
||||
|
@ -320,7 +320,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
}
|
||||
else
|
||||
{
|
||||
var tw = Target.Texture2d.Opaque as TextureWrapper;
|
||||
var tw = Target.Texture2d.Opaque as GDIPTextureWrapper;
|
||||
r = Target.Texture2d.Rectangle;
|
||||
refGraphics = Graphics.FromImage(tw.SDBitmap);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
|
||||
public unsafe RenderTarget CreateRenderTarget(int w, int h)
|
||||
{
|
||||
TextureWrapper tw = new TextureWrapper();
|
||||
GDIPTextureWrapper tw = new GDIPTextureWrapper();
|
||||
tw.SDBitmap = new Bitmap(w,h, sdi.PixelFormat.Format32bppArgb);
|
||||
var tex = new Texture2d(this, tw, w, h);
|
||||
|
||||
|
@ -406,7 +406,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
}
|
||||
else
|
||||
{
|
||||
var tw = rt.Texture2d.Opaque as TextureWrapper;
|
||||
var tw = rt.Texture2d.Opaque as GDIPTextureWrapper;
|
||||
CurrentRenderTargetWrapper = rt.Opaque as RenderTargetWrapper;
|
||||
_CurrentOffscreenGraphics = Graphics.FromImage(tw.SDBitmap);
|
||||
//if (CurrentRenderTargetWrapper.MyBufferedGraphics == null)
|
||||
|
@ -429,21 +429,6 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
|
||||
public BufferedGraphicsContext MyBufferedGraphicsContext;
|
||||
|
||||
public class TextureWrapper : IDisposable
|
||||
{
|
||||
public sd.Bitmap SDBitmap;
|
||||
public TextureMinFilter MinFilter = TextureMinFilter.Nearest;
|
||||
public TextureMagFilter MagFilter = TextureMagFilter.Nearest;
|
||||
public void Dispose()
|
||||
{
|
||||
if (SDBitmap != null)
|
||||
{
|
||||
SDBitmap.Dispose();
|
||||
SDBitmap = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} //class IGL_GdiPlus
|
||||
|
|
@ -21,7 +21,7 @@ using swf = System.Windows.Forms;
|
|||
|
||||
//todo - do a better job selecting shader model? base on caps somehow? try several and catch compilation exceptions (yuck, exceptions)
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
||||
public class IGL_SlimDX9 : IGL
|
|
@ -25,7 +25,7 @@ using sd = System.Drawing;
|
|||
using sdi = System.Drawing.Imaging;
|
||||
using swf = System.Windows.Forms;
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
/// <summary>
|
||||
/// OpenTK implementation of the BizwareGL.IGL interface.
|
|
@ -8,7 +8,7 @@ using System.Text;
|
|||
using BizHawk.Bizware.BizwareGL;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
/// <summary>
|
||||
/// Adapts a GraphicsControl to gain the power of remembering what was drawn to it, and keeping it presented in response to Paint events
|
|
@ -130,7 +130,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// create IGL context. we do this whether or not the user has selected OpenGL, so that we can run opengl-based emulator cores
|
||||
GlobalWin.IGL_GL = new Bizware.BizwareGL.IGL_TK(2, 0, false);
|
||||
GlobalWin.IGL_GL = new IGL_TK(2, 0, false);
|
||||
|
||||
// setup the GL context manager, needed for coping with multiple opengl cores vs opengl display method
|
||||
GLManager.CreateInstance();
|
||||
|
@ -140,13 +140,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
REDO_DISPMETHOD:
|
||||
if (Global.Config.DispMethod == EDispMethod.GdiPlus)
|
||||
{
|
||||
GlobalWin.GL = new Bizware.BizwareGL.IGL_GdiPlus();
|
||||
GlobalWin.GL = new IGL_GdiPlus();
|
||||
}
|
||||
else if (Global.Config.DispMethod == EDispMethod.SlimDX9)
|
||||
{
|
||||
try
|
||||
{
|
||||
GlobalWin.GL = new Bizware.BizwareGL.IGL_SlimDX9();
|
||||
GlobalWin.GL = new IGL_SlimDX9();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
@ -248,7 +248,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//cleanup:
|
||||
//cleanup IGL stuff so we can get better refcounts when exiting process, for debugging
|
||||
//DOESNT WORK FOR SOME REASON
|
||||
//GlobalWin.IGL_GL = new Bizware.BizwareGL.Drivers.OpenTK.IGL_TK();
|
||||
//GlobalWin.IGL_GL = new IGL_TK();
|
||||
//GLManager.Instance.Dispose();
|
||||
//if (GlobalWin.IGL_GL != GlobalWin.GL)
|
||||
// GlobalWin.GL.Dispose();
|
||||
|
|
|
@ -6,11 +6,29 @@
|
|||
Name="Newtonsoft.Json"
|
||||
Private="true"
|
||||
SpecificVersion="true" />
|
||||
<!--<PackageReference Include="OpenTK" Version="3.0.1" PrivateAssets="All" />
|
||||
<Reference Include="$(MachineNuGetPackageDir)/opentk/3.0.1/lib/net20/OpenTK.dll"
|
||||
FusionName="OpenTK, Version=3.0.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"
|
||||
Name="OpenTK"
|
||||
Private="true"
|
||||
SpecificVersion="true" />-->
|
||||
<PackageReference Include="OpenTK.GLControl" Version="3.0.1" PrivateAssets="All" />
|
||||
<Reference Include="$(MachineNuGetPackageDir)/opentk.glcontrol/3.0.1/lib/net20/OpenTK.GLControl.dll"
|
||||
FusionName="OpenTK.GLControl, Version=3.0.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"
|
||||
Name="OpenTK.GLControl"
|
||||
Private="true"
|
||||
SpecificVersion="true" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.1.0" PrivateAssets="All" />
|
||||
<Reference Include="$(MachineNuGetPackageDir)/sharpziplib/1.1.0/lib/net45/ICSharpCode.SharpZipLib.dll"
|
||||
FusionName="ICSharpCode.SharpZipLib, Version=1.1.0.145, Culture=neutral, PublicKeyToken=1b03e6acf1164f73"
|
||||
Name="ICSharpCode.SharpZipLib"
|
||||
Private="true"
|
||||
SpecificVersion="true" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" PrivateAssets="All" />
|
||||
<Reference Include="$(MachineNuGetPackageDir)/system.drawing.common/4.7.0/lib/net461/System.Drawing.Common.dll"
|
||||
FusionName="System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
|
||||
Name="System.Drawing.Common"
|
||||
Private="true"
|
||||
SpecificVersion="true" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
|
||||
<!--<package id="OpenTK" version="3.0.1" targetFramework="net20" />-->
|
||||
<package id="OpenTK.GLControl" version="3.0.1" targetFramework="net20" />
|
||||
<package id="SharpZipLib" version="1.1.0" targetFramework="net45" />
|
||||
<package id="System.Drawing.Common" version="4.7.0" targetFramework="net461" />
|
||||
</packages>
|
|
@ -2,25 +2,11 @@
|
|||
<Import Project="$(SolutionDir)Common.props" />
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
<!--<Reference Include="Microsoft.CSharp" />-->
|
||||
<!--<Reference Include="System" />-->
|
||||
<!--<Reference Include="System.Core" />-->
|
||||
<!--<Reference Include="System.Data" />-->
|
||||
<!--<Reference Include="System.Data.DataSetExtensions" />-->
|
||||
<!--<Reference Include="System.Xml" />-->
|
||||
<!--<Reference Include="System.Xml.Linq" />-->
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(SolutionDir)BizHawk.Emulation.DiscSystem/BizHawk.Emulation.DiscSystem.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(SolutionDir)Version/svnrev.cs" />
|
||||
<Compile Include="$(SolutionDir)Version/VersionInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -2,66 +2,23 @@
|
|||
<Import Project="$(SolutionDir)Common.props" />
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<!-- This stuff was unique to this project and also not mentioned in the tutorial, so I've left them commented here. -->
|
||||
<!--
|
||||
<PropertyGroup>
|
||||
<FileUpgradeFlags />
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<PublishUrl>publish/</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5" Install="false" ProductName=".NET Framework 3.5 SP1 Client Profile" Visible="False" />
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1" Install="true" ProductName=".NET Framework 3.5 SP1" Visible="False" />
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1" Install="true" ProductName="Windows Installer 3.1" Visible="False" />
|
||||
</ItemGroup>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
<!--<Reference Include="System" />-->
|
||||
<!--<Reference Include="System.ComponentModel.DataAnnotations" />-->
|
||||
<!--<Reference Include="System.Core" RequiredTargetFramework="3.5" />-->
|
||||
<!--<Reference Include="System.Data" />-->
|
||||
<!--<Reference Include="System.Data.DataSetExtensions" RequiredTargetFramework="3.5" />-->
|
||||
<!--<Reference Include="System.Drawing" />-->
|
||||
<!--<Reference Include="System.Numerics" />-->
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<!--<Reference Include="System.Xml" />-->
|
||||
<!--<Reference Include="System.Xml.Linq" RequiredTargetFramework="3.5" />-->
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" PrivateAssets="All" />
|
||||
<PackageReference Include="ELFSharp" Version="0.1.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" PrivateAssets="All" />
|
||||
<PackageReference Include="OpenTK" Version="3.0.1" PrivateAssets="All" />
|
||||
<Reference Include="PeNet" HintPath="$(SolutionDir)References/PeNet.dll" Private="true" />
|
||||
<Reference Include="Virtu" HintPath="$(SolutionDir)References/Virtu.dll" Private="true" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PeNet"
|
||||
HintPath="$(SolutionDir)References/PeNet.dll"
|
||||
Private="true" />
|
||||
<Reference Include="Virtu"
|
||||
HintPath="$(SolutionDir)References/Virtu.dll"
|
||||
Private="true" />
|
||||
<ProjectReference Include="$(SolutionDir)BizHawk.BizInvoke/BizHawk.BizInvoke.csproj" />
|
||||
<ProjectReference Include="$(SolutionDir)BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(SolutionDir)Version/svnrev.cs" />
|
||||
<Compile Include="$(SolutionDir)Version/VersionInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources/*" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -2,24 +2,11 @@
|
|||
<Import Project="$(SolutionDir)Common.props" />
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
<!--<Reference Include="Microsoft.CSharp" />-->
|
||||
<!--<Reference Include="System" />-->
|
||||
<!--<Reference Include="System.Core" />-->
|
||||
<!--<Reference Include="System.Data" />-->
|
||||
<!--<Reference Include="System.Data.DataSetExtensions" />-->
|
||||
<!--<Reference Include="System.Xml" />-->
|
||||
<!--<Reference Include="System.Xml.Linq" />-->
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(SolutionDir)BizHawk.Common/BizHawk.Common.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(SolutionDir)Version/svnrev.cs" />
|
||||
<Compile Include="$(SolutionDir)Version/VersionInfo.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
|
|
|
@ -2,24 +2,15 @@
|
|||
<Import Project="$(SolutionDir)Common.props" />
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" PrivateAssets="All" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" PrivateAssets="All" />
|
||||
<PackageReference Include="OpenTK" Version="3.0.1" PrivateAssets="All" />
|
||||
<PackageReference Include="OpenTK.GLControl" Version="3.0.1" PrivateAssets="All" />
|
||||
<Reference Include="SlimDX"
|
||||
HintPath="$(SolutionDir)References/x64/SlimDX.dll"
|
||||
Private="true" />
|
||||
<ProjectReference Include="$(SolutionDir)BizHawk.Common/BizHawk.Common.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="GLControlWrapper_GdiPlus.cs" SubType="Component" />
|
||||
<Compile Update="GLControlWrapper_SlimDX9.cs" SubType="Component" />
|
||||
<Compile Update="GraphicsControl.cs" SubType="UserControl" />
|
||||
<Compile Update="GraphicsControl_TK.cs" SubType="UserControl" />
|
||||
<Compile Update="IGuiRenderer.cs" SubType="Code" />
|
||||
<Compile Update="RetainedGraphicsControl.cs" SubType="UserControl" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
{
|
||||
public class GDIPTextureWrapper : IDisposable
|
||||
{
|
||||
public System.Drawing.Bitmap SDBitmap;
|
||||
public TextureMinFilter MinFilter = TextureMinFilter.Nearest;
|
||||
public TextureMagFilter MagFilter = TextureMagFilter.Nearest;
|
||||
public void Dispose()
|
||||
{
|
||||
if (SDBitmap != null)
|
||||
{
|
||||
SDBitmap.Dispose();
|
||||
SDBitmap = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,10 +15,9 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
{
|
||||
public class GDIPlusGuiRenderer : IGuiRenderer
|
||||
{
|
||||
public GDIPlusGuiRenderer(IGL_GdiPlus gl)
|
||||
public GDIPlusGuiRenderer(IGL gl)
|
||||
{
|
||||
Owner = gl;
|
||||
Gdi = gl as IGL_GdiPlus;
|
||||
}
|
||||
|
||||
OpenTK.Graphics.Color4[] CornerColors = new OpenTK.Graphics.Color4[4] {
|
||||
|
@ -164,8 +163,8 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
|
||||
public void DrawSubrect(Texture2d tex, float x, float y, float w, float h, float u0, float v0, float u1, float v1)
|
||||
{
|
||||
var tw = tex.Opaque as IGL_GdiPlus.TextureWrapper;
|
||||
var g = Gdi.GetCurrentGraphics();
|
||||
var tw = tex.Opaque as GDIPTextureWrapper;
|
||||
var g = ((dynamic) Gdi).GetCurrentGraphics() as sd.Graphics;
|
||||
PrepDraw(g, tex);
|
||||
SetupMatrix(g);
|
||||
|
||||
|
@ -200,7 +199,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
|
||||
void PrepDraw(sd.Graphics g, Texture2d tex)
|
||||
{
|
||||
var tw = tex.Opaque as IGL_GdiPlus.TextureWrapper;
|
||||
var tw = tex.Opaque as GDIPTextureWrapper;
|
||||
//TODO - we can support bicubic for the final presentation..
|
||||
if ((int)tw.MagFilter != (int)tw.MinFilter)
|
||||
throw new InvalidOperationException($"{nameof(tw)}.{nameof(tw.MagFilter)} != {nameof(tw)}.{nameof(tw.MinFilter)}");
|
||||
|
@ -253,7 +252,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
|
||||
unsafe void DrawInternal(Texture2d tex, float x, float y, float w, float h, float u0, float v0, float u1, float v1)
|
||||
{
|
||||
var g = Gdi.GetCurrentGraphics();
|
||||
var g = ((dynamic) Gdi).GetCurrentGraphics() as sd.Graphics;
|
||||
PrepDraw(g, tex);
|
||||
|
||||
SetupMatrix(g);
|
||||
|
@ -271,7 +270,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
float sw = sx2 - sx;
|
||||
float sh = sy2 - sy;
|
||||
|
||||
var tw = tex.Opaque as IGL_GdiPlus.TextureWrapper;
|
||||
var tw = tex.Opaque as GDIPTextureWrapper;
|
||||
g.PixelOffsetMode = sd.Drawing2D.PixelOffsetMode.Half;
|
||||
g.DrawImage(tw.SDBitmap, destPoints, new sd.RectangleF(sx, sy, sw, sh), sd.GraphicsUnit.Pixel, CurrentImageAttributes);
|
||||
g.Transform = new sd.Drawing2D.Matrix(); //.Reset() doesnt work ? ?
|
||||
|
@ -285,7 +284,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
|
||||
public bool IsActive { get; private set; }
|
||||
public IGL Owner { get; private set; }
|
||||
public IGL_GdiPlus Gdi;
|
||||
public IGL Gdi => Owner;
|
||||
|
||||
}
|
||||
}
|
|
@ -5,8 +5,6 @@ using System.Drawing;
|
|||
using OpenTK;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
|
||||
using swf = System.Windows.Forms;
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
{
|
||||
|
||||
|
@ -208,10 +206,12 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
/// </summary>
|
||||
void SetViewport(int width, int height);
|
||||
|
||||
#if false // Unused and WinForms unavailable on .NET Standard
|
||||
/// <summary>
|
||||
/// sets the viewport (and scissor) according to the client area of the provided control
|
||||
/// </summary>
|
||||
void SetViewport(swf.Control control);
|
||||
void SetViewport(System.Windows.Forms.Control control);
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// sets the viewport (and scissor) according to the provided specifications
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>NU1701</NoWarn><!-- can't use .ruleset, and NU1702 can't be silenced at all (see https://github.com/NuGet/Home/issues/8797) -->
|
||||
<OutputPath>$(SolutionDir)output/dll</OutputPath>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<RunAnalyzersDuringBuild Condition=" '$(MachineRunAnalyzersDuringBuild)' == '' ">false</RunAnalyzersDuringBuild>
|
||||
|
|
Loading…
Reference in New Issue