FS#2969 - Doom

Attached to Project: Rockbox
Opened by Karl Kurbjun (kkurbjun) - Tuesday, 31 January 2006, 23:22 GMT
Last edited by Karl Kurbjun (kkurbjun) - Thursday, 23 February 2006, 02:19 GMT
Task Type Patches
Category Games
Status Closed
Assigned To No-one
Operating System
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Here's an initial doom port for the H300 and rockbox.
It always starts up and gets to the main menu,
sometimes it will let you start a game. Unfortunately,
there are graphics errors once the game starts. I will
also include a diff against IDOOM if you want to try
and find the problem with it. This port is based off
digita doom which is in turn based off the original
linux doom release (GPL'd). I started to port PrBoom
but I didn't get that to a workable state. I think
there may be some performance improvements from prboom
that may be worth looking into specifically in the
W_CheckNumForName under w_wad.c. The best guess I have
for the map problems is with structure packing, but I
think I'm handling that correct in gcc.

Needleboy: I wouldn't recomend putting this in an
optimized build or anything like that, it's in poor
shape, and does not always run.
This task depends upon

Closed by  Dave Chapman (linuxstb)
Tuesday, 28 March 2006, 15:47 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed to CVS
Comment by Karl Kurbjun (kkurbjun) - Tuesday, 31 January 2006, 23:27 GMT

Here is the diff file needed to compile the code also, it
increases the plugin buffer size and adds access to
vsnprintf to the plugins.
Comment by Karl Kurbjun (kkurbjun) - Tuesday, 31 January 2006, 23:33 GMT

Thanks to Daniel Stenberg for hosting the source, here's the
Comment by Karl Kurbjun (kkurbjun) - Wednesday, 01 February 2006, 00:00 GMT

A couple of notes I forgot: it looks for wads in /doom/
also, make sure you re-run configure after applying the
patch to cvs rebuild and copy your new rockbox zip to your

Also, I havn't made a sim or tested this out on one, but I
would be curious to know what the behavior is like.
Comment by Karl Kurbjun (kkurbjun) - Wednesday, 01 February 2006, 06:00 GMT

With this new patch the game doesn't crash anymore (it was a
timing issue) I was sending it bad vales for tic's in
i_system.c. Also, the controls work a bit better. It
doesn't let you use more then one key at a time though.
Also sometimes the buttons get stuck. I've added in all the
packed attributes to structures ala prboom, but it doesn't
fix the graphics problems. Also, if you know the level that
you're playing pretty well (map1 of doom 2) you can beat the
level, unfortunately, the game will crash. This has to do
with lack of precision formatting in snprintf/vsnprintf or
more specifically the format function in sprintf.c under
firmware/common. I have a hack that works for the hub
loading in hu_stuff.c, and I tried briefly with wi_stuff.c,
but it didn't work for the end of game screens. To apply
this patch I think you have to name your directory olddoom
and then patch against that.
Comment by Karl Kurbjun (kkurbjun) - Wednesday, 01 February 2006, 23:23 GMT

