Duke3D For PSP Slim

Discussion in 'Articles' started by x3sphere, May 24, 2008.

  1. x3sphere

    x3sphere Administrator Staff Member

    Joined:
    May 17, 2006
    Messages:
    14,686
    Likes Received:
    128
    Last played:
    Sunset Overdrive on Xbox One
    [​IMG]

    Homebrew developer Wally today sent over an updated build of the Duke Nukem 3D PSP port originally written by MrPeanut, complete with support for Slim units. Since various individuals assisted him in the creation of the release, the author would like to send thanks to the following developers:[blockquote2]* MrPeanut - Gave me a hand while still learning
    * HardHat - Always ready to help
    * InsertWittyName - For the quick stress free advice[/blockquote2]As with previous builds, a shareware or retail version of the DUKE3D.GRP data file is required to play. The file itself should be placed inside of the Duke3D folder contained in the archive below.

    Download Duke3D For PSP Slim
     
  2. Chilly Willy

    Chilly Willy Contributor

    Joined:
    Mar 14, 2007
    Messages:
    749
    Likes Received:
    26
    Hmm... not bad, but it still has the audio sample rate bug, and crashes when you try to exit.
     
  3. Wally1

    Wally1 New Member

    Joined:
    May 24, 2008
    Messages:
    2
    Likes Received:
    0
    Yeah, i'm still yet to learn how to do that yet Chilly Willy :p

    Noob I am yes!

    People should expect some more releases here in the future!

    Wally
     
  4. Wally1

    Wally1 New Member

    Joined:
    May 24, 2008
    Messages:
    2
    Likes Received:
    0
    I'd like to acknowledge the following:

    stereomike made the original PSP port, MrPeanut followed it up. My bad.

    Also Chilly Willy, MrPeanut said that there is an app which he has made that fixes the audio sample bug. Its avaliable here
    [rapidshare.com]


    Wally
     
  5. Chilly Willy

    Chilly Willy Contributor

    Joined:
    Mar 14, 2007
    Messages:
    749
    Likes Received:
    26
    Hey Wally! Good to see you here. If you post the source, maybe I can help with the audio bug. I don't see why you should have to use a Windows app to resample the sound. There are ways to change the PSP's sample rate. You could also resample the audio on the fly if needed. :)
     
  6. wally

    wally Developer

    Joined:
    Mar 24, 2007
    Messages:
    23
    Likes Received:
    0
    <p>the source is avaliable at
    www.68kshrine.net/temp/jfbuildandduke.zip</p>
    <p>Cheers!</p>
    <p>wally</p>
     
  7. Chilly Willy

    Chilly Willy Contributor

    Joined:
    Mar 14, 2007
    Messages:
    749
    Likes Received:
    26
    Cool. I'll start looking into the sound.

    EDIT: Just to be certain - there's three source folders in the arc... which one are you building from?
     
  8. wally

    wally Developer

    Joined:
    Mar 24, 2007
    Messages:
    23
    Likes Received:
    0
    <p>Heh, i said exactly the same to Mr Peanut.</p>
    <p>the correct makefile is located in jfduke3d_psp_mrp_98</p>
    <p>All the other folders are just linked somehow (Don't ask)</p>
    <p>Wally</p>
     
  9. wally

    wally Developer

    Joined:
    Mar 24, 2007
    Messages:
    23
    Likes Received:
    0
    <p>OH and don't forget about Basilisk 2 xD</p>
     
  10. fungusinmymilk

    fungusinmymilk New Member

    Joined:
    May 27, 2008
    Messages:
    8
    Likes Received:
    0
    Duke Nukem 3d is one of my most favourite games.

    very much looking forward to a stable port on the psp!

    thanks for picking up the project guys :smile:
     
  11. Chilly Willy

    Chilly Willy Contributor

    Joined:
    Mar 14, 2007
    Messages:
    749
    Likes Received:
    26
    Okay folks, try this out... just drop it in place of the EBOOT.PBP you already use.

    http://www.mediafire.com/download.php?x3l2vivjnjy

    It fixes the audio pitch problem for me. The source of the trouble is actually SDL - SDL has the ability to convert samples from one format and rate into another, and Duke3D uses that. The problem is in SDL_audiocvt.c:

    Code:
    		/* We may need a slow conversion here to finish up */
    		if ( (lo_rate/100) != (hi_rate/100) ) {
    #if 1
    			/* The problem with this is that if the input buffer is
    			   say 1K, and the conversion rate is say 1.1, then the
    			   output buffer is 1.1K, which may not be an acceptable
    			   buffer size for the audio driver (not a power of 2)
    			*/
    			/* For now, punt and hope the rate distortion isn't great.
    			*/
    #else
    			if ( src_rate < dst_rate ) {
    				cvt->rate_incr = (double)lo_rate/hi_rate;
    				cvt->len_mult *= 2;
    				cvt->len_ratio /= cvt->rate_incr;
    			} else {
    				cvt->rate_incr = (double)hi_rate/lo_rate;
    				cvt->len_ratio *= cvt->rate_incr;
    			}
    			cvt->filters[cvt->filter_index++] = SDL_RateSLOW;
    #endif
    		}
    
    Notice that the "slow" conversion isn't enabled. SDL by default only does conversions by powers of two. If the difference in the sample rate of the sample and the audio playback rate isn't a power of two, SDL only scales is to the closest power of two. That's why the Duke3D sounds are all off. If you change that "#if 1" to "#if 0", the sounds will be fine. My executable is compiled with the SDL compiled that way.

    One point: this isn't a fast conversion. Duke3D waits until a sound needs to be played the first time before doing the conversion. This means there's a brief pause right as the sound effect is used (or not so brief for some of Duke's one-liners). I'll probably try adding code to force all the sound effects to be converted right at the start of the level or something.

    Note that this version also exits to the XMB, and allows you to exit via the Home button as well.
     
  12. Chilly Willy

    Chilly Willy Contributor

    Joined:
    Mar 14, 2007
    Messages:
    749
    Likes Received:
    26
    Okay, here's test 2.

    http://www.mediafire.com/download.php?ep1ghmtd1zg

    I expanded the heap to 16 MB. The earlier value (10 MB) caused sounds to not be played, especially when the music was playing. I suppose it ran out of heap space for the sounds.

    I also set the optimization level to 1. The code base for this is pretty lousy - if you set the optimization level higher than 1, it crashes. Even at O0, it still had a tendency to crash after using the menu, or restarting a level. I suppose someone needs to make a conversion of EDuke32 instead of old JFDuke code. Oh well.

    EDIT: Here's the source for test 2.
    http://www.mediafire.com/download.php?0p2xd1gmk2e
     
  13. wally

    wally Developer

    Joined:
    Mar 24, 2007
    Messages:
    23
    Likes Received:
    0
    <p>Sweet!</p>
    <p>Good on ya chilly willy :)</p>
    <p>I'll test when i get home.</p>
    <p>Wally</p>
     
  14. Chilly Willy

    Chilly Willy Contributor

    Joined:
    Mar 14, 2007
    Messages:
    749
    Likes Received:
    26
    The only files that were changed were:
    sdlayer.c - altered heap size, fixed callbacks, and added callback setup to main
    game.c - added sceKernelExitGame() right before ShutDown()
    Makefile - some changes to get it to compile with the latest toolchain/sdk in linux

    And of course, I changed SDL_audiocvt.c as mentioned previously.
     
  15. midnitdragoon

    midnitdragoon New Member

    Joined:
    Jun 6, 2008
    Messages:
    22
    Likes Received:
    0
    i registered just so i can post on this topic. I love Duke Nukem 3D and i love you for undertaking this project so well!!!! Thank you! Quick question how do i enable music? trying to get it to work but dunno where to start arrrgh
     
  16. midnitdragoon

    midnitdragoon New Member

    Joined:
    Jun 6, 2008
    Messages:
    22
    Likes Received:
    0
    ok i tried this new version and its a little skippy dunno why. other than that no crash when trying to exit =D. anyone know how to add music?

    ok i read above and realize why it skips hehe!
     
  17. Chilly Willy

    Chilly Willy Contributor

    Joined:
    Mar 14, 2007
    Messages:
    749
    Likes Received:
    26
    Download the timidity instruments from here (Warning! 14MB file):
    http://www.libsdl.org/projects/SDL_mixer/timidity/timidity.tar.gz

    Put the timidity directory that is inside that arc into the Duke3D directory on your PSP. Then put this file (inside the attached zip) in the Duke3D directory as well.

    Haven't had the chance to look into preloading the sounds yet. Maybe this weekend.
     

    Attached Files:

  18. midnitdragoon

    midnitdragoon New Member

    Joined:
    Jun 6, 2008
    Messages:
    22
    Likes Received:
    0
    oooo ok very i got that to work thanks Willy!! Well i played through the first level fust fine. Now when getting to second level loading it went to "Generating Music Data... Wait, Please." and just frose there. Dont know what thats about hehe. Well anyways gonna keep trying other duke levels and let you know whats up =D

    Edit- Ok i tried episode 2 and got passed the first level. When it got to the loading screen for the second level it froze and shut of my psp at the "Generating music data..." screen.
     
  19. Chilly Willy

    Chilly Willy Contributor

    Joined:
    Mar 14, 2007
    Messages:
    749
    Likes Received:
    26
    Thanks for the report... I'll look into that. Might be an issue with how the current code releases the memory for the old score, or how it deals with the temporary file generated.
     
  20. Chilly Willy

    Chilly Willy Contributor

    Joined:
    Mar 14, 2007
    Messages:
    749
    Likes Received:
    26
    Okay, as far as I can tell, the problem with the music going from level 1 to level 2 is the fault of timidity. Timidity is used by SDL_mixer to play the MIDI scores, but when timidity is converting the score, if it runs out of memory, it tries to exit the program instead of simply not playing the music. Go fig. Anywho, trying to exit on Duke3D blows up, which is why it hangs when it tries to convert the score for level 2. I haven't figured out a way to limit the memory or flush the memory in use (sound effects). So music is a no-go at the moment. :(

    On the plus side, this test version has the speed bumped to 333MHz, which makes the sound effects conversion less noticeable, and the game a bit smoother. I also added TV support to SDL, so now you can play Duke3D on the TV on the Slim. When you start the app, hold down the TRIANGLE button. You'll get a set of message dialogs asking about what video settings you want SDL to use. If you don't have a Slim, don't have the dvemgr.prx, or don't have a cable, it only asks if you wish to make the display wide screen (480x272) or not (364x272) on the LCD. That's good if you want to play Duke3D in the original aspect ratio.

    If you have a Slim, the dvemgr.prx, and a cable, then you get asked if you wish to use the TV output, if you wish to do interlaced output (if you have the component cable - composite is ALWAYS interlaced), if your TV is 16 : 9 (HDTV), and if you wish to make the display widescreen. Just try a few different settings to see how it works. It writes this data to a prefs file so that the next time you run the app, it'll use those same settings (unless you hold TRI again).

    So here's test 4: http://www.mediafire.com/download.php?mvzzye0amqi
     

Share This Page