Wolfenstein 3D SDL

This is a forum for discussing the feasibility of getting emulators, games, or other applications that have had their source released ported to the Dreamcast. Please read the Porting FAQ before starting a topic in this forum!
OneThirty8
Damn Dirty Ape
Damn Dirty Ape
Posts: 5031
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Thu Nov 07, 2002 11:11 pm
Location: Saugerties, NY
Has thanked: 0
Been thanked: 0

Post by OneThirty8 »

Alrighty, guys...

I've taken a look at the NewWolf source code to see how the sound code in that version differs from the code I've been working with. I made one change -

Code: Select all

static short int sndbuf[512]
static short int musbuf[256]
became

Code: Select all

static short int sndbuf[512*1024]
static short int musbuf[256*1024]
This has made the horrific static start to sound like the radio at work with all the equipment running. This is good - the music is recognizable, just distorted.

Progress! :D :D :D

If things keep going like this, we may see a KOS port of my Windows port of the Linux port!

I knew there was a good reason to take another extended summer vacation - I may take the spring semester off too. :D
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

Just wondering - is there any reason to keep the existing sound system? On the PC side, you could just use SDL mixer, and let it handle all the buffering and streaming garbage. On the Dreamcast, you could simply upload the sounds to the Dreamcast's sound RAM, then play them each on a different channel. That's what I did in nxDoom, and it was much easier than getting the existing sound driver working correctly.

For the music, I assume it's using a software FM synth and outputting it to a sound buffer, right? Using SDL, it might be easier to generate the FM samples from the SDL sound callback (or hook into SDL mixer and use that to do the same thing). On the Dreamcast, it'd be a lot easier to just use the KOS streaming system, and generate the sound in the callback function. It's not like it has to be synchronized with anything.
User avatar
emptythought
DC Developer
DC Developer
Posts: 2015
Joined: Wed Jan 30, 2002 9:14 am
Location: UNITED STATES NRN
Has thanked: 0
Been thanked: 0
Contact:

Post by emptythought »

:dancey: :dancey:
OneThirty8
Damn Dirty Ape
Damn Dirty Ape
Posts: 5031
Joined: Thu Nov 07, 2002 11:11 pm
Location: Saugerties, NY
Has thanked: 0
Been thanked: 0

Post by OneThirty8 »

BlackAura wrote:Just wondering - is there any reason to keep the existing sound system? On the PC side, you could just use SDL mixer, and let it handle all the buffering and streaming garbage. On the Dreamcast, you could simply upload the sounds to the Dreamcast's sound RAM, then play them each on a different channel. That's what I did in nxDoom, and it was much easier than getting the existing sound driver working correctly.

For the music, I assume it's using a software FM synth and outputting it to a sound buffer, right? Using SDL, it might be easier to generate the FM samples from the SDL sound callback (or hook into SDL mixer and use that to do the same thing). On the Dreamcast, it'd be a lot easier to just use the KOS streaming system, and generate the sound in the callback function. It's not like it has to be synchronized with anything.
I'm glad you're around! Yeah, it's using a software FM synth and outputting it to a sound buffer just like you said. The only reason for keeping the existing sound code is basically that it's already there, but what you said makes a lot of sense. I'll try that after work. I'm not using SDL_Mixer at all right now, so I'll try just generating the samples from within the sound callback function. Thanks for the suggestion! :D

As far as the Dreamcast is concerned, I'll probably scrap all of the SDL stuff anyway. I'm doing this on my PC just to get a grasp on what I'm getting myself into.
bender
Mental DCEmu
Mental DCEmu
Posts: 399
Joined: Sun May 12, 2002 4:18 pm
Has thanked: 0
Been thanked: 0

Post by bender »

[quote="OneThirty8"]The Linux port only supports Wolfenstein3D shareware, Wolfenstein3D full version, Spear of Destiny, and the Spear of Destiny demo.

If you want to just play your old DOS games, DOSBox might do the job for you. Spear of Destiny works fairly well on my WindowsXP machine with DOSBox, so the music works. Just running it normally on XP, the game works but there is no music.

