FugiTech / deckmaster

A Twitch overlay for MTG Arena
MIT License
96 stars 18 forks source link

Getting deckmaster running under Wine? #28

Open JeffHoogland opened 6 years ago

JeffHoogland commented 6 years ago

Hey There -

This may or may not be something that can be done, but I was wondering if you could give me some insight as to the Windows dependencies of the addon that I might be able to install to get the app to run properly under Wine on Ubuntu. Been running / streaming MTGA from Linux without issue, but would like to get this addon working under it as well if possible.

It seems to load up fine, but the UI doesn't populate: image

If have ideas that would be great, either way, thanks for reading!

bobziuchkovski commented 5 years ago

Hey @JeffHoogland I'm a viewer/subscriber on your stream (RootSamurai), and also a developer. I took a look into this and it looks like the main problem is that Chrome/Chromium-based things currently don't run well on Wine. If you take a look at https://appdb.winehq.org/objectManager.php?sClass=category&iId=33&sAction=view&sTitle=Browse+Applications, Chrome along with everything Chromium-based are all listed as Garbage or Bronze status. All the entries I looked at indicated pages don't render. This project is using electron, which is effectively an embedded Chromium browser with nodejs, so I think you're running into the same Chromium support issues with Wine.

That said, I think there might be a way to get you up and running with your Linux rig. It seems Deckmaster at it's core just tails/follows the Arena log files. It might be possible to run the electron-based UI directly on Linux and point it at the Arena log files in your wine prefix (~/.wine/drive_c/<path to arena logs>). Then the electron process would be running directly on Linux, which handles Chrome/Chromium just fine.

Thoughts, @Fugiman ?

JeffHoogland commented 5 years ago

Yeah - in theory the code here should build + run cross platform from my understanding of what Electron is doing. I just don't have the experience to get it to build correctly on Ubuntu 18.04. Simply following the build directions after installing the dependencies hit some errors for me after I pointed it to the correct location of my output log file.

If my time permits I might also take a look at seeing how it sends information to Twitch. Odds are I could probably write a similar tool in Python that scraps the log and sends up the information it needs to populate the UI.

bobziuchkovski commented 5 years ago

@JeffHoogland I've forked and pushed a build-on-linux branch here. You should only need nodejs and yarn installed on your Linux box in order to build. I built with node version 10.12.0 and yarn version 1.10.1, but other versions should be fine, too.

Just run the updated build.sh script, set the ARENA_LOG_PATH environment variable to point to the output_log.txt from your wine install, and run the deckmaster binary from the dist directory.

Feel free to review the commits. I had to disable the Sentry release plugin, drop a bogus reference to a static directory, and drop the auto-updater check since this repo has no linux builds pushed. Nothing too crazy, but those were some small adaptations required to get it to run without throwing exceptions.

CC @Fugiman on the Sentry release plugin and static directory reference -- having the webpacker config wired to notify Sentry means other contributors can't build without having Sentry configured locally...might make sense to use their CLI command instead and wire that up to a release script or something instead. And the static directory reference seems like some outdated/unused reference for production builds?

JeffHoogland commented 5 years ago

Builds, launches, and detects as expected!

https://cdn.discordapp.com/attachments/200494040502894595/504762734898970644/unknown.png

I'll try it on a live stream tomorrow afternoon to confirm it sends the info to Twitch correctly.

Will the path to my output file be baked into this app image directly, or will I need to make sure to set it in my terminal before running the app image?

bobziuchkovski commented 5 years ago

@JeffHoogland Glad it works! You'll need to set the ARENA_LOG_PATH in your terminal before launching each time (or create a wrapper script/shortcut or similar that sets it before launching). I could make it configurable via the UI and persist the path, but I figured it would make sense to get something working first and see if @Fugiman chimes in with any thoughts on how best to handle going forward. Ideally we could agree on some changes that don't affect the windows builds but make it flexible enough to use like you're using, too.

JeffHoogland commented 5 years ago

Makes sense - I'll confirm it sends to twitch tomorrow.

Other apps that work off the log file auto detect it (which works for most installs) and then also leave the option to manually point to it in a settings panel. Something like that might work well here as well so it leaves people who have stock setups alone, but lets others like mine work as expected.

bobziuchkovski commented 5 years ago

Yep, that's probably the best way forward

JeffHoogland commented 5 years ago

Just wanted to confirm that this works as expected running from Linux.

bobziuchkovski commented 5 years ago

Awesome!

@Fugiman I realize you probably aren't planning to release linux builds, but are you open to accepting some PRs that would at least make it easier for @JeffHoogland and others to build and run on Linux/Mac themselves, assuming the changes don't impact the existing Windows support?

I think the main things would be:

I'd be happy to make these changes and submit as PRs, but want to check if you'd accept them before I invest the time.

JeffHoogland commented 5 years ago

@Fugiman it would be really nice if you could take the time to look over this fork and merge the few changes it needs to build on Linux into your main branch here. @bobziuchkovski even offered to help a bit.

I think I've updated it successfully for RNA cards, but I'll have to wait till Thursday to find out.

If time / money is an issue I'm willing to pay you to take the time to do this as I am likely one of the few that would end up using it.

Thanks!

mianosm commented 5 years ago

@Fugiman - also adding support for any/all PRs to include MTGA streamers via Wine installation.