Commit Graph
1531 Commits
Author SHA1 Message Date
HetCreep da64b220eb Do not abort startup when the config file cannot be written (#1340)
* Don't abort startup when the config file can't be written

ConfigFile.Save opens the file for writing with no exception handling and is invoked automatically via SaveOnConfigSet while settings are bound during startup, before logging is initialized. A read-only or otherwise unwritable config file (a read-only install directory, a file locked by another process or antivirus) therefore throws UnauthorizedAccessException out of the early startup path and shows the Failed to start BepInEx dialog.
2026-06-11 14:49:59 +02:00
js6pak bd467c9af6 Expose a DisplayBepInExVersion (#556) 2026-06-11 12:25:33 +02:00
HetCreep a06688e85b Degrade instead of crashing when the IL2CPP interop assemblies are missing (#1338)
* Degrade instead of crashing when the interop assemblies are missing

OnInvokeMethod references interop types (UnityEngine.Application/LogType) in its body. The CLR JIT-compiles the whole method before running any of it, so when the interop assemblies cannot be resolved the method throws FileNotFoundException at JIT time -- before its own try is entered -- and the exception escapes into the native runtime-invoke detour and crashes the process with nothing logged.

Move the interop-referencing call into its own SetupUnityLogging method called inside the try. OnInvokeMethod then JITs without the interop assemblies present, the missing-interop failure is caught, and the loader degrades (logs and continues) so the game runs unmodded. Set unhook at the top of the try so the detour fires exactly once even on failure.

* Condense the interop-degrade comments and reword the fatal log

Per review: trim the JIT-bypass comments to one line each and change
the fatal message to "Unable to execute IL2CPP chainloader, no plugins
will be loaded".
2026-06-11 11:54:22 +02:00
HetCreep a1afbfb169 Skip missing search directories to fix preloader DirectoryNotFoundException (#1331) 2026-06-11 11:46:18 +02:00
はやしうめ 9aedb90fc6 Set the console codepage to ensure correct text display regardless of encoding (#1337) 2026-06-09 17:07:44 +02:00
HetCreep f568f0e7b5 Fix misleading error label for Finished handlers (#1329)
BaseChainloader.Execute invoked the Finished event inside the same
try/catch that reports plugin-loading failures, so an exception thrown
by a Finished event listener was logged as "Error occurred loading
plugins:" even though it was unrelated to plugin loading.

Move Finished?.Invoke() into its own try/catch with an accurate
message. Control flow is otherwise unchanged: Finished still runs only
after LoadPlugins succeeds, a throwing listener is still caught, and
"Chainloader startup complete" is still logged afterwards.

Fixes #842
2026-06-08 14:49:39 +02:00
HetCreep 77d438cf69 Clarify BepInDependency version errors and docs (#1330)
The chainloader collected both not-installed dependencies and
installed-but-incompatible-version dependencies into one list and
reported them all as "missing dependencies", which is confusing when
the plugin is present but on a version outside the requested range.

Separate the two cases and log distinct, actionable messages: one for
dependencies that are not installed, and one for dependencies present
with an incompatible version (showing the found version and the
required range).

Also expand the BepInDependency(string, string) xmldoc: the version is
a SemVer range, link the range syntax, and warn about the BepInEx 5 ->
6 behaviour change (a bare version was a minimum, now it is exact).

Fixes #779
2026-06-08 14:48:55 +02:00
HetCreep f8ba0a41af Give actionable error when base-libs download fails (#1332)
When the Unity base-libraries download fails (commonly a 404 for a
Unity version not yet hosted on unity.bepinex.dev), the uncaught
HttpRequestException surfaced only as a cryptic "Failed to generate
Il2Cpp interop assemblies" and the game would not launch -- even
though a local fallback (the unity-libs directory) already exists.

Catch the download failure and throw a clear message naming the Unity
version, the URL and the two workarounds: place a matching
base-libraries .zip in the unity-libs directory, or point the
[IL2CPP] UnityBaseLibrariesSource config at a valid URL.

Refs #1295, #1084, #986, #941, #515
2026-06-08 14:36:17 +02:00
tobey 3fab71a191 Improved support for IL2CPP metadata v23-106 (Unity 6+) (#1284)
chore(deps): update Cpp2IL and Il2CppInterop
2026-03-07 14:10:33 +01:00
Arrowmaster c0386134c6 Upgrade Doorstop to version 4.5.0 (#1260) 2026-02-24 17:05:40 +01:00
The0x539 0d275a4df3 Avoid accidentally (indirectly) reading PlatformHelper.Current before setting it (#1254) 2026-01-27 15:26:39 +01:00
ManlyMarco dd0655fe9d Cache downloaded base libraries in the unity-libs directory (#1213) 2025-11-16 19:49:19 +01:00
ManlyMarco 88b4838fef Fix assembly preloading overriding preloader patches (#1212) 2025-11-14 12:23:18 +01:00
ManlyMarco af0cba71fb v6 - Bump Il2CppInterop to 1.5.0-ci.620 (#1106) 2025-06-21 02:59:18 +02:00
ManlyMarco 5fef3570f2 Bump Cpp2IL to pre-release.19 (#1103) 2025-05-09 19:09:55 +02:00
js6pak 995f04991b Fix CI webhook 2025-01-12 17:13:13 +01:00
ManlyMarco 0c2a3f13c3 Switch Build.csproj TargetFramework to net8.0 (#1039)
Fixes CI broken by net6.0 being deprecated.
2025-01-12 16:25:43 +01:00
Howard Lam 28559fe708 Checks if target Unity binaries archive exists before attempting download in case game's network conenction is blocked (#1024) 2025-01-11 22:51:47 +01:00
itectori 35f6b1b541 include DeobfuscationMap.csv.gz in ComputeHash (#1020) 2024-12-02 19:48:56 +01:00
ManlyMarco e1974e26fd Use joelwmale/webhook-action@2.4.1 2024-09-24 20:44:45 +02:00
ManlyMarco e2d5ab8ebc Clean up empty files 2024-09-24 20:32:25 +02:00
aldelaro5 544f909a80 Revert "Merge pull request #960 from aldelaro5/metaplugins" (#995)
This reverts commit 2a61b61497, reversing
changes made to 6b38cee127.
2024-09-24 20:25:56 +02:00
aldelaro5andManlyMarco d9b95a0ac7 Add input abstraction layer to support games with the Input class disabled
Originally pull request #444

Co-authored-by: ManlyMarco <39247311+manlymarco@users.noreply.github.com>
2024-09-17 18:50:35 +02:00
aldelaro5andManlyMarco af5d93917c Make Logger.Listeners and Logger.Sources thread safe
Originally pull request #656

Co-authored-by: ManlyMarco <39247311+manlymarco@users.noreply.github.com>
2024-09-17 18:50:35 +02:00
aldelaro5andManlyMarco 8597ce7ebf Add TomlTypeConverter for UnityEngine.Rect
Originally pull request #510

Co-authored-by: ManlyMarco <39247311+manlymarco@users.noreply.github.com>
2024-09-17 18:50:35 +02:00
aldelaro5andghorsington 6e846fc70a Preload Harmony and MonoMod
Originally commit a1bb117c86

Co-authored-by: ghorsington <neigh@coder.horse>
2024-09-17 18:50:35 +02:00
aldelaro5andghorsington 92f7d25698 Print file write data in console
Originally commit 6c5766d5ab

Co-authored-by: ghorsington <neigh@coder.horse>
2024-09-17 18:50:35 +02:00
aldelaro5andghorsington a5b7dabc1d Add error when using *nix build with Windows executable
Originally commit 8c7dcf265c

Co-authored-by: ghorsington <neigh@coder.horse>
2024-09-17 18:50:35 +02:00
aldelaro5 b891cecab9 Upgrade the github workflows sdk to 8.0.x (#992) 2024-09-17 18:18:48 +02:00
aldelaro5 726b68e52b Prioritize the shallowest path for the same assembly name in the default providers (#980)
Change the behaviors of the default providers so if multiple assemblies with the same name exists, but in different directories, ignore any that are located deeper.
2024-09-10 14:48:48 +02:00
ManlyMarco cdeaad7868 Use upload-artifact@v4 (#981) 2024-09-10 14:47:22 +02:00
ManlyMarco f800cbcc43 Add GlobalMetadataPath setting (#978) 2024-09-08 16:09:44 +02:00
ManlyMarco cbd70eb2f0 Automatically load all interop assemblies before loading plugins (#777)
Assemblies are often loaded on the il2cpp side but not on the mono side, causing confusion when using reflection.
This will load all interop assemblies right before plugins are loaded, which should mostly avoid these issues at a low time cost of around 40ms.
2024-09-08 15:45:19 +02:00
Bepis 2a61b61497 Merge pull request #960 from aldelaro5/metaplugins
Implement patcher and plugin providers
2024-09-08 23:19:59 +10:00
aldelaro5 2474dce1a1 Use PascalCase for the cache versioning const 2024-09-04 11:58:52 -04:00
aldelaro5 ede28de4a5 Make the cache version a const 2024-09-04 11:54:53 -04:00
aldelaro5 ae4d7bb34c Actually write the cache version in SaveAssemblyCache 2024-09-04 11:46:18 -04:00
aldelaro5 d389ed8067 Add versioning to CachedAssembly 2024-09-03 21:09:52 -04:00
aldelaro5 be1beb5e13 Address code review round 5 2024-09-03 20:34:17 -04:00
aldelaro5 7315b7dd66 Make the default providers classes internal in their assemblies 2024-09-02 14:16:12 -04:00
ManlyMarco 6b38cee127 Fix failing to initialize if game's Data folder is just 'Data' (#975)
Any Unity game can have its _Data folder renamed to just Data and continue working just fine.
2024-09-02 13:26:49 +02:00
aldelaro5 c02ad9cd68 Add an obsolete property for compatibility 2024-09-02 07:23:10 -04:00
aldelaro5 e0a81dfdbd Rename Location to prevent compilation with it 2024-09-02 07:16:13 -04:00
aldelaro5 d44b93ba93 Use the IL2CPPChainLoader instance for il2cpp to preserve compatibility 2024-09-01 22:56:30 -04:00
aldelaro5 e9337e9982 Revert the removal of the il2cpp chainloader instance 2024-09-01 17:35:53 -04:00
aldelaro5 0a4f1d6d73 Accomodate breaking changes in preparation for api refactors 2024-09-01 17:14:59 -04:00
thegu5 5a324246f1 Bump Cpp2IL (#967)
The currently used version doesn't have support for metadata version 29.2 (Unity 2023.2+) and 31 (2022.3.33+)
2024-09-01 19:09:38 +02:00
aldelaro5 24cf635e65 Ensure providers and plugins / patchers folders are created if they don't exist 2024-09-01 09:29:35 -04:00
aldelaro5 4597be006e Remove files caching from CachedPluginLoadContext, make it forward the call instead 2024-08-31 05:54:41 -04:00
aldelaro5 ba3fac94da Upgrade MonoMod to 22.7.31.1 to fix old mono preloader crashes (#973) 2024-08-31 11:07:51 +02:00