‹ BackHN Continuity

Thread

Resident Evil 4 (GameCube) – complete byte-identical decompilation to C/C++

140 points · 99 comments · metrofun

  1. shakna · · focus · HN ↗
    CC0, on the decompilation of a copyrighted work? That's... Not the way it works.

    You inherit the copyright from the original, as this is derivative.

    There's a reason decompilation has always been a grey area of seeing whether or not the copyright holder cares.

    1. throwaway888777 · · focus · HN ↗
      There are some absolutely insane ideas in the decomp space about how copyright works.

      You took a copyrighted work, did some lossless mathematical transformations on it, and have created an artifact that reproduces the original copyrighted work with perfect fidelity every time. From a legal perspective, this is effectively identical to zipping and unzipping a copyrighted file. You won't have much luck claiming that the intermediate Zip file is somehow free of copyright.

      The legal problem is the original taint of using a copyrighted work (expressly contrary to its license), and the fact that nothing transformative is occurring here sufficient to enliven the defense of fair use. (Not even close, and no, this is nowhere near the realm of being arguable. The fact that this spits out a copyrighted work 'byte for byte' is a stake through the heart of any such argument.)

      Decomp projects are cool, but if you work on them, please be aware that you're taking a risk, and some video game companies are famously litigious, even for old games.

      1. ferro_ · · focus · HN ↗
        If reverse engineering is legal, why wouldn't this be? By reverse engineering you take a closed source program and gradually figure out how it works, eventually ending up with source code that can be transformed into a binary that implements the same function. Reverse engineering would have to be illegal if what you say is true, because the source code you obtained from a copyrighted work is "tainted".

        There are also creative choices made in reverse engineering because there are many possible source codes that could compile to the same executable output. The author has to make countless choices around how to interpret assembly as higher level language constructs, and code organization in terms of functions and variables used. This isn't anything like zipping and unzipping some file, it's not a one to one transformation. As you can see we can absolutely have byte for byte identical output without having access to the original source code.

        I agree that it would be copyright infringement if you distribute the original game assets (sounds, fonts, textures, models), but I strongly disagree when it comes to the source code because of above factors. And clearly distributing reversed source code without those assets would not enable someone to even obtain the original binary. They'd need to already have them in the first place (e.g. by buying the game and dumping them).

        Also this is anecdotal but Nintendo is known for being quite belligerent with their copyright enforcement, they will take down various fan games in the name of protecting their IP. However to this day there are multiple full byte for byte decomps of Pokémon GBC games available on GitHub that haven't received so much as a DMCA takedown. Why wouldn't they care to take them down unless they couldn't do anything about reverse engineering? Nintendo still profits from reselling their old games after all (under their "Virtual Console" releases). The pattern repeats with Nintendo game console emulators, the only reason Nintendo is able to take some of them down is when these emulators include decryption keys for ROMs, they have never had a case for taking down an emulator on the basis of it behaving identically to the hardware they sell.

        Both in theory and in practice I fail to see why you would be right that game decomps are illegal or even in the gray area.

        1. shakna · · focus · HN ↗
          > Reverse engineering would have to be illegal if what you say is true, because the source code you obtained from a copyrighted work is "tainted".

          Yes. It often is. Hence why we have "clean room" practices to avoid the taint.

          There's a reason "legality" is one of the headlines on the reverse engineering wiki page.

          The headliner legal case in the US being Sega v. Accolade, which said that reverse-engineering to discover functions is fine if no documentation exists, but almost all other options are not fair use.

          As for Nintendo, I guess you missed that they throw gigantic DCMAs at GitHub all the time? [1]

          <a href="https:&#x2F;&#x2F;github.com&#x2F;github&#x2F;dmca&#x2F;blob&#x2F;master&#x2F;2025&#x2F;02&#x2F;2025-02-26-nintendo.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;github&#x2F;dmca&#x2F;blob&#x2F;master&#x2F;2025&#x2F;02&#x2F;2025-02-2...

          1. ferro_ · · focus · HN ↗
            &gt; Yes. It often is. Hence why we have &quot;clean room&quot; practices to avoid the taint.

            You refer to the Wikipedia page on the legality of reverse engineering which says reverse engineering is often legal, contrary to what you say. And the clean room practice is not reverse engineering as I use the term here. When I say reverse engineering I mean using actual binary disassembly to construct your own version of the source code, not &quot;cloning&quot; a piece of software by only looking at the results it produces from the outside. You may want to avoid the questions altogether and that&#x27;s fine but clean room practice doesn&#x27;t answer the question on the legality of reveng itself.

            There are specific cases in which you can&#x27;t reverse engineer: if you agree to a EULA that says you can&#x27;t reverse engineer. Or if you run afoul of DMCA by for example distributing tools to circumvent DRM alongside your reverse engineered game console emulator, as I said. But in the general case my previous comment applies.

            &gt; &quot;legality&quot; is one of the headlines on fhe reverse engineering wiki page.

            The legal question is always raised when one party does something another party doesn&#x27;t want, even if it&#x27;s legal. Companies selling proprietary tech understandably don&#x27;t like having it reverse engineered. But reverse engineering has merits as mentioned in my original comment provided you don&#x27;t violate other laws like distributing copyrighted assets with your source release.

            The Sega v Accolade case you refer to concludes reverse engineering is OK in the absence of docs describing the workings of a system. But that&#x27;s the typical case in reverse engineering! You don&#x27;t have docs for the algorithm and implementation of a proprietary game or its engine. If you had such documentation you could just write your own implementation using the docs, without reverse engineering in the first place. Needless to say proprietary devs never provide such docs for obvious reasons, they don&#x27;t want to make it easier to no benefit for themselves.

            &gt; As for Nintendo, I guess you missed that they throw gigantic DCMAs at GitHub all the time?

            Very misleading. The Nintendo DMCA you link to here is a takedown of forks of specifically the RyujinX emulator, which they had a right to take down under the DMCA because RyujinX included tools to circumvent Nintendo consoles&#x27; ROM encryption. Exactly what I refer to in my original comment. To emulate a Nintendo Switch you need to use decryption keys from the console, but distributing the keys or tools to dump those crypto keys from your console is itself illegal. Here the emulator was not taken down because it implements the actual workings of a Nintendo Switch (reverse engineered), it was taken down because under DMCA you can&#x27;t legally distribute tools to circumvent encryption (think DRM removal for different movies&#x2F;audiobooks or game cracking). This case doesn&#x27;t prove RevEng is illegal, other highly popular emulators like VisualBoyAdvance and Dolphin were not taken down by Nintendo because they don&#x27;t do what RyujinX, Citra, and yuzu did. Again I said exactly this earlier.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.