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;
}
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;
}