Skip to content

Instantly share code, notes, and snippets.

@ChadSki
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChadSki/9aff8b2dca4eeeb503fa to your computer and use it in GitHub Desktop.
Save ChadSki/9aff8b2dca4eeeb503fa to your computer and use it in GitHub Desktop.
XML Plugins vs Python DSL
plugin_classes['test'] = struct(size=0x450, fields={
"collision": reference(0x70),
"velocity": float32(0x3B4),
"weapons": struct_array(0x2D8, struct(size=36, fields={
"weapon": reference(0x0),})),
"hypothetical": struct_array(0x164, struct(size=0x8, fields={
"doubly_nested": struct_array(0x20, struct(size=0x30, fields={
"foobar": reference(0x0),
"quxbaz": uint32(0x0A),
"function": enum16(0x10, options={
0: "One",
1: "Zero",
2: "Cosine",
3: "Cosine (variable period)",
4: "Diagonal Wave",
5: "Diagonal Wave (variable period)",
6: "Slide",
7: "Slide (variable period)",
8: "Noise",
9: "Jitter",
10: "Wander",
11: "Spark",}),})),})),
"flags": bitmask32(0x32B, options={
18: "Projectile is Client-Side Only",
19: "Projectiles Have Identical Error",
20: "Projectile Vector Cannot Be Adjusted",
21: "Use Error When Unzoomed",
22: "Analog Rate of Fire",
23: "Discharging Spews",
24: "Ejects During Chamber",
25: "Sticks When Dropped",
26: "Projectiles Use Weapon Origin",
27: "Locks in On/Off State",
28: "Does Not Repeat Automatically",
29: "Can Fire With Partial Ammo",
30: "Random Firing Effects",
31: "Tracks Fired Projectile",}),})
<plugin name="test" struct_size="0x450">
<reference name="collision" offset="0x70" />
<float32 name="velocity" offset="0x3B4" />
<struct_array name="weapons" offset="0x2D8" struct_size="36">
<reference name="weapon" offset="0x00" />
</struct_array>
<struct_array name="hypothetical" offset="0x2D8" struct_size="0x8">
<struct_array name="doubly_nested" offset="0x220" struct_size="0x30">
<reference name="foobar" offset="0x00" />
<int32 name="quxbaz" offset="0x0A" />
<enum16 name="function" offset="0x10">
<option name="One" value="0" />
<option name="Zero" value="1" />
<option name="Cosine" value="2" />
<option name="Cosine (variable period)" value="3" />
<option name="Diagonal Wave" value="4" />
<option name="Diagonal Wave (variable period)" value="5" />
<option name="Slide" value="6" />
<option name="Slide (variable period)" value="7" />
<option name="Noise" value="8" />
<option name="Jitter" value="9" />
<option name="Wander" value="10" />
<option name="Spark" value="11" />
</enum16>
</struct_array>
</struct_array>
<bitmask32 name="flags" offset="0x32B">
<option name="Projectile is Client-Side Only" value="18" />
<option name="Projectiles Have Identical Error" value="19" />
<option name="Projectile Vector Cannot Be Adjusted" value="20" />
<option name="Use Error When Unzoomed" value="21" />
<option name="Analog Rate of Fire" value="22" />
<option name="Discharging Spews" value="23" />
<option name="Ejects During Chamber" value="24" />
<option name="Sticks When Dropped" value="25" />
<option name="Projectiles Use Weapon Origin" value="26" />
<option name="Locks in On/Off State" value="27" />
<option name="Does Not Repeat Automatically" value="28" />
<option name="Can Fire With Partial Ammo" value="29" />
<option name="Random Firing Effects" value="30" />
<option name="Tracks Fired Projectile" value="31" />
</bitmask32>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment