<trclass="memdesc:ac5f04297153c2e445330e5cc103e8589"><tdclass="mdescLeft"> </td><tdclass="mdescRight">the explicit constructor for the <aclass="el"href="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html"title="the main class responsible for recomposition">recomp_t</a> class. <ahref="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html#ac5f04297153c2e445330e5cc103e8589">More...</a><br/></td></tr>
<trclass="memdesc:a78502665e218d3addca9b1e5e3875f39"><tdclass="mdescLeft"> </td><tdclass="mdescRight">when called, this function allocates space for every symbol. <ahref="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html#a78502665e218d3addca9b1e5e3875f39">More...</a><br/></td></tr>
<trclass="memdesc:a299fbede378f04991df2e39293307094"><tdclass="mdescLeft"> </td><tdclass="mdescRight">when called, this function resolves all relocations in every symbol. <ahref="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html#a299fbede378f04991df2e39293307094">More...</a><br/></td></tr>
<trclass="memdesc:a080d88f122d12faf2e328c9bdd10be6e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">when called, this function copies symbols into allocations. <ahref="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html#a080d88f122d12faf2e328c9bdd10be6e">More...</a><br/></td></tr>
<trclass="memdesc:a0da9a904b0057c14190218592aff0f07"><tdclass="mdescLeft"> </td><tdclass="mdescRight">setter for the allocater lambda function. <ahref="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html#a0da9a904b0057c14190218592aff0f07">More...</a><br/></td></tr>
<trclass="memdesc:aa6fecf752d4c5bc211e164d8496724b1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">setter for the copier lambda function. <ahref="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html#aa6fecf752d4c5bc211e164d8496724b1">More...</a><br/></td></tr>
<trclass="memdesc:a1be6d0cdb57565c31b138248c8b2d470"><tdclass="mdescLeft"> </td><tdclass="mdescRight">setter for the resolve lambda function. <ahref="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html#a1be6d0cdb57565c31b138248c8b2d470">More...</a><br/></td></tr>
<trclass="memdesc:ae0c56f0f8af33b390e4123509523602c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">resolves the address of a function given its name. <ahref="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html#ae0c56f0f8af33b390e4123509523602c">More...</a><br/></td></tr>
<divclass="textblock"><p>the main class responsible for recomposition </p>
<pclass="definition">Definition at line <aclass="el"href="../../d4/d4a/recomp_8hpp_source.html#l00064">64</a> of file <aclass="el"href="../../d4/d4a/recomp_8hpp_source.html">recomp.hpp</a>.</p>
<p>the explicit constructor for the <aclass="el"href="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html"title="the main class responsible for recomposition">recomp_t</a> class. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">dcmp</td><td>pointer to a decomp_t class.</td></tr>
<tr><tdclass="paramname">alloc</td><td>lambda function which is used to allocate memory for symbols.</td></tr>
<tr><tdclass="paramname">copy</td><td>lambda function used to copy bytes into allocations.</td></tr>
<tr><tdclass="paramname">resolve</td><td>lambda function used to resolve external symbols.</td></tr>
<pclass="definition">Definition at line <aclass="el"href="../../db/d55/recomp_8cpp_source.html#l00034">34</a> of file <aclass="el"href="../../db/d55/recomp_8cpp_source.html">recomp.cpp</a>.</p>
<divclass="fragment"><divclass="line"><spanclass="lineno"> 38</span> : m_dcmp(dcmp), m_allocator(alloc), m_copier(copy), m_resolver(<aclass="code hl_function"href="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html#a299fbede378f04991df2e39293307094"title="when called, this function resolves all relocations in every symbol.">resolve</a>) {}</div>
<pclass="definition">Definition at line <aclass="el"href="../../db/d55/recomp_8cpp_source.html#l00040">40</a> of file <aclass="el"href="../../db/d55/recomp_8cpp_source.html">recomp.cpp</a>.</p>
<divclass="line"><spanclass="lineno"> 43</span> m_dcmp-><aclass="code hl_function"href="../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120"title="gets the symbol table.">syms</a>()-><aclass="code hl_function"href="../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html#a35008ba37814a94209cf979302e13e6d"title="this function is a wrapper function that allows you to get at each entry in the symbol table by refer...">for_each</a>([&](<aclass="code hl_class"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html"title="symbol_t is an abstraction upon the coff symbol. this allows for easier manipulation of the symbol....">theo::decomp::symbol_t</a>& sym) {</div>
<divclass="line"><spanclass="lineno"> 44</span><spanclass="keywordflow">switch</span> (sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#a16587cddd37cd45d9ec6cd25c229e8d1"title="returns the type of the symbol.">type</a>()) {</div>
<divclass="line"><spanclass="lineno"> 45</span> case decomp::sym_type_t::section:</div>
<divclass="line"><spanclass="lineno"> 46</span> case decomp::sym_type_t::function:</div>
<divclass="line"><spanclass="lineno"> 47</span> case decomp::sym_type_t::instruction: {</div>
<divclass="line"><spanclass="lineno"> 58</span> m_dcmp-><aclass="code hl_function"href="../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120"title="gets the symbol table.">syms</a>()-><aclass="code hl_function"href="../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html#a35008ba37814a94209cf979302e13e6d"title="this function is a wrapper function that allows you to get at each entry in the symbol table by refer...">for_each</a>([&](<aclass="code hl_class"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html"title="symbol_t is an abstraction upon the coff symbol. this allows for easier manipulation of the symbol....">theo::decomp::symbol_t</a>& sym) {</div>
<divclass="line"><spanclass="lineno"> 59</span><spanclass="keywordflow">if</span> (sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#a16587cddd37cd45d9ec6cd25c229e8d1"title="returns the type of the symbol.">type</a>() == <aclass="code hl_enumvalue"href="../../d9/dbd/namespacetheo_1_1decomp.html#af96177687d0ad683c5897d8fa01135f9acdb885c0ea7f6b2874224487c69b8112">decomp::sym_type_t::data</a>) {</div>
<divclass="line"><spanclass="lineno"> 60</span><spanclass="comment">// if the symbol has a section then we will refer to the allocation made</span></div>
<divclass="line"><spanclass="lineno"> 61</span><spanclass="comment">// for that section...</span></div>
<divclass="line"><spanclass="lineno"> 67</span> if (!scn_sym.has_value()) {</div>
<divclass="line"><spanclass="lineno"> 68</span> spdlog::error(<spanclass="stringliteral">"failed to locate section: {} for symbol: {}"</span>,</div>
<divclass="line"><spanclass="lineno"> 75</span> } <spanclass="keywordflow">else</span> { <spanclass="comment">// else if there is no section then we allocate based upon the</span></div>
<divclass="line"><spanclass="lineno"> 76</span><spanclass="comment">// size of the symbol... this is only done for symbols that are</span></div>
<divclass="line"><spanclass="lineno"> 86</span> sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#ae92f3e35fba82a1d16a58ad09b39fb47"title="returns the address where the symbol is allocated.">allocated_at</a>(m_allocator(sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#ae33f1452b01fe80f9c384241b9fe6286"title="returns the size of the symbol.">size</a>(), sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#a64d51dabe91687ed40c3942d106fd7dd"title="gets the section header of the section in which the symbol is contained.">scn</a>()->characteristics));</div>
<pclass="reference">References <aclass="el"href="../../da/d0c/symbol__table_8cpp_source.html#l00049">theo::recomp::symbol_table_t::for_each()</a>, <aclass="el"href="../../dc/d83/decomp_8cpp_source.html#l00293">theo::decomp::decomp_t::syms()</a>, and <aclass="el"href="../../d8/d67/symbol_8cpp_source.html#l00080">theo::decomp::symbol_t::type()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="../../d2/d26/theo_8cpp_source.html#l00056">theo::theo_t::compose()</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="../../db/d55/recomp_8cpp_source.html#l00163">163</a> of file <aclass="el"href="../../db/d55/recomp_8cpp_source.html">recomp.cpp</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="../../db/d55/recomp_8cpp_source.html#l00167">167</a> of file <aclass="el"href="../../db/d55/recomp_8cpp_source.html">recomp.cpp</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="../../db/d55/recomp_8cpp_source.html#l00155">155</a> of file <aclass="el"href="../../db/d55/recomp_8cpp_source.html">recomp.cpp</a>.</p>
<divclass="line"><spanclass="lineno"> 158</span> m_dcmp-><aclass="code hl_function"href="../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120"title="gets the symbol table.">syms</a>()-><aclass="code hl_function"href="../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html#a35008ba37814a94209cf979302e13e6d"title="this function is a wrapper function that allows you to get at each entry in the symbol table by refer...">for_each</a>([&](<aclass="code hl_class"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html"title="symbol_t is an abstraction upon the coff symbol. this allows for easier manipulation of the symbol....">theo::decomp::symbol_t</a>& sym) {</div>
<divclass="line"><spanclass="lineno"> 159</span> m_copier(sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#ae92f3e35fba82a1d16a58ad09b39fb47"title="returns the address where the symbol is allocated.">allocated_at</a>(), sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#aa3ecf0b480d10bffe68812409c06d61b"title="returns a vector by reference of bytes containing the data of the symbol.">data</a>().data(), sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#aa3ecf0b480d10bffe68812409c06d61b"title="returns a vector by reference of bytes containing the data of the symbol.">data</a>().size());</div>
<pclass="reference">References <aclass="el"href="../../d8/d67/symbol_8cpp_source.html#l00060">theo::decomp::symbol_t::allocated_at()</a>, and <aclass="el"href="../../d8/d67/symbol_8cpp_source.html#l00076">theo::decomp::symbol_t::data()</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="../../d2/d26/theo_8cpp_source.html#l00056">theo::theo_t::compose()</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="../../db/d55/recomp_8cpp_source.html#l00092">92</a> of file <aclass="el"href="../../db/d55/recomp_8cpp_source.html">recomp.cpp</a>.</p>
<divclass="line"><spanclass="lineno"> 95</span> m_dcmp-><aclass="code hl_function"href="../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120"title="gets the symbol table.">syms</a>()-><aclass="code hl_function"href="../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html#a35008ba37814a94209cf979302e13e6d"title="this function is a wrapper function that allows you to get at each entry in the symbol table by refer...">for_each</a>([&](<aclass="code hl_class"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html"title="symbol_t is an abstraction upon the coff symbol. this allows for easier manipulation of the symbol....">theo::decomp::symbol_t</a>& sym) {</div>
<divclass="line"><spanclass="lineno"> 96</span><spanclass="keyword">auto</span>& relocs = sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#abc158e1dc1567161f0a57ed15fc718f7"title="returns a vector of relocations.">relocs</a>();</div>
<divclass="line"><spanclass="lineno"> 100</span><spanclass="stringliteral">"invalid relocation... writing outside of symbol length... offset: "</span></div>
<divclass="line"><spanclass="lineno"> 107</span><spanclass="comment">// try and resolve the symbol by refering to the internal symbol table</span></div>
<divclass="line"><spanclass="lineno"> 108</span><spanclass="comment">// first... if there is no symbol then refer to the resolver...</span></div>
<divclass="line"><spanclass="lineno"> 110</span><spanclass="keyword">auto</span> reloc_sym = m_dcmp-><aclass="code hl_function"href="../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120"title="gets the symbol table.">syms</a>()-><aclass="code hl_function"href="../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html#a308c0dbcc4d569467e0986b32ef30db5"title="returns an optional pointer to a symbol from the symbol table given the symbols hash (hash of its nam...">sym_from_hash</a>(reloc.hash());</div>
<divclass="line"><spanclass="lineno"> 115</span> if (!allocated_at) {</div>
<divclass="line"><spanclass="lineno"> 116</span> spdlog::error(<spanclass="stringliteral">"failed to resolve reloc from symbol: {} to symbol: {}"</span>,</div>
<divclass="line"><spanclass="lineno"> 117</span> sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#a7c6dee036291ded334aa10d89293fc2a"title="gets the name of the symbol.">name</a>(), reloc.name());</div>
<divclass="line"><spanclass="lineno"> 122</span><spanclass="keywordflow">switch</span> (sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#a16587cddd37cd45d9ec6cd25c229e8d1"title="returns the type of the symbol.">type</a>()) {</div>
<divclass="line"><spanclass="lineno"> 125</span> m_dcmp-><aclass="code hl_function"href="../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120"title="gets the symbol table.">syms</a>()-><aclass="code hl_function"href="../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html#a308c0dbcc4d569467e0986b32ef30db5"title="returns an optional pointer to a symbol from the symbol table given the symbols hash (hash of its nam...">sym_from_hash</a>(m_dcmp-><aclass="code hl_function"href="../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a860dddc3a5d12231b685dbaa12a0db06"title="gets the section hash table section header --> hash of the section header ptr.">scn_hash_tbl</a>()[sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#a64d51dabe91687ed40c3942d106fd7dd"title="gets the section header of the section in which the symbol is contained.">scn</a>()]);</div>
<divclass="line"><spanclass="lineno"> 132</span> *<spanclass="keyword">reinterpret_cast<</span>std::uintptr_t*<spanclass="keyword">></span>(sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#aa3ecf0b480d10bffe68812409c06d61b"title="returns a vector by reference of bytes containing the data of the symbol.">data</a>().data() +</div>
<divclass="line"><spanclass="lineno"> 144</span> *<spanclass="keyword">reinterpret_cast<</span>std::uintptr_t*<spanclass="keyword">></span>(sym.<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#aa3ecf0b480d10bffe68812409c06d61b"title="returns a vector by reference of bytes containing the data of the symbol.">data</a>().data() +</div>
<pclass="definition">Definition at line <aclass="el"href="../../db/d55/recomp_8cpp_source.html#l00175">175</a> of file <aclass="el"href="../../db/d55/recomp_8cpp_source.html">recomp.cpp</a>.</p>
<divclass="line"><spanclass="lineno"> 176</span><spanclass="keyword">auto</span> res = m_dcmp-><aclass="code hl_function"href="../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120"title="gets the symbol table.">syms</a>()-><aclass="code hl_function"href="../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html#a308c0dbcc4d569467e0986b32ef30db5"title="returns an optional pointer to a symbol from the symbol table given the symbols hash (hash of its nam...">sym_from_hash</a>(<aclass="code hl_function"href="../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#a8695d75670cc4d61d275464e9109ff06"title="gets the hash of the symbol name.">decomp::symbol_t::hash</a>(sym));</div>
<pclass="definition">Definition at line <aclass="el"href="../../db/d55/recomp_8cpp_source.html#l00171">171</a> of file <aclass="el"href="../../db/d55/recomp_8cpp_source.html">recomp.cpp</a>.</p>
<divclass="line"><spanclass="lineno"> 172</span> m_resolver = <aclass="code hl_function"href="../../d5/d05/classtheo_1_1recomp_1_1recomp__t.html#a299fbede378f04991df2e39293307094"title="when called, this function resolves all relocations in every symbol.">resolve</a>;</div>