I found a way to make working windows mods, which crashes on mac and linux. Even worse it's fairly easy to do so and you have no indication of it when testing on windows. I had no idea about this until lots of people reported my mod to be crashing.
It's a problem with the execution of IBuildingConfig. Take for instance EthanolDistilleryConfig. It has DoPostConfigurePreview, DoPostConfigureUnderConstruction and DoPostConfigureComplete. Adding a Postfix to all 3 works on windows, but the first two will cause a NULL exception on mac and linux, apparently because the methods are empty. My guess is that there is some sort of optimization going on, which prevents replacing an empty virtual method with another virtual method.
There is a related issue, which also affects windows. If one of the virtual methods isn't mentioned by the building and you patch it, the building will work because you end up patching IBuildingConfig. The problem here is that your newly created building will work, but your change will also apply to all other buildings not mentioning the method in question.
Solution:
I think both problems can be solved by not using virtual methods. Make them abstract instead and fill out buildings with empty methods as needed. That will force the compiler to make code for each method in each class even if those methods doesn't contain any code. At least I hope so. I have no way of testing this.
I hope to see a fix for this soon. Right now Piped Output is broken on mac and linux.
Mod certain IBuildingConfig methods. Verify the mod to work on windows, release and watch reports of crashes on mac and linux.
- 3
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now