190 Commits
Author SHA1 Message Date
MenShiyun 6cea286d20 Fix GameDataPath exception in non-Unity3D games (#1416)
When `GameDataPath` is invalid, do not throw an exception; instead, set
both `GameDataPath` and `ManagedPath` to `null`.
2026-10-16 12:41:59 +02:00
HetCreep 4a879f582c Hash the full UTF-8 byte length in HashStrings (#1355)
HashStrings passed str.Length (a char count) as the byte count to
MD5.TransformBlock, so for any non-ASCII string only a truncated prefix
of the UTF-8 bytes was hashed. Capture the byte array and use its Length.
2026-06-21 12:20:41 +02:00
HetCreep fb5f191b36 Enumerate a config snapshot under the lock (#1357)
ConfigFile documents its public methods as thread-safe, but GetEnumerator
returned the live Dictionary enumerator with no lock, so a concurrent
Bind/Reload could invalidate it mid-foreach. Snapshot under _ioLock instead.
2026-06-21 12:13:51 +02:00
HetCreep 32fb12f2e9 Remove the duplicate byte TomlTypeConverter registration (#1359)
typeof(byte) was registered twice in the TypeConverters initializer; the
second entry silently overwrote the first. Keep the one grouped with the
other integral types.
2026-06-21 12:10:28 +02:00
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 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
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 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
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
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 0a4f1d6d73 Accomodate breaking changes in preparation for api refactors 2024-09-01 17:14:59 -04: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
aldelaro5 40643ffdef Offload the load context caching to bepinex 2024-08-29 21:12:07 -04:00
aldelaro5 1f182c7770 Correct the symbols resolution and rename the method 2024-08-29 21:11:36 -04:00
aldelaro5 ee5918bd76 Address minor code review 2024-08-29 14:44:30 -04:00
aldelaro5 e2396d202b address code review round 3 2024-08-29 12:50:46 -04:00
aldelaro5 b729aee545 Address code review round 3 (first part) 2024-08-28 01:14:00 -04:00
aldelaro5 bfc539bd74 Address code review round 2 2024-08-25 12:03:33 -04:00
aldelaro5 b688bfa978 Add a Source property to PluginInfo
Also abstract an interface among the base plugins classes to make this easier
2024-08-23 23:06:54 -04:00
aldelaro5 d8dd404e52 Address code review 2024-08-23 15:40:22 -04:00
aldelaro5 4d47c3cd39 Address code review 2024-08-20 15:13:10 -04:00
aldelaro5 952c74f6fe Implement Patcher and plugin providers 2024-08-19 19:57:52 -04:00
aldelaro5 53625800b8 Upgrade Harmonyx, Iced and AssetRipper.Primitives packages (#953)
* Upgrade Harmonyx to 2.10.2

* Upgrade Iced to 1.21.0

* Upgrade AssetRipper.Primitives to 3.1.3
2024-08-12 21:54:02 +02:00
ghorsington 5796f53564 Bump Il2CppInterop, HarmonyX 2022-11-13 20:02:15 +02:00
ghorsington 684959d840 Bump Cpp2IL and Il2CppInterop 2022-09-30 20:33:50 +03:00
ghorsington b9fe507672 Use Assembly.LoadFrom for loading assemblies
Assembly.LoadFile is meant for a special case that is not relevant to BepInEx
2022-09-11 18:41:22 +03:00
js6pak 0d2cbe61bf Add chainloader events 2022-08-24 21:55:09 +02:00
ghorsington f7857c7994 Restructure project names and folder layout 2022-08-14 17:19:09 +03:00
ghorsington 579ee8511b Add extended Unity version resolver; reorganise projects
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
2022-08-14 17:19:09 +03:00
ghorsington 828ef20996 UnityMono: Resolve assemblies into memory using mono API
This fixes several issues with loading assemblies. In turn, this commit also removes old Location/CodeBase fixes since now assemblies are resolved automatically correctly.

Additionally, integrate the mono loader into preloading which fixes assembly location resolving
2022-08-14 17:19:08 +03:00
ghorsington f400445ba1 Refactor Unity -> UnityMono
Use runtime names for BepInEx modules instead of just the game engine
2022-08-14 17:19:08 +03:00
ghorsington d190b069a1 Restructure versioning and project configuration
To simplify versioning and configuration:

* Removed BepInEx.Shared
* Removed BuildInfoAttribute
* Moved shared configuration to Directory.Build.props
* Refactored to use VersionSuffix and SourceRevisionId for embedding BE and commit hash info
* Enabled debug info embedding
2022-08-14 17:19:06 +03:00
js6pak 5dce49007e ConsoleOut workaround isn't needed anymore 2022-08-14 17:18:58 +03:00
js6pak 3538abf277 Support macos 2022-08-14 17:18:58 +03:00
js6pak 12079aeb09 Improve ConsoleWindow exceptions 2022-08-14 17:18:58 +03:00
js6pak 1315427acd Fix console on wine 2022-08-14 17:18:58 +03:00
ghorsington b80f29784c BepInEx.IL2CPP: Fix mutex checks 2022-08-14 17:18:58 +03:00