All times are UTC - 5 hours [ DST ]


Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Global sound for Ultima Online
PostPosted: Sun Oct 30, 2011 5:30 am 
Offline
User avatar
User Rep: Unsung
 Profile

Joined: Sun Oct 30, 2011 5:17 am
Posts: 19
Ohai,

Just started on the shard yesterday and forgot how annoying UO can be when you minimize or alt-tab to a different window - the sounds stop.

A lot of people probably would appreciate having the game sounds played whatever you do so I made a patch including source.

The code itself is naturally very crappy as I made it quickly but the results are fine ;)

Just download uo-gsound.exe anywhare and drag your client.exe on top of it. It should patch it successfully, at least the UOSA client package client.exe and client_noenc.exe work fine. 3D client not tested, might work.

http://hifi.iki.fi/uo-gsound.exe (patcher)
http://hifi.iki.fi/uo-gsound.c (source)

For programmers etc.: the game uses DirectSound (naturally) and the secodary buffers it requests do not set DSBCAPS_GLOBALFOCUS flag. This patch adds it to the flags DWORD parameter by changing a single byte in the executable.

Code:
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    char search[] = { 0xC7, 0x44, 0x24, 0x3C, 0xE0, 0x00, 0x01, 0x00 };
    char replace[] = { 0xC7, 0x44, 0x24, 0x3C, 0xE0, 0x80, 0x01, 0x00 };
    long int fsize;
   
    printf("hifi's UO 2D global sound patch <3\n");
    printf("==================================\n");
   
    if (argc < 2) {
        printf("Error: Need a file to patch, drag client.exe to this executable.\n");
        getchar();
        return 0;
    }
   
    printf("Opening %s...\n", argv[1]);
    FILE *fh = fopen(argv[1], "rb+");
    if (!fh) {
        perror("Failed to open file");
        getchar();
        return 0;
    }
   
    fseek(fh, 0, SEEK_END);
    fsize = ftell(fh);
    fseek(fh, 0, SEEK_SET);
    printf("Crawling %ld bytes...\n", fsize);
   
    char *file = malloc(fsize);
    if (fread(file, fsize, 1, fh) != 1) {
        perror("Failed to read file");
        getchar();
        return 0;     
    }
   
    long int i;
    for (i = 0; i < fsize - sizeof(search); i++) {
        if (memcmp(file + i, search, sizeof(search)) == 0) {
            fseek(fh, i, SEEK_SET);
            if (fwrite(replace, sizeof(replace), 1, fh) != 1) {
                perror("Failed to write file");
            } else {
                printf("Patched! You now have global sound enabled!\n");
            }
            fclose(fh);
           
            getchar();
            return 0;
        }
        if (memcmp(file + i, replace, sizeof(replace)) == 0) {
            fseek(fh, i, SEEK_SET);
            if (fwrite(search, sizeof(search), 1, fh) != 1) {
                perror("Failed to write file");
            } else {
                printf("Reverted! Global sound is removed.\n");
            }
            fclose(fh);
           
            getchar();
            return 0;
        }
    }
 
    fclose(fh);
   
    printf("Did not find g-spot :-(\n");
   
    getchar();
    return 0;
}


Last edited by Derrick on Wed Feb 08, 2012 8:16 pm, edited 1 time in total.
Added code to post from external link.


Top
 
These Support SecondAge
Links open a new window.
UOSA Donors & Subscribers do not receive these ads.

 Post subject: Re: Global sound for Ultima Online
PostPosted: Mon Oct 31, 2011 9:02 am 
Offline
User avatar
User Rep: Trustworthy
Trustworthy
 WWW  ICQ  Profile

Joined: Thu Dec 13, 2007 7:49 pm
Posts: 9002
Location: Cove
Welcome to Second Age!!

I think your reputation precedes you, unless I'm mistaking you with another hifi :)

Thanks much for this patch!

_________________
Image
"The text in this article or section may be incoherent or very hard to understand, and should be reworded if the intended meaning can be determined."


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Wed Nov 02, 2011 7:33 am 
Offline
UOSA Donor!!
UOSA Donor!!
User avatar
User Rep: Unsung
 Profile

Joined: Sun Nov 30, 2008 9:40 pm
Posts: 1013
Image

_________________
Please choose a more appropriate signature.


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Wed Nov 02, 2011 10:44 am 
Offline
UOSA Subscriber!
UOSA Subscriber!
User Rep: Good
Good
 Profile

Joined: Tue Aug 02, 2011 7:26 am
Posts: 463
Location: Finland, Northeast Europe
It's beautiful. What else can I say?

I'm a very curious person though, and I'd like to know where does hifi get his reputation from? Obviously he is some demi-god programmer, but where can I find his other work/references? I honestly doubt I'll be needing any of it, just out of curiosity. It's always fun to see what people are capable of when they're passionate about something.

