Mac Support

0

Copied from : https://forums.faforever.com/viewtopic.php?f=2&t=16947#p169818

I got SupCom and FAF running on a mac and figured I should post about what I had to do, so anyone else who tries this has ideas.
I basically started by following this guide: https://wiki.faforever.com/index.php?ti ... hon_client
except I changed things whenever I had to.
I installed Steam with PlayOnMac, which is basically just a wrapper around Wine. Once I had Steam I installed FA in there. At first Steam wouldn't download anything, I had to change it to use different download servers for some reason, using some weird advice I saw on Reddit or something. I don't remember exactly what I had to do here but it was annoying.
I used the original FAF client because I know more about Python than Java, sorry Downlord.
I had to do dumb stuff to get faf-uid working because there isn't a compiled Mac (BSD) client. Specifically, I downloaded the linux faf-uid, then I installed this program called "noah" with homebrew. It is basically Wine for Linux -> BSD. Then I renamed faf-uid to real-faf-uid, and in the place of faf-uid put this script:

#!/bin/bash
noah $(dirname "$0")/real-faf-uid "$@"

I don't know if this actually works well or not, so don't blame me if you get autobanned 😎
For the FA directory, I used the directory from the WIne client. PlayOnMac installs everything in "$HOME/Library/PlayOnMac/wineprefix/Steam/drive_c" so look there.
Finally it was really hard to debug why launching FA was working or not working. As such I just gave up and used this as the "exe" in the [wine] section of FA Lobby.ini:

[wine]
exe=/Users/nrook/code/faf-client/dumb_wine_shim

Of course dumb_wine_shim is something I wrote myself. It is another dumb script, here is its contents:

export WINEPREFIX=/Users/nrook/Library/PlayOnMac/wineprefix/steam
/Users/nrook/Library/PlayOnMac/wine/darwin-x86/3.17/bin/wine "$@" >/Users/nrook/FAForever/logs/winestdout 2>/Users/nrook/FAForever/logs/winestderr

Since it pipes the output of wine, it is way easier trying to figure out why FA decided not to boot than going through forever.log or gamesession.log.
So that is how I got FAF running. Hopefully this is slightly helpful to anyone trying this. It is not supported and will probably break randomly but oh well. I haven't actually played a multi game with it because my network is currently bad, but vs AI worked, and connecting in lobby worked, so it will probably work.

So yeah As you can see in the old thread I'd gotten an auto-install script working that was gonna work for every single existing operating system, even windows (this script doesn't work anymore because I haven't updated since it's really lost it's point: most of the things that were needed are no longer needed, it much easier today).

That guy's guide will serve you much better.

I may not be able to answer your mac questions but if it pertains to proton and steam ect I'm pretty sure I'll be able to help out.

Also I personally know jack shit about the python client, I use the downlord Java one (that's the one that's supported and who's support isn't going away anytime soon) I'm pretty sure you can get that one running natively too. I'll ask around to see if they can get a Mac native build going.

That being said. All of this was from the post-"Big Sur" era. Building either FAF clients for Mac's new architecture is probably a tall ask, let alone emulating Forged Alliance.

I dunno how that will pan out, this post is mainly intended for pre-"Big Sur" macs.

A general-use piece of wisdom for your life: don't buy apple.

TLDR : I don't own a mac, I'm no mac expert, this method worked before on a non big-sur mac it should still work on a non big-sur mac today for you. I'll start digging for more info and support.

Git issue is here : https://github.com/FAForever/downlords-faf-client/issues/1854
You want mac support with a full mac build? be the hero you want to see in the world and offer your testing help in that github issue!

0

I have a mac mini around. But why would you want the ancient python version instead of the java version. The mac version when attempting to compile only shows some errors and warnings https://i.postimg.cc/28DxJjpm/MAC-compiler-output.png
(Same Code, Tools and Versions)

0

I agree, you should probably build the java one instead. I didn't write this guide if you read well. I'm looking for an upgrade to this whole guide, would you help me out?

0

Yes sure. I may not be much help with nasty mac problems but rewriting the compile guide would be nice.

0

Ok, so can you try building and running the Java client on mac? (make sure you have java 14 installed first and you'll need to expose the INSTALL4J_JAVA_HOME variable as a variable that points towards the java bin folder, something like this :

 export INSTALL4J_JAVA_HOME=/usr/lib/jvm/jdk-14.0.2/

somewhere mac picks up)

an then see if it runs.

0

@tatsu
I'm excited that there has been some traction on an FAF for Mac Discussion. I hadn't played Supreme Commander FA for about 8 years (never played the original, but hopped in for FA and it was amazing) and was so excited to find a community still around it. I'm using PaulTheTalls Porting Kit on my 2017 MacBook Pro and have been running the campaign and normal online with no issues. I really want to get online and involved with FAF

