madkit 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. madkit-0.1.3/.gitignore +78 -0
  2. madkit-0.1.3/.python-version +1 -0
  3. madkit-0.1.3/EDITOR.yaml +2 -0
  4. madkit-0.1.3/LICENSE +201 -0
  5. madkit-0.1.3/PKG-INFO +211 -0
  6. madkit-0.1.3/README.md +184 -0
  7. madkit-0.1.3/devsetup.py +218 -0
  8. madkit-0.1.3/other/ATTRIBUTES.md +258 -0
  9. madkit-0.1.3/other/chunkid.html +206 -0
  10. madkit-0.1.3/other/legacy/rwaRWS.py +628 -0
  11. madkit-0.1.3/other/legacy/rws_2057.py +184 -0
  12. madkit-0.1.3/other/legacy/rws_2061.py +294 -0
  13. madkit-0.1.3/other/legacy/stream_repack.py +99 -0
  14. madkit-0.1.3/other/legacy/stream_unpack.py +304 -0
  15. madkit-0.1.3/packages/madformats/LICENSE +201 -0
  16. madkit-0.1.3/packages/madformats/README.md +19 -0
  17. madkit-0.1.3/packages/madformats/pyproject.toml +29 -0
  18. madkit-0.1.3/packages/madformats/src/madformats/__init__.py +0 -0
  19. madkit-0.1.3/packages/madformats/src/madformats/anm.py +39 -0
  20. madkit-0.1.3/packages/madformats/src/madformats/bsp.py +40 -0
  21. madkit-0.1.3/packages/madformats/src/madformats/dff.py +40 -0
  22. madkit-0.1.3/packages/madformats/src/madformats/lib/__init__.py +0 -0
  23. madkit-0.1.3/packages/madformats/src/madformats/lib/entityAtributeDocs/CFXPartSpray.py +1343 -0
  24. madkit-0.1.3/packages/madformats/src/madformats/lib/entityAtributeDocs/CProtoActor.py +127 -0
  25. madkit-0.1.3/packages/madformats/src/madformats/lib/entityAtributeDocs/__init__.py +0 -0
  26. madkit-0.1.3/packages/madformats/src/madformats/lib/entityAttributeDocs.py +633 -0
  27. madkit-0.1.3/packages/madformats/src/madformats/lib/game_memory.py +153 -0
  28. madkit-0.1.3/packages/madformats/src/madformats/lib/ima_adpcm.py +93 -0
  29. madkit-0.1.3/packages/madformats/src/madformats/lib/parser.py +201 -0
  30. madkit-0.1.3/packages/madformats/src/madformats/lib/rwConstants.py +269 -0
  31. madkit-0.1.3/packages/madformats/src/madformats/lib/rw_basics.py +690 -0
  32. madkit-0.1.3/packages/madformats/src/madformats/lib/sytax_hilighting.py +38 -0
  33. madkit-0.1.3/packages/madformats/src/madformats/lib/utils.py +3 -0
  34. madkit-0.1.3/packages/madformats/src/madformats/lib/writer.py +73 -0
  35. madkit-0.1.3/packages/madformats/src/madformats/lpa.py +245 -0
  36. madkit-0.1.3/packages/madformats/src/madformats/mod.py +50 -0
  37. madkit-0.1.3/packages/madformats/src/madformats/rws.py +90 -0
  38. madkit-0.1.3/packages/madformats/src/madformats/savegame.py +817 -0
  39. madkit-0.1.3/packages/madformats/src/madformats/sections/ANIMANIMATION_001B.py +176 -0
  40. madkit-0.1.3/packages/madformats/src/madformats/sections/ATOMICSECT_0009.py +218 -0
  41. madkit-0.1.3/packages/madformats/src/madformats/sections/ATOMIC_0014.py +128 -0
  42. madkit-0.1.3/packages/madformats/src/madformats/sections/BINMESHPLUGIN_050E.py +99 -0
  43. madkit-0.1.3/packages/madformats/src/madformats/sections/CAMERA_0005.py +140 -0
  44. madkit-0.1.3/packages/madformats/src/madformats/sections/CLUMP_0010.py +141 -0
  45. madkit-0.1.3/packages/madformats/src/madformats/sections/COLLISIONPLG_011D.py +84 -0
  46. madkit-0.1.3/packages/madformats/src/madformats/sections/COLLTREE_002C.py +591 -0
  47. madkit-0.1.3/packages/madformats/src/madformats/sections/EXTENSION_0003.py +69 -0
  48. madkit-0.1.3/packages/madformats/src/madformats/sections/FRAMELIST_000E.py +102 -0
  49. madkit-0.1.3/packages/madformats/src/madformats/sections/GEOMETRYLIST_001A.py +89 -0
  50. madkit-0.1.3/packages/madformats/src/madformats/sections/GEOMETRY_000F.py +300 -0
  51. madkit-0.1.3/packages/madformats/src/madformats/sections/HANIMPLUGIN_011E.py +150 -0
  52. madkit-0.1.3/packages/madformats/src/madformats/sections/MATERIALEFFECTSPLUGIN_0120.py +297 -0
  53. madkit-0.1.3/packages/madformats/src/madformats/sections/MATERIAL_0007.py +121 -0
  54. madkit-0.1.3/packages/madformats/src/madformats/sections/MATLIST_0008.py +112 -0
  55. madkit-0.1.3/packages/madformats/src/madformats/sections/PLANESECT_000A.py +197 -0
  56. madkit-0.1.3/packages/madformats/src/madformats/sections/RIGHTTORENDER_001F.py +48 -0
  57. madkit-0.1.3/packages/madformats/src/madformats/sections/RWA/STREAM_080D.py +386 -0
  58. madkit-0.1.3/packages/madformats/src/madformats/sections/RWA/STREAM_DATA_080F.py +49 -0
  59. madkit-0.1.3/packages/madformats/src/madformats/sections/RWA/STREAM_HDR_080E.py +469 -0
  60. madkit-0.1.3/packages/madformats/src/madformats/sections/RWA/WAVEDATA_0804.py +43 -0
  61. madkit-0.1.3/packages/madformats/src/madformats/sections/RWA/WAVEDICT_0809.py +218 -0
  62. madkit-0.1.3/packages/madformats/src/madformats/sections/RWA/WAVEDICT_DICT_080A.py +153 -0
  63. madkit-0.1.3/packages/madformats/src/madformats/sections/RWA/WAVEDICT_WAVE_080C.py +69 -0
  64. madkit-0.1.3/packages/madformats/src/madformats/sections/RWA/WAVESTRUCT_0803.py +300 -0
  65. madkit-0.1.3/packages/madformats/src/madformats/sections/RWA/WAVE_0802.py +297 -0
  66. madkit-0.1.3/packages/madformats/src/madformats/sections/RWA/__init__.py +0 -0
  67. madkit-0.1.3/packages/madformats/src/madformats/sections/Rockstar/FRAME_0253F2FE.py +42 -0
  68. madkit-0.1.3/packages/madformats/src/madformats/sections/Rockstar/REFLECTIONMATERIAL_0253F2FC.py +76 -0
  69. madkit-0.1.3/packages/madformats/src/madformats/sections/Rockstar/SPECULARMATERIAL_0253F2F6.py +50 -0
  70. madkit-0.1.3/packages/madformats/src/madformats/sections/Rockstar/__init__.py +0 -0
  71. madkit-0.1.3/packages/madformats/src/madformats/sections/SKINPLUGIN_0116.py +215 -0
  72. madkit-0.1.3/packages/madformats/src/madformats/sections/SKYMIPMAPVAL_0110.py +57 -0
  73. madkit-0.1.3/packages/madformats/src/madformats/sections/STRING_0002.py +54 -0
  74. madkit-0.1.3/packages/madformats/src/madformats/sections/TEXDICTIONARY_0016.py +179 -0
  75. madkit-0.1.3/packages/madformats/src/madformats/sections/TEXTURENATIVE_0015.py +1740 -0
  76. madkit-0.1.3/packages/madformats/src/madformats/sections/TEXTURE_0006.py +106 -0
  77. madkit-0.1.3/packages/madformats/src/madformats/sections/TFB/TFBMATERIAL_800000F6.py +144 -0
  78. madkit-0.1.3/packages/madformats/src/madformats/sections/TFB/TFBTEXTURE1_800000DD.py +54 -0
  79. madkit-0.1.3/packages/madformats/src/madformats/sections/USERDATAPLUGIN_011F.py +103 -0
  80. madkit-0.1.3/packages/madformats/src/madformats/sections/WORLD_000B.py +220 -0
  81. madkit-0.1.3/packages/madformats/src/madformats/sections/__init__.py +281 -0
  82. madkit-0.1.3/packages/madformats/src/madformats/sections/copybase.py +39 -0
  83. madkit-0.1.3/packages/madformats/src/madformats/sections/shared/worldflags.py +80 -0
  84. madkit-0.1.3/packages/madformats/src/madformats/stream/__init__.py +31 -0
  85. madkit-0.1.3/packages/madformats/src/madformats/stream/edit.py +183 -0
  86. madkit-0.1.3/packages/madformats/src/madformats/stream/file.py +99 -0
  87. madkit-0.1.3/packages/madformats/src/madformats/stream/log.py +185 -0
  88. madkit-0.1.3/packages/madformats/src/madformats/stream/query.py +196 -0
  89. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/__init__.py +48 -0
  90. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/copybase.py +53 -0
  91. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/sf_CreateEntity.py +620 -0
  92. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/sf_EnableDirectorsCamera.py +58 -0
  93. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/sf_LoadEmbeddedAsset.py +163 -0
  94. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/sf_PlacementNew.py +96 -0
  95. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/sf_SetDirectorsCameraMatrix.py +71 -0
  96. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/sf_SetFrozenMode.py +58 -0
  97. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/sf_SetRunningMode.py +57 -0
  98. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/sf_Shutdown.py +58 -0
  99. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/sf_StartSystem.py +58 -0
  100. madkit-0.1.3/packages/madformats/src/madformats/streamfuncs/stringfuncs/sf_StopSystem.py +58 -0
  101. madkit-0.1.3/packages/madformats/src/madformats/txd.py +41 -0
  102. madkit-0.1.3/packages/madlysimple/LICENSE +201 -0
  103. madkit-0.1.3/packages/madlysimple/README.md +17 -0
  104. madkit-0.1.3/packages/madlysimple/pyproject.toml +34 -0
  105. madkit-0.1.3/packages/madlysimple/src/madlysimple/__init__.py +23 -0
  106. madkit-0.1.3/packages/madlysimple/src/madlysimple/actorparams.py +367 -0
  107. madkit-0.1.3/packages/madlysimple/src/madlysimple/cameradata.py +213 -0
  108. madkit-0.1.3/packages/madlysimple/src/madlysimple/classes.py +24 -0
  109. madkit-0.1.3/packages/madlysimple/src/madlysimple/cprotoactor.py +172 -0
  110. madkit-0.1.3/packages/madlysimple/src/madlysimple/extended_stream.py +5 -0
  111. madkit-0.1.3/packages/madlysimple/src/madlysimple/levelhub.py +160 -0
  112. madkit-0.1.3/packages/madlysimple/src/madlysimple/prefabs/__init__.py +5 -0
  113. madkit-0.1.3/packages/madlysimple/src/madlysimple/prefabs/prefab.py +383 -0
  114. madkit-0.1.3/packages/tfbpseudo/LICENSE +201 -0
  115. madkit-0.1.3/packages/tfbpseudo/README.md +25 -0
  116. madkit-0.1.3/packages/tfbpseudo/pyproject.toml +38 -0
  117. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/__init__.py +29 -0
  118. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/arguments.py +271 -0
  119. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/compiler.py +722 -0
  120. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/decompiler.py +597 -0
  121. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/__init__.py +3 -0
  122. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/app.py +805 -0
  123. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/basic.tai +16 -0
  124. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/completer.py +242 -0
  125. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/completions.py +945 -0
  126. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/favicon.png +0 -0
  127. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/highlighter.py +164 -0
  128. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/panel.py +397 -0
  129. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/preferences.py +180 -0
  130. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/search.py +427 -0
  131. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/settings.py +77 -0
  132. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/theme.py +290 -0
  133. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/editor/widgets.py +1161 -0
  134. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/errors.py +20 -0
  135. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/lexer.py +62 -0
  136. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/methods.py +456 -0
  137. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/nodes.py +86 -0
  138. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/parser.py +366 -0
  139. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/references.py +254 -0
  140. madkit-0.1.3/packages/tfbpseudo/src/tfbpseudo/rhs.py +486 -0
  141. madkit-0.1.3/packages/tfbscript/FORMAT.md +98 -0
  142. madkit-0.1.3/packages/tfbscript/LICENSE +201 -0
  143. madkit-0.1.3/packages/tfbscript/NOTES +7 -0
  144. madkit-0.1.3/packages/tfbscript/README.md +98 -0
  145. madkit-0.1.3/packages/tfbscript/demo.py +24 -0
  146. madkit-0.1.3/packages/tfbscript/diff_ai.py +425 -0
  147. madkit-0.1.3/packages/tfbscript/find_occurance.py +50 -0
  148. madkit-0.1.3/packages/tfbscript/pyproject.toml +35 -0
  149. madkit-0.1.3/packages/tfbscript/src/tfbscript/__init__.py +21 -0
  150. madkit-0.1.3/packages/tfbscript/src/tfbscript/__main__.py +52 -0
  151. madkit-0.1.3/packages/tfbscript/src/tfbscript/ansi.py +203 -0
  152. madkit-0.1.3/packages/tfbscript/src/tfbscript/arena.py +119 -0
  153. madkit-0.1.3/packages/tfbscript/src/tfbscript/binary.py +84 -0
  154. madkit-0.1.3/packages/tfbscript/src/tfbscript/debug.py +14 -0
  155. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/__init__.py +3 -0
  156. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/app.py +141 -0
  157. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/fonts/ms-sans-serif/MS Sans Serif.ttf +0 -0
  158. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/fonts/ms-sans-serif/license.txt +4 -0
  159. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/fonts/ms-sans-serif/readme.txt +26 -0
  160. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/fonts/ms-sans-serif-bold/MS Sans Serif Bold.ttf +0 -0
  161. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/fonts/ms-sans-serif-bold/license.txt +4 -0
  162. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/fonts/ms-sans-serif-bold/readme.txt +26 -0
  163. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/fonts.py +98 -0
  164. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/search.py +200 -0
  165. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/style.py +141 -0
  166. madkit-0.1.3/packages/tfbscript/src/tfbscript/editor/widgets.py +321 -0
  167. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/__init__.py +104 -0
  168. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/base.py +362 -0
  169. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/block.py +34 -0
  170. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/enums.py +219 -0
  171. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_behavior_implementation.py +39 -0
  172. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_change_membership.py +62 -0
  173. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_check_fov.py +73 -0
  174. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_check_membership.py +41 -0
  175. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_check_message.py +79 -0
  176. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_check_reference.py +61 -0
  177. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_check_value.py +66 -0
  178. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_comment.py +43 -0
  179. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_control.py +80 -0
  180. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_create_variable.py +42 -0
  181. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_cut_scene.py +44 -0
  182. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_dec_value.py +43 -0
  183. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_displace.py +111 -0
  184. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_find_subset.py +49 -0
  185. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_find_variable.py +28 -0
  186. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_for_each.py +65 -0
  187. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_if_else.py +105 -0
  188. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_inc_value.py +43 -0
  189. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_loop_value.py +28 -0
  190. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_move_from.py +47 -0
  191. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_move_to.py +99 -0
  192. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_play_animation.py +46 -0
  193. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_play_sound.py +42 -0
  194. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_prescript.py +26 -0
  195. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_print.py +53 -0
  196. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_remove.py +43 -0
  197. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_reset.py +42 -0
  198. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_run_as_player.py +26 -0
  199. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_send_message.py +53 -0
  200. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_set_behavior.py +41 -0
  201. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_set_reference.py +52 -0
  202. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_set_value.py +52 -0
  203. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_shutdown.py +26 -0
  204. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_slide_value.py +81 -0
  205. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_spawn_actor.py +96 -0
  206. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_startup.py +26 -0
  207. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_stop_sound.py +26 -0
  208. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_teleport_to.py +47 -0
  209. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_turn_to.py +33 -0
  210. madkit-0.1.3/packages/tfbscript/src/tfbscript/opcodes/op_use_camera.py +68 -0
  211. madkit-0.1.3/packages/tfbscript/src/tfbscript/payload.py +40 -0
  212. madkit-0.1.3/packages/tfbscript/src/tfbscript/reference.py +926 -0
  213. madkit-0.1.3/packages/tfbscript/src/tfbscript/rhs.py +326 -0
  214. madkit-0.1.3/packages/tfbscript/src/tfbscript/script.py +160 -0
  215. madkit-0.1.3/packages/tfbscript/src/tfbscript/string_table.py +101 -0
  216. madkit-0.1.3/packages/tfbscript/supercoolscript.py +264 -0
  217. madkit-0.1.3/packages/tfbscript/test.py +5 -0
  218. madkit-0.1.3/packages/tfbscript/tests/test_example_scripts.py +19 -0
  219. madkit-0.1.3/packages/tfbscript/tfbscript_pseudocode.txt +18 -0
  220. madkit-0.1.3/pyproject.toml +61 -0
  221. madkit-0.1.3/pyrightconfig.json +48 -0
  222. madkit-0.1.3/src/madkit/__init__.py +0 -0
  223. madkit-0.1.3/src/madkit/cli/__init__.py +3 -0
  224. madkit-0.1.3/src/madkit/cli/__main__.py +4 -0
  225. madkit-0.1.3/src/madkit/cli/cli.py +15 -0
  226. madkit-0.1.3/src/madkit/cli/commands/__init__.py +0 -0
  227. madkit-0.1.3/src/madkit/cli/commands/config.py +26 -0
  228. madkit-0.1.3/src/madkit/cli/commands/mod.py +138 -0
  229. madkit-0.1.3/src/madkit/cli/commands/repack.py +72 -0
  230. madkit-0.1.3/src/madkit/cli/commands/txd_add_texture.py +43 -0
  231. madkit-0.1.3/src/madkit/cli/commands/txd_unpack.py +26 -0
  232. madkit-0.1.3/src/madkit/cli/commands/unpack.py +96 -0
  233. madkit-0.1.3/src/madkit/cli/commands/unpack_directory.py +31 -0
  234. madkit-0.1.3/src/madkit/cli/settings.py +38 -0
  235. madkit-0.1.3/src/madkit/cli/utils.py +89 -0
  236. madkit-0.1.3/src/madkit/tools/__init__.py +0 -0
  237. madkit-0.1.3/src/madkit/tools/analyze/__init__.py +5 -0
  238. madkit-0.1.3/src/madkit/tools/analyze/__main__.py +28 -0
  239. madkit-0.1.3/src/madkit/tools/analyze/app.py +410 -0
  240. madkit-0.1.3/src/madkit/tools/analyze/formatting.py +398 -0
  241. madkit-0.1.3/src/madkit/tools/analyze/rwtree.py +67 -0
  242. madkit-0.1.3/src/madkit/tools/analyze/syntax.py +140 -0
  243. madkit-0.1.3/src/madkit/tools/analyze/theme.py +188 -0
  244. madkit-0.1.3/src/madkit/tools/livescan.py +97 -0
  245. madkit-0.1.3/src/madkit/tools/nearest.py +245 -0
  246. madkit-0.1.3/src/madkit/tools/nearest_gui.py +291 -0
  247. madkit-0.1.3/src/madkit/tools/poschecker.py +201 -0
  248. madkit-0.1.3/src/madkit/tools/stream/__init__.py +5 -0
  249. madkit-0.1.3/src/madkit/tools/stream/__main__.py +22 -0
  250. madkit-0.1.3/src/madkit/tools/stream/app.py +632 -0
  251. madkit-0.1.3/src/madkit/tools/stream/formatting.py +259 -0
  252. madkit-0.1.3/src/madkit/tools/stream/syntax.py +140 -0
  253. madkit-0.1.3/src/madkit/tools/stream/theme.py +328 -0
  254. madkit-0.1.3/src/madkit/tools/txd/__init__.py +1 -0
  255. madkit-0.1.3/src/madkit/tools/txd/__main__.py +23 -0
  256. madkit-0.1.3/src/madkit/tools/txd/app.py +539 -0
  257. madkit-0.1.3/tests/conftest.py +25 -0
  258. madkit-0.1.3/tfbeditor.py +11 -0
  259. madkit-0.1.3/uv.lock +610 -0
