Forum Archive

Go Back   3D Realms Forums > 3D Realms Topics > Other Apogee/3D Realms Games > Shadow Warrior Source Code
Blogs FAQ Community Calendar

Notices

 
 
Thread Tools
Old 04-18-2005, 02:49 PM   #1
Arkion
CD audio quickfix for JonoF\'s port
Hello all!
I wrote a quick'n'dirty CD audio support for windows version of JonoF's port. CD support is implemented using windows Multimedia Control Interface and Mixer APIs. This meant to be a temporary solution until JonoF gets next version of his port ready.

Download JFSW_CDA.zip from http://www.angelfire.com/alt/arkion . Sorry about the horrible quality of the web page, but angelfire makes it a real mess with those ads an all.

Aforementioned zip contains the pre-compiled Debug build executable (hence the 2+ MB size) and relevant source code files (cd.c is modified, cd_mx.c and cd_mx.h are new), so you can alternatively compile it yourself by merging these files with JFSW sources.

Unfortunately save games are still not functional - coming up with a portable solution seems to be very tricky and will take some time.
Arkion is offline  
Old 04-18-2005, 03:51 PM   #2
Maren Gnawol
 
Re: CD audio quickfix for JonoF\'s port
Thank you, I'm about to give it a shot
Maren Gnawol is offline  
Old 04-18-2005, 04:25 PM   #3
WarHammer

WarHammer's Avatar
Re: CD audio quickfix for JonoF\'s port
Nice. Makes Shadow Warrior that much more playable. Saving would be nice but the shoddy mouse aim is my primary concern.

