Norbyte / lslib

Tools for manipulating Divinity Original Sin and Baldur's Gate 3 files
MIT License
760 stars 141 forks source link

Move to .NET Core #137

Open erri120 opened 1 year ago

erri120 commented 1 year ago

As great as these libraries are, they're currently being held down by the .NET Framework. Only recently did the project upgrade to .NET Framework 4.7.2, but with the rise of Baldur's Gate 3, more and more developers will want to use this project and don't want to depend on obsolete technology.

Any project that wants to use these libraries would be forced to also use the .NET Framework, instead of .NET 6/7, and would be unable to create cross-platforms tools. They would be unable to profit from the multitude of enhancements that the newer .NET version bring over the .NET Framework, such as better performance, new language features (polyfill is a thing, but that only goes so far) and being able to target Windows and Linux (Steam Deck and Linux Desktop).

I understand that porting a large and old code base is not something that can be done on a whim, so let me know if you have any questions. Microsoft also has a porting guide and various tools exists to help in this endeavor.

LennardF1989 commented 1 year ago

While I agree with this, do keep in mind that ConverterApp uses Winforms and is also the tool that most people would use. That is not easily converted to something crossplatform as Winforms is no more, WPF is Windows-only. So the next step would either be web-based UI (and/or Blazor) or MAUI.

erri120 commented 1 year ago

While I agree with this, do keep in mind that ConverterApp uses Winforms and is also the tool that most people would use. That is not easily converted to something crossplatform as Winforms is no more, WPF is Windows-only. So the next step would either be web-based UI (and/or Blazor) or MAUI.

You can still move to .NET 6/7. WinForms and WPF are not really recommended for new projects, but it's still supported. There is also Avalonia, which is cross-platform.

The important aspect is getting the libs over to the new .NET.

LennardF1989 commented 1 year ago

See up.

CryoMyst commented 1 year ago

Same, I am looking to use the Granny2 part specifically for an external project so I would love to see it in either standard or core. Would cross platform (Without wine) even work because of the Granny2 wrapper bindings?

MAUI doesn't support Linux (Boo) so Avalonia is probably best for desktop UI.

Norbyte commented 1 year ago

Granny support needs to be able to load granny2.dll, which is a windows x64 native binary, so a .NET Core version likely wouldn't support GR2 conversion, or only in very limited circumstances since binding platform specific binaries there is finicky.

CryoMyst commented 1 year ago

PInvokes (Or better yet, LibraryImport) would work for granny2 under windows/wine, so maybe targeting net6.0-windows is probably the best way to go initially for that specific library. Could we move some of the bindings to use https://github.com/arves100/opengr2 instead?

Norbyte commented 1 year ago

Yea, .NET 6 would probably be the most likely target.

Granny2.dll is needed for the proprietary BitKnit1/2 decompressor/compressor functions, which are not implemented by OpenGR2 (i.e. it cannot read BG3 GR2 files at all).