oh, i see. thnks
Don't know if it's possible but I think i have a better idea, something like a DOS livecd with all my old games ;)
good luck with this fantastic project :)
User avatar
emptythought
DC Developer
DC Developer
Posts: 2015
Joined: Wed Jan 30, 2002 9:14 am
Location: UNITED STATES NRN
Has thanked: 0
Been thanked: 0
Contact:

Post by emptythought »

DOS livecd
What's that?
typoEDR
Insane DCEmu
Insane DCEmu
Posts: 117
Joined: Tue Dec 16, 2003 1:46 pm
Has thanked: 0
Been thanked: 0

Post by typoEDR »

A DOS LiveCD would be, in theory, a bootable CD that would load some version of DOS (either MS-DOS or FreeDOS) into the system (not installing it or anything, but just playing it, like a console). This would allow for a DOS environment, which, accompanied by proper drivers, would allow for many classic DOS games to be played without a problem.

Much like Linux LiveCDs.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

I've done something like that before. Not particularly useful now, because on modern hardware a lot of games simply will not work even in DOS mode. I think I set it up with FreeDOS, a mouse driver, a CD driver, a small-ish RAM disk (around 32MB, which would be huge by DOS standards, but now it's nothing), and a load of games "installed" on the CD. Worked quite well, although sound generally doesn't work properly because modern sound cards are nothing like the old SoundBlaster cards these games were written for.
Alexvrb
DCEmu Ultra Poster
DCEmu Ultra Poster
Posts: 1754
Joined: Wed Jul 17, 2002 11:25 am
Has thanked: 0
Been thanked: 0

Post by Alexvrb »

The best way to achieve compatibility with current/future PCs would be to run DOS on an emulated machine. There are a number of ways you could do that, including making a bootable CD with a cut-down Linux and a port of a DOS emulator like DOSbox, which would actually skip using DOS altogether.
If you have twenty monkeys,
banging randomly on typewriters,
they will in twenty minutes produce the complete source code to World of Warcraft.
OneThirty8
Damn Dirty Ape
Damn Dirty Ape
Posts: 5031
Joined: Thu Nov 07, 2002 11:11 pm
Location: Saugerties, NY
Has thanked: 0
Been thanked: 0

Post by OneThirty8 »

*AHEM*

I now have sound working on Windows using SDL. I plan on making a few changes to the code so that I can change the sampling rate with a single define, but other than that sound is a-OK.

I don't have *anything* working on Dreamcast. There were a couple of defines in the code for reading in the data files on Linux or DOS, neither of which will work right for KOS, so all of that has to be rewritten or modified. I think I sort of know how I'm going to do it, but ATM I'm in the middle of setting up my Linux box again so I haven't had a chance to try it. That shouldn't be too hard, except for maybe the saving stuff.

And, @BlackAura, I sort of tried what you were talking about, and it didn't work (probably because I misunderstood you, or just did something wrong - I did like your way better, though). I just disabled the sound effects altogether temporarilly, and tried setting up my sound callback function to play what was in the buffer, and then call a function to fill the buffer with the next chunk of music. That didn't work too well - the sound seemed to get stuck in the same spot for a few seconds, and then I'd be given an invitation to report the error to Microsoft. I figured a simple workaround, though. I have a function that sort of resembles this:

Code: Select all