Frustrating though that I could only get it to play CD audio with the CD in my DVD±RW drive (E and not my otherwise worthless CD-ROM drive (F.
WarHammer is offline  
Old 04-18-2005, 06:51 PM   #4
djimd
Re: CD audio quickfix for JonoF\'s port
Yep - with many of the old cd audio games you can only have cd audio playing if the cd is in the cdrom with the highest letter - some games only accept letter D. ( So if you were to change the letters of your cd roms you could easily get the game to play from the one you like )
Nice fix tho - works a treat - Even better when ogg support comes in. - Don't suppose you can make a quick fix for this?
djimd is offline  
Old 04-18-2005, 07:19 PM   #5
tpz

tpz's Avatar
Re: CD audio quickfix for JonoF\'s port
Thank you... It works like a charm.

I wonder however, why your build of sw.exe is so much smaller then JonoF's. Did you rip out a lot of code?
__________________
"A Smith & Wesson beats four aces."
tpz is offline  
Old 04-19-2005, 04:00 AM   #6
Arkion
Re: CD audio quickfix for JonoF\'s port
You're welcome.

If I remember correctly, exe from my build was bigger than JonoF's. Main reason for this is that mine is a debug build and no optimizations are enabled. Also, I combined the engine and game codebases into single project and made it a Visual Studio Solution, instead of using the old makefile-only project. Thus, some settings could differ from the makefile ones.

MCI probably automatically picks the CD drive with lowest drive letter in case there are multiple drives installed, so that's the reason why only one of them works.
Arkion is offline  
Old 04-19-2005, 05:56 AM   #7
JonoF

JonoF's Avatar
Re: CD audio quickfix for JonoF\'s port
On my machine with two physical drives (I:, J and a virtual one from Daemon Tools (K, the physical drive with the highest drive letter is the default CDA device. I haven't yet seen any way to change that in Windows, but you can instruct MCI to use a specific drive if you use the mciSendCommand() interface like so:

Code:
MCI_OPEN_PARMS mop;
CHAR drive[4] = "K:";

memset(&mop, 0, sizeof(mop));
mop.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_CD_AUDIO;
mop.lpstrElementName = drive;

if (mciSendCommand(0, MCI_OPEN,
    MCI_WAIT|MCI_OPEN_SHAREABLE|MCI_OPEN_TYPE|
    MCI_OPEN_TYPE_ID|MCI_OPEN_ELEMENT,
    (DWORD)&mop)) /* error */;
I would release more frequent versions of the ports for testing and bleeding-edge diehards to use if it weren't for the frustratingly long time it takes to prepare new source and binary packages and put them online. Hopefully I can streamline my processes more to make it less of a hassle.

PS. Savegames are the next item on my "to-tackle" list right after I sort out the input problem that I'm working on at the moment. After that's done, I'm pretty much in a position for the next release.

Jonathon
JonoF is offline  
Old 04-19-2005, 06:40 AM   #8
Blade Nightflame

Blade Nightflame's Avatar
Re: CD audio quickfix for JonoF\'s port
I hope the Crash Bomb bug is fixed, it's kinda stupid to have a Sticky Bomb that crashes the game, not explodes. XD;;
__________________

Blade Nightflame is offline  
Old 04-19-2005, 06:44 AM   #9
Viciarg

Viciarg's Avatar
Re: CD audio quickfix for JonoF\'s port
Quote:
JonoF said:
PS. Savegames are the next item on my "to-tackle" list right after I sort out the input problem that I'm working on at the moment. After that's done, I'm pretty much in a position for the next release.
mmh...savegames...working mouse...cd audio?

__________________
Humanas actiones non ridere, non lugere, neque detestari; sed intellegere curavi.
Viciarg is offline  
Old 04-19-2005, 10:29 AM   #10
Maren Gnawol
 
Re: CD audio quickfix for JonoF\'s port
Just reporting it's working flawlessy here.
Maren Gnawol is offline  
Old 04-19-2005, 10:43 AM   #11
Arkion
Re: CD audio quickfix for JonoF\'s port
Quote:
I haven't yet seen any way to change that in Windows, but you can instruct MCI to use a specific drive if you use the mciSendCommand() interface like so:
Thanks for the pointer, Jonathon. However, we need to add a new menu item to Sound Options menu or a .cfg file entry to pick the CD drive to be used. Personally, I prefer the former option.

Quote:
I hope the Crash Bomb bug is fixed, it's kinda stupid to have a Sticky Bomb that crashes the game, not explodes. XD;;
That's weird - Sticky Bombs work flawlessly for me with my SW.EXE.

I'm going to tackle on the savegame problem as well and see what can be done. Having no savegame functionality is extremely frustrating, especially on higher skill levels. I must admit that it's really difficult stay alive for long in SW
Arkion is offline  
Old 04-21-2005, 08:46 AM   #12
JonoF

JonoF's Avatar
Re: CD audio quickfix for JonoF\'s port
My solution to the savegame problem appears to hold water, so the next release definitely will have working savegame support.

Jonathon
JonoF is offline  
Old 04-21-2005, 09:14 AM   #13
SamSwashbuckler
Re: CD audio quickfix for JonoF\'s port
Any idea when we can expect that? (Please don't let this be another WID!)
/me wants.... :P
__________________
{EDF}Sam Swashbuckler
Member of the SW Cult
http://SamSwashbuckler.Ath.Cx/
SamSwashbuckler is offline  
Old 04-21-2005, 10:55 AM   #14
TerminX

TerminX's Avatar
Re: CD audio quickfix for JonoF\'s port
Quote:
JonoF said:
My solution to the savegame problem appears to hold water, so the next release definitely will have working savegame support.

Jonathon
I see the commits to the tree for savegame support, but I can't test them out for a couple of days. Convenient time for the hard disk in my Windows machine to go FUBAR, no? Actually, hmm..

-- 1 minute later --

Well, with a few minor changes to the source (slightly misplaced #ifdef RENDERTYPEWIN in cd.c, missing include "baselayer.h" in rts.c) it builds and runs on Linux, but keyboard input seems to be messed up. No testing for me, I guess.
TerminX is offline  
Old 04-21-2005, 01:39 PM   #15
Arkion
Re: CD audio quickfix for JonoF\'s port
Quote:
My solution to the savegame problem appears to hold water, so the next release definitely will have working savegame support.
That's great news! I thought fixing this symbol table dilemma was near impossible without rewriting much of SW codebase and had to give up.

How'd you manage to store pointers in a file and make sure they are still valid when loaded from the file, possibly after restarting the application, is beyond me. Isn't that what the symbol table is all about? Oh well...
Arkion is offline  
Old 04-21-2005, 06:20 PM   #16
JonoF

JonoF's Avatar
Re: CD audio quickfix for JonoF\'s port
The method I'm using is to bring the symbol table into the program itself by constructing tables of saveable code and data in each module of the game. The new symbol lookup code then searches the saveable code/data tables of each module for a match and converts that into a "module, ordinal" pair for code and a "module, ordinal, offset" triplet for data. The downside of this is the tables for each module need to be constructed and maintained by hand but thankfully that job is made easier with a text editor capable of regular expressions and only some bits of the game really need to be saved. Basically, wherever in the SaveGame function you see a SaveSymDataInfo or SaveSymCodeInfo call, the data it could potentially point to is what goes into the saveable tables. My tests so far have indicated saving is quite feasible which makes loading then similarly straightforward since it's just a reversal of the process.

Jonathon
JonoF is offline  
Old 04-21-2005, 08:20 PM   #17
Ras

Ras's Avatar
Re: CD audio quickfix for JonoF\'s port
Will the new version have a way to choose which CD drive to use from the menu? Thanks for getting the saves working. Can't wait.
Ras is offline  
Old 04-21-2005, 09:17 PM   #18
JonoF

JonoF's Avatar
Re: CD audio quickfix for JonoF\'s port
I've got three things in the works at the moment which when they're complete will signal the release being ready:
  • save-games
  • fixed input code
  • start-up configuration window
Selection of a CD Audio drive will happen in the third item. If you've run the Build editor for JFSW you'll have seen an example of the startup config window in an early form.

Jonathon
JonoF is offline  
Old 04-21-2005, 11:12 PM   #19
Ras

Ras's Avatar
Re: CD audio quickfix for JonoF\'s port
Thanks! I really look forward to it.
Ras is offline  
Old 04-22-2005, 04:58 AM   #20
Another Duke Fan

Another Duke Fan's Avatar
Re: CD audio quickfix for JonoF\'s port
Just one question: "Failed setting buffering: DI_POLLEDEVICE", related to joystick misconfiguration, that led to disabled mouse & keyboard in game, is that now being fixed?
Thank you for all your great effort!! Really looking forward to the new JFSW!
__________________
アーティスト
Another Duke Fan is offline  
Old 04-22-2005, 09:50 AM   #21
JonoF

JonoF's Avatar
Re: CD audio quickfix for JonoF\'s port
Yeah, that's taken care of. DI_POLLEDDEVICE isn't a failure code but my daft use of DirectInput forgot that.

Jonathon
JonoF is offline  
Old 04-23-2005, 01:11 AM   #22
JonoF

JonoF's Avatar
Re: CD audio quickfix for JonoF\'s port
Saved games now work.

Jonathon
JonoF is offline  
Old 04-23-2005, 01:14 AM   #23
TerminX

TerminX's Avatar
Re: CD audio quickfix for JonoF\'s port
Quote:
JonoF said:
Saved games now work.

Jonathon
Yes, yes they do. I haven't had any save related failures at all in the test copies I've built. You're awesome, man.
TerminX is offline  
Old 04-23-2005, 01:48 AM   #24
djimd
Re: CD audio quickfix for JonoF\'s port
Quote:
TerminX said:
Quote:
JonoF said:
Saved games now work.

Jonathon
Yes, yes they do. I haven't had any save related failures at all in the test copies I've built. You're awesome, man.
GOOD stuff - look forward to trying a copy.
djimd is offline  
Old 05-06-2005, 12:52 AM   #25
Lt.Phobos
Re: CD audio quickfix for JonoF\'s port
I don't get how you can compile the files in the cd audio zip with the jwshadow warrior source code?
__________________
You don't know what death is? let me show you!
Lt.Phobos is offline  
Old 05-06-2005, 08:50 AM   #26
TerminX

TerminX's Avatar
Re: CD audio quickfix for JonoF\'s port
Quote:
Lt.Phobos said:
I don't get how you can compile the files in the cd audio zip with the jwshadow warrior source code?
You probably need to modify the Makefile to build and link cd.o and cd_mx.o.
TerminX is offline  
Old 05-29-2005, 04:09 AM   #27
Mephisto
Re: CD audio quickfix for JonoF\'s port
Speaking of joystick, does joystick finally work on Linux now? And does it support all 8 buttons and 4 axes, like the config file claims? (cause i could never get more than 4 buttons and 2 axes to work on the dos version). It's kinda pointless using a joystick in a 3d shooter with only 2 axes, cause you need at least 4 to be able to turn around and look at the same time.

[edit:] and how about ignoring the setting for ControllerType and have it use everything at the same time, like all modern games? I don't know if it's possible within the code though, its just a suggestion, but modern games let you use joystick and mouse at the same time.

[edit2:] just curious though, whats that with music during games? i personally turn off *all* music in every game because it gets repetative quickly and distracts from the real game, and certainly doesnt belong in "reality games" (like those army shooters), cause you dont hear any music on a *real* battlefield. I know, shadow warrior has nothing to do with reality, but in SW its even worse: you have to put a CD in. I always use no-cd cracks because i dont want to put no CD in. Oh well, it seems to be getting more like a rant now though, so i'll just quit before i start on copy protections and the uselessness of that.
__________________
"Fatal Error: Windows not found: (C)heer (P)arty (D)ance ?"
Mephisto is offline  
Old 05-29-2005, 04:24 AM   #28
JonoF

JonoF's Avatar
Re: CD audio quickfix for JonoF\'s port
Quote:
Mephisto said:
Speaking of joystick, does joystick finally work on Linux now?
I've written some SDL joystick code for the next release and it was fine on Windows so I can see no reason why it wouldn't work on Linux.

Quote:
and how about ignoring the setting for ControllerType and have it use everything at the same time, like all modern games?
I plan on doing that in the near future. The last time I tried it there were problems.

Jonathon
JonoF is offline  
Old 05-29-2005, 05:01 AM   #29
Blade Nightflame

Blade Nightflame's Avatar
Re: CD audio quickfix for JonoF\'s port
By the way, how's the JFDuke3d port coming along? Or is that delayed until JFSW is working properly again?
__________________

Blade Nightflame is offline  
 

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 06:34 PM.

Page generated in 0.14284205 seconds (100.00% PHP - 0% MySQL) with 16 queries

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

Website is ©1987-2014 Apogee Software, Ltd.
Ideas and messages posted here become property of Apogee Software Ltd.