Emerald icon indicating copy to clipboard operation
Emerald copied to clipboard

🏗️ Multi-platform support

Open NoobNotFound opened this issue 1 year ago • 28 comments

add multi platform support (wip)

Summary by Sourcery

Add multi-platform support by introducing platform-specific configurations and assets, refactor JSON serialization to use System.Text.Json, and enhance the build and CI processes with new scripts and workflows. Implement a new CoreX module for handling Minecraft mods and profiles, and update issue templates for better bug reporting and feature requests.

New Features:

  • Introduce multi-platform support by adding new platform-specific configurations and assets for MacCatalyst and other platforms.
  • Add a new CoreX module to support different Minecraft installation profiles and mods.
  • Implement a new ModrinthStore class for handling mod, plugin, resource pack, shader, and modpack downloads from the Modrinth API.

Enhancements:

  • Refactor JSON serialization from Newtonsoft.Json to System.Text.Json across multiple files for improved performance and consistency.
  • Update issue templates for bug reports and feature requests to include more detailed fields and platform-specific options.
  • Add a new FileDownloader class to handle file downloads with integrity checks using SHA-1 and SHA-512 hashes.

Build:

  • Add a PowerShell script to automate the installation of the Windows SDK ISO for build environments.
  • Introduce a global.json file to manage SDK versions and dependencies.

CI:

  • Create a new GitHub Actions workflow for continuous integration, including steps for dependency installation and project build.
  • Add a custom action to install platform-specific dependencies using Uno.Check.

Documentation:

  • Add a ReadMe.md file in the Emerald directory to guide users on getting started with the Uno Platform.

NoobNotFound avatar Jul 08 '24 13:07 NoobNotFound

This is one of the reasons that UWP is better 😭 I remember multi-platform support was so easy...

Lamparter avatar Jul 11 '24 16:07 Lamparter

This is one of the reasons that UWP is better 😭 I remember multi-platform support was so easy...

yeah I agree to @0x5bfa this was UWP at the first (SD Launcher) but it was so difficult to even a run a single Minecraft version because accessing resources is limited. This originally created the option 'Run Minecraft As Admin' because it would solve it at some kind of security risk

NoobNotFound avatar Jul 13 '24 14:07 NoobNotFound

