DFU Injector
Posted: Fri Oct 09, 2020 12:16 pm
Hi everyone,
I've attempted to create a solution to be able to replace methods at run time in DFU. It's not elegant, but it's a solution.
Known issues:
Preface:
This is very much a work in progress. You should expect things not to work properly. This has the potential to mess everything and anything up. Use this at your own risk. Please see the post below with the header "risks" for more information on that. Please also note, this has only been tested on 64 bit versions of Windows.
What DFU Injector?:
In short, DFU Injector will allow modders to overwrite existing in-game methods. Though reflection can be used in .dfmods to access private members, method-changing (as far as I know) has been somewhat untouchable. Note, that this type of mod creation will create mods in an entirely different way, and will use a modders custom DLL files instead of .dfmod files.
How it works:
When Daggerfall Unity launches, a piece of software called "Doorstop" allows code to run right before the "core" of the DFU code runs. This allows arbitrary code execution, and an ability to replace methods at run time using Harmony. I'm not sure if there is a better method, but this is the solution I have come up with. DFU Injector acts as a middle-man between Doorstop and Harmony-based mods.
Should I use this?:
Probably not. Please use the regular .dfmod where possible, as they extend on existing and working functionality of the game. DFU Injector has the potential to break everything if you don't know what you're doing. You also run the risk that your mod may mess up core-functionality after a DFU update. Use this at your own risk. If your game breaks, it's up to you to fix it. If your save file stops working, that's on you. If a mod that someone else has given you breaks, talk to the person who made the mod. This is only intended to provide a platform for more mod customization, what happens beyond that is out of my control.
Requirements for mod developers:
• Decent knowledge of C#
• You know how to compile a DLL
• You know how to reference and include other DLLs
• A basic understanding of XML
Beyond providing DFU Injector and a very basic tutorial so that you know how to use it, it's up to the modders to figure out how to use Harmony to get the results they want. I can provide some outlining, and I will help where I can, but I can't write your whacky mod for you. I've tried to make what is a somewhat complicated process as simple as I can. I am far from an expert, and I am sure there are a million better ways to do it.
Technical requirements:
For this your mod to function correctly with DFU Injector, there's a few things you will need:
• DFU_Injector.dll + Doorstop & Harmony (Provided in a .rar file attached to this post)
• Naming conventions in your mods code so that DFU Injector knows how to work with it (more on this below in the tutorial)
• An XML file that accompanies your DLL file (Contains some basic data about the mod, author, version, etc.) An example XML file is also attached.
-See next post for basic tutorial-
I've attempted to create a solution to be able to replace methods at run time in DFU. It's not elegant, but it's a solution.
Known issues:
- Doesn't work on Windows 7 - Fixed
Preface:
This is very much a work in progress. You should expect things not to work properly. This has the potential to mess everything and anything up. Use this at your own risk. Please see the post below with the header "risks" for more information on that. Please also note, this has only been tested on 64 bit versions of Windows.
What DFU Injector?:
In short, DFU Injector will allow modders to overwrite existing in-game methods. Though reflection can be used in .dfmods to access private members, method-changing (as far as I know) has been somewhat untouchable. Note, that this type of mod creation will create mods in an entirely different way, and will use a modders custom DLL files instead of .dfmod files.
How it works:
When Daggerfall Unity launches, a piece of software called "Doorstop" allows code to run right before the "core" of the DFU code runs. This allows arbitrary code execution, and an ability to replace methods at run time using Harmony. I'm not sure if there is a better method, but this is the solution I have come up with. DFU Injector acts as a middle-man between Doorstop and Harmony-based mods.
Should I use this?:
Probably not. Please use the regular .dfmod where possible, as they extend on existing and working functionality of the game. DFU Injector has the potential to break everything if you don't know what you're doing. You also run the risk that your mod may mess up core-functionality after a DFU update. Use this at your own risk. If your game breaks, it's up to you to fix it. If your save file stops working, that's on you. If a mod that someone else has given you breaks, talk to the person who made the mod. This is only intended to provide a platform for more mod customization, what happens beyond that is out of my control.
Requirements for mod developers:
• Decent knowledge of C#
• You know how to compile a DLL
• You know how to reference and include other DLLs
• A basic understanding of XML
Beyond providing DFU Injector and a very basic tutorial so that you know how to use it, it's up to the modders to figure out how to use Harmony to get the results they want. I can provide some outlining, and I will help where I can, but I can't write your whacky mod for you. I've tried to make what is a somewhat complicated process as simple as I can. I am far from an expert, and I am sure there are a million better ways to do it.
Technical requirements:
For this your mod to function correctly with DFU Injector, there's a few things you will need:
• DFU_Injector.dll + Doorstop & Harmony (Provided in a .rar file attached to this post)
• Naming conventions in your mods code so that DFU Injector knows how to work with it (more on this below in the tutorial)
• An XML file that accompanies your DLL file (Contains some basic data about the mod, author, version, etc.) An example XML file is also attached.
-See next post for basic tutorial-