-
Notifications
You must be signed in to change notification settings - Fork 651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructure project, add Doorstop 4 support, use CoreCLR for Il2Cpp #391
Conversation
Download the artifacts for this pull request: |
f8232e0
to
a701ffb
Compare
Can I get the latest artifact of this branch for testing purposes? I'd like to try it on an ARM64 architecture, running the BOX64 emulator. |
Build artifacts are automatically generated and updated in the first comment of this PR. |
Thank you very much <3 |
999ca36
to
b26971f
Compare
445934f
to
2eff34f
Compare
79d937f
to
6d2403c
Compare
This still happens with the latest version avaible here. Using Box64 emulator on ARM architecture.
Does this make sense? What does it mean?. thx. |
9305a2a
to
f3087bc
Compare
I tried again using the latest "BepInEx-UnityMono-linux-x64-6.0.0" version. I noticed that it kind of worked, since it loaded the doorstop library without issuing a segfault and it did actually created a config folder, with the BepInEx.cfg file in it, and that's is as far as I ever got with BepInex on ARM64. However, the whole loading process stopped after a few seconds. I checked the logs and realized that the three times I ran the tests, it always stopped at loading libz.so.1. Is this a bug? Is there any work around? Latest try log/home/ubuntu/valheim_server/valheim_server.x86_64 As you can see, doorstop libraries now do load! but it just freezes at libz.so.1 every time. Any help will be appreciated. Thank you guys! |
Well, I made it pass the libz.so.1 library and finally loaded the entire BepinEx patcher. I all needed to do was to turn the ApplyRuntimePatches to false, in the [Preloader] section of the BepInEx.cfg and voìla. After it fully loaded the first time, I turned it to true again and it just loaded fine. So, for the first time, I just got BepInEx fully loading on an ARM 64 Ubuntu setup. The thing now is that it doesn't seem to find any plugin in the plugins folder. I tried with a variety of diffent plugins, from simple "hello world" loggers to anticheat systems for Valheim and got nothing. So, again, I will appreciate if you guys can take a look to it. I'm really excited on how close we are to get this running fully functional on ARM. I'll paste the full log of my server down here and my current BepInEx.cfg settings. Any other info you need to work on this, just ask. Thank you <3 Latest Log
/home/ubuntu/valheim_server/valheim_server.x86_64
�[37m07/30/2022 01:05:15: Starting to load scene:start �[37m07/30/2022 01:05:26: Setting -savedir to: /home/ubuntu/valheim_data �[37m07/30/2022 01:05:26: Get create world Fallands �[37m07/30/2022 01:05:26: Using environment steamid 892970 �[37m07/30/2022 01:05:26: Using steam APPID:892970 �[37m07/30/2022 01:05:27: Server ID 90071992547409920 �[37m07/30/2022 01:05:27: Authentication:k_ESteamNetworkingAvailability_Waiting �[37m07/30/2022 01:05:27: Steam game server initialized �[37m07/30/2022 01:05:27: Using default prefs �[37m07/30/2022 01:05:27: Valheim version:0.209.10 �[37m07/30/2022 01:05:27: Render threading mode:SingleThreaded �[37m07/30/2022 01:05:27: Missing audio clip in music respawn �[37m07/30/2022 01:05:30: Loaded localization CSV:localization language:English �[37m07/30/2022 01:05:30: Loaded localization CSV:localization_extra language:English �[37m07/30/2022 01:05:30: Game server connected �[37m07/30/2022 01:05:30: UI Group status changed Menu = True Unloading 16 unused Assets to reduce memory usage. Loaded Objects now: 104622. Unloading 6 Unused Serialized files (Serialized files now loaded: 0) �[37m07/30/2022 01:05:32: Using default prefs �[37m07/30/2022 01:05:32: isModded: False �[37m07/30/2022 01:05:32: Zonesystem Awake 271 �[37m07/30/2022 01:05:32: DungeonDB Awake 271 �[37m07/30/2022 01:05:32: Registering lobby �[37m07/30/2022 01:05:39: Audioman already exist, destroying self Unloading 524 unused Assets to reduce memory usage. Loaded Objects now: 105495. Using native(wrapped) libSDL2-2.0.so.0 �[37m07/30/2022 01:05:51: Zonesystem Start 271 �[37m07/30/2022 01:05:53: Added 3 locations, 0 vegetations, 0 environments, 0 biome env-setups from locations_cp1 �[37m07/30/2022 01:05:53: Added 1 locations, 0 vegetations, 1 environments, 0 biome env-setups from locations_mountaincaves �[37m07/30/2022 01:05:53: DungeonDB Start 271 �[37m07/30/2022 01:05:54: Load world: Fallands (Fallands) �[37m07/30/2022 01:05:54: Loading 1171680 zdos , my id -480219097 data version:28 �[37m07/30/2022 01:06:18: Loaded 100000 dead zdos �[37m07/30/2022 01:06:19: Removed 0 OLD generated ZDOS �[37m07/30/2022 01:06:19: Loaded 7440 locations BepInEx.cfg[Logging.Unity] What log levels to log to Unity's output log.Setting type: LogLevelDefault value: Fatal, Error, Warning, Message, InfoAcceptable values: None, Fatal, Error, Warning, Message, Info, Debug, AllMultiple values can be set at the same time by separating them with , (e.g. Debug, Warning)LogLevels = Fatal, Error, Warning, Message, Info [Preloader] Enables or disables runtime patches.This should always be true, unless you cannot start the game due to a Harmony related issue (such as running .NET Standard runtime) or you know what you're doing.Setting type: BooleanDefault value: trueApplyRuntimePatches = true Specifies which MonoMod backend to use for Harmony patches. Auto uses the best available backend.This setting should only be used for development purposes (e.g. debugging in dnSpy). Other code might override this setting.Setting type: MonoModBackendDefault value: autoAcceptable values: auto, dynamicmethod, methodbuilder, cecilHarmonyBackend = auto If enabled, BepInEx will save patched assemblies into BepInEx/DumpedAssemblies.This can be used by developers to inspect and debug preloader patchers.Setting type: BooleanDefault value: falseDumpAssemblies = false If enabled, BepInEx will load patched assemblies from BepInEx/DumpedAssemblies instead of memory.This can be used to be able to load patched assemblies into debuggers like dnSpy.If set to true, will override DumpAssemblies.Setting type: BooleanDefault value: falseLoadDumpedAssemblies = false If enabled, BepInEx will call Debugger.Break() once before loading patched assemblies.This can be used with debuggers like dnSpy to install breakpoints into patched assemblies before they are loaded.Setting type: BooleanDefault value: falseBreakBeforeLoadAssemblies = false [Preloader.Entrypoint] The local filename of the assembly to target.Setting type: StringDefault value: UnityEngine.CoreModule.dllAssembly = UnityEngine.CoreModule.dll The name of the type in the entrypoint assembly to search for the entrypoint method.Setting type: StringDefault value: ApplicationType = MonoBehaviour The name of the method in the specified entrypoint assembly and type to hook and load Chainloader from.Setting type: StringDefault value: .cctorMethod = .cctor |
This PR is specifically for BepInEx 6 which currently does not load BepInEx 5 plugins (which I assume you've been testing since you mentioned Valheim). There will eventually be a support layer for BepInEx 5 plugins, but its priority is lower than the other API changes that are being done to BepInEx 6. TL;DR: Current Valheim plugins will not load with this PR. Support is coming eventually, but it's not the target of this PR. |
d32fe8b
to
b5d20cb
Compare
`git rebase -i` edit this and `git commit --amend --reset-author` once you're happy with it
In older Unity (ones that embed UnityPlayer into the EXE), __Internal will map to the EXE which causes wrong DllImport resolving. Instead, use Doorstop's env var to resolve correct functions
The new resolver resides in BepInEx.Unity.Core The resolver is based on multiple heuristics and integrates all workarounds we currently use so this shouldn't be a breaking change
ThreadingHelper seemed to cause crashes on Unity 4 because of too early default entrypoint. Using the new version resolver, this changes now selects MonoBehaviour as the new default entrypoint for older Unity versions
On Windows, emit BepInEx/ErrorLog.log that will contain the latest stderr This allows to catch any errors CoreCLR writes before closing on a fatal crash On Unix, same is already possible via normal piping
6121530
to
e8ba62b
Compare
Migrated from #385 so that the branch now resides in this repo.
Add Doorstop 4 support, replacing older UnityDoorstop 3. This includes also upgrading Il2Cpp to use self-hosted CoreCLR runtime as that's what Doorstop 4 uses.
Motivation and Context
Debuggers are handy to have.
How Has This Been Tested?
I've tested it with two games so far, StuntMANIA Reloaded,
which is crashing with BepInEx 6 for other reasons (as far as I can tell), and Thomas Was Alone. @bbepis has tested this successfully with Risk of Rain 2.Screenshots (if appropriate):
Types of changes
Checklist:
ThreadingHelper
to not bootstrap on Unity 4Use mono's native API for intercepting assembly loading events instead ofInstead use mono API to load assembly into memory with filenameAppDomain.AssemblyLoad
UnityDataMiner: start collecting mono corlibs for Unhollower usenot really needed due to how unhollower worksOther: