<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="https://www.lifehacker101.net/feed.xml" rel="self" type="application/atom+xml" /><link href="https://www.lifehacker101.net/" rel="alternate" type="text/html" /><updated>2024-11-04T08:20:12+00:00</updated><id>https://www.lifehacker101.net/feed.xml</id><title type="html">lifehacker 101</title><subtitle></subtitle><author><name>lifehackerhansol</name></author><entry><title type="html">EZ-Flash Parallel - And GPL</title><link href="https://www.lifehacker101.net/homebrew/ez-flash-parallel-and-gpl/" rel="alternate" type="text/html" title="EZ-Flash Parallel - And GPL" /><published>2024-03-11T00:00:00+00:00</published><updated>2024-03-11T00:00:00+00:00</updated><id>https://www.lifehacker101.net/homebrew/ez-flash-parallel-and-gpl</id><content type="html" xml:base="https://www.lifehacker101.net/homebrew/ez-flash-parallel-and-gpl/"><![CDATA[<p>For the uninitiated, <a href="https://www.ezflash.cn">EZ-Flash</a> released the <a href="https://www.ezflash.cn/product/ez-flash-parallel/">EZ-Flash Parallel</a> on January 22, 2024.</p>

<p>To be honest, there isn’t much interesting things going on with the cart; the feature set is largely identical to the generic flashcarts, the closest to identical being the Ace3DS X. Aside from having built-in ntrboot functionality (the Ace3DS X requires flipping a hardware switch), it doesn’t have any special gaming functionality such as save states. The price isn’t all that ideal either; current distributor prices range somewhere near 25 USD as of this writing, which is kind of unfortunate as the Ace3DS X can be purchased for as low as 10 bucks on Aliexpress.</p>

<p>All things considered, it’s sort of a baseline flashcart, and there is nothing wrong with that.</p>

<p>The real problem is with its software stack, and it’s not because of the quality.</p>

<h2 id="its-always-gpl">It’s always GPL</h2>

<p>What is it with Chinese brands and failing to follow the simple logic behind the <a href="https://www.gnu.org/licenses/licenses.html">GNU General Public License</a>? All that had to be done was to upload the source code somewhere, and nothing more than that. <a href="https://hackaday.com/2018/08/27/gpl-violations-cost-creality-a-us-distributor/">Creality’s printers have come under fire</a>, <a href="https://linux-sunxi.org/GPL_Violations">Allwinner fails to provide Linux kernel sources</a>, and, well, for the DS hacking scene, the <a href="https://gbatemp.net/threads/290793/">Wood kernel’s license was violated multiple times</a> as stated by the author, to the point they closed access to the source code from 1.26 onwards.</p>

<p>Unfortunately for EZ-Flash, the Parallel is no exception.</p>

<p>First, it also uses the Wood kernel source base. This was, in fact, <a href="https://www.ezflash.cn/product/ez-flash-parallel/">explicitly advertised this way</a>. The only way this would work is that EZ-Flash is building on top of the last open source version of Wood, which is 1.25 (there’s an archive of it <a href="https://github.com/flashcarts/woodrpg">here</a>.) There’s nothing wrong with this, since version 1.25 was openly released with <code class="language-plaintext highlighter-rouge">GPL-3.0-or-later</code>.</p>

<p>The problem is that, after two months, EZ-Flash’s modifications are nowhere to be found. It’s not on <a href="https://github.com/ez-flash">their GitHub</a>, nor is it on their website. EZ-Flash has since released 3 versions of their kernel with various minor fixes. If they did upload it somewhere, where? And not just some “UI only” or “IO routines” minimal release; the entire kernel source is GPL, including the <code class="language-plaintext highlighter-rouge">akloader</code> ROM loading module, <code class="language-plaintext highlighter-rouge">akmenu4</code> menu, and every other library needed to compile both of these, as the GPL requires the full source to be released along with all the assets needed to compile it (none of those are released either…)</p>

