Files
N64FlashcartMenu/datel__codes_8h_source.html
2025-11-26 01:10:51 +00:00

163 lines
16 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>N64FlashcartMenu: datel_codes.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">N64FlashcartMenu
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search',false);
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_1a56cc8cdc1689899910be5fa4716ee4.html">menu</a></li> </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
<div class="headertitle"><div class="title">datel_codes.h</div></div>
</div><!--header-->
<div class="contents">
<a href="datel__codes_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="preprocessor">#ifndef DATEL_CODES_H__</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#define DATEL_CODES_H__</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="preprocessor">#include &lt;stdbool.h&gt;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="preprocessor">#include &lt;stdint.h&gt;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="preprocessor">#include &lt;stddef.h&gt;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> </div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="comment">// The maximum number of cheat codes to support is dependent on the available space in the N64 RAM.</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="comment">// However, for simplicity, we will hardcode it to 64 for now, as this number of codes should handle most games (keeping it low allows us to collect caveats).</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="comment">// The Krikzz official menu only supports upto 34 codes, so this is already an improvement.</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#define MAX_CHEAT_CODES (64) </span><span class="comment">// Maximum number of cheat codes to support. This can be changed later if needed.</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#define MAX_CHEAT_CODE_ARRAYLIST_SIZE (MAX_CHEAT_CODES * 2 + 2) </span><span class="comment">// Maximum size of the cheat code list (address/value pairs + two trailing zeros)</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> </div>
<div class="foldopen" id="foldopen00021" data-start="{" data-end="};">
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"><a class="line" href="datel__codes_8h.html"> 21</a></span><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="datel__codes_8h.html#a8f5dd3b35d8a73d609a3daa7f8c5f21a"> 22</a></span> uint32_t <a class="code hl_variable" href="datel__codes_8h.html#a8f5dd3b35d8a73d609a3daa7f8c5f21a">address</a>; </div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"><a class="line" href="datel__codes_8h.html#ac5cac97ba923a96d36002845327f1da4"> 23</a></span> uint16_t <a class="code hl_variable" href="datel__codes_8h.html#ac5cac97ba923a96d36002845327f1da4">value</a>; </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"><a class="line" href="datel__codes_8h.html#af66ea10995d03c6bcc8019ec06335f7d"> 24</a></span> <span class="keywordtype">bool</span> <a class="code hl_variable" href="datel__codes_8h.html#af66ea10995d03c6bcc8019ec06335f7d">enabled</a>; </div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"><a class="line" href="datel__codes_8h.html#ab8c093a6a99afc63e683968b2fef8d10"> 25</a></span> <span class="keywordtype">char</span> description[32]; </div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span>} <a class="code hl_struct" href="datel__codes_8h.html#structcheat__file__code__t">cheat_file_code_t</a>;</div>
</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
<div class="foldopen" id="foldopen00030" data-start="{" data-end="};">
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="datel__codes_8h.html#ab1ea8a6c9fbe6b99dee66b7ee26a024a"> 30</a></span><span class="keyword">typedef</span> <span class="keyword">enum</span> {</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> CHEAT_FILE_LOAD_OK,</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> CHEAT_FILE_LOAD_ERR_MEMORY_ALLOC_FAIL,</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> CHEAT_FILE_LOAD_ERR_FILE_OPEN_FAIL,</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> CHEAT_FILE_LOAD_ERR_FILE_STAT_FAIL,</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> CHEAT_FILE_LOAD_ERR_FILE_EMPTY,</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> CHEAT_FILE_LOAD_ERR_FILE_TOO_BIG,</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> CHEAT_FILE_LOAD_ERR_FILE_CONTENTS_ALLOC_FAIL,</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> CHEAT_FILE_LOAD_ERR_FILE_READ_FAIL,</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> CHEAT_FILE_LOAD_ERR_FILE_CLOSE_FAIL,</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> CHEAT_FILE_LOAD_ERR_UNKNOWN</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span>} <a class="code hl_enumeration" href="datel__codes_8h.html#ab1ea8a6c9fbe6b99dee66b7ee26a024a">cheat_file_load_err_t</a>;</div>
</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span><span class="keywordtype">size_t</span> <a class="code hl_function" href="datel__codes_8h.html#ae74416630fc80ad6f62a02a535c09b7c">generate_enabled_cheats_array</a>(<a class="code hl_struct" href="datel__codes_8h.html#structcheat__file__code__t">cheat_file_code_t</a> *cheats_in, uint32_t *cheats_out);</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span><a class="code hl_struct" href="datel__codes_8h.html#structcheat__file__code__t">cheat_file_code_t</a> *<a class="code hl_function" href="datel__codes_8h.html#ae8bdc386f52913f11c7f215dac7e69c6">get_cheat_codes</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span><span class="keywordtype">void</span> <a class="code hl_function" href="datel__codes_8h.html#a7194ae3b8448a8c61aab9f33bd55f307">set_cheat_codes</a>(<a class="code hl_struct" href="datel__codes_8h.html#structcheat__file__code__t">cheat_file_code_t</a> *cheats);</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span><span class="keywordtype">void</span> <a class="code hl_function" href="datel__codes_8h.html#ababa585b4c78930ea841d3139ef91652">load_cheats_from_file</a>(<span class="keywordtype">char</span> *path);</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> </div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span><span class="keywordtype">void</span> <a class="code hl_function" href="datel__codes_8h.html#a94e7597c22a0fb0b4be5d1bfd4aef814">save_cheats_to_file</a>(<span class="keywordtype">char</span> *path);</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span><span class="preprocessor">#endif </span><span class="comment">/* DATEL_CODES_H__ */</span><span class="preprocessor"></span></div>
<div class="ttc" id="adatel__codes_8h_html_a7194ae3b8448a8c61aab9f33bd55f307"><div class="ttname"><a href="datel__codes_8h.html#a7194ae3b8448a8c61aab9f33bd55f307">set_cheat_codes</a></div><div class="ttdeci">void set_cheat_codes(cheat_file_code_t *cheats)</div><div class="ttdoc">Set the cheat codes.</div><div class="ttdef"><b>Definition</b> datel_codes.c:57</div></div>
<div class="ttc" id="adatel__codes_8h_html_a8f5dd3b35d8a73d609a3daa7f8c5f21a"><div class="ttname"><a href="datel__codes_8h.html#a8f5dd3b35d8a73d609a3daa7f8c5f21a">cheat_file_code_t::address</a></div><div class="ttdeci">uint32_t address</div><div class="ttdef"><b>Definition</b> datel_codes.h:22</div></div>
<div class="ttc" id="adatel__codes_8h_html_a94e7597c22a0fb0b4be5d1bfd4aef814"><div class="ttname"><a href="datel__codes_8h.html#a94e7597c22a0fb0b4be5d1bfd4aef814">save_cheats_to_file</a></div><div class="ttdeci">void save_cheats_to_file(char *path)</div><div class="ttdoc">Save cheats to a file.</div><div class="ttdef"><b>Definition</b> datel_codes.c:278</div></div>
<div class="ttc" id="adatel__codes_8h_html_ab1ea8a6c9fbe6b99dee66b7ee26a024a"><div class="ttname"><a href="datel__codes_8h.html#ab1ea8a6c9fbe6b99dee66b7ee26a024a">cheat_file_load_err_t</a></div><div class="ttdeci">cheat_file_load_err_t</div><div class="ttdoc">Cheat code loading enum.</div><div class="ttdef"><b>Definition</b> datel_codes.h:30</div></div>
<div class="ttc" id="adatel__codes_8h_html_ababa585b4c78930ea841d3139ef91652"><div class="ttname"><a href="datel__codes_8h.html#ababa585b4c78930ea841d3139ef91652">load_cheats_from_file</a></div><div class="ttdeci">void load_cheats_from_file(char *path)</div><div class="ttdoc">Load cheats from a file.</div><div class="ttdef"><b>Definition</b> datel_codes.c:214</div></div>
<div class="ttc" id="adatel__codes_8h_html_ac5cac97ba923a96d36002845327f1da4"><div class="ttname"><a href="datel__codes_8h.html#ac5cac97ba923a96d36002845327f1da4">cheat_file_code_t::value</a></div><div class="ttdeci">uint16_t value</div><div class="ttdef"><b>Definition</b> datel_codes.h:23</div></div>
<div class="ttc" id="adatel__codes_8h_html_ae74416630fc80ad6f62a02a535c09b7c"><div class="ttname"><a href="datel__codes_8h.html#ae74416630fc80ad6f62a02a535c09b7c">generate_enabled_cheats_array</a></div><div class="ttdeci">size_t generate_enabled_cheats_array(cheat_file_code_t *cheats_in, uint32_t *cheats_out)</div><div class="ttdoc">Generate a cheats array containing enabled cheats as address/value pairs. The last two entries will a...</div><div class="ttdef"><b>Definition</b> datel_codes.c:30</div></div>
<div class="ttc" id="adatel__codes_8h_html_ae8bdc386f52913f11c7f215dac7e69c6"><div class="ttname"><a href="datel__codes_8h.html#ae8bdc386f52913f11c7f215dac7e69c6">get_cheat_codes</a></div><div class="ttdeci">cheat_file_code_t * get_cheat_codes(void)</div><div class="ttdoc">Get the cheat codes.</div><div class="ttdef"><b>Definition</b> datel_codes.c:49</div></div>
<div class="ttc" id="adatel__codes_8h_html_af66ea10995d03c6bcc8019ec06335f7d"><div class="ttname"><a href="datel__codes_8h.html#af66ea10995d03c6bcc8019ec06335f7d">cheat_file_code_t::enabled</a></div><div class="ttdeci">bool enabled</div><div class="ttdef"><b>Definition</b> datel_codes.h:24</div></div>
<div class="ttc" id="adatel__codes_8h_html_structcheat__file__code__t"><div class="ttname"><a href="datel__codes_8h.html#structcheat__file__code__t">cheat_file_code_t</a></div><div class="ttdoc">Cheat file code Structure.</div><div class="ttdef"><b>Definition</b> datel_codes.h:21</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Nov 26 2025 01:10:49 for N64FlashcartMenu by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0
</small></address>
</div><!-- doc-content -->
</body>
</html>