Here's a playable version of Doom. I havn't done much in
IRAM, but I've imported some of the wad handling code from
PrBoom which did give a noticable jump in performance. Thom
Johansen wrote an ASM function for the fixed multiply which
helped out as well. An ASM version of the Divide and
Absolute functions should help performance as well. The
game is now at least playable. Work still needs to be done
with the button handling (you can't run right now so there
are levels that can't be beaten). Sound needs to be done.
The compiler flags that need to be used on the IPOD are
-fpack-struct -mstructure-size-boundary=8 at least that's
what they use in iDoom. The code also still needs to be
cleaned up. And credit to the other doom ports given. An
interface for choosing the base game would be nice along
with command line option toggles. Also, Loading multiple
Wads will not work correct right now as realloc does not
copy the old malloc data over.
Comment by Karl Kurbjun (kkurbjun) - Thursday, 02 February 2006, 16:59 GMT

As a note: the link in the last post is the source in case
it wasn't clear.
Comment by Karl Kurbjun (kkurbjun) - Friday, 03 February 2006, 19:01 GMT

Here's the latest source for doom. The shareware wads are
now playable. The game is much faster as well. I am no
longer using the IDOOM code for scaling as it was a bit slow
on the H300. Their code is still present for other targets
as it's an excellent starting point. The game is running
about 150% right now (not in terms of frames, but game
speed) because of the timer. I am using HZ (100) ticks /sec
when the game is expecting 70 ticks/sec. Some code cleanup
still needs to be done. I've tried to credit code where
it's due, but I think there are still some sections that
need it. The game can now exit and the buttons are handled
ala rockboy, so it's very playable now.

The source code is here:

I also updated the patch as there was another change I had
to make to rockbox (allow the button_hold() command to be
mapped in plugins for the H300.
Comment by Anonymous Submitter - Monday, 06 February 2006, 03:11 GMT

I've updated the sources:
This should fix simulator compiles and adds another speedup
in graphics for the H300. Now it is writing the doom buffer
directly to the LCD skipping the intermediate framebuffer.
Comment by Karl Kurbjun (kkurbjun) - Friday, 10 February 2006, 05:51 GMT

I've updated the sources, this version fixes the problems
with the screen going blank. It also includes sound (no
music). The code still needs cleanups - - I also still need
to merge the changes Paul Louden has done for the ipod. An
interface for the Pwads and Iwads still has to be done.
Also, the midi patch I sent in needs at least some of this
doom patch against cvs.

The sources are still at:
Comment by Karl Kurbjun (kkurbjun) - Thursday, 23 February 2006, 02:09 GMT

Here's the latest change in doom, it's extremely stable now
(at least for me). The changes are:

Fixed Nightmare mode
Fixed end game
Fixed quit crash
Added more prboom rendering code -> speedup
expanded rendering code -> speedup
Rewrote lowquality renderer and moved option to loader ->
adds 1 fps to speed
Changed Default Keys:
------ ------
Menu Keys now work independent of ingame keys
All code reformatted and warnings reduced (only 6 now)
New Menu code to select options and Base game
doom shareware doom1.wad
doom registered doom.wad
doom retail (ultimate doom) doomu.wad
doom 2 doom2.wad
plutonia plutonia.wad
tnt tnt.wad
Doom directory is now /games/doom/
Disabled mouse calls -> speedup
Finally have the right timer. -> run is actually usable now
Added a timedemo option for speed testing, only runs with
doom shareware,
Ultimate doom, or registered doom saves timedemo
information in /games/doom/timedemo.txt
Merged Paul's Ipod changes, hopefully it works now
Comment by Karl Kurbjun (kkurbjun) - Thursday, 23 February 2006, 02:19 GMT

Had to move doom to a new server, don't know what was wrong
with my old one:
Comment by Karl Kurbjun (kkurbjun) - Thursday, 23 February 2006, 20:36 GMT
Here is the latest release of the code
This release eliminates all the compiler warnings for gcc 3.4 and has doom fitting into the standard plugin buffer size (0x80000).
Comment by Karl Kurbjun (kkurbjun) - Thursday, 23 February 2006, 20:37 GMT
oops, forgot that the new link to the code is:
Comment by Loaded (Loaded) - Sunday, 26 February 2006, 00:25 GMT
Can you post a precompiled playable beta version?

Comment by Paul Louden (darkkone) - Wednesday, 15 March 2006, 19:47 GMT
This .diff *should* compile against CVS as of RIGHT NOW. No guarantees if you haven't downloaded it by the time this text shows up.
Comment by Karl Kurbjun (kkurbjun) - Wednesday, 15 March 2006, 22:40 GMT
Here's the latest release:

* New sound code - no more stalls in game
* Playable external demos - place in /games/doom/demos/
* Addon code redone to search for files in /doom/addons (No more typing)
* Whole new doom engine - many more playable mods and mod features
* Rockbox volume control in game
* Save games have default text now
* 20% faster then 0.70
* Strafe button and modified keys again
* The low quality renderer has been disabled (broken)
* Freedoom is now playable


I tried a demos from: and they seemed to work fine. Select "No demo" to play the game normally. After the demo is done playing the game will exit. Right now it can only handle 10 demo's in the directory.

This version will also play many many more mods for doom. This release has many of Prboom's mod features so chances are if it runs in prboom it will run in this version. The limit on addons in a directory is 10.

To play freedoom either replace your doom2.wad with the freedoom doom2.wad or place the freedoom wad in addons and select it in the addons menu (make sure you select doom2 under gametype otherwise the game will messup). Freedoom also shows some of the new in game features in this release (although it is slow at times).

GP32 mods will not play anymore. This is because of the menu screens that were made for the GP32 version. I may fix this later.

Here is a link to the top 100 wads of all time for some great levels and mods to try:

I've disabled translucencies for this version due to some problems I was having with it.

The Rockbox volume change is under sound options. Unfortunately it's labeled MUSIC VOLUME for now as I don't have a graphic to use for it yet.

Save games are modified to place My Save[slot number] in the description also.

Old save games are broken and will no longer load. This unfortunate, but unavoidable. This should be the last and only time that save games are broken.
Comment by Paul Louden (darkkone) - Thursday, 16 March 2006, 09:28 GMT
Hate to say it Karl, but the newest copy of the src there doesn't even come *close* to compiling on iPod, and I hear that if you do get it compiled it has data aborts.
Comment by Paul Louden (darkkone) - Thursday, 16 March 2006, 09:35 GMT
Edit: Doesn't compile for H300 anyway. The new source .zip doesn't seem to work. :)
Comment by Paul Louden (darkkone) - Thursday, 16 March 2006, 10:02 GMT
Okay, this .diff *should* work with the rockdoom-src-0.80 to allow you to compile. Doesn't work for iPods yet (those problems are withint the src zip itself) but it'll get you H300 folk back on track. Assuming I did it right. All I know is that it compiles. I have no H300 to test on, and all that jazz.
Comment by Linus Nielsen Feltzing (linusnielsen) - Thursday, 16 March 2006, 11:14 GMT
For some reason, Dbuild_base() returns if "prboom.wad" isn't present, without even checking for other wads. Why is that?

Also, on my H300, it hangs in the game when I push the UP button.
Comment by Karl Kurbjun (kkurbjun) - Thursday, 16 March 2006, 18:50 GMT
Sorry about that last source release, it was pretty messed up with respect to current cvs. This version needs prboom.wad The Prboom wad is used to load things like the trig, sine, cosine tables from disk. It has some other benefits that I can't recall off the top of my head right now. This release has the fixes needed to get doom to run on the sim (startup at least) thanks to Dave Chapman. It won't start a game - I don't have time yet to look into why. I've fixed the up button error, for some reason the code to switch weapons (in g_game.c) sometimes gives values over NUMWEAPONS. I'm not sure why it's doing that, but I've added a hack to set the newweapon to 0 if it's greater then NUMWEAPONS. This needs to be fixed properly though. This release also has many more warnings, sorry about that, but I wanted to get the new code in first and then worry about cleaning it up. I'm including my patch against cvs so everyone can compile. Needleboy, this new patch "should" stop breaking your builds as it adds in all the plugin stuff at the end keeping the plugin api version compatable.

Latest version:
Comment by Karl Kurbjun (kkurbjun) - Thursday, 16 March 2006, 18:53 GMT
As another note, you may have to erase your default.cfg in /games/doom to clear out the old settings
Comment by Karl Kurbjun (kkurbjun) - Friday, 17 March 2006, 07:50 GMT
Here's the latest version of the code, has some more updates to g_game.c and some more options to allow tweaking the engine's new options. This version compiles much cleaner on my system (around 5 warnings). It still can't start a game in the sim. Not sure why. Also, this version has some modified compiler flags. The game runs a bit slower, but it's more stable and it compiles about 100k smaller on the H300 so hopefully it will fit on the ipod without a modified plugin buffer. The 0.81 diff against cvs will work fine with this version.
Comment by Karl Kurbjun (kkurbjun) - Friday, 17 March 2006, 19:22 GMT
rockdoom 0.86

This version simplifies the addon code and makes rockdoom run fine on the sim.
Comment by Paul van der Heu (paulheu) - Tuesday, 21 March 2006, 11:30 GMT
IMO pathnames should be consistent throughout the code, so in dstrings.h(line 58) the path to the savefile should be "games/doom/doomsav" (all lowercase) just like elsewhere in the code..
Comment by Paul van der Heu (paulheu) - Tuesday, 21 March 2006, 13:55 GMT
the wad file won't load.. I have doom1.wad in /games/doom/ but I get an error 'sorry you have no base wadfile'

Also the plugin says it 0.85 while I do have 0.86 installed..
Comment by Karl Kurbjun (kkurbjun) - Tuesday, 21 March 2006, 16:28 GMT
Make sure you have prboom.wad in the /games/doom directory also, the link is on my first post on march 16. I forgot to update the version string in 0.86 to report 0.86. If you downloaded the 0.86 source, that's what you have. I wasn't really making the release for misticriver as it doesn't include any functional improvements from 0.85. If you want to fix the version string it's in rockdoom.c under main(.
Comment by Daniel Stenberg (bagder) - Friday, 24 March 2006, 08:07 GMT
What't the state of this work right now?

How about we commit what Karl has now and give him CVS commit access to continue working with doom directly in the CVS tree?
Comment by Reza (afruff23) - Saturday, 25 March 2006, 00:04 GMT
Could you possibly add iAudio X5 support?
Comment by Karl Kurbjun (kkurbjun) - Monday, 27 March 2006, 06:37 GMT
I have a newer build that adds in all of prbooms additional features. It also gives full access to all of prboom's menu's but I think it needs some more work as the text is barely readable. I can upload a new version that compiles cleanly with the old doom menus in a few days if you want to commit doom to cvs.

As far as iAudio support, I think it needs a developer interested in that platform. I will be interested in working on other ports once I have all the foundation work done.
Comment by Paul Louden (darkkone) - Monday, 27 March 2006, 06:45 GMT
Karl: Does it build for iPod now? Last time you updated, it wouldn't compile for iPod and I haven't really tried since. (Didn't really like the idea of it requiring prboom.wad, really. Is that something that can be distributed with Rockbox?)
Comment by Karl Kurbjun (kkurbjun) - Tuesday, 28 March 2006, 01:34 GMT
Here's the latest version of the source, it compiles for the H300 and the sim cleanly. The Ipod version is still not working. There are alot of features and fixes in this release, but as of now they are inaccessable as an interface needs to be added to change the settings. This release has all of prbooms code except the menu handling, dehacked support, and high resolution support. I think this release is ready for cvs. Let me know if there are any problems. I've included the cvs diff for this version as well.
Comment by Karl Kurbjun (kkurbjun) - Tuesday, 28 March 2006, 01:42 GMT
oops, forgot the code link: