-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problematic dependencies #2261
Comments
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
So I had a play with this thing (the Windows version works in Mono, who would have guessed) and the situation doesn't look too bad. GongShell, OpenTK 3, and SlimDX all reference In other news, .NET 6 doesn't include WinForms for Linux, even though Mono currently supports it, and they're instead pushing ahead with MAUI (a.k.a. Xamarin.Forms). Given that, my plans for the Linux port are as follows:
edit 2022-08-12: I've just been made aware of the ActiveQt library/framework which appears to require choice of Managed C++ or COM? Not sure if Mono supports either. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The other third-party option that was recommended to me several years ago was Eto, which translates to native options on their respective operating systems (WinForms, WPF, GTK, Cocoa): I had started a crappy recreation of the WinForms UI in it several years ago, only to abandon it because I didn't want to spend the time necessary to recreate everything and moved back to WinForms before mostly suspending the macOS port entirely. |
tracking opentk/opentk#937 re: OTK3 keyboard init heisenbug; my OpenTK watchlist |
This comment was marked as resolved.
This comment was marked as resolved.
https://github.com/emclient/mac-playground has a port of Mono's WinForms to netstandard2.1. I'm not clear on whether it's compatible with Linux or just macOS, though. |
That is just for macOS. It’s what I was using for the Mac port after Apple dropped 32-bit support. It won’t help you on Linux |
OpenTK.GLControl was renamed to OpenTK.WinForms, which is in beta and supports netcoreapp3.1: https://www.nuget.org/packages/OpenTK.WinForms |
Potential SlimDX replacement, targets .NET Standard 2.0: Supports Direct3D9, DirectInput, XInput, and XAudio2 among others, but not DirectSound. A few years ago I tried out the XAudio2 part and got it working in my forked repo: |
I also noticed edit 2023-04: |
I believe that's because Vortice uses XAudio2 2.9/2.8 whereas SlimDX uses XAudio2 2.7. Microsoft stated in the changes for XAudio2 2.8:
They don't make it clear how to get the "device identifier string" but I found a discussion where someone mentions Windows.Devices.Enumeration.DeviceInformation.FindAllAsync. I didn't want to mess with it anymore after that 😋. I think Direct3D9 might be the bigger problem though - I did start trying to convert some of that code out of curiosity, and although I'm not very familiar with Direct3D, I'm pretty sure Vortice's implementation of D3D9 is incomplete. My impression is that the author would be unwilling to fix that himself, although would accept pull requests if someone wanted to finish the missing features. |
I have a feeling we stumbled onto the same social.MSDN thread (login required)... edit: found another C++ code snippet that doesn't require login We won't have any problems w/ D3D9 if we switch to its D3D12 backend instead. (And if we use Vortice via Veldrid then Vulkan is also available. Verily.) |
This seems a good place to put this—.NET Framework 4.8.1 is real and available now, but only for Win10+, and it only includes the promised accessibility changes, not .NET Standard 2.1 support or anything "new". I don't think we should upgrade, and I'm not even going to bother checking if Mono runtime supports it. |
…ongshell's only actual use), re: #2261
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Something to note, OpenTK.Input 4 is actually netstandard 2.0 (the rest of OpenTK is not), so us using it for host input would be (mostly) a non-blocker (host graphics/sound is obviously still an issue). |
There was already an option for input on Linux,
|
Regardless, using OpenTK.Input means no building from source, the latest nuget package is already netstandard2.0 compatible. If we want another input backend, something to look into with Silk.NET is its SDL2 Input bindings, which may be nice in any case due to SDL2 supporting a ton of different controllers. |
Doing some work on the input, it seems more complicated when I thought. OpenTK.Input in 4.x is not the same as OpenTK.Input in 3.x, as it is supposed to be some "Hid/Controller" code (in reality, there's barely anything in there and looks to be just incomplete all in all). The old OpenTK input code was moved to OpenTK.Windowing.GraphicsLibraryFramework, and has a significantly different API. Differently enough that I'm not sure we can use it anymore. The main issue is simply that it requires that an OpenTK (sidenote: OpenTK 4.x internally just uses GLFW to handle getting input in a platform agnostic way, while OpenTK 3.x just used its own platform abstractions to native APIs) SDL2 similarly has this issue, but it does have an option to create a window from an existing window using a native window handle (which is handed over in the first place by our input API). Even then however, that doesn't work entirely, at least on Windows (maybe on Linux too, dunno), as for whatever reason as WM_KEYDOWN/WM_KEYUP just never arrive, despite the MainForm clearly having focus, so keyboard input just doesn't work at all. Not entirely sure what'd be a good solution here. We could use |
I'm increasingly souring on this position. macOS all but precludes that anyway (as does Windows UWP I believe). |
Continuing to look and it really just seems like we will forced to just write OS specific code for each platform for keyboard input. We can have SDL2 at least maybe as a nice catch all for gamepads (doesn't have dumb focused window requirement), but that's it. At least it seems possible across all platforms. I currently envision this for input: Windows: DirectInput+XInput, DirectInput+SDL2 On that, this isn't perfect. We may need to change the keyboard from using DirectInput, for UWP support, as UWP does not support DirectInput, the only alternative here seems to be using the RAWINPUT API (as a bonus, we can just make DirectInput back to no longer a hard dependency this way, as the removal of OpenTK would implicitly do for Windows users). Linux doesn't necessarily have to use evdev for keyboards, X11 and libinput can work, although evdev probably would be better as a nice catch all for Linux (and BSDs?). macOS lol find someone who cares enough for some OS specific macOS code, otherwise that would stay with SDL2 for gamepad support (and I'll write up the keyboard support here). On another note here, I don't like how the main form handle is passed on to input APIs, especially with our move to a new gui backend not making that a possibly not particularly possible idea (it is predicated on able to obtain that handle and being able to hook onto the window proc for reiniting gamepads for directinput), it would function the same if it created a hidden window internally (nb: also this would be needed for RAWINPUT use, as it responds to WM_INPUT messages), and that would be easy enough to message pump that new native window on some new thread... EDIT: RAWINPUT handler is done and used with the SDL2 backend (also DirectInput actually wraps around RAWINPUT internally anyways, lol) |
Possibly not the right thread for this: |
If it wasn't obvious, these prevent us from moving to .NET 6 (see #1415).
FlatBuffers.Core
Unknown (switched to NuGet, .NET Standard in 158c897Emulation.Cores
). IDK, natt hacked this in for Nyma. Presumably serialisation.GongShell
UI (removed in 98a8cdfEmuHawk
). Used inFile
>Recent ROM
><a file>
>Shell Context Menu
(right-click file to show submenu).NLua
Lua (switched to Standard-compatible engine in 45fbdb4Client.Common
,EmuHawk
). Needs to be loaded at runtime for either Lua engine to function. See #2260.OpenTK
v3.3.0
Host graphics (replaced in 78f5e75BizwareGL
,EmuHawk
), host input/sound (EmuHawk
). OpenTK 4 is now available, though not for Standard 2.0.OpenTK.GLControl
v3.1.0
Host graphics (replaced in 78f5e75EmuHawk
). IIRC natt said this isn't in OpenTK 4.SlimDX
Host graphics (replaced in 78f5e75EmuHawk
), host input/sound (EmuHawk
).System.Data.SQLite
DB manip (replaced in bb96825Client.Common
). Probably very easy to replace w/ NuGet package.System.Drawing.Common
EmuHawk
). (Partial) Linux implementation was deprecated, need to switch any drawn controls toMicrosoft.Maui.Graphics
.Point
et al. but notIcon
will remain available via a separate package.System.Windows.Forms
WinForms.Controls
,EmuHawk
). If we want to change UI framework after .NET 6, Linux will need to stay on .NET Framework and have separate "binaries" (it mostly does already).see also #2471 re: OpenTK 3.xThere are a couple of other libraries that I haven't mentioned:
In addition to the above,fixed for Linux in f6dde59,EmuHawk
's dependency onMicrosoft.VisualBasic
is only for the typeWindowsFormsApplicationBase
, inherited byEmuHawk.Program.SingleInstanceController
. There's no compatibility issues but it does add a runtime dep that's annoying to install on Linux.<PackageReference/>
removed in fa07dc8removed in 681b564System.Web
is only used in DiscoHawk, by static methodDiscoHawk.GetExeDirectoryAbsolute
We also have the option of replacingThe more I learn aboutNewtonsoft.Json
withSystem.Text.Json
at any time.Newtonsoft.Json
, the more I think we should replace it as soon as possible. See docs supplement. As of 2021-07,System.Text.Json
uses Source Generators instead of reflection.NativeLibrary
API, which we may be able to replaceDynamicLibraryImportResolver
with.[Nullable]
).The text was updated successfully, but these errors were encountered: