Giter Site home page Giter Site logo

unfuckassemblyloader's Introduction

UnfuckAssemblyLoader

This should really be called UnfuckOxideAssemblyLoader.

tl;dr - Dec 2022 patch of Rust broke the ability for Oxide to reference any Harmony DLLs entirely. This fixes that.

I stand by the original name now. As of December 1st 2022's patch, Rust's Harmony loader fully supports loading and unloading at runtime. However, the caveat to this was assembly namespaces needed to be juked. This causes an issue where referencing assemblies of the same name, from anywhere, including the HarmonyMod's folder loads them into a different namespace.
Unfortunately .NET's CLR isn't clever enough to allow casting between identical assemblies in different namespaces. So it leaves all the code in a harmony mod assembly untouchable without very complicated, and frustrating reflection.

In light of these changes, I've updated the Harmony mod to attempt to load the already loaded assembly from the HarmonyLoader class in Rust. This is not without caveats. As this time I won't have written any dependency reload checking. So if you unload a Harmony DLL that is being utilized by a plugin, expect bad things. Unload the plugin first, then unload/reload your Harmony DLL.

FAQ

How do I use it?

Download the latest release from the releases page, and place it in your HarmonyMods folder. Use // Reference: MyHarmonyMod in your plugin to reference the harmony mod assembly.

Why not just submit a PR for native Oxide support?

The code we're modifying here is the Oxide.CSharp module. This is a game agnostic module, so it complicates trying to support a Rust specific feature/fix.

Why would you even want this functionality?

There are a lot of reasons you'd want to load DLLs into Oxide plugins. In my specific case I wrote a Harmony mod that tracks various PVP statistics. I wanted to use it on a non-oxide, vanilla only server for external support (such as posting stats to discord, websites, etc.)

I also wanted to use it on a modded server and integrate it with a killfeed. I created some simply callback hooks that would allow me to hook into the stats mod to get the data needed to display the killfeed using an Oxide plugin and CUI. There are countless other use cases for this functionality, and I hope this helps someone else out there.

unfuckassemblyloader's People

Contributors

diametric avatar collectvood avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.