PDA

View Full Version : Halo Mumble Plugin(Code)



Skarma
September 20th, 2009, 02:45 PM
By: Prolak aka Snarf
3d Positional Sound
http://mumble.sourceforge.net/FAQ#How_does_the_positional_sound_work.3F
"Still working on it if anyone has a good idea on how to scale the distance please post " I think it's because of the game units halo uses, but if anyone else knows, post please!



/*Credits: Skarma,Skillz and whoever wrote this skeleton base*/

#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <tlhelp32.h>
#include <math.h>
#include "mumble_plugin.h"
HANDLE h = NULL;
static DWORD getProcess(const wchar_t *exename) {
PROCESSENTRY32 pe;
DWORD pid = 0;
pe.dwSize = sizeof(pe);
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnap != INVALID_HANDLE_VALUE) {
BOOL ok = Process32First(hSnap, &pe);
while (ok) {
if (wcscmp(pe.szExeFile, exename)==0) {
pid = pe.th32ProcessID;
break;
}
ok = Process32Next(hSnap, &pe);
}
CloseHandle(hSnap);
}
return pid;
}



static bool peekProc(VOID *base, VOID *dest, SIZE_T len) {
SIZE_T r;
BOOL ok=ReadProcessMemory(h, base, dest, len, &r);
return (ok && (r == len));
}
static void about(HWND h) {
::MessageBox(h, L"Reads audio position information from Halo", L"Mumble Halo Plugin", MB_OK);
}

static int fetch(float *pos, float *front, float *top) {
float viewHor, viewVer;
char state;
for (int i=0;i<3;i++)
pos[i]=front[i]=top[i]=0.0f;
bool ok;

ok = peekProc((BYTE *) 0x06AC4DE, &state, 1);
if (! ok)
return false;
if (state == 3)
return true;


DWORD addie;
ok =
peekProc((BYTE *) (0x6AC4E4) , pos, 4) &&
peekProc((BYTE *) (0x6AC4E8) , pos+1, 4) &&
peekProc((BYTE *) (0x6AC4EC) , pos+2, 4) &&


peekProc((BYTE *) (0x6AC504) , front, 4) &&
peekProc((BYTE *) (0x6AC508) , front+1, 4) &&
peekProc((BYTE *) (0x6AC50C) , front+2, 4);





if (! ok)
return false;

return ok;
}
static int trylock() {
h = NULL;
DWORD pid=getProcess(L"halo.exe");
if (!pid)
return false;
h=OpenProcess(PROCESS_VM_READ, false, pid);
if (!h)
return false;
float pos[3], front[3], top[3];
if (fetch(pos, front, top))
return true;
CloseHandle(h);
h = NULL;
return false;
}
static void unlock() {
if (h) {
CloseHandle(h);
h = NULL;
}
}
static MumblePlugin AssaultCubePlug = {
MUMBLE_PLUGIN_MAGIC,
L"Halo",
L"Halo",
about,
NULL,
trylock,
unlock,
fetch
};
extern "C" __declspec(dllexport) MumblePlugin *getMumblePlugin() {
return &AssaultCubePlug;
}

English Mobster
September 20th, 2009, 05:26 PM
What does this do, exactly?
It sounds interesting, but I'm not exactly sure what it does.

Skarma
September 20th, 2009, 05:50 PM
3d positional sound..so when you are talking to your teamates while playing...it sounds like their voice is coming from their character. Never used it, but when I get my pc working, I'll finish this plugin for Prolak and test it out.

Delta4907
September 20th, 2009, 06:07 PM
3d positional sound..so when you are talking to your teamates while playing...it sounds like their voice is coming from their character. Never used it, but when I get my pc working, I'll finish this plugin for Prolak and test it out.

But Halo doesn't have support for voice.., unless you mean to say this would work if you were using teamspeak, vent, or xfire voice.

Skarma
September 20th, 2009, 06:33 PM
But Halo doesn't have support for voice.., unless you mean to say this would work if you were using teamspeak, vent, or xfire voice.Doesn't matter though. It's just like how normal sounds work in game. Say someone is shooting a weapon, you can tell which direction they are because of positional sound the game uses. Mumble takes advantage of that and just applies it to voip. That's what this plugin is for, so it works with halo. And no, it doesn't work for teamspeak or vent, cuz it's for mumble only. Other voip software doesnt have this technology, yet.

Cortexian
September 20th, 2009, 06:49 PM
But Halo doesn't have support for voice.., unless you mean to say this would work if you were using teamspeak, vent, or xfire voice.
This is a Mumble plugin, not a Halo plugin.

Mumble reads Halo to figure out where everyone is and then applies directional sound to them.

Con
September 20th, 2009, 07:06 PM
I've never heard of mumble. Sounds cool, but I guess everyone uses teamspeak now. Maybe you should switch over to this, lancer ;p

Delta4907
September 20th, 2009, 07:28 PM
I'm still confused as to what this affects, but don't expect me to understand all this "mumble" jumble. (get it? ha.. :v:)

E: Alright, mumble is a voice chat program, now I [sorta] get it.

Sel
September 20th, 2009, 09:16 PM
I guess everyone uses teamspeak now.


looooool

oh and that's really cool dude

nice shit

Cortexian
September 20th, 2009, 11:53 PM
I've never heard of mumble. Sounds cool, but I guess everyone uses teamspeak now. Maybe you should switch over to this, lancer ;p
Maybe I will, at least until TeamSpeak 3 is released.

Flare
October 26th, 2011, 08:16 PM
can someone post the compiled plugin for us noobs?

souless
October 27th, 2011, 12:43 AM
http://www.mediafire.com/?ro8mlx3gp0ohox8

edit: it crashes my mumble off start, I think this source code was made for older Mumble version.

I'll recreate this plugin if I have time over this weekend.

souless
October 27th, 2011, 09:00 PM
http://www.mediafire.com/?s2d2bg32arkfnmw

Updated version, doesn't crash. Need somebody to test it out with me.