btw I planned to rewrite the Emerald.Core to Emerald.CoreX with a well (i'll try my best) organized code pattern so it would be easy to maintain. I was away from the dev for kind of a time so I don't even understand somethings I have written before lol.

And I'll mostly focused on bringing Emerald for MacOS but emerald for Linux will be also created since I hope to use single framework for all. Emerald for Windows works with no problem at all so I think it'll be a mess to replace Core with CoreX in Emerald.WinUI

BTW what do you guys think should I use for emerald cross platform? would it be

  • MAUI
  • MAUI Hybrid (Blazor based MAUI app)
  • Blazor with Something like PWA or electron to create a desktop like (idk even this is possible at all lol)
  • Uno Platform
  • Or something else (Because I think all of these are not just perfect as native WinUI and apple UI (idk whatever they call it)

@RiversideValley/emerald what do you think?

NoobNotFound avatar Jul 13 '24 14:07 NoobNotFound

@RiversideValley/emerald what do you think?

Okay..... So first things first. In terms of cross-platform, Uno seems like the best way to go as it is the most mature multi platform runtime engine. Blazor/Electron/ASP.NET apps are literally terrible and I wouldn't recommend them in a billion years as they are slow and buggy and the codebase is just messy - desktop apps shouldn't programmed in the same way as websites in my opinion. Plus, ASP.Net Core/Blazor/Electron apps are limited to most OS permission scopes as a website and may be able to open it but wouldn't function as a launcher in the same way that the Minecraft Launcher/Natsurainko.FluentLauncher/Lunar/Badlion/(whatever launchers are being used nowawadays) in terms of being actually able to manage the game on demand - you might as well be developing Emerald as a website that just launches Minecraft via protocols which betrays the true meaning behind what a Minecraft Launcher really is. Emerald for macOS, on the other hand, will be difficult. I'm not sure whether .NET desktop apps designed and managed by Uno are even supported on macOS. Then again, this leads me to question, why do we want Emerald to work as a cross-platform app? It's fine to make it universally available across different Windows versions (AMD64, Arm, Arm64, WinRT, etc.) but why do we really want it to function on different platforms? Minecraft on macOS is the only comparable version of the game to that of Windows and I am to suppose that we will have very little userbase who are interested in a Cupertino UI (what Apple's design system is called) Minecraft Launcher that lacks the features or core contributors of other major competitors or even the default Launcher itself? On top of that, Minecraft for Linux is incredibly underdeveloped and resembles Classic Minecraft in its entirety - not a proper game as Minecraft on Windows and macOS appears to be. Another thing - codebase unifier platforms like Uno and MAUI generally lean towards having a single codebase as that is literally the meaning of the word Uno - it makes no sense to have a separate project for each version as all the apps being able to be built from a singular codebase is the very nature of Uno and MAUI in the first place. All in all, this is merely speculative but it really does make me question what Emerald really is.

Lamparter avatar Jul 13 '24 19:07 Lamparter

Okay..... So first things first. In terms of cross-platform, Uno seems like the best way to go as it is the most mature multi platform runtime engine. Blazor/Electron/ASP.NET apps are literally terrible and I wouldn't recommend them in a billion years as they are slow and buggy and the codebase is just messy - desktop apps shouldn't programmed in the same way as websites in my opinion.

Yeah I do also prefer Uno over the others, Just listed down the possible ways of doing this. And also, I have never tried either Uno or Blazor with electron(ized) before. So I may need time to get these thing well.

Plus, ASP.Net Core/Blazor/Electron apps are limited to most OS permission scopes as a website and may be able to open it but wouldn't function as a launcher in the same way that the Minecraft Launcher/Natsurainko.FluentLauncher/Lunar/Badlion/(whatever launchers are being used nowawadays) in terms of being actually able to manage the game on demand - you might as well be developing Emerald as a website that just launches Minecraft via protocols which betrays the true meaning behind what a Minecraft Launcher really is.

Just to mention, ig some of the popular (legal or cracked) minecraft launchers like TLauncher, Lunarclient uses HTML UI with Java (I'm not sure since I haven't observed any Java based app before, but I think it works like that)

I don't like Electron\Blazor UI based apps because of the performance. The only thing I like about it is we can craft whatever unique UI we want with HTML and CSS (although I'm not a web designer lol)

Emerald for macOS, on the other hand, will be difficult. I'm not sure whether .NET desktop apps designed and managed by Uno are even supported on macOS.

There is some built with Uno for macOS, like Devtoys, Ryujinx (An amazing project I found when searching for emulators, not so sure whether it is poweren by Uno)

Then again, this leads me to question, why do we want Emerald to work as a cross-platform app? It's fine to make it universally available across different Windows versions (AMD64, Arm, Arm64, WinRT, etc.) but why do we really want it to function on different platforms?

well Minecraft JAVA Edition is cross-platform, so why not emerald? Actually I like to bring emerald for macOS since I have a mac tbh.