<p>When asked about it by someone in EZ-Flash’s Chinese community chat, we were met with the response that the kernel wasn’t something they planned on releasing:</p>

<p><img src="/assets/images/20240311/ez-flash-oss-request-response.png" alt="EZ-Flash response to open-source request" /></p>

<p>Of course, it is possible that EZ-Flash has somehow gotten ahold of the private source code for the last Wood version, 1.62. And maybe they asked Yellow Wood Goblin, the original author, for express permission on the matter. This is unlikely to be the case, as, if this were true, EZ-Flash’s changelogs (only provided in Chinese on their Chinese file sharing platform) would not show bug fixes for games that were fixed in original Wood ages ago, or users in Chinese forums such as <a href="https://bbs.oldmantvg.net">oldmantvg</a> complaining about such games not running where it <em>should</em> be on 1.62. Ruling this out.</p>

<p>I, of course, am annoyed about this, and you, the reader, should be annoyed too. If you are in possession of this cart, consider contacting EZ-Flash about this abusive behaviour.</p>

<p>On the other hand, it was less of a shock to me. This wouldn’t be the first time that Wood’s GPLv3 has been violated. Dozens of carts, notably the R4iTT 3DS and many of its direct descendants of other brands are also violating GPL (but the teams behind them are long gone), as well as the Ace3DS+ and X, all very common carts you may be able to find out there.</p>

<hr />

<p><strong>But wait, there’s more!</strong></p>

<h2 id="homebrew-menu">Homebrew Menu</h2>

<p>In the homebrew scene, there is usually a compiler, and a code library usually written in the C language that has functions for interacting with the hardware. <a href="https://devkitpro.org">devkitPro</a> and <a href="https://github.com/blocksds">BlocksDS</a> are two toolchains that allow building your own code to run on the Nintendo DS hardware.</p>

<p>Typically, when devkitPro supports a device, they also provide a reference menu application that serves as the de-facto application to load your custom code in all its glory. On the DS, this is the <a href="https://github.com/devkitPro/nds-hb-menu">NDS Homebrew Menu</a>.</p>

<p>For the DS, devkitPro also ships “bootstrap” binaries that allow replacing a flashcart’s (typically closed source) kernel with a flashcart-specific file that will launch the Homebrew Menu with full storage device access. This bootstrap, along with the bootloader module, is also code I use regularly in <a href="https://github.com/lifehackerhansol/flashcard-bootstrap">flashcard-bootstrap</a>, which is my personal playground to expand the list of supported carts, often with some crazy hax. I would have upstreamed all of this, but I’m banned from devkitPro’s GitHub, so there’s that.</p>

<p>So what does EZ-Flash have to do with all this?</p>

<p>An owner of the Parallel in the DS⁽ⁱ⁾ Mode Hacking Discord server privately provided me a dump of the Parallel’s firmware, extracted using <a href="https://github.com/d0k3/GodMode9">GodMode9</a>. This dump would serve to show what is on the cartridge’s flash, which is what the console will run and boot into your usual kernel. I requested this dump primarily to see what may be needed to add support for the Parallel in flashcard-bootstrap (as I do not have the cart yet; it’s coming soon, though), but as I was digging through their binary for specific quirks that may exist, I found, well, this snippet of code:</p>

<p><img src="/assets/images/20240311/ezp-firmware-main-func.png" alt="EZ-Flash Parallel firmware decompilation snippet - main()" /></p>

<p>The keen eye among you may already be cross-referencing with devkitPro’s Homebrew Menu, and will find that this is pretty much identical to the <code class="language-plaintext highlighter-rouge">main()</code> function found <a href="https://github.com/devkitPro/nds-hb-menu/blob/master/BootStrap/arm9/source/bootstrap.c">here</a>!</p>

<p>Another snippet, this time <code class="language-plaintext highlighter-rouge">runNdsFile()</code> from <a href="https://github.com/devkitPro/nds-hb-menu/blob/master/source/nds_loader_arm9.c"><code class="language-plaintext highlighter-rouge">nds_loader_arm9.c</code></a>:</p>

