Jump to content
XCOMUFO & Xenocide

(another) Mp3 Patch For Ufo:ce


Guest AbraM

Recommended Posts

I done it primarily for myself, but maybe someone else find it useful too.

 

This is patch for X-COM UFO CE (Collector's Edition). It will allow you to play
the mp3 music instead of crappy mid. I know that similar patch exists, but I
think that THIS patch is better. Why? It should work with any Windows (95/98/Me
also), with any file system and it doesn't use Windows Media Player (it plays
directly via DirectX). How it works? It searchs for mp3 files and, if it finds
files of proper names, it plays one of them (randomly choosed). If it doesn't
find any file, it plays original mid. For example, if game sends a command to
play

sound\gmtactic.mid

the patch will search for

sound\gmtactic.mp3

If this file exists, it will be played. However, if this file doesn't exist, the
patch will search for

sound\gmtactic_1.mp3
sound\gmtactic_2.mp3
...
sound\gmtactic_9.mp3

If if finds three first files (1, 2 and 3), it will play one of them, randomly
selected. This way you can use all files from playstation version of game, which
has more tracks. Remember, that there can't be any holes in numeration. If you
have files

sound\gmtactic_1.mp3
sound\gmtactic_2.mp3
sound\gmtactic_4.mp3

the last one won't be ever played. If you have files

sound\gmtactic_2.mp3
sound\gmtactic_3.mp3

none of them will be ever played (game will play mid instead).

