Results 1 to 10 of 13

Thread: Halo Mumble Plugin(Code)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Codesaurus Skarma's Avatar
    Join Date
    Apr 2009
    Location
    Columbus, OH
    Posts
    227

    Halo Mumble Plugin(Code)

    By: Prolak aka Snarf
    3d Positional Sound
    http://mumble.sourceforge.net/FAQ#Ho..._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!


    Code:
    /*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;
    }
    Last edited by Skarma; September 20th, 2009 at 01:49 PM.
    Reply With Quote

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •