<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DEVELOPMENT.md - fork/training-mode-ce @ master</title>
<meta name="description" content="DEVELOPMENT.md in fork/training-mode-ce at master.">
<meta property="og:title" content="DEVELOPMENT.md - fork/training-mode-ce @ master">
<meta property="og:description" content="DEVELOPMENT.md in fork/training-mode-ce at master.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="git.julia.blue">
<link rel="stylesheet" href="/css/style.css?v=62">
<script type="module" src="/js/main.js?v=62"></script>
</head>
<body>
<main data-ref="master" data-tip="042fd346162a34cda5017c394f566ae94f5282a7">
<noscript>
  <div class="callout">
    <p>
      hey! this is a static git repo viewer. commit diffs, file history,
      older commits and other revisions won't load without javascript.
    </p>
    <p>
      you are still able to view source files on branch/tag tips,
      but the experience is degraded.
    </p>
  </div>
</noscript>
<header class="repo"><div>
<h1>fork/training-mode-ce</h1>
</div>
<pre class="clone">git clone https://git.julia.blue/fork/training-mode-ce</pre>
</header>
<p class="snapshot-commit"><span class="commit-author">Alex Harrison</span><span class="commit-message" data-commit="b4752d6f4d7263c6c1f9eb778bda477f8f6ef024">remove docs message about no warnings</span><span class="snapshot-sha sha" data-commit="b4752d6f4d7263c6c1f9eb778bda477f8f6ef024">b4752d6</span><time datetime="2025-08-05T20:42:51-06:00" title="2025-08-05 20:42:51 -0600">2025-08-05</time></p>
<header class="topbar"><details class="switcher"><summary>master</summary><div class="menu"><strong>branches</strong><a class="current" href="/fork/training-mode-ce/ref/master/">master</a><a href="/fork/training-mode-ce/ref/nix/">nix</a><a href="/fork/training-mode-ce/ref/techchase-camera/">techchase-camera</a><a class="all" href="/fork/training-mode-ce/refs">all refs →</a></div></details><nav class="crumbs"><a href="/fork/training-mode-ce/">training-mode-ce</a> / <span class="cur">DEVELOPMENT.md</span></nav>
<span class="view-stats"><span>7.3 KiB</span><span>111 lines</span></span><span class="actions"><a class="raw" href="/fork/training-mode-ce/raw/26577114d5896637c7e74afe171390969992a6ea/DEVELOPMENT.md">raw</a></span></header>
<div class="markdown-view"><input type="radio" name="markdown-view" id="markdown-rendered" checked><label for="markdown-rendered">rendered</label><input type="radio" name="markdown-view" id="markdown-code"><label for="markdown-code">code</label><section class="readme rendered"><h1>Development</h1>
<p>Thanks for considering contributing to TM-CE!
I really appreciate all the help.
Melee is a pretty complicated game, but that doesn't make TM-CE hard to contribute to!
Here are a few things you should know before contributing.</p>
<p>First thing, <a href="https://discord.gg/2Khb8CVP7A">please join the discord</a>.
If you have any questions, feel free to ping me (Aitch) in the dev-discussion channel.</p>
<h2>Compilation</h2>
<h3>Windows</h3>
<ol>
<li><a href="https://github.com/devkitPro/installer/releases/latest">Install DevKitPro</a>. Install the Gamecube (aka PPC or PowerPC) package.</li>
<li>Run the 'windows_setup.bat' file.</li>
<li>Run the command <code>./build.sh path-to-melee.iso</code> in the console.</li>
</ol>
<h3>Linux / MacOS / WSL / MSYS2</h3>
<ol>
<li><a href="https://devkitpro.org/wiki/Getting_Started#Unix-like_platforms">Install DevKitPro</a>. Install the Gamecube (gamecube-dev) package.</li>
<li>Install xdelta3. This should be simple to install through your package manager.</li>
<li>Run the command <code>./build.sh path-to-melee.iso</code> in the console.
<ul>
<li>If the provided binaries fail (possibly due to libc issues), you can compile your own binaries from my repos:
<a href="https://github.com/AlexanderHarrison/gc_fst">gc_fst</a>, <a href="https://github.com/AlexanderHarrison/cdat">hmex</a>, <a href="https://github.com/AlexanderHarrison/hgecko">hgecko</a></li>
</ul>
</li>
</ol>
<h3>Build Mode</h3>
<p>The build script takes an optional additional mode argument called the mode - <code>build.sh iso [mode]</code>.
This allows building an optimized release, or fine-grained recompilation.
Examples:</p>
<ul>
<li><code>build.sh iso</code>: debug build from scratch. <strong>You probably want to use this</strong>.</li>
<li><code>build.sh iso release</code>: release build from scratch.</li>
<li><code>build.sh iso build/codes.gct</code>: only rebuild asm.</li>
<li><code>build.sh iso build/edgeguard.dat</code>: only rebuild edgeguard event. You can use any dat file here.</li>
</ul>
<h2>Project Structure</h2>
<p>There are four important directories to know about:</p>
<ol>
<li><code>src/</code>: this directory contains the source for the C events, as well as some setup code for the event in <code>events.c</code>.</li>
<li><code>MexTK/</code>:
<ul>
<li>The <code>include/</code> subdirectory contains headers for internal melee functions. Calling these will call native ssbm code.</li>
<li>The <code>MexTK</code> binary is the compiler executable, which takes in C source and spits out a dat file.</li>
<li>The <code>.txt</code> files contain symbols that we want called by the m-ex system.
For example, C events will want their <code>Event_Init</code> and <code>Event_Think</code> functions called.
We only use the evFunction and cssFunction modes.</li>
</ul>
</li>
<li><code>ASM/</code>: This huge directory contains gecko codes for various things like UCF, old events, OSDs, etc.
Every file has a injection address at the start.
When the game boots up, it will overwrite the instruction at that address and replace it with a branch to the asm contained in the file.
The <code>.asm</code> files will be injected and run, while the <code>.s</code> files contain include macros and will not be assembled by hgecko.</li>
<li><code>dats/</code>: The dat file format is used by SSBM for storing data, such as models and animations.
This directory contains HUD models and animations for events.
You will need to use <a href="https://github.com/Ploaj/HSDLib">HSDRawViewer</a> to view these.</li>
</ol>
<h2>Melee Stuff</h2>
<h3>HSDRaw and Dat Files</h3>
<p><a href="https://github.com/doldecomp/melee/blob/master/src/sysdolphin/baselib/archive.c">A dat file, or an HSD_Archive</a> is the file format for data in ssbm.
Everything is stored in dat files - models, animations, code, textures, etc. Only cutscenes and music are stored differently.</p>
<p><a href="https://github.com/Ploaj/HSDLib">You can open, view, and edit dat files with HSDRawViewer</a>.</p>
<p>The <code>dats/</code> directory contains some of these files.
They contain event specific objects, mostly menu models with some random other data.</p>
<h3>Objects</h3>
<ul>
<li><strong>GOBJ</strong> - game object. This is a very generic object.
They can have a model, an update function (think function in melee), pointer to arbitrary data, etc.
Most everything is a GOBJ.</li>
<li><strong>JOBJ/JOBJDesc</strong> - joint object (models).
Each JOBJ has a sibling and a child, forming a tree of joints.
Each joint can have a DOBJ, forming a large tree of models.
Technically, HSDRaw only deals with JOBJDescs, as JOBJs are only created at runtime from a JOBJDesc.
However, it calls them JOBJs for whatever reason. So JOBJDescs in training mode are JOBJs in HSDraw.
This same pattern holds for a lot (but not all!) HSDRaw objects.
Almost every object in the training mode dat files are JOBJDescs (node will be 0x40 in length).
You'll need to right click on the node -&gt; Open As -&gt; JOBJ in HSDRaw in order to view the model.</li>
<li><strong>DOBJ</strong> - display object. These contain meshes, textures, a material, etc.</li>
<li><strong>MOBJ</strong> - material object. Lots of stuff here, but I don't know much about them.</li>
<li><strong>HSD_Material</strong>. This contains colouring information. Most objects are coloured by setting the diffuse field in these.</li>
<li><strong>TOBJ</strong> - texture object. Images that will be displayed on a mesh.</li>
<li><strong>POBJ</strong> - polygon object. Contains a mesh.</li>
</ul>
<h2>How To Do Things</h2>
<ul>
<li>If you want to alter an event written in C (easy):
<ul>
<li>The training lab, lcancel, ledgedash, wavedash, edgeguard, and powershield events are written in c.
This makes them much easier to modify than the other events. Poke around in their source in <code>src/</code>.</li>
</ul>
</li>
<li>If you want to alter an event written in asm (big knowledge check):
<ul>
<li>You will need to know a bit of Power PC asm.</li>
<li>Read <code>ASM/Readme.md</code></li>
<li>Go to <code>ASM/training-mode/Custom Events/Custom Event Code - Rewrite.asm</code> and search for the event you want to modify.</li>
<li>These will A LOT trickier to modify than the other events. Prefer making a new event or modifying the lab.</li>
<li>There are a lot of random loads from random offsets there. Grep for that address in MexTK/include to see where it points.
Feel free to put a comment there indicating the source!</li>
</ul>
</li>
<li>If you want to make a new event (tricky, but super flexible):
<ul>
<li>Add a file and header to the <code>src/</code>.</li>
<li>Add the <code>EventDesc</code> and <code>EventMatchData</code> structs to <code>events.c</code> and add a reference to them in the <code>General_Events</code>, <code>Minigames_Events</code>, or <code>Spacie_Events</code> array.</li>
<li>Implement the <code>Event_Init</code>, <code>Event_Update</code>, <code>Event_Think</code> methods and <code>Event_Menu</code> pointer in your c file.</li>
<li>Add the required compilation steps in <code>build.sh</code>. Follow the same structure as the other events. You can skip the dat copy if you don't have any models attached to the event (you won't), like the powershield event.
Poke around the other events to figure out how to implement these.
The powershield event is the simplest and easiest to learn from.</li>
</ul>
</li>
<li>If you want to create a new OSD (hard):
<ul>
<li>You will need to know a lot of Power PC asm.</li>
<li>You will need to find the function that does the processing of the value you want to measure (reach out to me if you're not sure how to find this).</li>
<li>Create and write an asm file for the new OSD in <code>ASM/training-mode/Onscreen Display/</code>.</li>
<li>Add the OSD to the OSD list in <code>ASM/training-mode/Globals.s</code>. OSD ids are weird, I don't know exactly how to do this.</li>
</ul>
</li>
</ul>
<h2>Debugging Tips</h2>
<ul>
<li>Development builds enable logging! Call <code>TMLOG(...)</code> to print to the dolphin console and the onscreen console. L/R+Z toggles console visibility.</li>
<li><strong>Use the dolphin debugger!</strong> Make sure you have the latest version of dolphin for debugging.
<ul>
<li>To set a breakpoint, use the <code>bp()</code> fn call in C or the <code>SetBreakpoint</code> macro in ASM (which will clobber r3). Then when you boot up dolphin, put a breakpoint on the <code>bp</code> symbol.</li>
<li><strong>Be sure to load GTME01.map with Symbols-&gt;Load Other Map File!</strong>. Or copy it to the Maps/ directory in the dolphin data directory.</li>
</ul>
</li>
</ul>
</section><div class="code-panel"><pre class="code src language-markdown"><span class="code-line"><a class="ln" id="L1" href="#L1">1</a><span class="code-text"><a-p>#</a-p> <a-tt>Development</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L2" href="#L2">2</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L3" href="#L3">3</a><span class="code-text">Thanks for considering contributing to TM-CE!</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L4" href="#L4">4</a><span class="code-text">I really appreciate all the help.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L5" href="#L5">5</a><span class="code-text">Melee is a pretty complicated game, but that doesn&#39;t make TM-CE hard to contribute to!</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L6" href="#L6">6</a><span class="code-text">Here are a few things you should know before contributing.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L7" href="#L7">7</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L8" href="#L8">8</a><span class="code-text">First thing, [please join the discord](https://discord.gg/2Khb8CVP7A).</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L9" href="#L9">9</a><span class="code-text">If you have any questions, feel free to ping me (Aitch) in the dev-discussion channel.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L10" href="#L10">10</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L11" href="#L11">11</a><span class="code-text"><a-p>##</a-p> <a-tt>Compilation</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L12" href="#L12">12</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L13" href="#L13">13</a><span class="code-text"><a-p>###</a-p> <a-tt>Windows</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L14" href="#L14">14</a><span class="code-text"><a-p>1. </a-p>[Install DevKitPro](https://github.com/devkitPro/installer/releases/latest). Install the Gamecube (aka PPC or PowerPC) package.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L15" href="#L15">15</a><span class="code-text"><a-p>2. </a-p>Run the &#39;windows_setup.bat&#39; file.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L16" href="#L16">16</a><span class="code-text"><a-p>3. </a-p>Run the command `./build.sh path-to-melee.iso` in the console.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L17" href="#L17">17</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L18" href="#L18">18</a><span class="code-text"><a-p>### </a-p><a-tt>Linux / MacOS / WSL / MSYS2</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L19" href="#L19">19</a><span class="code-text"><a-p>1. [Install DevKitPro](https://devkitpro.org/wiki/Getting_Started#Unix-like_platforms). Install the Gamecube (gamecube-dev) package.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L20" href="#L20">20</a><span class="code-text"><a-p>2. Install xdelta3. This should be simple to install through your package manager.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L21" href="#L21">21</a><span class="code-text"><a-p>3. Run the command `./build.sh path-to-melee.iso` in the console.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L22" href="#L22">22</a><span class="code-text"><a-p>    - If the provided binaries fail (possibly due to libc issues), you can compile your own binaries from my repos:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L23" href="#L23">23</a><span class="code-text"><a-p>[gc_fst](https://github.com/AlexanderHarrison/gc_fst), [hmex](https://github.com/AlexanderHarrison/cdat), [hgecko](https://github.com/AlexanderHarrison/hgecko)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L24" href="#L24">24</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L25" href="#L25">25</a><span class="code-text"><a-p>### </a-p><a-tt>Build Mode</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L26" href="#L26">26</a><span class="code-text"><a-p>The build script takes an optional additional mode argument called the mode - `build.sh iso [mode]`.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L27" href="#L27">27</a><span class="code-text"><a-p>This allows building an optimized release, or fine-grained recompilation.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L28" href="#L28">28</a><span class="code-text"><a-p>Examples:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L29" href="#L29">29</a><span class="code-text"><a-p>- `build.sh iso`: debug build from scratch. **You probably want to use this**.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L30" href="#L30">30</a><span class="code-text"><a-p>- `build.sh iso release`: release build from scratch.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L31" href="#L31">31</a><span class="code-text"><a-p>- `build.sh iso build/codes.gct`: only rebuild asm.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L32" href="#L32">32</a><span class="code-text"><a-p>- `build.sh iso build/edgeguard.dat`: only rebuild edgeguard event. You can use any dat file here.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L33" href="#L33">33</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L34" href="#L34">34</a><span class="code-text"><a-p>## </a-p><a-tt>Project Structure</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L35" href="#L35">35</a><span class="code-text"><a-p>There are four important directories to know about:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L36" href="#L36">36</a><span class="code-text"><a-p>1. `src/`: this directory contains the source for the C events, as well as some setup code for the event in `events.c`.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L37" href="#L37">37</a><span class="code-text"><a-p>2. `MexTK/`:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L38" href="#L38">38</a><span class="code-text"><a-p>    - The `include/` subdirectory contains headers for internal melee functions. Calling these will call native ssbm code.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L39" href="#L39">39</a><span class="code-text"><a-p>    - The `MexTK` binary is the compiler executable, which takes in C source and spits out a dat file.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L40" href="#L40">40</a><span class="code-text"><a-p>    - The `.txt` files contain symbols that we want called by the m-ex system.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L41" href="#L41">41</a><span class="code-text"><a-p>        For example, C events will want their `Event_Init` and `Event_Think` functions called.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L42" href="#L42">42</a><span class="code-text"><a-p>        We only use the evFunction and cssFunction modes.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L43" href="#L43">43</a><span class="code-text"><a-p>3. `ASM/`: This huge directory contains gecko codes for various things like UCF, old events, OSDs, etc.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L44" href="#L44">44</a><span class="code-text"><a-p>Every file has a injection address at the start.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L45" href="#L45">45</a><span class="code-text"><a-p>When the game boots up, it will overwrite the instruction at that address and replace it with a branch to the asm contained in the file.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L46" href="#L46">46</a><span class="code-text"><a-p>The `.asm` files will be injected and run, while the `.s` files contain include macros and will not be assembled by hgecko.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L47" href="#L47">47</a><span class="code-text"><a-p>4. `dats/`: The dat file format is used by SSBM for storing data, such as models and animations.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L48" href="#L48">48</a><span class="code-text"><a-p>This directory contains HUD models and animations for events.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L49" href="#L49">49</a><span class="code-text"><a-p>You will need to use [HSDRawViewer](https://github.com/Ploaj/HSDLib) to view these.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L50" href="#L50">50</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L51" href="#L51">51</a><span class="code-text"><a-p>## </a-p><a-tt>Melee Stuff</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L52" href="#L52">52</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L53" href="#L53">53</a><span class="code-text"><a-p>### </a-p><a-tt>HSDRaw and Dat Files</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L54" href="#L54">54</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L55" href="#L55">55</a><span class="code-text"><a-p>[A dat file, or an HSD_Archive](https://github.com/doldecomp/melee/blob/master/src/sysdolphin/baselib/archive.c) is the file format for data in ssbm.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L56" href="#L56">56</a><span class="code-text"><a-p>Everything is stored in dat files - models, animations, code, textures, etc. Only cutscenes and music are stored differently.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L57" href="#L57">57</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L58" href="#L58">58</a><span class="code-text"><a-p>[You can open, view, and edit dat files with HSDRawViewer](https://github.com/Ploaj/HSDLib).</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L59" href="#L59">59</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L60" href="#L60">60</a><span class="code-text"><a-p>The `dats/` directory contains some of these files.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L61" href="#L61">61</a><span class="code-text"><a-p>They contain event specific objects, mostly menu models with some random other data.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L62" href="#L62">62</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L63" href="#L63">63</a><span class="code-text"><a-p>### </a-p><a-tt>Objects</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L64" href="#L64">64</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L65" href="#L65">65</a><span class="code-text"><a-p>- **GOBJ** - game object. This is a very generic object.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L66" href="#L66">66</a><span class="code-text"><a-p>They can have a model, an update function (think function in melee), pointer to arbitrary data, etc.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L67" href="#L67">67</a><span class="code-text"><a-p>Most everything is a GOBJ.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L68" href="#L68">68</a><span class="code-text"><a-p>- **JOBJ/JOBJDesc** - joint object (models).</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L69" href="#L69">69</a><span class="code-text"><a-p>Each JOBJ has a sibling and a child, forming a tree of joints.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L70" href="#L70">70</a><span class="code-text"><a-p>Each joint can have a DOBJ, forming a large tree of models.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L71" href="#L71">71</a><span class="code-text"><a-p>Technically, HSDRaw only deals with JOBJDescs, as JOBJs are only created at runtime from a JOBJDesc.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L72" href="#L72">72</a><span class="code-text"><a-p>However, it calls them JOBJs for whatever reason. So JOBJDescs in training mode are JOBJs in HSDraw.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L73" href="#L73">73</a><span class="code-text"><a-p>This same pattern holds for a lot (but not all!) HSDRaw objects.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L74" href="#L74">74</a><span class="code-text"><a-p>Almost every object in the training mode dat files are JOBJDescs (node will be 0x40 in length).</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L75" href="#L75">75</a><span class="code-text"><a-p>You&#39;ll need to right click on the node -&gt; Open As -&gt; JOBJ in HSDRaw in order to view the model.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L76" href="#L76">76</a><span class="code-text"><a-p>- **DOBJ** - display object. These contain meshes, textures, a material, etc.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L77" href="#L77">77</a><span class="code-text"><a-p>- **MOBJ** - material object. Lots of stuff here, but I don&#39;t know much about them.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L78" href="#L78">78</a><span class="code-text"><a-p>- **HSD_Material**. This contains colouring information. Most objects are coloured by setting the diffuse field in these.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L79" href="#L79">79</a><span class="code-text"><a-p>- **TOBJ** - texture object. Images that will be displayed on a mesh.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L80" href="#L80">80</a><span class="code-text"><a-p>- **POBJ** - polygon object. Contains a mesh.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L81" href="#L81">81</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L82" href="#L82">82</a><span class="code-text"><a-p>## </a-p><a-tt>How To Do Things</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L83" href="#L83">83</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L84" href="#L84">84</a><span class="code-text"><a-p>- If you want to alter an event written in C (easy):</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L85" href="#L85">85</a><span class="code-text"><a-p>    - The training lab, lcancel, ledgedash, wavedash, edgeguard, and powershield events are written in c.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L86" href="#L86">86</a><span class="code-text"><a-p>    This makes them much easier to modify than the other events. Poke around in their source in `src/`.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L87" href="#L87">87</a><span class="code-text"><a-p>- If you want to alter an event written in asm (big knowledge check):</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L88" href="#L88">88</a><span class="code-text"><a-p>    - You will need to know a bit of Power PC asm.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L89" href="#L89">89</a><span class="code-text"><a-p>    - Read `ASM/Readme.md`</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L90" href="#L90">90</a><span class="code-text"><a-p>    - Go to `ASM/training-mode/Custom Events/Custom Event Code - Rewrite.asm` and search for the event you want to modify.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L91" href="#L91">91</a><span class="code-text"><a-p>    - These will A LOT trickier to modify than the other events. Prefer making a new event or modifying the lab.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L92" href="#L92">92</a><span class="code-text"><a-p>    - There are a lot of random loads from random offsets there. Grep for that address in MexTK/include to see where it points.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L93" href="#L93">93</a><span class="code-text"><a-p>    Feel free to put a comment there indicating the source!</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L94" href="#L94">94</a><span class="code-text"><a-p>- If you want to make a new event (tricky, but super flexible):</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L95" href="#L95">95</a><span class="code-text"><a-p>    - Add a file and header to the `src/`.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L96" href="#L96">96</a><span class="code-text"><a-p>    - Add the `EventDesc` and `EventMatchData` structs to `events.c` and add a reference to them in the `General_Events`, `Minigames_Events`, or `Spacie_Events` array.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L97" href="#L97">97</a><span class="code-text"><a-p>    - Implement the `Event_Init`, `Event_Update`, `Event_Think` methods and `Event_Menu` pointer in your c file.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L98" href="#L98">98</a><span class="code-text"><a-p>    - Add the required compilation steps in `build.sh`. Follow the same structure as the other events. You can skip the dat copy if you don&#39;t have any models attached to the event (you won&#39;t), like the powershield event.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L99" href="#L99">99</a><span class="code-text"><a-p>Poke around the other events to figure out how to implement these.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L100" href="#L100">100</a><span class="code-text"><a-p>The powershield event is the simplest and easiest to learn from.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L101" href="#L101">101</a><span class="code-text"><a-p>- If you want to create a new OSD (hard):</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L102" href="#L102">102</a><span class="code-text"><a-p>    - You will need to know a lot of Power PC asm.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L103" href="#L103">103</a><span class="code-text"><a-p>    - You will need to find the function that does the processing of the value you want to measure (reach out to me if you&#39;re not sure how to find this).</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L104" href="#L104">104</a><span class="code-text"><a-p>    - Create and write an asm file for the new OSD in `ASM/training-mode/Onscreen Display/`.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L105" href="#L105">105</a><span class="code-text"><a-p>    - Add the OSD to the OSD list in `ASM/training-mode/Globals.s`. OSD ids are weird, I don&#39;t know exactly how to do this.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L106" href="#L106">106</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L107" href="#L107">107</a><span class="code-text"><a-p>## </a-p><a-tt>Debugging Tips</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L108" href="#L108">108</a><span class="code-text"><a-p>- Development builds enable logging! Call `TMLOG(...)` to print to the dolphin console and the onscreen console. L/R+Z toggles console visibility.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L109" href="#L109">109</a><span class="code-text"><a-p>- **Use the dolphin debugger!** Make sure you have the latest version of dolphin for debugging.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L110" href="#L110">110</a><span class="code-text"><a-p>    - To set a breakpoint, use the `bp()` fn call in C or the `SetBreakpoint` macro in ASM (which will clobber r3). Then when you boot up dolphin, put a breakpoint on the `bp` symbol.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L111" href="#L111">111</a><span class="code-text"><a-p>    - </a-p>**Be sure to load GTME01.map with Symbols-&gt;Load Other Map File!**. Or copy it to the Maps/ directory in the dolphin data directory.</span></span></pre></div></div>
</main>
</body>
</html>
