• ⚠️ Mod Release Rules now apply to this board.

    All mods must include a license, source code (for executable mods), and proper attribution.

    Read the full rules here before posting.

Tools KittenExtensions v0.3.0 - XML Patching (ModuleManager), Custom XML Asset and Shader Extensions

tom_is_unlucky

New Member
Dec 1, 2025
10
10
KittenExtensions 0.3.0 (KSA Build 3293)
License: MIT

Features:
- Allows modders to write patches that alter any XML file (including in Core or other mods)
- Provides an easy mechanism for mods to add additional XML asset types
- Adds an extended shader asset that allows binding additional textures and uniform buffers to a gauge fragment shader.
- Adds an extended gauge canvas asset that allows adding a post-processing shader
- Adds an imgui shader asset that allows adding a post-processing shader to a specific imgui window

See github repo for full installation installation and usage details

Github Repo: https://github.com/tsholmes/KittenExtensions
Download: https://github.com/tsholmes/KittenExtensions/releases/latest

Requires StarMap

XML:
<Patch>
  <!-- set context to MyMod -->
  <With Path="Mod[@Id='MyMod']">
    <!-- Copy Venus from core system into custom system (assuming MySystem already exists) -->
    <Copy
      Path="System[@Id='MySystem']"
      From="/Root/Mod[@Id='Core']/System[@Id='SolSystem']/AtmosphericBody[@Id='Venus']"
      Pos="Append"
    />
    <!-- set context to the copied Venus -->
    <With Path="System/AtmosphericBody[@Id='Venus']">
      <!-- Change Id to MyVenus -->
      <Copy Path="@Id" Pos="Prepend">My</Copy>
      <!-- Make it a little heavier -->
      <Copy Path="Mass/@Earths">1</Copy>
      <!-- Remove stratus clouds -->
      <Remove Path="Clouds/CloudType[@Name='Stratus']" />
    </With>
  </With>
</Patch>

C#:
[KxAsset("ShaderEx")] // top-level asset as <ShaderEx>
[KxAssetInject(
  // use for component fragment shader as <FragmentEx>
  typeof(GaugeComponent), nameof(GaugeComponent.FragmentShader), "FragmentEx"
)]
public class ShaderEx : ShaderReference
{
  // ...
}

XML:
<Assets>
  <ShaderEx Id="MyFragmentShader" Path="MyShader.frag">
    <TextureBinding Path="Texture1.png" />
    <TextureBinding Path="Texture2.png" />
  </ShaderEx>
</Assets>

1767910704223.png
1767910713970.png
 
Last edited:
  • Like
Reactions: UriahGnu
Released v0.2.1
When debug mode is enabled, a patch debug view now displays during startup where you can step through patches and see their effects, including any errors.
When debug mode is disabled, if an error occurs during patching it will display the error with some details before exiting.
 
Released v0.3.0

Pulled the xml patching out into a separate library that KittenExtensions uses (plus a lot more changes to set the groundwork for some future features, which is why it took a few weeks), as well as updated compatibility for the latest build (3293).

There are some changes to the patch format from v0.2:
- merging is handled with a separate <Merge> operation instead of using Pos="Merge"
- <Update> has been folded into the <Copy> operation (<Copy> uses its contents as the source value if From isn't specified).
- XPath variables can be set with the <SetVar> operation (see README section)
- The $path variable always points to the currently executing patch element. The `From` attribute defaults to the XPath expression $path/node().

XML:
<!-- old -->
<Update Pos="Merge" Path="A">Value</Update>
<Copy Pos="Merge" Path="A" From="B" />
<Update Path="A">Value</Update>
<!-- new -->
<Merge Path="A">Value</Merge>
<Merge Path="A" From="B" />
<Copy Path="A">Value</Copy>