<p><img src="/assets/images/20240311/ezp-firmware-runndsfile-func.png" alt="EZ-Flash Parallel firmware decompilation snippet - runNdsFile()" /></p>

<p>The snippets are kind of ugly; I blame Ghidra as it doesn’t handle legacy ARM binaries too well. However, it is enough to get an idea of just how <em>similar</em> everything is. Nearly all of the <code class="language-plaintext highlighter-rouge">BootStrap</code> output is here; <code class="language-plaintext highlighter-rouge">nds_loader_arm9.c</code> is unmodified, and the <code class="language-plaintext highlighter-rouge">bootloader</code> module appeared to be identical save for the fact that it seemed to lack DSi-specific code, implying it was built with the <code class="language-plaintext highlighter-rouge">-DNO_SDMMC</code> flag.</p>

<p>It should be noted that all code provided in Homebrew Menu is licensed <code class="language-plaintext highlighter-rouge">GPL-2.0-or-later</code>.</p>

<p>I didn’t bother to take apart any of the other code in the firmware after that. If you have an EZ-Flash Parallel, feel free to do the forensics work yourself too; the above snippets were based on whatever firmware was shipped in the last 3 months, if it ever gets updated at all.</p>

<h2 id="decent-cart-otherwise-morally-not-a-good-buy">Decent cart otherwise; morally, not a good buy</h2>

<p>The EZ-Flash Parallel was a hype for all of us that saw the initial leaks in September in the Discord, and pre-release information in EZ-Flash’s Chinese group chat in early January that was <a href="https://gbatemp.net/threads/646658/">cross-posted to GBAtemp</a>. I was especially interested in it, since, as the administrator of <a href="https://www.flashcarts.net/">flashcarts.net</a>, this cart felt like a good, solid option to recommend to new users. It’s currently supported by the team behind it, compared to the flashcart red ocean on Aliexpress at the time of writing.</p>

<p>The pricing, unfortunately, isn’t ideal; had it been sold for 99 CNY, which is the China domestic pricing at the time of writing, I would have pushed users to this cartridge instead of the Ace3DS X, even if it was slightly more on the expensive side, just because EZ-Flash has usually delivered good products. Call it brand loyalty. But with a feature set that doesn’t surpass the Ace3DS X, and for double the price, I’m not sure if it’s worth it.</p>

<p>Even with pricing aside, with not one, but <strong><em>two</em></strong> GPL violations, is it right to support them? The DS flashcart scene is already tainted with so many redistribution licenses violated (YSMenu’s distribution clause, Wood’s GPLv3), do we need another one to add to that list, in 2024?</p>

<p>The funny thing is, EZ-Flash typically had a history of open-sourcing what <em>should</em> be. EZ-Flash V and Vi used Moonshell code, which was GPL and released by EZ-Flash (though some are lost to the Internet; can’t blame EZ-Flash for that). Understandably the ROM loading portion wasn’t open source then, but it was external to Moonshell and did not really apply. But with Wood, the entire kernel, menu and loader, was (and is for 1.25) all GPL, so this is quite a disappointment.</p>

<p>Perhaps these issues may be rectified by EZ-Flash some time in the future, but as it is right now, pricing-wise and licensing-wise, I cannot recommend it to users looking to buy a new flashcart. In general, they aren’t needed; you can install custom firmware on your <a href="https://3ds.hacks.guide">3DS</a> or <a href="https://dsi.cfw.guide">DSi</a>. Should you still be looking for options, however, myself and the flashcarts.net contributors has a <a href="https://www.flashcarts.net/ds-quick-start-guide.html">quick start guide</a> for you.</p>]]></content><author><name>lifehackerhansol</name></author><category term="Homebrew" /><summary type="html"><![CDATA[History repeats itself with software licensing]]></summary></entry><entry><title type="html">flashcard-bootstrap</title><link href="https://www.lifehacker101.net/homebrew/flashcard-bootstrap/" rel="alternate" type="text/html" title="flashcard-bootstrap" /><published>2023-09-29T00:00:00+00:00</published><updated>2023-09-29T00:00:00+00:00</updated><id>https://www.lifehacker101.net/homebrew/flashcard-bootstrap</id><content type="html" xml:base="https://www.lifehacker101.net/homebrew/flashcard-bootstrap/"><![CDATA[<p>The DS scene may be well over 15 years old, but DS flash cartridges, to this day, makes up an integral part of it. However, during these trying times and the waning popularity, do we know everything about them? The hundreds or so cartridges that have been, and still are, being mass-produced?</p>

