Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

New positional audio plugin for Planetside 2. #147

Closed
wants to merge 2 commits into from

2 participants

@QuirB
  • Supports version v0.554.6.191766
  • No identity support yet
@QuirB QuirB New positional audio plugin for Planetside 2.
* Supports version v0.554.6.191766
* No identity support yet
9f38cc7
@hacst
Owner

They bumped the version again (0.563.1.193912 for me) :( We'll have to go for a robust plugin approach for this game or we'll never get an acceptable lifetime for the plugin.

My suggestion would be to take a look at the PlanetSide 2 folder, pick out good sounding dll's that haven't changed for a while (I see ones from 2010 and 11 in there) and limit future searches to pointer chains starting there. Many of the structures in there will be usage dependent and might change but if we find the right one that'll happen very rarely or never. Also comparing them to ones found in the past might help.

That way it should be possible to create a plugin that survives updates. It might be harder to find those though not sure which dll's are for the game and which ones for the launcher though.

ps: Timer is also using the non-steam version. So we both are on non-steam.

@QuirB

Yeah, i see that Problem too.
I'm gonna try to find stable pointerchains, the way u suggested. Maybe i can find some friends which can help me with testing. But that probably won't be before tomorrow.

@hacst
Owner

Timer and I are around in case you want something tested. Just hit us up on IRC.

@QuirB

Sorry for the long delay. I sunk some time into finding pointer chains starting on one of the older dlls you mentioned. The sad part is, every seemingly stable pointerchain i found, was based on the ps2.exe itself. To make it worse, i found, that i accidently deleted almost every pointerscan from the previous versions.

I'd suggest to delay the official release of the plugin for a few game updates. In the meantime i'll try to find some pointerchains, which survive these updates. In my oppinion this is be the best chance we have to get stable pa-support for ps2 going apart from official mumble support by SOE.

@QuirB QuirB Planetside 2 plugin:
* updated for version v0.590.2.201856
3083ce6
@QuirB

I just updated the plugin to work with the current version of Planetside 2. I used existing pointerscans where possible but had to do new scans for state information and the continent string. The plugin works on the machines i have got access but all had the steam version installed.
It'd be great if you you could test it with your "standalone" versions.

@QuirB

Planetside 2 version got bumped with a small patch recently. All pointerchains in the plugin still seem to work.

@hacst
Owner

Hm. Just tried it today (v0.595.8.204501) and it doesn't link for me.

@QuirB

Yup... The new patch completely broke every pointerchain and i wasn't able to find new ones based off older pointerscans. I think we really have to hope SOE implements mumblesupport on their side. I'm closing this pullrequest since i don't see the chance for a stable PS2 plugin anytime soon :(.

@QuirB QuirB closed this
@hacst
Owner

Can't be helped :( Thanks for trying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 22, 2013
  1. @QuirB

    New positional audio plugin for Planetside 2.

    QuirB authored
    * Supports version v0.554.6.191766
    * No identity support yet
Commits on Mar 26, 2013
  1. @QuirB

    Planetside 2 plugin:

    QuirB authored
    * updated for version v0.590.2.201856
This page is out of date. Refresh to see the latest.
View
4 installer/Plugins.wxs
@@ -107,6 +107,9 @@
<Component Id="manual.dll">
<File Source="$(var.SourceDir)\release\plugins\manual.dll" KeyPath="yes" />
</Component>
+ <Component Id="ps2.dll">
+ <File Source="$(var.SourceDir)\release\plugins\ps2.dll" KeyPath="yes" />
+ </Component>
<Component Id="sto.dll">
<File Source="$(var.SourceDir)\release\plugins\sto.dll" KeyPath="yes" />
</Component>
@@ -165,6 +168,7 @@
<ComponentRef Id="lol.dll" />
<ComponentRef Id="lotro.dll" />
<ComponentRef Id="manual.dll" />
+ <ComponentRef Id="ps2.dll" />
<ComponentRef Id="sto.dll" />
<ComponentRef Id="tf2.dll" />
<ComponentRef Id="ut99.dll" />
View
2  plugins/plugins.pro
@@ -5,5 +5,5 @@ SUBDIRS = link manual
DIST = plugins.pri
win32 {
- SUBDIRS += aoc arma2 bf1942 bf2 bf3 bf2142 bfbc2 bfheroes blacklight borderlands borderlands2 breach cod2 cod4 cod5 codmw2 codmw2so cs css dods dys etqw tf2 gmod gtaiv gw hl2dm insurgency jc2 l4d l4d2 lol lotro sto ut2004 ut3 ut99 wolfet wow
+ SUBDIRS += aoc arma2 bf1942 bf2 bf3 bf2142 bfbc2 bfheroes blacklight borderlands borderlands2 breach cod2 cod4 cod5 codmw2 codmw2so cs css dods dys etqw tf2 gmod gtaiv gw hl2dm insurgency jc2 l4d l4d2 lol lotro ps2 sto ut2004 ut3 ut99 wolfet wow
}
View
173 plugins/ps2/ps2.cpp
@@ -0,0 +1,173 @@
+/* Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
+ Copyright (C) 2012-2013, Moritz Schneeweiss <quirb@hotmail.com>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ - Neither the name of the Mumble Developers nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#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*/) {
+ for (int i=0;i<3;i++)
+ avatar_pos[i]=avatar_front[i]=avatar_top[i]=camera_pos[i]=camera_front[i]=camera_top[i]=0.0f;
+
+ unsigned int state;
+ bool ok;
+
+ BYTE *stateptr0;
+ BYTE *stateptr1;
+ BYTE *stateptr2;
+ ok = peekProc((BYTE *) pModule+0x2B57830, stateptr0) &&
+ peekProc((BYTE *) stateptr0 + 0x134, stateptr1) &&
+ peekProc((BYTE *) stateptr1 + 0x24, stateptr2) &&
+ peekProc((BYTE *) stateptr2 + 0x5fc, state);
+
+ if (! ok)
+ return false;
+
+ if (state != 0xFFFFFFFF) {
+ context.clear();
+ return true; // This results in all vectors beeing zero which tells Mumble to ignore them.
+ }
+
+ // Create containers to stuff our raw data into, so we can convert it to Mumble's coordinate system
+ float cam_corrector[3];
+ float pos_corrector[3];
+ float front_corrector[3];
+ float top_corrector[3];
+
+ // Peekproc and assign game addresses to our containers, so we can retrieve positional data
+ BYTE *baseptr0;
+ BYTE *baseptr1;
+
+ ok = peekProc((BYTE *) pModule + 0x00001984, baseptr0) &&
+ peekProc((BYTE *) baseptr0 + 0x4AC, baseptr1) &&
+ peekProc((BYTE *) baseptr1 + 0x1e10, cam_corrector) &&
+ peekProc((BYTE *) baseptr1 + 0x1e30, front_corrector) &&
+ peekProc((BYTE *) baseptr1 + 0x1e20, top_corrector) &&
+ peekProc((BYTE *) baseptr1 + 0xB0, pos_corrector);
+
+ if (! ok)
+ return false;
+
+ // Convert to left-handed coordinate system
+ camera_pos[0] = cam_corrector[2];
+ camera_pos[1] = cam_corrector[1];
+ camera_pos[2] = cam_corrector[0];
+
+ avatar_pos[0] = pos_corrector[2];
+ avatar_pos[1] = pos_corrector[1];
+ avatar_pos[2] = pos_corrector[0];
+
+ avatar_pos[1] += 1.5f;
+
+ avatar_front[0] = front_corrector[2];
+ avatar_front[1] = front_corrector[1];
+ avatar_front[2] = front_corrector[0];
+
+ avatar_top[0] = -top_corrector[2];
+ avatar_top[1] = -top_corrector[1];
+ avatar_top[2] = -top_corrector[0];
+
+ for (int i=0;i<3;i++) {
+ camera_front[i] = avatar_front[i];
+ camera_top[i] = avatar_top[i];
+ }
+
+ // Read continent name
+ BYTE *cbase = peekProc<BYTE *> ((BYTE *) pModule + 0x02B0F548);
+ BYTE *cptr1 = cbase + 0xEC;
+
+ char continentname[6];
+ peekProc(cptr1, continentname);
+ continentname[sizeof(continentname)/sizeof(continentname[0]) - 1] = '\0';
+
+ std::ostringstream contextss;
+ contextss << "{"
+ << "\"continent\":\"" << continentname << "\""
+ << "}";
+
+ context = contextss.str();
+
+ return true;
+}
+
+static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
+
+ if (! initialize(pids, L"PlanetSide2.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 {
+ generic_unlock();
+ return false;
+ }
+}
+
+static const std::wstring longdesc() {
+ return std::wstring(L"Supports Planetside 2 (v0.590.2.201856). No identity support yet. Context support limited to continentname.");
+}
+
+static std::wstring description(L"Planetside 2 (v0.590.2.201856)");
+static std::wstring shortname(L"Planetside 2");
+
+static int trylock1() {
+ return trylock(std::multimap<std::wstring, unsigned long long int>());
+}
+
+static MumblePlugin ps2plug = {
+ MUMBLE_PLUGIN_MAGIC,
+ description,
+ shortname,
+ NULL,
+ NULL,
+ trylock1,
+ generic_unlock,
+ longdesc,
+ fetch
+};
+
+static MumblePlugin2 ps2plug2 = {
+ MUMBLE_PLUGIN_MAGIC_2,
+ MUMBLE_PLUGIN_VERSION,
+ trylock
+};
+
+extern "C" __declspec(dllexport) MumblePlugin *getMumblePlugin() {
+ return &ps2plug;
+}
+
+extern "C" __declspec(dllexport) MumblePlugin2 *getMumblePlugin2() {
+ return &ps2plug2;
+}
View
7 plugins/ps2/ps2.pro
@@ -0,0 +1,7 @@
+include(../plugins.pri)
+
+TARGET = ps2
+SOURCES = ps2.cpp
+LIBS += -luser32
+
+
Something went wrong with that request. Please try again.