LavaGang / MelonLoader

The World's First Universal Mod Loader for Unity Games compatible with both Il2Cpp and Mono
https://discord.gg/2Wn3N2P
Apache License 2.0
2.38k stars 472 forks source link

[Enhancement]: Native Linux #447

Closed ThisNekoGuy closed 1 year ago

ThisNekoGuy commented 1 year ago

Describe the new feature or enhancement

I'm aware MelonLoader can be used with Wine but can native Linux support become a project goal so that this isn't a hard requirement anymore? It's irritating to want to support developers who actually care about (us) Linux users, and they therefore give good Linux builds (The Long Dark, for example), then we as the end-users get pigeon-holed into not using those builds they spent time and effort on just because we want to make/use mods. (I'm personally bringing this up because I wanted to write a mod, as an [Arch] Linux user, and am running into this explicit issue.)

D2Lx0wse commented 1 year ago

But this already has linux support, as of latest release (https://github.com/LavaGang/MelonLoader/releases/tag/v0.6.1)

ThisNekoGuy commented 1 year ago

@D2Lx0wse I was under a very different impression from the docs :v

D2Lx0wse commented 1 year ago

yeah someone should start updating them

D2Lx0wse commented 1 year ago

I would but idk how the linux version works and idk if I would have time

SamboyCoding commented 1 year ago

Yeah there is a native linux version. Docs just haven't been updated.

RinLovesYou commented 1 year ago

(Linux support is still a little scuffed, hence the missing documentation. Current procedure is relatively easy, install .net 6, and load Melonloader's proxy with LD_PRELOAD. cpp2il needs to be manually chmodded)

ThisNekoGuy commented 1 year ago

cpp2il needs to be manually chmodded

~~@RinLovesYou Can you clarify that part for me? Apparently the Linux build of The Long Dark uses il2cpp2? It threw this error window when I tried to load the library: Screenshot_20230429_010342~~

EDIT: Wait, I thought I had dotnet6 installed; after installing it and trying again, the game window is just transparent for some reason

It seems, in the log, it's complaining about a permissions failure (why would it want root permissions?) (it apparently wasn't set to executable):

Latest.log ```log [01:39:15.841] ------------------------------ [01:39:15.875] MelonLoader v0.6.1 Open-Beta [01:39:15.875] OS: Unix 6.2.7.273 [01:39:15.875] Hash Code: 696B58144EEC73C72FA36A811CA73312EEE4EC28AD5E3527BDA1E14F388A [01:39:15.875] ------------------------------ [01:39:15.875] Game Type: Il2cpp [01:39:15.875] Game Arch: x64 [01:39:15.875] ------------------------------ [01:39:15.876] Core::BasePath = /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark [01:39:15.876] Game::BasePath = /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark [01:39:15.876] Game::DataPath = /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/tld_Data [01:39:15.876] Game::ApplicationPath = /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/tld.x86_64 [01:39:15.876] Runtime Type: net6 [01:39:16.096] ------------------------------ [01:39:16.096] Game Name: TheLongDark [01:39:16.096] Game Developer: Hinterland [01:39:16.097] Unity Version: 2021.3.16f1 [01:39:16.097] Game Version: 2.16 [01:39:16.097] ------------------------------ [01:39:16.748] Preferences Loaded! [01:39:16.779] Loading Plugins from '/mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/Plugins'... [01:39:16.781] 0 Plugins loaded. [01:39:18.621] Loading Il2CppAssemblyGenerator... [01:39:18.641] [Il2CppAssemblyGenerator] Contacting RemoteAPI... [01:39:19.443] [Il2CppAssemblyGenerator] RemoteAPI.DumperVersion = null [01:39:19.443] [Il2CppAssemblyGenerator] RemoteAPI.ObfuscationRegex = null [01:39:19.443] [Il2CppAssemblyGenerator] RemoteAPI.MappingURL = null [01:39:19.443] [Il2CppAssemblyGenerator] RemoteAPI.MappingFileSHA512 = null [01:39:19.496] [Il2CppAssemblyGenerator] Using Dumper Version: 2022.1.0-pre-release.10 [01:39:19.496] [Il2CppAssemblyGenerator] Using Il2CppInterop Version = 1.4.5 [01:39:19.496] [Il2CppAssemblyGenerator] Using Unity Dependencies Version = 2021.3.16 [01:39:19.496] [Il2CppAssemblyGenerator] Using Deobfuscation Regex = null [01:39:19.496] [Il2CppAssemblyGenerator] Downloading Cpp2IL... [01:39:19.497] [Il2CppAssemblyGenerator] Downloading https://github.com/SamboyCoding/Cpp2IL/releases/download/2022.1.0-pre-release.10/Cpp2IL-2022.1.0-pre-release.10-Linux to /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/Cpp2IL_2022.1.0-pre-release.10 [01:39:23.592] [Il2CppAssemblyGenerator] Processing Cpp2IL... [01:39:23.593] [Il2CppAssemblyGenerator] Creating Directory /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/Cpp2IL [01:39:23.593] [Il2CppAssemblyGenerator] Moving /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/Cpp2IL_2022.1.0-pre-release.10 to /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/Cpp2IL [01:39:23.594] [Il2CppAssemblyGenerator] Downloading UnityDependencies... [01:39:23.594] [Il2CppAssemblyGenerator] Downloading https://github.com/LavaGang/Unity-Runtime-Libraries/raw/master/2021.3.16.zip to /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/UnityDependencies_2021.3.16.zip [01:39:24.914] [Il2CppAssemblyGenerator] Processing UnityDependencies... [01:39:24.914] [Il2CppAssemblyGenerator] Creating Directory /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/UnityDependencies [01:39:24.914] [Il2CppAssemblyGenerator] Extracting /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/UnityDependencies_2021.3.16.zip to /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/UnityDependencies [01:39:24.971] [Il2CppAssemblyGenerator] Checking GameAssembly... [01:39:26.967] [Il2CppAssemblyGenerator] Assembly Generation Needed! [01:39:26.974] [Il2CppAssemblyGenerator] Executing Cpp2IL... [01:39:26.975] [Il2CppAssemblyGenerator] "/mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/Cpp2IL/Cpp2IL" --game-path "/mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark" --exe-name "tld.x86_64" --use-processor attributeinjector --output-as dummydll [01:39:26.980] [Il2CppAssemblyGenerator] System.ComponentModel.Win32Exception (13): An error occurred trying to start process '/mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/Cpp2IL/Cpp2IL' with working directory '/mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/Cpp2IL'. Permission denied at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at MelonLoader.Il2CppAssemblyGenerator.Packages.Models.ExecutablePackage.Execute(String[] args, Boolean parenthesize_args, Dictionary`2 environment) in D:\a\MelonLoader\MelonLoader\Dependencies\Il2CppAssemblyGenerator\Packages\Models\ExecutablePackage.cs:line 79 [01:39:26.981] [INTERNAL FAILURE] Failed to Execute Cpp2IL! ```

EDIT: Throws an error after manually setting it as an executable...

Latest.log ```log [01:49:46.948] ------------------------------ [01:49:46.975] MelonLoader v0.6.1 Open-Beta [01:49:46.975] OS: Unix 6.2.7.273 [01:49:46.975] Hash Code: 696B58144EEC73C72FA36A811CA73312EEE4EC28AD5E3527BDA1E14F388A [01:49:46.975] ------------------------------ [01:49:46.975] Game Type: Il2cpp [01:49:46.975] Game Arch: x64 [01:49:46.976] ------------------------------ [01:49:46.976] Core::BasePath = /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark [01:49:46.976] Game::BasePath = /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark [01:49:46.976] Game::DataPath = /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/tld_Data [01:49:46.976] Game::ApplicationPath = /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/tld.x86_64 [01:49:46.976] Runtime Type: net6 [01:49:47.167] ------------------------------ [01:49:47.167] Game Name: TheLongDark [01:49:47.167] Game Developer: Hinterland [01:49:47.169] Unity Version: 2021.3.16f1 [01:49:47.169] Game Version: 2.16 [01:49:47.169] ------------------------------ [01:49:47.680] Preferences Loaded! [01:49:47.715] Loading Plugins from '/mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/Plugins'... [01:49:47.718] 0 Plugins loaded. [01:49:48.895] Loading Il2CppAssemblyGenerator... [01:49:48.929] [Il2CppAssemblyGenerator] Contacting RemoteAPI... [01:49:49.705] [Il2CppAssemblyGenerator] RemoteAPI.DumperVersion = null [01:49:49.705] [Il2CppAssemblyGenerator] RemoteAPI.ObfuscationRegex = null [01:49:49.705] [Il2CppAssemblyGenerator] RemoteAPI.MappingURL = null [01:49:49.705] [Il2CppAssemblyGenerator] RemoteAPI.MappingFileSHA512 = null [01:49:49.716] [Il2CppAssemblyGenerator] Using Dumper Version: 2022.1.0-pre-release.10 [01:49:49.716] [Il2CppAssemblyGenerator] Using Il2CppInterop Version = 1.4.5 [01:49:49.716] [Il2CppAssemblyGenerator] Using Unity Dependencies Version = 2021.3.16 [01:49:49.716] [Il2CppAssemblyGenerator] Using Deobfuscation Regex = null [01:49:49.716] [Il2CppAssemblyGenerator] Cpp2IL is up to date. [01:49:49.716] [Il2CppAssemblyGenerator] UnityDependencies is up to date. [01:49:49.716] [Il2CppAssemblyGenerator] Checking GameAssembly... [01:49:51.709] [Il2CppAssemblyGenerator] Assembly Generation Needed! [01:49:51.717] [Il2CppAssemblyGenerator] Executing Cpp2IL... [01:49:51.717] [Il2CppAssemblyGenerator] "/mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/Cpp2IL/Cpp2IL" --game-path "/mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark" --exe-name "tld.x86_64" --use-processor attributeinjector --output-as dummydll [01:49:51.831] TODO: SetProcessId(244733) [01:49:52.245] [Il2CppAssemblyGenerator] ===Cpp2IL by Samboy063=== [01:49:52.245] [Il2CppAssemblyGenerator] A Tool to Reverse Unity's "il2cpp" Build Process. [01:49:52.247] [Il2CppAssemblyGenerator] Version 2022.1.0-pre-release.10 [01:49:52.247] [Il2CppAssemblyGenerator] [01:49:52.252] [Il2CppAssemblyGenerator] [Warn] [Program] NO_COLOR set, disabling ANSI color codes as you requested. [01:49:52.253] [Il2CppAssemblyGenerator] [Info] [Program] Running on Unix [01:49:52.356] [Il2CppAssemblyGenerator] [Info] [Plugins] Loading plugins from /mnt/extraStorage/Gaming/SteamLibrary/steamapps/common/TheLongDark/MelonLoader/Dependencies/Il2CppAssemblyGenerator/Cpp2IL/Plugins... [01:49:52.371] [Il2CppAssemblyGenerator] [Info] [Plugins] Using Plugin: Cpp2IL Built-In [01:49:52.458] [Il2CppAssemblyGenerator] [Info] [Program] Determined game's unity version to be 2021.3.16f1 [01:49:52.514] [Il2CppAssemblyGenerator] [Info] [Library] Initializing Metadata... [01:49:52.515] [Il2CppAssemblyGenerator] [Info] [Library] Using actual IL2CPP Metadata version 29 [01:49:52.747] [Il2CppAssemblyGenerator] [Info] [Library] Initialized Metadata in 233ms [01:49:52.748] [Il2CppAssemblyGenerator] [Info] [Library] Using binary type ELF (from LibCpp2IL) [01:49:52.748] [Il2CppAssemblyGenerator] [Info] [Library] Searching Binary for Required Data... [01:49:56.769] [Il2CppAssemblyGenerator] [Fail] [Program] [01:49:56.770] [Il2CppAssemblyGenerator] [01:49:56.770] [Il2CppAssemblyGenerator] Cpp2IL.Core.Exceptions.LibCpp2ILInitializationException: Fatal Exception initializing LibCpp2IL! [01:49:56.770] [Il2CppAssemblyGenerator] ---> System.Exception: Failed to find pCodegenModules [01:49:56.770] [Il2CppAssemblyGenerator] at LibCpp2IL.BinarySearcher.FindCodeRegistrationPost2019() in C:\Users\Sarah\RiderProjects\Cpp2IL\LibCpp2IL\BinarySearcher.cs:line 193 [01:49:56.770] [Il2CppAssemblyGenerator] at LibCpp2IL.Elf.ElfFile.FindCodeAndMetadataRegDefaultBehavior(Int32 methodCount, Int32 typeDefinitionsCount) in C:\Users\Sarah\RiderProjects\Cpp2IL\LibCpp2IL\Elf\ElfFile.cs:line 666 [01:49:56.770] [Il2CppAssemblyGenerator] at LibCpp2IL.Elf.ElfFile.FindCodeAndMetadataReg(Int32 methodCount, Int32 typeDefinitionsCount) in C:\Users\Sarah\RiderProjects\Cpp2IL\LibCpp2IL\Elf\ElfFile.cs:line 503 [01:49:56.770] [Il2CppAssemblyGenerator] at LibCpp2IL.LibCpp2IlBinaryRegistry.CreateAndInit(Byte[] buffer, Il2CppMetadata metadata) in C:\Users\Sarah\RiderProjects\Cpp2IL\LibCpp2IL\LibCpp2IlBinaryRegistry.cs:line 68 [01:49:56.770] [Il2CppAssemblyGenerator] at LibCpp2IL.LibCpp2IlMain.Initialize(Byte[] binaryBytes, Byte[] metadataBytes, UnityVersion unityVersion) in C:\Users\Sarah\RiderProjects\Cpp2IL\LibCpp2IL\LibCpp2IlMain.cs:line 159 [01:49:56.770] [Il2CppAssemblyGenerator] at LibCpp2IL.LibCpp2IlMain.LoadFromFile(String pePath, String metadataPath, UnityVersion unityVersion) in C:\Users\Sarah\RiderProjects\Cpp2IL\LibCpp2IL\LibCpp2IlMain.cs:line 203 [01:49:56.770] [Il2CppAssemblyGenerator] at Cpp2IL.Core.Cpp2IlApi.InitializeLibCpp2Il(String assemblyPath, String metadataPath, UnityVersion unityVersion, Boolean allowUserToInputAddresses) in C:\Users\Sarah\RiderProjects\Cpp2IL\Cpp2IL.Core\Cpp2IlApi.cs:line 60 [01:49:56.770] [Il2CppAssemblyGenerator] --- End of inner exception stack trace --- [01:49:56.770] [Il2CppAssemblyGenerator] at Cpp2IL.Core.Cpp2IlApi.InitializeLibCpp2Il(String assemblyPath, String metadataPath, UnityVersion unityVersion, Boolean allowUserToInputAddresses) in C:\Users\Sarah\RiderProjects\Cpp2IL\Cpp2IL.Core\Cpp2IlApi.cs:line 66 [01:49:56.770] [Il2CppAssemblyGenerator] at Cpp2IL.Program.MainWithArgs(Cpp2IlRuntimeArgs runtimeArgs) in C:\Users\Sarah\RiderProjects\Cpp2IL\Cpp2IL\Program.cs:line 485 [01:49:56.770] [Il2CppAssemblyGenerator] at Cpp2IL.Program.Main(String[] args) in C:\Users\Sarah\RiderProjects\Cpp2IL\Cpp2IL\Program.cs:line 429 [01:49:56.770] [Il2CppAssemblyGenerator] [01:49:56.770] [Il2CppAssemblyGenerator] Waiting for you to press enter - feel free to copy the error... ```
ThisNekoGuy commented 1 year ago

Should this be a seperate issue?

SamboyCoding commented 1 year ago

cpp2il needs to be manually chmodded

ThisNekoGuy commented 1 year ago

@SamboyCoding I figured that out already, that's no longer the issue The problem is that cpp2il crashes