BattletechModders / BattleTechModLoader

A simple mod loader and injector for HBS's PC game BattleTech.
The Unlicense
48 stars 10 forks source link

OSX: BattleTechModLoaderInjector.exe won't work w/System.Core.dll present #9

Closed ffaristocrat closed 5 years ago

ffaristocrat commented 6 years ago

OSX High Sierra 10.13.4 Mono JIT compiler version 5.10.1.47

Running mono BattleTechModLoaderInjector.exe leads to the following error.

BattleTechModLoader Injector
----------------------------
An exception occured: System.MissingMethodException: !!0 System.Linq.Enumerable.First<!0>(System.Collections.Generic.IEnumerable`1<!!0>,System.Func`2<!!0, bool>)
  at BattleTechModLoader.BTMLInjector.Main (System.String[] args) [0x00067] in <dee73dca3dba496696680c1c266c6c33>:0

Temporarily removing System.Core.dll from the directory results in the script properly executing.

ffaristocrat commented 6 years ago

I believe the issue is that the injector is being built on v4.5.2 rather than v3.5.

Compiling to that framework fixed the issue for me.

mpstark commented 6 years ago

There are two ways that we can approach this. We can attempt to drop injector down to v3.5 -- I had issues when I had it set here though.

We could also just include the system library in the binary instead of using what's there.

ffaristocrat commented 6 years ago

So the fun thing is that I have the injector targeted at 3.5 but I left the packages targeted to net452. It compiled (with 3 warnings) and the injector appears to work correctly.

OTOH, I do get this warning when I run the injector so maybe this is why it works correctly for me.

WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
ffaristocrat commented 6 years ago

In any case, you know C# way better than me so I'll defer to your judgment on the best way to handle it.

mpstark commented 6 years ago

@Tyler-IN Input?

eric82501 commented 6 years ago

Sorry if this is the wrong place to start, but I am new to modding on my MAC. I opened the contents of the battletech app and found the managed folder with the c# dll. I tried running the exe with wine because that was the first solution I found but I don’t think it did anything. What would the backup of the c# dll be called?

If this should be its own help request let me know and I will delete it. Complete noob so patience is appreciated

mpstark commented 6 years ago

@eric82501 Right now Mac support is very limited, take a look here for more information: https://github.com/saltyhotdog/BattletechIssueTracker/issues/2

ffaristocrat commented 6 years ago

@eric82501 Here are the steps to do the injector on OSX currently. You'll run the injector with mono on OSX.

Here are the steps to get it working. I've tested it with the current release of BattleTech on OSX (1.0.4-280D) and the current release of BTML (0.2.1).

  1. Install homebrew if you don't have it already
  2. Copy the injector & the DLLs to BattleTech.app/Contents/Resources/Data/Managed
  3. Open up Terminal
  4. brew install mono
  5. cd "Library/Application Support/Steam/SteamApps/common/BATTLETECH/BattleTech.app/Contents/Resources/Data/Managed"
  6. mv System.Core.dll System.Core.dll.temp
  7. mono BattleTechModLoaderInjector.exe
  8. mv System.Core.dll.temp System.Core.dll
  9. cd ../..
  10. mkdir Mods

Then put ModTek and anything else you're using for modding there.

App bundles are pain to navigate to so I highly suggest making the Contents folder a favorite so you can just jump to it.

eric82501 commented 6 years ago

@ffaristocrat I followed these steps and when I open the game it gets to the point of the opening cinimatic and all I get is a black screen with what I believe is a frame count in the upper right corner of the screen. The only file I put in the mods folder was the ModTek dll. Thanks for the step by step command lines too.

YoungCP commented 6 years ago

I'll take a look at it, don't currently have a Mac to test it with...

eric82501 commented 6 years ago

Found the problem. alpha 0.1.5 was the issue. Working fine with 0.1.4

mpstark commented 6 years ago

@eric82501 I'm guessing you mean ModTek version. Is the log saying anything about how it's breaking?

eric82501 commented 6 years ago

Yes, modtek 0.1.5 was the issue. I might have deleted the log, if not I will let you know. Like I said, very new to this. I didn’t think to look at the log. Do you want me to recreate the issue and get the log if I did delete it?

Squidcv41 commented 6 years ago

Guys, I'm glad I found this thread, because I have been trying for about 6 hours to get the BTML mod and ModTek to work on my Mac, I just simply cannot follow the steps in some of the other people's directions, they either jump from step to step or do not explain it enough for me to follow. I do not code, and getting this to work has given me a headache no amount of rum can fix. lol any step by step directions out there??

mclang commented 6 years ago

BTW @ffaristocrat how did you find out that System.Core.dll is the problem?

ffaristocrat commented 6 years ago

Lots & lots of trial and error