imnyang/BlockModLoader
Archived
Watch
2
0
Fork
You've already forked BlockModLoader
0
This repository has been archived on 2026-10-08. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
BlockModLoader/README.md
2026-10-05 12:57:50 +09:00

56 lines
2.5 KiB
Markdown

# BlockMelonLoader
A .NET Framework 4.8 library with no Unity or MelonLoader dependency.
Call `BlockMelonLoader.LoaderGuard.EnsureAllowed("YourMod")` before initializing
a mod. Building this library does not require a game installation.
If an assembly named `MelonLoader` is loaded in the current AppDomain, the guard
shows a Windows error dialog and calls `Environment.FailFast` after dismissal.
Termination also happens if showing the dialog fails. On other platforms the
message is written to standard error before termination; there is no native dialog.
The guard does not inspect installation folders, modify loader files, or monitor
assemblies loaded after the check. UMM and MelonLoader running together are blocked.
Add a `PackageReference` dependency on `BlockMelonLoader` version `1.0.0`.
Ship `BlockMelonLoader.dll` alongside your mod DLL; NuGet copies the runtime asset
to the consuming project's build output.
This is an initialization guard, not a MelonLoader plugin. Simply placing the
UMM-only mod DLL in MelonLoader's Mods folder will not invoke the guard.
A bridge that invokes the UMM entry point is checked; direct assembly loading
without invoking that entry point is not. Modified binaries can bypass this check.
## Build and test
On Windows, run `./build.ps1 -Test`. Visual Studio or Rider MSBuild is required;
use `-MSBuildPath` to select it explicitly. The script downloads .NET Framework
4.8 reference assemblies into the ignored `packages` folder when needed.
The DLL is written to `bin/Release/BlockMelonLoader.dll` and the NuGet package to
`artifacts/BlockMelonLoader.1.0.0.nupkg`. Packaging uses `NuGet.Build.Tasks.Pack`.
The standalone tests check detection, notification ordering, and dialog failure
handling. They substitute the dialog and termination callbacks and do not crash
the game. Run them directly with `Tests/bin/Release/BlockMelonLoader.Tests.exe`.
## Installation
The NuGet feed for this project is:
```text
https://git.mizuki.guru/api/packages/imnyang/nuget/index.json
```
Add that feed to the consuming project's `NuGet.Config`, then add the dependency:
```xml
<PackageReference Include="BlockMelonLoader" Version="[1.0.0]" />
```
For local development, build this repository and use the generated `.nupkg` in
a local NuGet feed. The source repository is not required when building a consumer.
New library versions must use a new package version and update the consumer's
dependency version.
## License
GNU General Public License version 3 only (`GPL-3.0-only`); see `LICENSE.md`.