Code Monkey home page Code Monkey logo

Comments (11)

phonique avatar phonique commented on May 24, 2024 7

Hey, @Fusion86. Spent the evening yesterday myself getting BepInEx to work.
Here's the rundown.

  • Moved Valheim.app from build/ to it's own directory in /Applications/Games/Valheim/GAME
  • Downloaded BepInEx (BepInEx_unix_5.4.21.0.zip)
  • Unpacked it into GAME dir (i.e. the dir-structure is now: Valheim.app, BepInEx, doorstop_libs, run_bepinex.sh and changelog.txt)
  • Open a terminal in the GAME dir and make the .sh user-executable by typing chmod u+x run_bepinex.sh
  • [hours of trying to get it to work skipped for you]
  • Download the denikson BepInEx distribution for Valheim at thunderstore.io
  • unpack somewhere else and copy winhttp.dll, doostop_config.ini and (probably, most importantly) unstripped_corlib to the GAME dir. Also copy BepInEx/config (and why not BepInEx/plugins/Valheim.DisplayBepInExInfo.dll, while you're at it) to GAME/BepInEx/
    First part is done.

Now edit run_bepinex.sh in the GAME dir as follows:

  • after the # ---- EDIT AS NEEDED ------ line - add export SteamAppId=892970 as per @timkurvers comment above (thanks!)
  • change executable_name to executable_name="Valheim.app"
  • find the DOORSTOP_CORLIB_OVERRIDE_PATH and change it to "$BASEDIR/unstripped_corlib"
    (or copy the relevant part for it from here:)
# -------- SETTINGS --------
# ---- EDIT AS NEEDED ------

export SteamAppId=892970

# EDIT THIS: The name of the executable to run
# LINUX: This is the name of the Unity game executable 
# MACOS: This is the name of the game app folder, including the .app suffix
executable_name="Valheim.app"

# The rest is automatically handled by BepInEx

# Whether or not to enable Doorstop. Valid values: TRUE or FALSE
export DOORSTOP_ENABLE=TRUE

# What .NET assembly to execute. Valid value is a path to a .NET DLL that mono can execute.
export DOORSTOP_INVOKE_DLL_PATH="$BASEDIR/BepInEx/core/BepInEx.Preloader.dll"

# If specified, Doorstop will load core libraries from this folder instead of the normal Managed folder
# Mainly usable to unstrip assemblies in some games
export DOORSTOP_CORLIB_OVERRIDE_PATH="$BASEDIR/unstripped_corlib"

# ----- DO NOT EDIT FROM THIS LINE FORWARD  ------

To launch directly from steam:

  • Open steam and add a non-steam game.
  • Now, find Valheim.app (in my case it's inside: /Applications/Games/Valheim/GAME)
  • After you add the game, select the newly added Valheim in your steam library (it shouldn't have an icon), click the little cogwheel-settings button and select Properties....
  • There, edit Launch Options as follows:
    "/Applications/Games/Valheim/GAME/run_bepinex.sh" %command% --args -console"
    (You can skip the --args -console if you don't need the in-game console for some reason).

That's it.

You should now be able to start from steam and it should work.
In case it doesn't - try to launch from the terminal and post the output here: (i.e. open the terminal, go to the GAME dir and type in ./run_bepinex.sh).

PS: Oh, and @timkurvers: Thanks so much for making this happen! We'll enjoy the ride, while it lasts : )

from valheim-macos.

timkurvers avatar timkurvers commented on May 24, 2024 2

Incredible write-up @phonique! Thanks for sharing 🥳

from valheim-macos.

seathasky avatar seathasky commented on May 24, 2024 2

Great write up @phonique
Just chiming in about some recent changes:

image

Basically unstripped_corlibs is no longer needed. Tested this last night, and bepinex works.

For reference, this is what my shell file now looks like:

Screenshot_2023-11-08_at_1 37 48_PM

Have fun!

from valheim-macos.

fellnerse avatar fellnerse commented on May 24, 2024 1

Thanks @phonique for that detailed description! with that held I was able to make it even easier to work (in my case I wanted to use ValheimPlus, which already includes BepEx):

Just head to their release page and get the latest UnixClient.zip (for me it was 0.9.9.16) and put the content next to the Valheim.app folder.
The only thing you have to adapt now is the same as @phonique described:

edit the start_game_bepinex.sh:

...

# -------- SETTINGS --------
# ---- EDIT AS NEEDED ------
export SteamAppId=892970
# EDIT THIS: The name of the executable to run
# LINUX: This is the name of the Unity game executable 
# MACOS: This is the name of the game app folder, including the .app suffix
executable_name="Valheim.app"

...

export DOORSTOP_CORLIB_OVERRIDE_PATH="$BASEDIR/unstripped_corlib"

...

If you do not want ValheimPlus you can just delete the dll in the `BepInEx/plugins` folder

from valheim-macos.

timkurvers avatar timkurvers commented on May 24, 2024 1

@seathasky Judging from Mono's FileSystemWatcher code, it should be possible to swap to a different watcher (seems to default to CoreFX on macOS?) by setting environment variable MONO_MANAGED_WATCHER to something (e.g. false) or disabled.

from valheim-macos.

seathasky avatar seathasky commented on May 24, 2024 1

@seathasky Judging from Mono's FileSystemWatcher code, it should be possible to swap to a different watcher (seems to default to CoreFX on macOS?) by setting environment variable MONO_MANAGED_WATCHER to something (e.g. false) or disabled.

This did it! Thank you!!

For those having similar issues to mods, add export MONO_MANAGED_WATCHER=FALSE to you run shell.

Screenshot 2023-11-09 at 11 56 37 PM

epic loot working:

Screenshot 2023-11-09 at 11 59 16 PM

@timkurvers thanks again

from valheim-macos.

timkurvers avatar timkurvers commented on May 24, 2024

No worries! 🙌

The current Valheim + Steam integration works due to injection of SteamAppId into the environment when the app launches in Info.plist.

From a quick inspection it seems that the BepInEx script launches the MacOS/Valheim binary directly, which might mean that particular Steam setting is not taken into account.

Could you try running it as follows:

SteamAppId=892970 ./run_bepinex.sh

from valheim-macos.

lyk4ndna avatar lyk4ndna commented on May 24, 2024

This worked fantastic! Thank you! Was able to get Valheim+ (Grantapher Temp) and Advize PlantEverything installed and haven't had any issues so far.

from valheim-macos.

HankHill121 avatar HankHill121 commented on May 24, 2024

I've followed the steps in this thread and have mods loading but some mods have a problem where their textures aren't loading and all the items or enemies they add are purple. For example monstrum mobs are purple but the odinshorse loads in just fine. Epicloot weapons are purple pillars when thrown. but odins campsites loads and works fine. There are no errors in the logs.

I've tested it on windows and all the mods are compatible with no issues.

Any help would be appreciated.

from valheim-macos.

timkurvers avatar timkurvers commented on May 24, 2024

I've followed the steps in this thread and have mods loading but some mods have a problem where their textures aren't loading and all the items or enemies they add are purple. For example monstrum mobs are purple but the odinshorse loads in just fine. Epicloot weapons are purple pillars when thrown. but odins campsites loads and works fine. There are no errors in the logs.

I've tested it on windows and all the mods are compatible with no issues.

Any help would be appreciated.

It's possible the mods are using texture formats that are not supported by OpenGL for macOS (Apple deprecated it years ago, after all).

Anything in the Player.log about textures that could not be loaded?

from valheim-macos.

seathasky avatar seathasky commented on May 24, 2024

LogOutput.log
Anyone able to get epicloot working? Bepin loads just fine, but plugins seem to not load in game. Doing same manual setup on pc works just fine.

Here's the error in the log:

[Error  : Unity Log] IOException: Operation not supported
Stack trace:
System.IO.CoreFX.FileSystemWatcher.StartRaisingEvents () (at <5fe808a9ce234d7cb9b1a4e14f988a80>:0)
System.IO.CoreFX.FileSystemWatcher.StartRaisingEventsIfNotDisposed () (at <5fe808a9ce234d7cb9b1a4e14f988a80>:0)
System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) (at <5fe808a9ce234d7cb9b1a4e14f988a80>:0)
(wrapper remoting-invoke-with-check) System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents(bool)
System.IO.CoreFXFileSystemWatcherProxy+<>c.<StartDispatching>b__9_0 (System.IO.CoreFX.FileSystemWatcher internal_fsw, System.IO.FileSystemWatcher fsw) (at <5fe808a9ce234d7cb9b1a4e14f988a80>:0)
System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action`4[T1,T2,T3,T4] map_op, System.Action`2[T1,T2] object_op, System.Object handle, System.Action`2[T1,T2] cancel_op) (at <5fe808a9ce234d7cb9b1a4e14f988a80>:0)
Rethrow as InvalidOperationException: object_op
System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action`4[T1,T2,T3,T4] map_op, System.Action`2[T1,T2] object_op, System.Object handle, System.Action`2[T1,T2] cancel_op) (at <5fe808a9ce234d7cb9b1a4e14f988a80>:0)
System.IO.CoreFXFileSystemWatcherProxy.StartDispatching (System.Object handle) (at <5fe808a9ce234d7cb9b1a4e14f988a80>:0)
System.IO.FileSystemWatcher.Start () (at <5fe808a9ce234d7cb9b1a4e14f988a80>:0)
System.IO.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) (at <5fe808a9ce234d7cb9b1a4e14f988a80>:0)
(wrapper remoting-invoke-with-check) System.IO.FileSystemWatcher.set_EnableRaisingEvents(bool)
EpicLoot.EpicLoot.LoadJsonFile[T] (System.String filename, System.Action`1[T] onFileLoad, EpicLoot.Data.ConfigType configType, System.Boolean update) (at <c085ade0925d42a7910d0d32c1396d5c>:0)
EpicLoot.EpicLoot.InitializeConfig () (at <c085ade0925d42a7910d0d32c1396d5c>:0)
EpicLoot.EpicLoot.Awake () (at <c085ade0925d42a7910d0d32c1396d5c>:0)
UnityEngine.GameObject:AddComponent(Type)
BepInEx.Bootstrap.Chainloader:Start()
UnityEngine.UI.Graphic:get_canvas()
TMPro.TextMeshProUGUI:OnCanvasHierarchyChanged()

from valheim-macos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.