_________________
Sales History - Housing


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Wed Nov 02, 2011 10:55 am 
Offline
UOSA Donor!!
UOSA Donor!!
User Rep: Unsung
 Profile

Joined: Mon Aug 10, 2009 9:25 pm
Posts: 324
*Looks at an x86 opcode reference to see what changed.*


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Wed Nov 02, 2011 1:00 pm 
Offline
User avatar
User Rep: Unsung
 Profile

Joined: Sun Oct 30, 2011 5:17 am
Posts: 19
jekkis wrote:
It's beautiful. What else can I say?

I'm a very curious person though, and I'd like to know where does hifi get his reputation from? Obviously he is some demi-god programmer, but where can I find his other work/references? I honestly doubt I'll be needing any of it, just out of curiosity. It's always fun to see what people are capable of when they're passionate about something.


http://cncnet.org/
http://hifi.iki.fi/cnc-ddraw/
http://hifi.iki.fi/ra95-hires/

Stuck wrote:
*Looks at an x86 opcode reference to see what changed.*


Maybe the thing I described in the last paragraph of the post? -_-


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Wed Nov 02, 2011 1:13 pm 
Offline
UOSA Donor!!
UOSA Donor!!
User Rep: Unsung
 Profile

Joined: Mon Aug 10, 2009 9:25 pm
Posts: 324
hifi wrote:
Maybe the thing I described in the last paragraph of the post? -_-


Yeah, I didn't read that, I just kind of looked at the code. The joke being, that single byte wipes your entire disk or something equally malicious. I guess it fell flat. =/


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Sat Feb 18, 2012 11:22 am 
Offline
User Rep: Unsung
 Profile

Joined: Tue Feb 14, 2012 4:51 pm
Posts: 72
I told derrick about hifi's work on other oldschool games and showed off some of his stuff to him (Oldschool gamers/devs are a close knit group generally).

Hifi was quite interested in helping out with any issues here for a while, but he seemed to of lost interest quite quickly :P , it seems GOG.com caught wind of his stuff and are interested in using his skills for increasing compatibility with official releases.

Some of us in the *background* do continually contemplate ideas about how to help derrick/etc and find ways to make the experience on this shard more O/S and client/server friendly.

On that note: UO never had the problem of being left behind, client exe wise because of the continued support other games wern't afforded. But when support is dropped/etc, people like hifi/etc will be around to pick up the pieces.


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Tue Apr 03, 2012 1:02 am 
Offline
UOSA Donor!!
UOSA Donor!!
User avatar
User Rep: Kind
 Profile

Joined: Thu Sep 25, 2008 3:28 pm
Posts: 1763
Location: North Brit
I'm having an issue with my sound. When I go to my volume mixed, I keep trying to readjust my volume levels for my client, but everytime I increase it, it keeps my bar at 25%, an ideas?

_________________
Image


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Sat Apr 07, 2012 3:45 pm 
Offline
UOSA Donor!!
UOSA Donor!!
User avatar
User Rep: Fair
 Profile

Joined: Thu Mar 12, 2009 5:24 pm
Posts: 1456
Hello hifi and welcome. Glad to see your already posting in support. People willing to take part in the support forums is always much needed and welcomed.

Again Welcome to UOSA if you have questions feel free to ask in public or pm me.

_________________
Image

[21:27] <@Derrick> UOSA is a tribute to the feasibility of anarchy


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Sat Apr 07, 2012 11:06 pm 
Offline
User Rep: Unsung
 Profile

Joined: Sat Feb 18, 2012 10:24 pm
Posts: 415
I love this man. That drove me nuts. On the downside now even the non-hardcore dweebs will run 3 clients.


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Mon Apr 09, 2012 6:55 am 
Offline
User Rep: Unsung
 Profile

Joined: Thu Mar 22, 2012 7:49 am
Posts: 23
Here's same patch for 6.x+ clients:

C7 44 24 28 E0 00 01 00 ->
C7 44 24 28 E0 80 01 00

Cheers!


Top
 

 Post subject: Re: Global sound for Ultima Online
PostPosted: Thu Nov 01, 2012 1:44 pm 
Offline
User avatar
User Rep: Unsung
Post Rep: 1
 Profile

Joined: Sun Oct 30, 2011 5:17 am
Posts: 19
Hello again,

I actually made a generic patch later that proxies the call to DirectSound. This works for almost any game (not necessarily DRM protected, also note that anticheats might get triggered so use at your own risk).

Just drop this in your game directory and it should work.

http://hifi.iki.fi/dsound.dll

Unfortunately, I apparently lost the code so you just need to trust me on this one. I'll redo it some day with sources.


Top
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Support Second Age: These links Open in a New Window

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group  
Extended by Karma MOD © 2007—2012 m157y