1
0
mirror of https://github.com/switchbrew/libnx.git synced 2025-06-30 08:42:40 +02:00
libnx/hosversion_8h_source.html
2025-05-08 06:59:12 +00:00

151 lines
18 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.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libnx: include/switch/runtime/hosversion.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>
<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">libnx<span id="projectnumber">&#160;v4.9.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<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" 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');
$(document).ready(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 */
$(document).ready(function() { init_codefold(0); });
/* @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_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_42bea3d40f1f1694e41a8f3166c98108.html">switch</a></li><li class="navelem"><a class="el" href="dir_afd0453aeaaca58db0f3a26ffe540381.html">runtime</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">hosversion.h</div></div>
</div><!--header-->
<div class="contents">
<a href="hosversion_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><span class="comment">/**</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="comment"> * @file hosversion.h</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="comment"> * @brief Horizon OS (HOS) version detection utilities.</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="comment"> * @author fincs</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="comment"> * @copyright libnx Authors</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="comment"> */</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#include &quot;../types.h&quot;</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="comment"></span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="comment">/// Builds a HOS version value from its constituent components.</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"><a class="line" href="hosversion_8h.html#a7a2eae6f53323a9d1ea036c618b4ccfe"> 11</a></span><span class="comment"></span><span class="preprocessor">#define MAKEHOSVERSION(_major,_minor,_micro) (((u32)(_major) &lt;&lt; 16) | ((u32)(_minor) &lt;&lt; 8) | (u32)(_micro))</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="comment"></span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="comment">/// Extracts the major number from a HOS version value.</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"><a class="line" href="hosversion_8h.html#abc4915d3e8b74743c8bcaa8ef2bd963c"> 14</a></span><span class="comment"></span><span class="preprocessor">#define HOSVER_MAJOR(_version) (((_version) &gt;&gt; 16) &amp; 0xFF)</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="comment"></span> </div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="comment">/// Extracts the minor number from a HOS version value.</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"><a class="line" href="hosversion_8h.html#a3162a7b0cb79a91bda54b2fbc9845388"> 17</a></span><span class="comment"></span><span class="preprocessor">#define HOSVER_MINOR(_version) (((_version) &gt;&gt; 8) &amp; 0xFF)</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="comment"></span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="comment">/// Extracts the micro number from a HOS version value.</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"><a class="line" href="hosversion_8h.html#ad30a8d994192f0dbdab9508d1df8b140"> 20</a></span><span class="comment"></span><span class="preprocessor">#define HOSVER_MICRO(_version) ( (_version) &amp; 0xFF)</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="comment"></span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="comment">/// Returns the current HOS version that was previously set with \ref hosversionSet. If version initialization fails during startup (such as in the case set:sys is not available), this function returns zero.</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"><a class="line" href="hosversion_8h.html#a5f7367682f5ef9b0ba79b89ccc590373"> 23</a></span><span class="comment"></span><a class="code hl_typedef" href="types_8h.html#afaa62991928fb9fb18ff0db62a040aba">u32</a> <a class="code hl_function" href="hosversion_8h.html#a5f7367682f5ef9b0ba79b89ccc590373">hosversionGet</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="comment"></span> </div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="comment">/// Sets or overrides the current HOS version. This function is normally called automatically by libnx on startup with the version info obtained with \ref setsysGetFirmwareVersion.</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"><a class="line" href="hosversion_8h.html#afbe14f8ae698c6628e0e63ed7e58e342"> 26</a></span><span class="comment"></span><span class="keywordtype">void</span> <a class="code hl_function" href="hosversion_8h.html#afbe14f8ae698c6628e0e63ed7e58e342">hosversionSet</a>(<a class="code hl_typedef" href="types_8h.html#afaa62991928fb9fb18ff0db62a040aba">u32</a> version);</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span><span class="comment"></span> </div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><span class="comment">/// Returns whether the current HOS version is augmented by running the Atmosphère custom firmware.</span></div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="hosversion_8h.html#a5783b4a212ddf46746b5773e6473c485"> 29</a></span><span class="comment"></span><span class="keywordtype">bool</span> <a class="code hl_function" href="hosversion_8h.html#a5783b4a212ddf46746b5773e6473c485">hosversionIsAtmosphere</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span><span class="comment"></span> </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span><span class="comment">/// Returns true if the current HOS version is equal to or above the specified major/minor/micro version.</span></div>
<div class="foldopen" id="foldopen00032" data-start="{" data-end="}">
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"><a class="line" href="hosversion_8h.html#a1ed43401b3c7270752a69f18508c9e35"> 32</a></span><span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="hosversion_8h.html#a1ed43401b3c7270752a69f18508c9e35">hosversionAtLeast</a>(<a class="code hl_typedef" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> major, <a class="code hl_typedef" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> minor, <a class="code hl_typedef" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> micro) {</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keywordflow">return</span> <a class="code hl_function" href="hosversion_8h.html#a5f7367682f5ef9b0ba79b89ccc590373">hosversionGet</a>() &gt;= <a class="code hl_define" href="hosversion_8h.html#a7a2eae6f53323a9d1ea036c618b4ccfe">MAKEHOSVERSION</a>(major,minor,micro);</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span>}</div>
</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span><span class="comment"></span> </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span><span class="comment">/// Returns true if the current HOS version is earlier than the specified major/minor/micro version.</span></div>
<div class="foldopen" id="foldopen00037" data-start="{" data-end="}">
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="hosversion_8h.html#a786e90fee1edeef50c82638ce0910978"> 37</a></span><span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="hosversion_8h.html#a786e90fee1edeef50c82638ce0910978">hosversionBefore</a>(<a class="code hl_typedef" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> major, <a class="code hl_typedef" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> minor, <a class="code hl_typedef" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> micro) {</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keywordflow">return</span> !<a class="code hl_function" href="hosversion_8h.html#a1ed43401b3c7270752a69f18508c9e35">hosversionAtLeast</a>(major, minor, micro);</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span>}</div>
</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span><span class="comment"></span> </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span><span class="comment">/// Returns true if the current HOS version is between the two specified major versions, i.e. [major1, major2).</span></div>
<div class="foldopen" id="foldopen00042" data-start="{" data-end="}">
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"><a class="line" href="hosversion_8h.html#a36992c9b5eaff8239c9d671f4d0cb797"> 42</a></span><span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="hosversion_8h.html#a36992c9b5eaff8239c9d671f4d0cb797">hosversionBetween</a>(<a class="code hl_typedef" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> major1, <a class="code hl_typedef" href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a> major2) {</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <a class="code hl_typedef" href="types_8h.html#afaa62991928fb9fb18ff0db62a040aba">u32</a> ver = <a class="code hl_function" href="hosversion_8h.html#a5f7367682f5ef9b0ba79b89ccc590373">hosversionGet</a>();</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordflow">return</span> ver &gt;= <a class="code hl_define" href="hosversion_8h.html#a7a2eae6f53323a9d1ea036c618b4ccfe">MAKEHOSVERSION</a>(major1,0,0) &amp;&amp; ver &lt; <a class="code hl_define" href="hosversion_8h.html#a7a2eae6f53323a9d1ea036c618b4ccfe">MAKEHOSVERSION</a>(major2,0,0);</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span>}</div>
</div>
<div class="ttc" id="ahosversion_8h_html_a1ed43401b3c7270752a69f18508c9e35"><div class="ttname"><a href="hosversion_8h.html#a1ed43401b3c7270752a69f18508c9e35">hosversionAtLeast</a></div><div class="ttdeci">static bool hosversionAtLeast(u8 major, u8 minor, u8 micro)</div><div class="ttdoc">Returns true if the current HOS version is equal to or above the specified major/minor/micro version.</div><div class="ttdef"><b>Definition</b> hosversion.h:32</div></div>
<div class="ttc" id="ahosversion_8h_html_a36992c9b5eaff8239c9d671f4d0cb797"><div class="ttname"><a href="hosversion_8h.html#a36992c9b5eaff8239c9d671f4d0cb797">hosversionBetween</a></div><div class="ttdeci">static bool hosversionBetween(u8 major1, u8 major2)</div><div class="ttdoc">Returns true if the current HOS version is between the two specified major versions,...</div><div class="ttdef"><b>Definition</b> hosversion.h:42</div></div>
<div class="ttc" id="ahosversion_8h_html_a5783b4a212ddf46746b5773e6473c485"><div class="ttname"><a href="hosversion_8h.html#a5783b4a212ddf46746b5773e6473c485">hosversionIsAtmosphere</a></div><div class="ttdeci">bool hosversionIsAtmosphere(void)</div><div class="ttdoc">Returns whether the current HOS version is augmented by running the Atmosphère custom firmware.</div></div>
<div class="ttc" id="ahosversion_8h_html_a5f7367682f5ef9b0ba79b89ccc590373"><div class="ttname"><a href="hosversion_8h.html#a5f7367682f5ef9b0ba79b89ccc590373">hosversionGet</a></div><div class="ttdeci">u32 hosversionGet(void)</div><div class="ttdoc">Returns the current HOS version that was previously set with hosversionSet. If version initialization...</div></div>
<div class="ttc" id="ahosversion_8h_html_a786e90fee1edeef50c82638ce0910978"><div class="ttname"><a href="hosversion_8h.html#a786e90fee1edeef50c82638ce0910978">hosversionBefore</a></div><div class="ttdeci">static bool hosversionBefore(u8 major, u8 minor, u8 micro)</div><div class="ttdoc">Returns true if the current HOS version is earlier than the specified major/minor/micro version.</div><div class="ttdef"><b>Definition</b> hosversion.h:37</div></div>
<div class="ttc" id="ahosversion_8h_html_a7a2eae6f53323a9d1ea036c618b4ccfe"><div class="ttname"><a href="hosversion_8h.html#a7a2eae6f53323a9d1ea036c618b4ccfe">MAKEHOSVERSION</a></div><div class="ttdeci">#define MAKEHOSVERSION(_major, _minor, _micro)</div><div class="ttdoc">Builds a HOS version value from its constituent components.</div><div class="ttdef"><b>Definition</b> hosversion.h:11</div></div>
<div class="ttc" id="ahosversion_8h_html_afbe14f8ae698c6628e0e63ed7e58e342"><div class="ttname"><a href="hosversion_8h.html#afbe14f8ae698c6628e0e63ed7e58e342">hosversionSet</a></div><div class="ttdeci">void hosversionSet(u32 version)</div><div class="ttdoc">Sets or overrides the current HOS version. This function is normally called automatically by libnx on...</div></div>
<div class="ttc" id="atypes_8h_html_a92c50087ca0e64fa93fc59402c55f8ca"><div class="ttname"><a href="types_8h.html#a92c50087ca0e64fa93fc59402c55f8ca">u8</a></div><div class="ttdeci">uint8_t u8</div><div class="ttdoc">8-bit unsigned integer.</div><div class="ttdef"><b>Definition</b> types.h:19</div></div>
<div class="ttc" id="atypes_8h_html_afaa62991928fb9fb18ff0db62a040aba"><div class="ttname"><a href="types_8h.html#afaa62991928fb9fb18ff0db62a040aba">u32</a></div><div class="ttdeci">uint32_t u32</div><div class="ttdoc">32-bit unsigned integer.</div><div class="ttdef"><b>Definition</b> types.h:21</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>