blake502 / balatro-mobile-maker

Create a mobile Balatro app from your Steam version of Balatro
270 stars 21 forks source link

Stepping stones for cross-platform building #26

Closed valknight closed 1 month ago

valknight commented 1 month ago

This PR migrates to the .NET Core profile, as well as refactors significant amounts of the project to be more in line with modern C# standards & naming conventions.

Part of this refactor is also breaking out Constants into a seperate Constants.cs file. This is intended such that logic can be kept mostly similar, and, we can conditional compile the correct constant per platform.

Discussed in #25

blake502 commented 1 month ago

Looks like you know what you're doing haha. Considered it merged, but I wanna do a deep dive before I hit the big green button-- just to make sure I can still navigate the project and pump out quick-fix builds as necessary.

Thanks for kick-starting cross-platform!

valknight commented 1 month ago

Looks like you know what you're doing haha.

it's the magic of a good IDE ✨ i'd collapse into dust if it wasn't for ReSharper + Rider

blake502 commented 1 month ago

I'm still navigating the best way to publish this as a single file. I got a single-file build that ended up being 65Mb-- not ideal. And I'd strongly prefer not to bundle the app in a ZIP with the DLL if I can avoid it. I'm an old-school .NET Framework developer, all this new-fangled .NET Core stuff is outside of my wheelhouse haha. I'll do some more research. I'm sure I'm doing something wrong.

valknight commented 1 month ago

I've quickly made a patch to enable trimming on builds; on my machine (macOS-ARM64), a release build comes out to around 15.4mb after running the dotnet publish command.

My understanding is this is an idealogical move by Microsoft, as the single file build contains the entirety of the .NET Runtime required to run the program.

This is such that the .NET Core Runtime doesn't need to be installed on end-user machines; the space increase of bundling .NET is "worth it" to Microsoft, as it comes with the benefit that users don't need to be installing new versions of .NET Core system wide - meaning the time to install an application is actually reduced.

blake502 commented 1 month ago

I may attempt to setup a kinda "hybrid" build system, such that the Windows build can remain in the ~40kb range with Framework, and the other platforms can benefit from Core. I've got some experience with things like that.

I certainly appreciate you kick-starting cross-platform, but I'm going to wait on merging this until either:

blake502 commented 1 month ago

Okay I think we get to have our cake and eat it too. I got a build script written up that should do the trick. image

blake502 commented 1 month ago

With this worked out, I'd be happy to accept your changes as stepping stones towards proper cross-platform compatibility... That said, with the project being renamed (and me merging my own .NET Core migration), I'm afraid this PR may be a bit dead. Sorry for stepping on your toes with this one!

I'd implement your changes manually, but I'd hate to steal the spotlight on your contributions. Do you use Discord? We may be able to collaborate more efficiently if we have a little communication there haha.

blake502 commented 1 month ago

Okay I resolved all the merge conflicts I created haha. With all that sorted, we should be in a good position to move forward with proper cross-platform support!

Thanks again!