games/NXDoom: Initial port of Chocolate DOOM to NuttX.#3573
Conversation
This commit includes a (highly) modified version of Chocolate DOOM which can run on NuttX. The majority of the modifications were made to pass the NuttX style check. Some small modifications have been added to support keyboard input, render graphics to frame buffers and directly use the POSIX interfaces NuttX supplies, stripping out Windows/Mac stuff and any references to SDL. NOTE: Sound is currently not supported in any capacity, nor is the networking stuff. A lot of Chocolate DOOM code was stripped out since it was unused. If there is a need/desire to add it back later, the original Chocolate DOOM source can be used as a reference. WARNING: The NuttX keyboard codec is incredibly non-standard and so there are problems translating from X11 keys to NuttX ones to play DOOM. Right now, the CTRL key for firing doesn't work because the NuttX codec has no concept of it. The NuttX codec should be modified (and other input devices supported), but at the time of this port I am not sufficiently comfortable doing so since I am afraid of breaking other things in the kernel. NOTE: This port (and likely the original DOOM) seems to be written with 32-bit computers in mind. As such, most things are given the type of natural `int`, even when a single byte might do. There are significant size optimizations that could be made to make this more suited to embedded devices that NuttX typically runs on. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
12dd565 to
f062c8c
Compare
Ignore some style/spelling errors in the DOOM port that cannot be fixed. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
| @@ -0,0 +1,129 @@ | |||
| /**************************************************************************** | |||
| * apps/games/NXDoom/pcsound/pcsound.c | |||
There was a problem hiding this comment.
should we download doom from the original repo
There was a problem hiding this comment.
No, there haven't been any meaningful updates to Chocolate DOOM in several years. I also plan that NXDoom will become its own unique port that diverges quite heavily from the original Chocolate DOOM port in order to run well on embedded devices. The patches that would need to be applied to the original source to get it to run well would be really cumbersome to apply after downloading from the original repo.
I've kept some of the stuff (like pcsound) as a reference for when I (or others) go to implement the sound support. But I also gutted a ton of other stuff (SDL support, different sound mixers, support for game variants like "Hexen" and "Strife).
I plan to make other changes, like replace the checksum, hashing, fixed-point math, etc. stuff with NuttX-native libraries. So this port will really become more "nuttx-ified" over time, hence my plan to maintain a separate port.
Summary
This commit includes a (highly) modified version of Chocolate DOOM which can run on NuttX. The majority of the modifications were made to pass the NuttX style check. Some small modifications have been added to support keyboard input, render graphics to frame buffers and directly use the POSIX interfaces NuttX supplies, stripping out Windows/Mac stuff and any references to SDL.
NOTE: Sound is currently not supported in any capacity, nor is the networking stuff. A lot of Chocolate DOOM code was stripped out since it was unused. If there is a need/desire to add it back later, the original Chocolate DOOM source can be used as a reference.
WARNING: The NuttX keyboard codec is incredibly non-standard and so there are problems translating from X11 keys to NuttX ones to play DOOM. Right now, the CTRL key for firing doesn't work because the NuttX codec has no concept of it. The NuttX codec should be modified (and other input devices supported), but at the time of this port I am not sufficiently comfortable doing so since I am afraid of breaking other things in the kernel.
NOTE: This port (and likely the original DOOM) seems to be written with 32-bit computers in mind. As such, most things are given the type of natural
int, even when a single byte might do. There are significant size optimizations that could be made to make this more suited to embedded devices that NuttX typically runs on.This is part of my GSoC proposal; the final milestone of adding some cool user demos: apache/nuttx#18507
The twin PR to the kernel containing a defconfig for playing NXDoom on sim and documenting the port is available here: apache/nuttx#19239
Impact
Play DOOM on NuttX!
Testing
Played on NuttX simulator: