SDX

Mod compiler & injector tool

Installation

  • Download the latest version of SDX from Here
  • Extract the SDX_X.X.X.zip file to a location of your choosing
  • Run the SDXLauncher.exe

Install and Run Mods

The current version of SDX comes with the plugin for 7 Days To Die

To run mods for that target:

  • Copy your mods to [SDX DIR]/Targets/7DaysToDie/Mods
  • Run the SDXLauncher
  • Make sure you have the correct Target selected
  • You should now see your installed mods in the mods list in SDX
  • Click the Build button to compile the mods
  • If the build succeeded correctly, click the Play button to launch the game

Tip - Load Order

You can drag and drop mods to change their load order

Tip - Disable Mods

You can untick the Enable box next to a mod to disable it

Target Plugins

The list of enabled mods and mod order is stored in AppData

%appdata%/SDX/Targets/TARGET_NAME/EnabledMods.xml

Folder Structure

Mods
Config.xml
Plugin.dll

Plugin.dll

Your plugin must implement the SDX.Core.ICompileTargetPlugin interface

interface ICompileTargetPlugin
{
	// Return the plugin version. The current version is 1
	int PluginVersion { get; }
	
	// Return the path to the exe to launch when the user clicks the Play button
	string GetTargetAppExePath();
	
	// Run actions defined in the Menu section of the Config.xml
	// Returns true on success
	bool RunAction(string action, CompilerConfig config);
}

The Build button in the SDX interface executes the "Build" action on the current target plugin

Config.xml Format

The config can contain more than one config elements if you need to have multiple targets in a single plugin (e.g: Client and Server targets)

<configs>
  <config>
    <name>My Target Name<name>
    <version>1.0<version>
    <author>Domonix<author>
    <website>http://sdxmod.com<website>
	
    <settings>
      <setting name="" label="" dir="" />
      ...
    </settings>

    <menu>
      <item label="" action="" confirm="">
      ...
    </menu>
		
    <patches>
      <class name="CLASS_NAME_HERE">
        <method name="METHOD_NAME_HERE">
          <hook type="PAYLOAD_HOOK_CLASS" method="METHOD_NAME" pos="start/end/#offset" />
        </method>
      </class>
    </patches>
  </config>
</configs>

Mods

Folder Structure

This is the base format for a mod. Mods for different platforms expand on this format.

PatchScripts/*.cs
PatchScripts/*.dll
Resources/*.unity3d
Scripts/*.cs
Scripts/*.dll
Mod.xml

Mod.xml Format

<mod>
  <info>
    <author>Domonix</author>
    <name>Name of my mod</name>
    <description>Desciption of my mod</description>
    <mod_version>1.0</mod_version>
    <game_version>15.1</game_version>  
    <launcher_version>0.7.0</launcher_version>
  </info>
</mod>

Game Scripts

Game scripts are compiled into the Mods.dll

The Mods.dll is injected into the target application at runtime

DLLs in the Scripts folder are added as references during compilation and copied to the output folder with the Mods.dll

Patch Scripts

Patch mods are used to hook into the SDX patching process using the IPatcherMod interface.

interface IPatcherMod
{
	// Called during the patching process to modify the game assembly
	// Return true if successful
	bool Patch(ModuleDefinition module);
	
	// Called after the patching process and after scripts are compiled.
	// Used to link references between both assemblies
	// Return true if successful
	bool Link(ModuleDefinition gameModule, ModuleDefinition modsModule);
}

Resources

The resources folder is for Unity Asset Bundles that are injected at runtime

SDX expects these bundles to have the extension .unity3d for them to be loaded

SDX hooks all calls to Resources.Load and checks if the resource path is a bundle asset request. An example bundle asset path is as follows: #BundleName?AssetName

For documentation about creating asset bundles, check the Unity Documentation:

7 Days To Die Plugin

Additional Mod Structure

Mods for 7D2D extend on the standard mod structure with the following additions

Configs/*.xml
Icons/*.png
Text/Localization.txt
Text/Localization - Quests.txt

Configs

Configs are xml files used to add/remove/modify the Config files in 7D2D

<configs>
  <config name="items">
    PATCH NODES HERE
  </config>
</configs>

The config node has a name attribute which correspondes to which 7D2D config we are patching. name="items" means we are patching items.xml

There are 5 patch node types

  • set - Replaces child nodes or value of attribute
  • append
  • remove
  • insertBefore
  • insertAfter

Each patch node also has a xpath attribute which is how we search the xml for nodes to patch

Example patch node:

<remove xpath="/items/item[@name='clubWood']" />

XPath

Learn more abour XPaths Here

Icons

The icons folder contains item icons and are expected to be 116x80 .png files

They are copied to a native mod during the build phase

Localization

The localization files are merged with the games files

On the first line of the file you define which columns you include, if you do not include a column, all cells for that column will be empty during the merge.

For example, it is acceptable to have the following:


Key,English
MyKey,My Text
					

After the merge the injected row is in the format:


Key,Source,Context,Changes,English,French,German,Klingon,Spanish
MyKey,,,,My Text,,,,