>distributing code
The code is also copyrighted and owning a license for a game does not make you safe from being sued for pirating that game or its code. It's fine in this case only because the engine was open sourced.
You may run afoul of DCMA rules around circumventing copy protection measures, and you are most likely going to be violating the EULA on any recent games. But you aren't necessarily violating any copyrights - several high-profile cases in the US have been fought about this, such as Sony vs Connectix, and its generally fallen on the side of reverse-engineering for interoperability being within the bounds of fair use
(as always, IANAL)
> The code is also copyrighted and owning a license for a game does not make you safe from being sued for pirating that game or its code. It's fine in this case only because the engine was open sourced.
Nothing makes you safe from getting sued.
See also: [1]. You could also reverse engineer in a solid jurisdiction.
I ran C&C Generals in Wine on Linux back in the days. More stable than Windows XP.
[1] https://en.wikipedia.org/wiki/Clean-room_design