I have downloaded the Java Client. I made sure I had Java 14 installed. Then I ran the command you listed above. I then followed the rest of the instructions (here: https://wiki.faforever.com/index.php?title=Setting_Up_FAF_Linux) but making slight adjustments based on my file names.

When I ran my faf-client executable I saw the following:
java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:832)

After this, I started digging into the /usr/lib directory, and I couldn't find any folder named jvm. This leads me to believe that Java 14 wasn't installed correctly. I tried it again and still was not here. Not sure if this would mean I don't even have java downloaded. Feeling pretty stupid rn. Any thoughts?

0

I didn't check what tatsu is doing in particular.

JavaFX has dedicated jars for Windows, Linux and Mac. Whether you took the Windows or the Linux release we provide, you are missing the JavaFX dependencies for Mac. The stacktrace indicates this as well. You would need a dedicated build for Mac. Not sure how tatsu worked around this.

0

If you want mac support you should start the client from Intelij and make it has no issues if that works we can provide a built for mac

0

There is a video in the Read me that shows how to use the client via Intelij

0

@Brutus5000
Not sure if you had read, but he was referencing this original post on it: https://forums.faforever.com/viewtopic.php?f=2&t=16947#p169818 . Don't want to take up too much of your time but if you look at those instructions, do you think this would still work?

@axel12 are you saying just test to see if I can run the client from Intelij? I will start attempting this now and update you on my progress

0

Well I can built you can installer for mac but Ithink the client has bugs that make it unusable on mac. Those need to be resolved by someone on mac. Therefore you need to start it from Intelij and solve those. They are gonna be minor bugs. E.g. we have code that makes the icon blink but this code might not work on mac therefore would need to be wrapped in an

if(! isMac()){
    ...
}

Just as an example but we will only know what is bugged out on mac if somebody tries...

0

@axel12
Followed the Video in the readme to set up Intelij, and tried to run faf-client. Here is a majority of my output:

1:29:33 PM: Executing task 'Main.main() --stacktrace'...

Configure project :
Platform is: mac

Task :downloadIceAdapter UP-TO-DATE
Unable to get progress logger. Download progress will not be displayed.

Task :downloadUnixUid
Unable to get progress logger. Download progress will not be displayed.

Task :downloadWindowsUid UP-TO-DATE

Task :downloadNativeDependencies
Unable to get progress logger. Download progress will not be displayed.
Task :processResources UP-TO-DATE
Task :webview-patch:compileJava UP-TO-DATE
Task :webview-patch:processResources NO-SOURCE
Task :webview-patch:classes UP-TO-DATE
Task :webview-patch:jar UP-TO-DATE
Task :webview-patch:assemble UP-TO-DATE
Task :webview-patch:compileTestJava NO-SOURCE
Task :webview-patch:processTestResources NO-SOURCE
Task :webview-patch:testClasses UP-TO-DATE
Task :webview-patch:test NO-SOURCE
Task :webview-patch:check UP-TO-DATE
Task :webview-patch:build UP-TO-DATE
Task :compileJava UP-TO-DATE
Task :classes UP-TO-DATE