int SoundThread(void *data){

//Do some stuff to set up the software fm synth:

  while (SD_Started){
   if (bufferempty ==0){
     // figure out what song we're playing

     // send some info to the FM synth.

     //generate some music.
     if (/*we're playing a sound effect*/){
       // generate any needed sound effects and mix the music in with them.
    }else{
     // if there are no sound effects, split the music into 'stereo.'
     bufferempty = 1;
   }

  }
 return 0;
}
Then, I just create a SDL_Thread.

Code: Select all

int SD_Startup (){
  // Set up the SDL Audio stuff, and the FM synth stuff, etc... 
  hSoundThread = SDL_CreateThread(SoundThread, NULL);
  SDL_PauseAudio(0);
}
Then, my audio callback function is like this:

Code: Select all

int soundcallback(void *userdata, Uint8 *stream, int len){
  memcpy(stream, userdata, len)
  bufferempty = 0;
}
That fixes the problem I was having before, which was basically that the sound thread looped too fast, so the sound was getting a bit garbled. It's now nice and smooth, although I think it makes more sense to have the music playing constantly, and just have the sound effects play on their own channels as needed.
LyingWake
DCEmu Super Poster
DCEmu Super Poster
Posts: 1342
Joined: Thu Aug 26, 2004 4:05 am
Has thanked: 0
Been thanked: 0
Contact:

Post by LyingWake »

Anything new?
OneThirty8
Damn Dirty Ape
Damn Dirty Ape
Posts: 5031
Joined: Thu Nov 07, 2002 11:11 pm
Location: Saugerties, NY
Has thanked: 0
Been thanked: 0

Post by OneThirty8 »

I've got it to compile for DC, but it doesn't work yet. I know what's wrong with it, but I haven't had time to mess around with it to fix it. I basically have to replace a bunch of DOS and Linux stuff with something equivalent in KOS. I 'replaced' it with something that allows it to compile, but it doesn't actually do what it's supposed to. I expected that. It shouldn't be hard, but I have to find time to do it.
LyingWake
DCEmu Super Poster
DCEmu Super Poster
Posts: 1342
Joined: Thu Aug 26, 2004 4:05 am
Has thanked: 0
Been thanked: 0
Contact:

Post by LyingWake »

:wink:
User avatar
Christuserloeser
Moderator
Moderator
Posts: 5948
Joined: Thu Aug 28, 2003 12:16 am
Location: DCEvolution.net
Has thanked: 10 times
Been thanked: 0
Contact:

Post by Christuserloeser »

:devillook:
Insane homebrew collector.
OneThirty8
Damn Dirty Ape
Damn Dirty Ape
Posts: 5031
Joined: Thu Nov 07, 2002 11:11 pm
Location: Saugerties, NY
Has thanked: 0
Been thanked: 0

Post by OneThirty8 »

Sorry guys. I don't have any new progress right now. I promise to get back to it soon.
User avatar
Christuserloeser
Moderator
Moderator
Posts: 5948
Joined: Thu Aug 28, 2003 12:16 am
Location: DCEvolution.net
Has thanked: 10 times
Been thanked: 0
Contact:

Post by Christuserloeser »

Maybe tr0ll's source code could help you a bit?

http://www.dcemulation.org/phpBB/viewto ... sc&start=0
Insane homebrew collector.
LyingWake
DCEmu Super Poster
DCEmu Super Poster
Posts: 1342
Joined: Thu Aug 26, 2004 4:05 am
Has thanked: 0
Been thanked: 0
Contact:

Post by LyingWake »

Anything happen?
OneThirty8
Damn Dirty Ape
Damn Dirty Ape
Posts: 5031
Joined: Thu Nov 07, 2002 11:11 pm
Location: Saugerties, NY
Has thanked: 0
Been thanked: 0

Post by OneThirty8 »

I haven't had much time to work on it since I last posted about it. I don't know if anyone else is working with that source code.
User avatar
Christuserloeser
Moderator
Moderator
Posts: 5948
Joined: Thu Aug 28, 2003 12:16 am
Location: DCEvolution.net
Has thanked: 10 times
Been thanked: 0
Contact:

Post by Christuserloeser »

*bump*

Any news ? :(
Insane homebrew collector.
LyingWake
DCEmu Super Poster
DCEmu Super Poster
Posts: 1342
Joined: Thu Aug 26, 2004 4:05 am
Has thanked: 0
Been thanked: 0
Contact:

Post by LyingWake »

Not much. OneThirty8 is busy with school and I'm sure he has some other plans on his mind, not just Wolfenstein 3D. Though, for those that are interested, there was a new release of LoneWolf which is a pretty darn good Wolfenstein 3D port with SDL in it.

http://www.users.globalnet.co.uk/~brlow ... _win32.zip
http://www.users.globalnet.co.uk/~brlowe/LW086_src.zip
Post Reply