Skip to content
Permalink
Browse files

Fix bug and formating in subrosa PA plugin.

  • Loading branch information...
hacst committed Oct 23, 2013
1 parent 3af1651 commit e51921e6f723f5d917cac9d438d4eed094bb9fb4
Showing with 21 additions and 21 deletions.
  1. +21 −21 plugins/sr/sr.cpp
@@ -32,44 +32,44 @@

#include "../mumble_plugin_win32.h"

static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &context, std::wstring &identity) {
static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &/*context*/, std::wstring &/*identity*/) {
for (int i=0;i<3;i++)
avatar_pos[i]=avatar_front[i]=avatar_top[i]=0.0f;

char state;
char state;
bool ok;
// Create containers to stuff our raw data into, so we can convert it to Mumble's coordinate system
// Create containers to stuff our raw data into, so we can convert it to Mumble's coordinate system
float pos_corrector[3];
float front_corrector[3];
float top_corrector[3];

/*
value is < >
*/
ok = peekProc((BYTE *) 0xB378564, &state, 1); // Magical state value
if (! ok)
return false;

if (state == 1)
return true; // This results in all vectors beeing zero which tells Mumble to ignore them.

// Peekproc and assign game addresses to our containers, so we can retrieve positional data
return true; // This results in all vectors beeing zero which tells Mumble to ignore them.
// Peekproc and assign game addresses to our containers, so we can retrieve positional data
ok = peekProc((BYTE *) 0x1243BE84, &pos_corrector, 12) &&
peekProc((BYTE *) 0x1243BEA8, &front_corrector, 12) &&
peekProc((BYTE *) 0x1243BE9C, &top_corrector, 12);

peekProc((BYTE *) 0x1243BEA8, &front_corrector, 12) &&
peekProc((BYTE *) 0x1243BE9C, &top_corrector, 12);
if (! ok)
return false;

// Convert to left-handed coordinate system

// Convert to left-handed coordinate system
avatar_pos[0] = pos_corrector[0];
avatar_pos[1] = pos_corrector[1];
avatar_pos[2] = -pos_corrector[2];

for (int i=0;i<3;i++)
avatar_pos[i] / 15; // Scale to meters

avatar_pos[i] /= 15; // Scale to meters
avatar_front[0] = -front_corrector[0];
avatar_front[1] = -front_corrector[1];
avatar_front[2] = front_corrector[2];
@@ -83,21 +83,21 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa
camera_front[i] = avatar_front[i];
camera_top[i] = avatar_top[i];
}

return true;
}

static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {

if (! initialize(pids, L"subrosa.exe"))
return false;

// Check if we can get meaningful data from it
float apos[3], afront[3], atop[3];
float cpos[3], cfront[3], ctop[3];
std::wstring sidentity;
std::string scontext;

if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) {
return true;
} else {
@@ -141,4 +141,4 @@ extern "C" __declspec(dllexport) MumblePlugin *getMumblePlugin() {

extern "C" __declspec(dllexport) MumblePlugin2 *getMumblePlugin2() {
return &subrosaplug2;
}
}

0 comments on commit e51921e

Please sign in to comment.
You can’t perform that action at this time.