Task :Main.main()
13:29:35.280 [main] DEBUG com.faforever.client.preferences.PreferencesService - Logger initialized
2020-10-01 13:29:36.552 INFO 34270 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Starting application on Nicholass-MBP.columbus.rr.com with PID 34270 (started by namore in /Users/namore/IdeaProjects/downlords-faf-client)
2020-10-01 13:29:36.554 INFO 34270 --- [JavaFX-Launcher] o.s.boot.SpringApplication : The following profiles are active: mac,prod
Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
2020-10-01 13:29:37.692 INFO 34270 --- [JavaFX-Launcher] trationDelegate$BeanPostProcessorChecker : Bean 'asyncConfig' of type [com.faforever.client.config.AsyncConfig$$EnhancerBySpringCGLIB$$6f7770ec] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-10-01 13:29:37.733 INFO 34270 --- [JavaFX-Launcher] trationDelegate$BeanPostProcessorChecker : Bean 'cacheConfig' of type [com.faforever.client.config.CacheConfig$$EnhancerBySpringCGLIB$$d0b62432] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.gson.internal.reflect.UnsafeReflectionAccessor (file:/Users/namore/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.5/f645ed69d595b24d4cf8b3fbb64cc505bede8829/gson-2.8.5.jar) to field java.net.HttpCookie.name
WARNING: Please consider reporting this to the maintainers of com.google.gson.internal.reflect.UnsafeReflectionAccessor
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2020-10-01 13:29:38.244 INFO 34270 --- [JavaFX-Launcher] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler'
Error in LSRegisterURL: -10811
2020-10-01 13:29:38.677 INFO 34270 --- [JavaFX-Launcher] c.f.c.map.generator.MapGeneratorService : Deleting leftover generated maps...
2020-10-01 13:29:38.682 WARN 34270 --- [JavaFX-Launcher] com.faforever.client.map.MapService : Could not load maps: installation path is not set
2020-10-01 13:29:38.707 INFO 34270 --- [JavaFX-Launcher] com.faforever.client.update.Version : The current application version is: snapshot
2020-10-01 13:29:38.710 INFO 34270 --- [JavaFX-Launcher] c.f.c.update.ClientUpdateServiceImpl : Current version: snapshot
2020-10-01 13:29:38.725 INFO 34270 --- [pool-3-thread-2] c.f.client.update.CheckForUpdateTask : Checking for client update
2020-10-01 13:29:38.789 WARN 34270 --- [JavaFX-Launcher] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileOpeningHandler' defined in file [/Users/namore/IdeaProjects/downlords-faf-client/build/classes/java/main/com/faforever/client/os/FileOpeningHandler.class]: Invocation of init method failed; nested exception is java.awt.HeadlessException
2020-10-01 13:29:38.790 WARN 34270 --- [JavaFX-Launcher] c.f.client.fa.relay.ice.IceAdapterImpl : Ignoring call to ICE adapter as we are not connected: quit([])
2020-10-01 13:29:38.794 INFO 34270 --- [JavaFX-Launcher] com.faforever.client.config.AsyncConfig : Shutting down ExecutorService 'taskExecutor'
2020-10-01 13:29:38.794 INFO 34270 --- [JavaFX-Launcher] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler'
2020-10-01 13:29:38.800 INFO 34270 --- [JavaFX-Launcher] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-10-01 13:29:38.811 ERROR 34270 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileOpeningHandler' defined in file [/Users/namore/IdeaProjects/downlords-faf-client/build/classes/java/main/com/faforever/client/os/FileOpeningHandler.class]: Invocation of init method failed; nested exception is java.awt.HeadlessException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:893)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)
at com.faforever.client.FafClientApplication.init(FafClientApplication.java:97)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:824)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.awt.HeadlessException: null
at java.desktop/java.awt.Desktop.getDesktop(Desktop.java:301)
at com.install4j.runtime.installer.helper.versionspecific.Java9Helper.setMacStartupListener(Java9Helper.java:30)
at com.install4j.runtime.installer.helper.versionspecific.VersionSpecificHelper.setMacStartupListener(VersionSpecificHelper.java:56)
at com.install4j.api.launcher.StartupNotification.registerStartupListener(StartupNotification.java:41)
at com.faforever.client.os.FileOpeningHandler.afterPropertiesSet(FileOpeningHandler.java:31)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
... 18 common frames omitted

Exception in Application init method
Exception in thread "main" java.lang.RuntimeException: Exception in Application init method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:895)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileOpeningHandler' defined in file [/Users/namore/IdeaProjects/downlords-faf-client/build/classes/java/main/com/faforever/client/os/FileOpeningHandler.class]: Invocation of init method failed; nested exception is java.awt.HeadlessException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:893)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)
at com.faforever.client.FafClientApplication.init(FafClientApplication.java:97)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:824)
... 2 more
Caused by: java.awt.HeadlessException
at java.desktop/java.awt.Desktop.getDesktop(Desktop.java:301)
at com.install4j.runtime.installer.helper.versionspecific.Java9Helper.setMacStartupListener(Java9Helper.java:30)
at com.install4j.runtime.installer.helper.versionspecific.VersionSpecificHelper.setMacStartupListener(VersionSpecificHelper.java:56)
at com.install4j.api.launcher.StartupNotification.registerStartupListener(StartupNotification.java:41)
at com.faforever.client.os.FileOpeningHandler.afterPropertiesSet(FileOpeningHandler.java:31)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
... 18 more

0

Gotta google what that means ...

0

@axel12
My misunderstanding then. I'm not sure I would have the capability to fix every bug to allow it to be run on a mac, given I have extremely limited developing experience.

Because you have a better understanding of the code, would you expect these to truly be easy fixes? - for example, adding those if blocks. If it's not stuff like that, I don't think I am the person to lead the rebuild.

0

We can try it. Me making changes and you copying the Exceptions 😄 and then use my code to fix them as long as they are easy fixes that is gonna work

1

https://drive.google.com/file/d/1JiMZDQNEEsQoK-n23QsyNb0X4v41n4l4/view?usp=sharing

Checkout the feature/mac-support branch and try again I should have fixed the Exception above but there are sure gonna be more.

0

java version 14 on mac too I imagine?
your video doesn't play for me.

https://github.com/FAForever/downlords-faf-client/issues/1972

Log in to reply