@@ -0,0 +1,78 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyd
5
+
6
+ # Virtual environments
7
+ env/
8
+ .venv/
9
+ venv/
10
+
11
+ # Python build/package output
12
+ build/
13
+ dist/
14
+ *.egg-info/
15
+
16
+ # uv
17
+ # uv.lock is intentionally NOT ignored
18
+
19
+ # Test / tooling caches
20
+ .pytest_cache/
21
+ .mypy_cache/
22
+ .ruff_cache/
23
+ .coverage
24
+ htmlcov/
25
+
26
+ # IDE
27
+ .vscode/
28
+ .idea/
29
+ .claude/
30
+
31
+ # Environment / secrets
32
+ .env
33
+ .env.*
34
+ !.env.example
35
+
36
+ # OS
37
+ .DS_Store
38
+ Thumbs.db
39
+
40
+ *.stream
41
+ *.txd
42
+ *.rws
43
+ *.wav
44
+ *.bsp
45
+ *.dff
46
+
47
+ Levels/
48
+
49
+
50
+ # *.gig.* = Dont track this file
51
+ **/*.gig.*
52
+
53
+
54
+
55
+
56
+ native/printhook
57
+ native/mods
58
+
59
+ # Local scratch drivers / experiments
60
+ scratch/
61
+
62
+ # Compiler output from examples/
63
+ *.out.ai
64
+
65
+ # mod build output (cli mod build)
66
+ mods/*/build/
67
+
68
+ # machine-specific settings (cli config)
69
+ settings.toml
70
+
71
+ mods/
72
+ # tfbscript local data (game scripts, notes, decompiler output)
73
+ packages/tfbscript/example_scripts/
74
+ packages/tfbscript/my_scripts/
75
+ packages/tfbscript/archive/
76
+ packages/tfbscript/nopush.txt
77
+ _MYNOTES.*
78
+ *.decomp
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,2 @@
1
+ appereance:
2
+ font: "Microsoft Sans Serif" # MS Sans Serif != Microsoft Sans Serif
madkit-0.1.3/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
madkit-0.1.3/PKG-INFO ADDED
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.5
2
+ Name: madkit
3
+ Version: 0.1.3
4
+ Summary: CLI and tools for modding Madagascar (2005)
5
+ Project-URL: Repository, https://github.com/MaxStache/madagascar-game-asset-tools
6
+ Project-URL: Issues, https://github.com/MaxStache/madagascar-game-asset-tools/issues
7
+ Author: Max Stache
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Games/Entertainment
12
+ Classifier: Topic :: Software Development :: Libraries
13
+ Requires-Python: >=3.12
14
+ Requires-Dist: cyclopts>=4.22.5
15
+ Requires-Dist: fonttools>=4.63.0
16
+ Requires-Dist: madformats>=0.1.0
17
+ Requires-Dist: madlysimple>=0.1.0
18
+ Requires-Dist: pillow>=12.3.0
19
+ Requires-Dist: pymem>=1.14.0
20
+ Requires-Dist: pyyaml>=6.0.3
21
+ Requires-Dist: rich>=14.3.0
22
+ Requires-Dist: tfbpseudo[editor]>=0.1.0
23
+ Requires-Dist: tfbscript>=0.1.0
24
+ Requires-Dist: tqdm>=4.68.4
25
+ Requires-Dist: watchdog>=6.0.0
26
+ Description-Content-Type: text/markdown
27
+
28
+ # Madagascar Asset Tools
29
+
30
+ ![Python >= 3.12](https://img.shields.io/badge/python-%3E%3D3.12-blue)
31
+
32
+ Loads `.stream .dff .txd .bsp .txl .rws .lpa`
33
+
34
+ `madkit` is a collection of tools for modding the game "Madagascar" (released in 2005): a CLI to unpack, repack and build mods for the game's level files, plus viewers for streams and textures.
35
+
36
+ ## Contents
37
+
38
+ - [Requirements](#requirements)
39
+ - [Getting started](#getting-started)
40
+ - [1. Create a modding folder](#1-create-a-modding-folder)
41
+ - [2. Copy the stock levels](#2-copy-the-stock-levels)
42
+ - [3. Configure madkit](#3-configure-madkit)
43
+ - [Mods](#mods)
44
+ - [CLI](#cli)
45
+ - [Tools](#tools)
46
+ - [Development](#development)
47
+
48
+ ## Requirements
49
+
50
+ - [Python >= 3.12](https://www.python.org/downloads/)
51
+ - Your own copy of the game
52
+
53
+ > [!NOTE]
54
+ >
55
+ > ## 🎥 Video Tutorials
56
+ >
57
+ > **[▶️ Madagascar Modding Tutorials – YouTube Playlist](https://www.youtube.com/playlist?list=PLbBnMoHCtodg)**
58
+
59
+ ## Getting started
60
+
61
+ ### 1. Create a modding folder
62
+
63
+ Make a folder for your mods with its own virtual environment, and install `madkit` and `madlysimple` into it:
64
+
65
+ ```bash
66
+ mkdir my-madagascar-mods
67
+ cd my-madagascar-mods
68
+ python -m venv .venv
69
+
70
+ # WINDOWS:
71
+ .venv\Scripts\activate
72
+ # LINUX/MACOS:
73
+ source .venv/bin/activate
74
+
75
+ pip install madkit madlysimple
76
+ ```
77
+
78
+ `madkit` is the CLI and tools, `madlysimple` the helpers you use in your mod scripts.
79
+
80
+ The environment stays active until you close the terminal. In every new terminal, `cd` into your modding folder and run the `activate` line again before using `madkit`.
81
+
82
+ To update later: `pip install --upgrade madkit madlysimple`.
83
+
84
+ ### 2. Copy the stock levels
85
+
86
+ Mods are built from the original `.stream` level files. Copy the game's `Levels/` folder into your modding folder:
87
+
88
+ ```text
89
+ my-madagascar-mods/
90
+ .venv/
91
+ Levels/ # copy of <game folder>/Levels, never modified
92
+ ```
93
+
94
+ > [!IMPORTANT]
95
+ > Keep this copy untouched. `madkit mod install` overwrites the levels in the game folder, so building from the game's own `Levels/` would stack mods on top of each other.
96
+
97
+ ### 3. Configure madkit
98
+
99
+ Tell `madkit` where the game is installed (once):
100
+
101
+ ```bash
102
+ madkit config --game-dir "C:/Games/Madagascar"
103
+ ```
104
+
105
+ This writes a `settings.toml` in the current folder, so run `madkit` from your modding folder. Use `--levels-dir` if your stock levels are somewhere other than `Levels/`.
106
+
107
+ ## Mods
108
+
109
+ Create a mod:
110
+
111
+ ```bash
112
+ madkit mod init my_mod --level kingofny
113
+ ```
114
+
115
+ This creates:
116
+
117
+ ```text
118
+ mods/my_mod/
119
+ mod.toml # name, description
120
+ build.py # @level(...) functions
121
+ assets/ # files the mod imports (.AI scripts, textures, ...)
122
+ ```
123
+
124
+ Each `@level` function receives the named levels, loaded from `Levels/<level>.stream`.
125
+ After all functions ran, every level they received is saved to `mods/my_mod/build/<level>.stream`.
126
+
127
+ ```python
128
+ from pathlib import Path
129
+
130
+ from madformats.mod import level
131
+ from madformats.stream import RW_StreamFile
132
+
133
+ ASSETS = Path(__file__).parent / "assets"
134
+
135
+ @level("kingofny")
136
+ def gold_coins(kingofny: RW_StreamFile) -> None:
137
+ kingofny.assetByName("DG_Coin_Collectable.AI").importFrom(ASSETS / "scripts/DG_Coin_Collectable.AI")
138
+
139
+ @level("kingofny") # stacked: runs once per level
140
+ @level("kingofny_regen")
141
+ def bigger_coins(lvl): ...
142
+
143
+ @level("street", "kingofny") # several names: one call with all levels
144
+ def alex_to_marty(street, kingofny): ...
145
+ ```
146
+
147
+ Build it, or build it and copy the levels into the game:
148
+
149
+ ```bash
150
+ madkit mod build my_mod # -> mods/my_mod/build/
151
+ madkit mod install my_mod # build + copy into <game folder>/Levels
152
+ ```
153
+
154
+ Back up the game's `Levels/` folder before installing mods, so you can restore the originals.
155
+
156
+ ## CLI
157
+
158
+ ```bash
159
+ madkit unpack LEVEL.stream output/directory/
160
+
161
+ madkit repack input/directory/ LEVEL.stream
162
+ ```
163
+
164
+ For more information run
165
+
166
+ ```bash
167
+ madkit --help
168
+ madkit COMMAND --help
169
+ ```
170
+
171
+ ## Tools
172
+
173
+ GUI tools are run as modules:
174
+
175
+ ```bash
176
+ python -m madkit.tools.stream LEVEL.stream # stream viewer
177
+ python -m madkit.tools.txd FILE.txd # texture viewer
178
+ python -m madkit.tools.analyze FILE # RenderWare file viewer
179
+ tfbeditor # TfbPseudo AI script editor
180
+ ```
181
+
182
+ ## Development
183
+
184
+ To work on madkit itself you need [uv](https://docs.astral.sh/uv/getting-started/installation/). Clone the repository and install the whole workspace:
185
+
186
+ ```bash
187
+ git clone https://github.com/MaxStache/madagascar-game-asset-tools.git
188
+ cd madagascar-game-asset-tools
189
+ uv sync
190
+ ```
191
+
192
+ The repository is a uv workspace with these packages, all installed in editable mode:
193
+
194
+ | Package | Path | Import |
195
+ | --- | --- | --- |
196
+ | `madkit` (CLI + tools) | `src/madkit/` | `madkit.cli`, `madkit.tools.*` |
197
+ | `madformats` (file formats) | `packages/madformats/` | `madformats` |
198
+ | `madlysimple` (modding helpers) | `packages/madlysimple/` | `madlysimple` |
199
+ | `tfbpseudo` (AI script compiler + editor) | `packages/tfbpseudo/` | `tfbpseudo` |
200
+ | `tfbscript` (.ai parser/decompiler, `tfbtool`) | `packages/tfbscript/` | `tfbscript` |
201
+
202
+ Each package under `packages/` has its own `pyproject.toml` and is published to PyPI on its own.
203
+
204
+ ## License
205
+
206
+ Apache-2.0. See [LICENSE](https://github.com/MaxStache/madagascar-game-asset-tools/blob/main/LICENSE).
207
+
208
+ ## Disclaimer
209
+
210
+ Unofficial fan project, not affiliated with or endorsed by DreamWorks,
211
+ Activision or Toys for Bob. No game assets are included, you need your own copy of the game.
madkit-0.1.3/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # Madagascar Asset Tools
2
+
3
+ ![Python >= 3.12](https://img.shields.io/badge/python-%3E%3D3.12-blue)
4
+
5
+ Loads `.stream .dff .txd .bsp .txl .rws .lpa`
6
+
7
+ `madkit` is a collection of tools for modding the game "Madagascar" (released in 2005): a CLI to unpack, repack and build mods for the game's level files, plus viewers for streams and textures.
8
+
9
+ ## Contents
10
+
11
+ - [Requirements](#requirements)
12
+ - [Getting started](#getting-started)
13
+ - [1. Create a modding folder](#1-create-a-modding-folder)
14
+ - [2. Copy the stock levels](#2-copy-the-stock-levels)
15
+ - [3. Configure madkit](#3-configure-madkit)
16
+ - [Mods](#mods)
17
+ - [CLI](#cli)
18
+ - [Tools](#tools)
19
+ - [Development](#development)
20
+
21
+ ## Requirements
22
+
23
+ - [Python >= 3.12](https://www.python.org/downloads/)
24
+ - Your own copy of the game
25
+
26
+ > [!NOTE]
27
+ >
28
+ > ## 🎥 Video Tutorials
29
+ >
30
+ > **[▶️ Madagascar Modding Tutorials – YouTube Playlist](https://www.youtube.com/playlist?list=PLbBnMoHCtodg)**
31
+
32
+ ## Getting started
33
+
34
+ ### 1. Create a modding folder
35
+
36
+ Make a folder for your mods with its own virtual environment, and install `madkit` and `madlysimple` into it:
37
+
38
+ ```bash
39
+ mkdir my-madagascar-mods
40
+ cd my-madagascar-mods
41
+ python -m venv .venv
42
+
43
+ # WINDOWS:
44
+ .venv\Scripts\activate
45
+ # LINUX/MACOS:
46
+ source .venv/bin/activate
47
+
48
+ pip install madkit madlysimple
49
+ ```
50
+
51
+ `madkit` is the CLI and tools, `madlysimple` the helpers you use in your mod scripts.
52
+
53
+ The environment stays active until you close the terminal. In every new terminal, `cd` into your modding folder and run the `activate` line again before using `madkit`.
54
+
55
+ To update later: `pip install --upgrade madkit madlysimple`.
56
+
57
+ ### 2. Copy the stock levels
58
+
59
+ Mods are built from the original `.stream` level files. Copy the game's `Levels/` folder into your modding folder:
60
+
61
+ ```text
62
+ my-madagascar-mods/
63
+ .venv/
64
+ Levels/ # copy of <game folder>/Levels, never modified
65
+ ```
66
+
67
+ > [!IMPORTANT]
68
+ > Keep this copy untouched. `madkit mod install` overwrites the levels in the game folder, so building from the game's own `Levels/` would stack mods on top of each other.
69
+
70
+ ### 3. Configure madkit
71
+
72
+ Tell `madkit` where the game is installed (once):
73
+
74
+ ```bash
75
+ madkit config --game-dir "C:/Games/Madagascar"
76
+ ```
77
+
78
+ This writes a `settings.toml` in the current folder, so run `madkit` from your modding folder. Use `--levels-dir` if your stock levels are somewhere other than `Levels/`.
79
+
80
+ ## Mods
81
+
82
+ Create a mod:
83
+
84
+ ```bash
85
+ madkit mod init my_mod --level kingofny
86
+ ```
87
+
88
+ This creates:
89
+
90
+ ```text
91
+ mods/my_mod/
92
+ mod.toml # name, description
93
+ build.py # @level(...) functions
94
+ assets/ # files the mod imports (.AI scripts, textures, ...)
95
+ ```
96
+
97
+ Each `@level` function receives the named levels, loaded from `Levels/<level>.stream`.
98
+ After all functions ran, every level they received is saved to `mods/my_mod/build/<level>.stream`.
99
+
100
+ ```python
101
+ from pathlib import Path
102
+
103
+ from madformats.mod import level
104
+ from madformats.stream import RW_StreamFile
105
+
106
+ ASSETS = Path(__file__).parent / "assets"
107
+
108
+ @level("kingofny")
109
+ def gold_coins(kingofny: RW_StreamFile) -> None:
110
+ kingofny.assetByName("DG_Coin_Collectable.AI").importFrom(ASSETS / "scripts/DG_Coin_Collectable.AI")
111
+
112
+ @level("kingofny") # stacked: runs once per level
113
+ @level("kingofny_regen")
114
+ def bigger_coins(lvl): ...
115
+
116
+ @level("street", "kingofny") # several names: one call with all levels
117
+ def alex_to_marty(street, kingofny): ...
118
+ ```
119
+
120
+ Build it, or build it and copy the levels into the game:
121
+
122
+ ```bash
123
+ madkit mod build my_mod # -> mods/my_mod/build/
124
+ madkit mod install my_mod # build + copy into <game folder>/Levels
125
+ ```
126
+
127
+ Back up the game's `Levels/` folder before installing mods, so you can restore the originals.
128
+
129
+ ## CLI
130
+
131
+ ```bash
132
+ madkit unpack LEVEL.stream output/directory/
133
+
134
+ madkit repack input/directory/ LEVEL.stream
135
+ ```
136
+
137
+ For more information run
138
+
139
+ ```bash
140
+ madkit --help
141
+ madkit COMMAND --help
142
+ ```
143
+
144
+ ## Tools
145
+
146
+ GUI tools are run as modules:
147
+
148
+ ```bash
149
+ python -m madkit.tools.stream LEVEL.stream # stream viewer
150
+ python -m madkit.tools.txd FILE.txd # texture viewer
151
+ python -m madkit.tools.analyze FILE # RenderWare file viewer
152
+ tfbeditor # TfbPseudo AI script editor
153
+ ```
154
+
155
+ ## Development
156
+
157
+ To work on madkit itself you need [uv](https://docs.astral.sh/uv/getting-started/installation/). Clone the repository and install the whole workspace:
158
+
159
+ ```bash
160
+ git clone https://github.com/MaxStache/madagascar-game-asset-tools.git
161
+ cd madagascar-game-asset-tools
162
+ uv sync
163
+ ```
164
+
165
+ The repository is a uv workspace with these packages, all installed in editable mode:
166
+
167
+ | Package | Path | Import |
168
+ | --- | --- | --- |
169
+ | `madkit` (CLI + tools) | `src/madkit/` | `madkit.cli`, `madkit.tools.*` |
170
+ | `madformats` (file formats) | `packages/madformats/` | `madformats` |
171
+ | `madlysimple` (modding helpers) | `packages/madlysimple/` | `madlysimple` |
172
+ | `tfbpseudo` (AI script compiler + editor) | `packages/tfbpseudo/` | `tfbpseudo` |
173
+ | `tfbscript` (.ai parser/decompiler, `tfbtool`) | `packages/tfbscript/` | `tfbscript` |
174
+
175
+ Each package under `packages/` has its own `pyproject.toml` and is published to PyPI on its own.
176
+
177
+ ## License
178
+
179
+ Apache-2.0. See [LICENSE](https://github.com/MaxStache/madagascar-game-asset-tools/blob/main/LICENSE).
180
+
181
+ ## Disclaimer
182
+
183
+ Unofficial fan project, not affiliated with or endorsed by DreamWorks,
184
+ Activision or Toys for Bob. No game assets are included, you need your own copy of the game.