<h2 id="flashcard-bootstrap-what-is-it">flashcard-bootstrap: what is it?</h2>

<p>A major portion of my research, development and documentation has been a tool called <a href="https://github.com/lifehackerhansol/flashcard-bootstrap">flashcard-bootstrap</a>.</p>

<p>What does it do? Simple, it is designed to replace these flash cartridges’ typically proprietary menu. It will load a <code class="language-plaintext highlighter-rouge">/boot.nds</code> on the SD card and install the necessary cartridge drivers (known as DLDI, dynamically linked device interface), allowing the end user to comfortably load any homebrew application of their choice.</p>

<h2 id="the-current-state-of-things">The current state of things</h2>

<p>Of course, simply compiling flashcard-bootstrap and bundling the driver is not enough. Many flashcarts are designed differently, and have a few “limitations”, so to speak. These limitations, in a non-exhaustive list, range from:</p>

<ul>
  <li>Poor implementation of the bootloader stored in the cartridge flash.
    <ul>
      <li>For easier software updates, often the cartridge flash contains just enough to load the menu from the SD card, which has different file names depending on the cartridge. (hereon “boot file”)</li>
      <li>A proper implementation would check the target application’s header, to see where the executable binaries are to be loaded in memory.</li>
      <li>Some implementations, unfortunately, <em>hardcode</em> these addresses, leaving it to the developer of the target application to fix it themselves…</li>
    </ul>
  </li>
  <li>The boot file may be a custom file format.
    <ul>
      <li>The M3 DS Real, and its descendant “clones”, use the “DSBooter” file format, which differs from a usual NDS ROM format.</li>
      <li>Some older original R4-based clones would store patches to the original R4’s kernel to add functionality.</li>
    </ul>
  </li>
  <li>The bootloader may contain integrity checks on the boot file.
    <ul>
      <li>This may be live integrity checks, encryption, etc.</li>
    </ul>
  </li>
  <li>A combination of the above…</li>
</ul>

<h2 id="freedom-of-choice">Freedom of choice</h2>

<p>Today, we are leaning towards free-and-open-source solutions more than ever in our community, and these flashcarts are everything but.</p>

<p>For some people, the manufacturer-provided software (hereon “kernel”) is more than enough; it can load their games, homebrew applications, and more or less doesn’t break functionality.</p>

<p>But the idea of free software is the freedom to use, study, share and modify; some users may simply not like how the provided kernel looks and performs, some may have a bias against piracy (which these carts were created specifically for), and some just want a new coat of paint.</p>

<h2 id="where-flashcard-bootstrap-falls-in-this">Where flashcard-bootstrap falls in this</h2>

<p>Enter flashcard-bootstrap. The project was inspired by <a href="https://github.com/devkitPro/nds-hb-menu">devkitPro’s NDS Homebrew Menu</a> and <a href="https://github.com/DS-Homebrew/TWiLightMenu">TWiLight Menu++</a>, and heavily based on the former’s source code. devkitPro does support a handful of flashcarts via their own research, but that wasn’t enough for me. I wanted to expand on it, document more cartridges, make it accessible for more people who may have, ah, <em>obscure</em> carts.</p>

