Main Menu

Demo playback sound?

Started by Cryfire, December 28, 2012, 09:31:59 AM

Cryfire

I was wondering if there was any way to get the sound to work again when playing demos? It's nice to play them and see what was but would be so much better if the sound worked again.

Hotaru

Sound works in demos played back with an earlier issue of the client--issue 17, possibly 18 (I'll have to pick up a Going Rogue disk to check that out, though). If you've got an earlier issue backed up to CD, that could give you your aural fix, though later parts/patterns/effects/maps might be missing from some demos.

Leandro

It might be possible to patch the current client to re-enable sound in demos. I think Codewalker is looking into it.

Hotaru

That would be unspeakably awesome, Leandro.

therain93

Quote from: Leandro on December 29, 2012, 10:43:49 AM
It might be possible to patch the current client to re-enable sound in demos. I think Codewalker is looking into it.
That would be a phenonemal accomplishment and one I look forward to, if it's in the pipeline!
@Texarkana - March 5, 2004 - December 1, 2012 -- Imageshack |-| Youtube
---------------------------------------------------------------------------------------

You don't know what it's like.... |-| Book One. Chapter one...

Codewalker

How to fix demo playback sound in the Issue 24 beta client:

You'll need 1 (one) hex editor program, 2 tablespoons of sugar, and a jackhammer.

Okay, just the hex editor.


  • MAKE A BACKUP COPY OF CITYOFHEROES.EXE

  • Check that you made a backup copy of Cityofheroes.exe

  • At offset 0043788A of Cityofheroes.exe, you'll see the following sequence of bytes:

    E8 F1 18 05 00 E8 BC 10 05 00

  • Change it to:

    83 05 30 13 67 01 01 90 90 90

  • Save the changes

  • Fire up your bug fixed copy and enjoy sound in demo playback!

Working on finding the correct locations in the Issue 23 client, will make a followup post shortly.

Codewalker

For the Issue 23 client:


  • MAKE A BACKUP COPY OF CITYOFHEROES.EXE

  • Check that you made a backup copy of Cityofheroes.exe

  • At offset 0043A43A of Cityofheroes.exe, you'll see the following sequence of bytes:

    E8 D1 15 05 00 E8 9C 0D 05 00

  • Change it to:

    83 05 D0 D4 66 01 01 90 90 90

  • Save the changes

  • Fire up your bug fixed copy and enjoy sound in demo playback!


Michiyo

Made a patcher for those not wanting to play with hex editors.

Link for Live Client

Link for Beta Client
Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems. – Jamie Zawinski

corvus1970

Holy crap on toast!

Codewalker, NeoRavencroft, you guys are awesome! :D
... ^o^CORVUS^o^
"...if nothing we do matters, than all that matters is what we do."
http://corvus1970.deviantart.com/

The Fifth Horseman

Tech awesome. (pardon the pun).
We were heroes. We were villains. At the end of the world we all fought as one. It's what we did that defines us.
The end occurred pretty much as we predicted: all servers redlining until midnight... and then no servers to go around.

Somewhere beyond time and space, if you look hard you might find a flash of silver trailing crimson: a lone lost Spartan on his way home.

Codewalker

The really funny part is that the bug is actually related to loading screens. Go figure.

Hotaru

Once again, I find myself celebrating Codewalker Xmas, which unlike plain ol' Xmas, seems to come ever few weeks. Outstanding!

NeoRavencroft, thank you so much for making it idiot simple. In the time it took me to read Codewalker's posts, hit Wikipedia for info on hex editors, and finally download one, you took care of everything. Nicely done!

Hotaru

Quote from: Codewalker on December 30, 2012, 01:37:11 AM
The really funny part is that the bug is actually related to loading screens. Go figure.

About 2 weeks back, Floride mentioned here http://www.cohtitan.com/forum/index.php/topic,7275.0.html that it might've been turned off by the devs to stop annoying sound bugs during loading screens.

Thanks again for another awesome contribution!

Codewalker

It is related to the loading screen change that Floride mentioned, but in a somewhat unexpected way.

The game keeps an internal frame counter in memory, and the main loop increments that counter for every frame that's drawn. It's not used for much, but one of the few things it is used for is to fade the volume back in after it was muted for a loading screen.

The demoplay loop however doesn't increment that counter. So the sound code thinks that you're still at a loading screen the whole time a demo is playing because the frame count is 0. So it keeps the volume at 0.

The patches above modify the demo loop to simply increment the frame counter, and then everything works properly. Since with all magic nothing is free, in order to do that I had to replace some existing instructions. I picked the ones that call a function to detect changed files, since the number of times when people need to move files around during demo playback should be close to 0.

Michiyo

So my Scene file replacements for a fog free Echo DA won't work anymore?  Darn!  Small trade off :D
Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems. – Jamie Zawinski

Codewalker

Quote from: NeoRavencroft on December 30, 2012, 02:52:17 AM
So my Scene file replacements for a fog free Echo DA won't work anymore?  Darn!  Small trade off :D

No, those will still work. :)

The only check I removed was the one for files that are changed after the game is already started -- like if you were to drag a new replacement sound file or something in during playback. Even that only worked if the files were present on startup (you couldn't add new overrides once the game was running; just replace existing ones). So very little is lost.

And thanks for putting together that patcher so quick. Saved me the trouble of writing yet another launcher!

Michiyo

Well my scene replacement required I rename and then rename back the skyfiles, I had a bat that did it for me.  They didn't work unless they were "New" and renaming worked.  But I'm REALLY not worried about that :p
Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems. – Jamie Zawinski

Codewalker

Oh, that's because scenes/ is one of the four excluded directories that normally is prohibited from being overridden by local files, along with ent_types/, geobin/, and object_library/.

It's pretty easy to hack that check out of the exe, I can PM you details if you want; just let me know which client version.

Hotaru

#18
I'm thinking this info and the links to NeoRavencroft's executables should be given a new sticky on this board--some folks who didn't follow this past the initial exchange should be jazzed to know we now have sound luv in demos.

I'd be interested in getting some info on how to override ent_types and scenes with local files, since I have some ideas I'd like to try out (mainly with trying to get clickies to show up demo playback).

Edited to add: in i24.

Electric-Knight

FANTASTIC!!
Thank you SO MUCH, Codewalker!
And thanks for those patchers, NeoRavencroft!

Has anyone told Black Pebble about this fix? I just thought he'd appreciate it.
--
"Your reality, sir, is lies and balderdash and I'm delighted to say that I have no grasp of it whatsoever."
- Baron Munchausen

http://www.pauldamonthomas.com/