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: Select all
#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;
}