<p>flashcard-bootstrap loads a homebrew on the SD card named <code class="language-plaintext highlighter-rouge">/boot.nds</code> and sets up all the hardware abstractions needed for it to work, allowing users to simply download any homebrew application from the Internet (or making one themselves), renaming it, and Bob’s your uncle.</p>

<p>It provides, to an end user the freedom to use whichever software they want without dealing with a proprietary loader interface, and, to a homebrew developer, a unified experience across as many different cartridges out there, making it “just work” on as much hardware as possible.</p>

<p>Taking Homebrew Menu’s BootStrap code, I decided to tweak a few configurations to adapt to the “limitations” of various flash cartridges as shown in the above list. Many of these were a simple task of adjusting the memory addresses to what the bootloaders expect, and it worked, just like that.</p>

<p>Some were not as simple, however.</p>

<h2 id="hacky-solutions-if-it-works-it-works">Hacky solutions: if it works it works</h2>

<h3 id="example-1-gmp-z003">Example 1: GMP-Z003</h3>

<p>Take, for instance, the M3i Zero (GMP-Z003) flashcart.</p>

<p>The boot file is <code class="language-plaintext highlighter-rouge">SYSTEM/_M3_MENU.DAT</code>. Unfortunately, it matched no file formats, and was <em>heavily encrypted</em>.</p>

<p>However, upon diff-ing behaviours of every kernel version released by the M3 Adapter team, I found a debug string printed to the screen when there was no other files, which showed… yet another file path?</p>

<p>From there it was a matter of repacking flashcard-bootstrap into the DSBooter file format and utilizing the kernel’s boot file as a Stage 1 launcher, which would launch flashcard-bootstrap, giving me the freedom once again.</p>

<h3 id="example-2-the-bomb-that-doesnt-really-do-much-but-annoys-you-to-no-end">Example 2: The bomb that doesn’t really do much, but annoys you to no end</h3>

<p>Another example are “timebomb” carts.</p>

<p>These are known for having a date checker in the kernel, and, if the current date was later than the one hardcoded, the kernel would abort.</p>

<p>The boot file, unfortunately, has integrity checks all over the place, but a famed developer from the heyday of DS homebrew, Xenon++, came in clutch with <a href="https://github.com/lifehackerhansol/xenobox/blob/main/applet/r4isdhc.c">a script to bypass it</a>, which, with some help, I then <a href="https://github.com/lifehackerhansol/flashcard-bootstrap/blob/master/resource/r4isdhc/r4isdhc.py">rewrote it to Python</a>. And off we are to the races again.</p>

<hr />

<p>This post is just a snippet of the supported flashcarts, in simplified detail. You can always refer to the <a href="https://github.com/lifehackerhansol/flashcard-bootstrap/blob/master/devnotes.txt">developer notes</a> to see more in-depth detail on what I have uncovered thus far.</p>

<p>We’re still a long ways from having a fully-free flashcart (or <a href="https://twitter.com/LostNintendoHt/status/1659698186670456833">maybe we aren’t?</a>), but my hopes for this project is that it helps someone get started with it.</p>]]></content><author><name>lifehackerhansol</name></author><category term="Homebrew" /><summary type="html"><![CDATA[research into flashcarts and replacing the proprietary]]></summary></entry><entry><title type="html">A fresh coat of paint</title><link href="https://www.lifehacker101.net/miscellaneous/hello-world/" rel="alternate" type="text/html" title="A fresh coat of paint" /><published>2023-09-28T00:00:00+00:00</published><updated>2023-09-28T00:00:00+00:00</updated><id>https://www.lifehacker101.net/miscellaneous/hello-world</id><content type="html" xml:base="https://www.lifehacker101.net/miscellaneous/hello-world/"><![CDATA[<p>Today, I decided I’ll actually use this site for something.</p>

<p>Stay tuned, I guess?</p>]]></content><author><name>lifehackerhansol</name></author><category term="Miscellaneous" /><summary type="html"><![CDATA[Today, I decided I’ll actually use this site for something.]]></summary></entry></feed>