Minecraft on macOS is the only comparable version of the game to that of Windows and I am to suppose that we will have very little userbase who are interested in a Cupertino UI (what Apple's design system is called)

Yeah I agree, but I have experienced that annoying user experience when I try to install 3rd party MC launcher on my new mac. I had to manually install Java runtime, finding the correct runtime could be challenging not to me but to other normal non-dev peoples like my younger brother who only knows to open emerald and launch minecraft. Since CMLLib automatically installs required java rumtime which is very easy for normal users.

Minecraft Launcher that lacks the features or core contributors of other major competitors or even the default Launcher itself? On top of that, Minecraft for Linux is incredibly underdeveloped and resembles Classic Minecraft in its entirety - not a proper game as Minecraft on Windows and macOS appears to be.

I had only a linux based device before (Which actually came with windows but had to install a linux because it was too old for Windows). I played Minecraft on that device using Tlauncher, I was happy with it. (even though the performence was not so great) I think Emerald would easily work if it was cross platform thanks to the well-written CMLLib.

Another thing - codebase unifier platforms like Uno and MAUI generally lean towards having a single codebase as that is literally the meaning of the word Uno - it makes no sense to have a separate project for each version as all the apps being able to be built from a singular codebase is the very nature of Uno and MAUI in the first place. All in all, this is merely speculative but it really does make me question what Emerald really is.

yeah, so do I 😀. Emerald is just a UI for some "custom minecraft launcher" Libraires. made for easy of use, easily download mods using Modrinth API and install and run moded MC version just like TLauncher.

btw what would be the final decision? what about. MAUI? actually I really don't love any of these, I would rather build a native mac app if I knew SwiftUI

NoobNotFound avatar Jul 14 '24 09:07 NoobNotFound

wow Ive written a whole essay lol

NoobNotFound avatar Jul 14 '24 09:07 NoobNotFound

Ryujinx isn't powered by Uno afaik

I love ryujinx too 💀

Lamparter avatar Jul 14 '24 17:07 Lamparter

well Minecraft JAVA Edition is cross-platform, so why not emerald? Actually I like to bring emerald for macOS since I have a mac tbh.

Yeah me too but don't really use it much since I recently got like a £5000 PC

Lamparter avatar Jul 14 '24 17:07 Lamparter

btw what would be the final decision? what about. MAUI? actually I really don't love any of these, I would rather build a native mac app if I knew SwiftUI

I know a tiny bit of Swift because it was the second language I learnt after getting into programming but I haven't done any programming with it in over 3 years and I'm probably going to be terrible at it. Also, using an app like Xcode is very unintuitive. Objective-C is also just terrible and I personally think refactoring Emerald via MAUI or Uno is preferable

Lamparter avatar Jul 14 '24 17:07 Lamparter

Also, I just remembered, MAUI doesn't support Linux so it wouldn't work that way anyway

Lamparter avatar Jul 14 '24 17:07 Lamparter

Also, I just remembered, MAUI doesn't support Linux so it wouldn't work that way anyway

so, a one solution is gone lol

NoobNotFound avatar Jul 14 '24 19:07 NoobNotFound

Ryujinx isn't powered by Uno afaik

But this feels like WinUI in Uno

https://github.com/user-attachments/assets/b287a5c6-7094-41a8-9bed-543ff97afeda

(don't mind about that time btw)

NoobNotFound avatar Jul 14 '24 19:07 NoobNotFound

Yeah it's a shame since MAUI is very much supported by Microsoft and it would be very nice to get to use it while its new because I imagine that in the near future Microsoft will standardise it as the core universal multi-platform framework for .NET

Lamparter avatar Jul 14 '24 19:07 Lamparter

But this feels like WinUI in Uno

Yes it looks like it because they recently replaced the UI with a custom built fluentUI framework for .NET called Avalonia It's actually just a .NET desktop app.

Lamparter avatar Jul 14 '24 19:07 Lamparter

Yes it looks like it because they recently replaced the UI with a custom built fluentUI framework for .NET called Avalonia

ahh I know that, how about using it?

NoobNotFound avatar Jul 14 '24 19:07 NoobNotFound

Cross platform WPF

💀 never knew that

NoobNotFound avatar Jul 14 '24 19:07 NoobNotFound

ahh I know that, how about using it?

In Emerald? That would require rewriting the app from scratch.

Lamparter avatar Jul 14 '24 19:07 Lamparter

If you think about it Uno has loads of potential. For example, if you ported an app like FluentHub to Uno you would be able to have a FluentHub mobile, and even a web interface. It's very cool to think about.

Lamparter avatar Jul 14 '24 19:07 Lamparter

In Emerald? That would require rewriting the app from scratch.

It seems like that. if so, that would be challenging. I can be never done because we don't have that much time. So It should be Emerald.Uno

NoobNotFound avatar Jul 14 '24 19:07 NoobNotFound

What do you mean "we don't have much time"?

Lamparter avatar Jul 14 '24 20:07 Lamparter

What do you mean "we don't have much time"?

I mean I would try to do that if I had more time to spend on this

NoobNotFound avatar Jul 14 '24 20:07 NoobNotFound

Yes. It seems like Uno is the way to go for now though.

Lamparter avatar Jul 14 '24 20:07 Lamparter

I give up 😭😭😭 This is practically impossible...

Lamparter avatar Jul 18 '24 17:07 Lamparter

guys I've recreated the store! now it has mods, shaders, plugins, modpacks and resourcepacks support Screenshot 2024-08-08 at 12 50 11 PM

now it's kind of well organized lol

NoobNotFound avatar Aug 08 '24 07:08 NoobNotFound

I read online that apparently if you do this command: @sourcery-ai review

Lamparter avatar Sep 10 '24 16:09 Lamparter

It's meant to do some kind of AI-based PR review?

Lamparter avatar Sep 10 '24 16:09 Lamparter

Reviewer's Guide by Sourcery

This pull request adds multi-platform support to the Emerald application by migrating from WinUI-specific implementation to Uno Platform. The changes include refactoring JSON serialization to use System.Text.Json, introducing new platform-specific configurations and assets, and implementing a new CoreX module for handling Minecraft mods and profiles.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Migrate from Newtonsoft.Json to System.Text.Json for improved performance
  • Replace JsonConvert calls with JsonSerializer
  • Update serialization options to maintain formatting
  • Refactor JSON property attributes to use System.Text.Json namespace
Emerald.App/Emerald.App/Helpers/Settings/JSON.cs
Emerald.App/Emerald.App/Helpers/Settings/SettingsSystem.cs
Emerald.Core/Store/Labrinth.cs
Emerald.Core/News/NewsHelper.cs
Add new CoreX module for Minecraft mod management
  • Create ModrinthStore class for handling mod downloads and management
  • Implement interfaces for different mod loaders (Fabric, Forge, LiteLoader, Optifine)
  • Add file download functionality with integrity checks
Emerald.CoreX/Store/Modrinth/ModrinthStore.cs
Emerald.CoreX/Store/Modrinth/Stores.cs
Emerald.CoreX/Helpers/FileDownloader.cs
Emerald.CoreX/Installers/Fabric.cs
Emerald.CoreX/Installers/Forge.cs
Implement multi-platform UI support using Uno Platform
  • Add platform-specific configurations for Windows and MacCatalyst
  • Create shared assets and resources structure
  • Implement platform-specific window management
Emerald/Platforms/MacCatalyst/Info.plist
Emerald/Platforms/Desktop/Program.cs
Emerald/Helpers/WindowManager.cs
Emerald/App.xaml.cs
Update build and CI infrastructure
  • Add GitHub Actions workflow for CI
  • Create PowerShell script for Windows SDK installation
  • Add dependency management configurations
.github/workflows/ci.yml
.github/Install-WindowsSdkISO.ps1
global.json
.github/dependabot.yml
Enhance issue templates and documentation
  • Add detailed bug report template with platform-specific fields
  • Create feature request template with API design sections
  • Update project documentation with new folder structure
.github/ISSUE_TEMPLATE/bug_report.yml
.github/ISSUE_TEMPLATE/feature_request.yml
README.md

Possibly linked issues

  • #45: The PR refactors JSON serialization from Newtonsoft.Json to System.Text.Json, addressing the issue directly.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Sep 10 '24 16:09 sourcery-ai[bot]

Maybe you guys can use Directory.Build.props to remove duplicated properties among projects?

We should do this 👀 We already did Directory.Packages.props in #42

Lamparter avatar Sep 13 '24 16:09 Lamparter

@NoobNotFound let's merge, what do you think? I'll need to review this first but it'll be easier to just commit to main rather than an insanely large PR.

Lamparter avatar Nov 30 '24 15:11 Lamparter