Some technical facts: exe is based on Mok's version of game. Besides adding mp3
support, I also speeded up geoscape (it works now with 10fps, instead of 1fps,
so it's smooth, but not too fast). Mp3 player is implemented in additional dll
file, source is included (for MS Visual C++ 6.0). Patch needs DirectX 8.1 or
higher, also if you want to compile source you will need DirectX 8.1 SDK.

That's all. Sorry for my English.

download (~270kB)

Link to comment
Share on other sites

  • 4 weeks later...

I like your approach of bringing mp3 into the game more because the music "responses" more quickly meaning it starts to play right away when it's supposed to. I suppose it's because of that "straigh through directx"-thingy..

 

But I can't get geoscape musics to play correctly. It plays GMGEO1 most of the time and rarely GMGEO2. 3 and 4 never plays... and I had to change GMTACTIC.MID to GMTACTIC_1.MID so that GMTACTIC_1.mp3 and GMTACTIC_2.mp3 would work...

Link to comment
Share on other sites

I'm glad someone tried this.

 

About your problems: I think game chooses to play gmgeo1.mid much more often than gmgeo2.mid. I personally have all four psx gmgeo files in two copies. Files in first copy are named:

 

gmgeo1_1.mp3 gmgeo1_2.mp3 gmgeo1_3.mp3 gmgeo1_4.mp3

 

and files in second copy are named:

 

gmgeo2_1.mp3 gmgeo2_2.mp3 gmgeo2_3.mp3 gmgeo2_4.mp3

 

With this configuration I feel that all tracks are played with equal frequency. Of course sometimes one track is played 2 or 3 times in a row (maybe even more). This is because program doesn't remember which files was choosed before. It's like throwing a coin: each time you have 50% chance to get each side. It doesn't matter that last 50 throws was obverse :)

 

And for the second problem: renaming gmtactic.mid to gmtactic_1.mid shouldn't have any influence, cause game sends message to play gmtactic.mid independent of fact, that this file exists or not. If you don't change name of this file, what's happen? Game is playing mid, or nothing?

 

If you want, you may try using this mp3patch.dll. Play a game for a while, and then post content of file mp3play.log, with listing of your ufo\sound\ directory. Maybe I will be able to help you more then.

Link to comment
Share on other sites

OK, Geomusics seems to play correctly now. Everything works great with musics, thank you.

 

However... ^_^

 

Could it be possible to play with this solution without Mok's fixed geo timer? Can it be removed from the executable? I feel it's still too jumpy even if you made it faster.

 

If that's possible and not too much trouble it would make this patch just Perfect.

Link to comment
Share on other sites

  • 1 month later...

I answered you there.

 

As a side note: my patch is based on mok's version of game, because I don't like max's version - I don't want changes to gameplay and I don't want to play on 3/4 of the screen. So, mok's version was the only one good alternative.

Link to comment
Share on other sites

I answered you there.

 

As a side note: my patch is based on mok's version of game, because I don't like max's version - I don't want changes to gameplay and I don't want to play on 3/4 of the screen. So, mok's version was the only one good alternative.

the 3/4 screen issue can be kinda fixed with some registry/screen tweaking, but what annoys me mostly is the speed Issues :/

Link to comment
Share on other sites

AbraM,

 

Can you tell me which part of the executable controls the FPS rate of the geoscape update ? I'm able to understand some disassembled asm.

 

And maybe also what code inserted for loading the mp3play.dll

 

So I can create a version which has :

[mok]

- proper alien screams

[abraM]

- mp3 music

[???]

- geoscape slowdown but with proper FPS

[max]

- autosell manufactured item

- allocate all engineers/scientist easily

 

Without the idle engineer on base contruction etc...

Or construct a way to item-ify each patch and patch in as needed.

Properly just patch everything in, but disable certain jmps to disable the 'feature'.

Link to comment
Share on other sites

If you are able to understand assembler, then why don't you find it yourself :P ?

 

Seriously, understanding assembler code of such size isn't simple task. Since I add only some minor modifications to the executable (I spent few hours with debugger), I am probably not the best person to answer your questions. I'm sure people, who created more advanced patches posses much larger knowledge. But even with their help it's not just copy-paste and you have exe with all features you wanted. If you want to create what you said, you'll have to get to known program structure, and it means a lot of time in front of monitor. Without this, you'll not be able to create correctly working executable.

 

In other words, I can't answer your questions without spending at least few more hours looking at unreadable assembler code :D I may write asm code I added, but you can easily see it if you compare original mok's exe with mine (I also explained how it works there). You can port it to max's version, but nobody said, that for example memory region that I used for some variable isn't used for something else. Or place that I used for code is not free. Or even something else. Now think about mixing together all features you listed... Don't get me wrong, it isn't impossible, but it isn't also simple. Or maybe it's only me thinking that assembler is hard (why isn't ufo source open? life would be such easy :D ).

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the new mp3 patch =b Finally mp3 musics work in my win xp machine.

 

Earlier NTFS patch stop working suddenly and i make everything i can and only intro music plays. (ntfs date stamp is on and everythink should be ok ,but no go)

 

Now i can continue my retro gaming with good musics. I bought my first enemy unknown in amiga 1200 and it have much better musics than pc version. Enemy unknown with these horrible midi music is allmost unplayable.

 

Amiga version have scariest musics in all versions available ,even PS1. But unfortunately i can't find them nowhere. Maybe these sample/mod based musics can converted to mp3.

Link to comment
Share on other sites

  • 2 weeks later...
Guest Kerigis

Sorry to bother, but, the intro music on my x-com doesn't run properly, every theme runs with 1 1/2 seconds of delay and that ruins all the intro. Maybe I didn't unzipped properly and I putted it on the wrong desk...

 

Anyways, thanks to your patch, I could finally hear the intro voices of the screams, the aliens, the "UFO located", etc. Plus fixing the geoscape. Thank you very much. =b

Link to comment
Share on other sites

Intro music? Where did you get mp3 music for intro? Not from PSX version I suppose, cause it has normal video as an intro so extracting only music (without sounds) is rather difficult. Anyway for me intro (with midi music) works good, but I don't watch it anyway :)

 

Also note, that I added only mp3 support, everything else (including sounds during intro and fixed alien screams) was done by Mok.

Edited by AbraM
Link to comment
Share on other sites

Guest Kerigis

No, the intro is all in midi.

 

Oh, and about the mp3, I did the thing about changing the names on the mp3 files of the Playstation X-Com music, but when I do that, there's no sound. Maybe I'm doing something wrong?

Link to comment
Share on other sites

You should be more detailed. As I said before, mp3 files must have the same name as midi files (plus eventual ending '_1', '_2',...) and be placed in the same directory. Also in the main game directory must be file called mp3play.dll and you must have installed at least direct-x 8.1. I suppose you did everything correctly. So, what happens:

- there is music but midi instead of mp3, or

- there is no music at all, or

- there are no music and no sounds?

Edited by AbraM
Link to comment
Share on other sites

OK, download this file, unpack it and copy mp3play.dll into your ufo directory. Play game for a while (few minutes is more than enough I think), and then post contents of a mp3play.log file, which should be created in your ufo directory. Post also listing of your ufo\sound directory (in case you don't want to write to much and don't know how to do it fast - write "dir <your ufo\sound directory> /b > aaa.txt" in command prompt - it will create file aaa.txt, which contain listing of files in this directory).

 

EDIT: Hmm, looks like he lost interest. Whatever...

Edited by AbraM
Link to comment
Share on other sites

Guest The_Key

Hi all!!

 

I want use Amiga version music because are much more beautifull but i don't know where download it...

 

I have find it in internet but nothing...

 

Can you help me?

 

Thank you!!

Link to comment
Share on other sites

Guest The_Key

Thank you AbraM.

 

I haved download this music file but i don't know like use it.

 

For example a file name is: MOD.ufo-geoscape1

 

what is the extention?

 

In the game the music file are MIDI (.mid) and if I change "MOD.ufo-geoscape1" in "MOD.ufo-geoscape1.mid" it don't work.

 

what can i do?

 

Thank you!!

Link to comment
Share on other sites

  • 1 year later...

Yeah, I know this one's been out of the loop for a while - but I'm interested. The system I play X-Com on runs with Windows 98, so this .mp3 patch would be fantastic. And in a sense, it is, because the computer doesn't play midi files. Yes, that's right. And you want to know the funny thing? This patch makes X-Com's midi files work. Unfortunately, not only are the instruments completely screwed up, that's not what I'd like the patch to play. ^_^

 

So, does anybody have that problem, midi files playing properly, but no .mp3? How could I fix it?

 

Oh, one more thing. About that Amiga music. Everybody seems to absolutely love the old Amiga version's soundtrack. I've visited that site out of curiosity, but when I type in John Broomhall's name into the search engine, no X-Com. What gives?

Edited by The Master Maniac
Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...

i finally deceided to check this .mp3 play and ...

it doesn't work for win98se :(

 

it only plays .mid files

additionally EVERY time when I quit from ufo

I receive fatal error window

( invalid page in module mp3play.dll )

 

dxdiag says DX v8.1 ( requirement stated in readme.txt )

and only one .mp3 in sound directory is added

( named 'gmtactic.mp3', with no underscores and numbers '_N' )

 

just for test, I removed .mid files and didn't hear any music at all

also intro sounds are corrected ( so the patch DO work, only .mp3 part do not )

 

I will gladly deep-check this problem, but ...

I can't download any of debug/log version of mp3play.dll

are all those links dead?

 

also it would be nice to have source files ( as is stated in patch readme.txt :D )

 

yarrow

Edited by yarrow
Link to comment
Share on other sites

The old links are dead, unfortunately. I uploaded the patch again.

 

http://www.4shared.com/zip/Fy5M-2ZC/mp3play.html

Here you can find the patch in both versions (with and without debug information), its source code, and the corresponding UFO executable. This is not exactly the same patch that was originally posted in this topic, as it has some bug fixes (I don't remember the details, sorry).

 

http://www.4shared.com/zip/2oROtteI/ufo_patch.html

Here you can find the newer patch, remade from scratch. It uses FMOD library to play music instead of Direct X. It can play mp3 and ogg files. Rules for selecting track to play are simpler (given a command to play gmtactic.mid, the patch will search for gmtactic*.mp3 and gmtactic*.ogg, and randomly select one of the found files, if any). Additionally I added FPS limit, so the game goes with normal speed regardless of how super-fast your computer is. This is the version I recommend.

 

EDIT: I decided to upload those files here as well.

 

Regards,

AbraM

mp3play.zip

ufo_patch.zip

Edited by AbraM
Link to comment
Share on other sites

funny thing is that:

debug version works perfectly for win9x ( with .log enabled )

but release version does not :)

 

according to wikipedia

fmod has support for .xm, .it and .mod files for xcom

I will check if it works with them ( I hope you compiled those plugs too )

 

yarrow

Edited by yarrow
Link to comment
Share on other sites

That's weird. What about the new version?

 

I don't have an access to a computer with win9x, so I won't help you much. Besides, if the new version works then there is no point in that.

 

As for the support of other music formats: The patch searches for files with mp3 and ogg extensions only - you would need to modify the code (a tiny change) and recompile it.

Link to comment
Share on other sites

hi

 

confirmed .... both the mp3play.dll and fmod.dll works with win98se

ROFL

 

but the exec timer slowdown functionality you provided is very crappy ( choppy ? )

for fmod so I stick with mp3play for now

 

( I remember from old times that hi res timers were limited on win9x )

can you provide ufo executable without additional fixes ( besides music play of course )

 

log version of mp3play works smothly

but release version causes invalid page faults in mp3play.dll module ( error message box points to it )

and they are not repeatable ( sometimes it accurs, sometimes not )

 

my guess is you miss something in the shutdown()

I suspect is this line:

if(g_contr) g_contr->Stop();

did it really stopped?

 

I remember that I has similiar problems with IGraphBuilder on win9x

I just added simple wait state to workarround this

 

same with fmod

page fault always accurs when I quit from ufo

( page fault message doesn't point to fmod, it says <unknown> module instead )

 

I tested them on winxp ( on the same hardware )

and both mp3 and fmod had none of this problems

so I am pretty sure it is something win9x specific

( thread / dshow ? )

 

at least it works in the game perfectly =b

yarrow

Link to comment
Share on other sites

Since page faults happen on exit in both mp3play and fmod versions, I guess they can have something to do with dll unloading maybe? You are probably right that a delay in the right place would do the trick.

 

As for the slowdown: QueryPerformanceCounter() seems to have a very poor quality on win9x, so timer_t::pause() should be reimplemented with different waiting method. If you don't need this functionality at all, then modify ufo_patch_api_pause() so that it is empty. This is easier than modifying the EXE to remove calls to this function.

 

EDIT: Reimplemented the patch to use timeGetTime() instead of QueryPerformanceCounter() - see the attachment.

ufo_patch.dll

Edited by AbraM
Link to comment
Share on other sites

I got some spare time to test

your new fmod version ... and ...

 

fmod version doesn't page faults anymore =b

 

still leaves dummy systray taskbar

after you click this 'empty' systray taskbar

it dissapperars normally

 

it's initialization is MUCH faster that mp3play.dll

( it is liveable since its only once )

 

fmod would be perfect

if it would be just a music patch on unmodified ufo exe

 

good work

yarrow

 

ps.

in the executable you provided, there is still 'ufo patch.dll' name with space ( not underscore )

at address 0x79F80

but you named your new patch file with underscore :P

Edited by yarrow
Link to comment
Share on other sites

  • 2 weeks later...

welcome back

 

I have recetly spent some time ( at last some spare time! )

and got recompiled your patch

reenabling all formats which fmod ( supposed to ) support

 

I used, devcpp 4.9.9.2 ( latest version )

and fmod 3.75, ( same as yours )

 

and ...

 

fmod of this version, does not =p support:

- tracker modules ( .mod, .xm and so on )

- .flac files

 

<copy from log file>

01:15:43:980 failed to open the sound stream for sound\gmgeo2.mod

01:15:54:420 failed to open the sound stream for sound\gmgeo2.xm

01:16:44:450 failed to open the sound stream for sound\gmgeo2.flac

01:16:51:540 failed to open the sound stream for sound\gmgeo2.it

01:16:53:310 failed to open the sound stream for sound\gmgeo2.s3m

</copy from log file>

 

so much for FMOD :(

 

yarrow

Edited by yarrow
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...