Skip to content
Permalink
Browse files

plugins/borderlands2: fix version check.

  • Loading branch information...
mkrautz committed Jan 11, 2014
1 parent 00b3686 commit 95214713c63cc002d6565879b27359a088196f93
Showing with 16 additions and 4 deletions.
  1. +15 −4 plugins/borderlands2/borderlands2.cpp
  2. +1 −0 plugins/mumble_plugin_win32.h
@@ -31,6 +31,7 @@
*/

#include "../mumble_plugin_win32.h"
#include <algorithm>

VOID *vects_ptr;
VOID *state_ptr;
@@ -95,7 +96,7 @@ static int trylock(const std::multimap<std::wstring, unsigned long long int> &pi
return false;
}

char detected_version[32];
unsigned char detected_version[32];

// Note for further versions:
// The "version" string above change. However, it looks like it will always start
@@ -119,25 +120,35 @@ static int trylock(const std::multimap<std::wstring, unsigned long long int> &pi
// Note that I couldn't find an address that would do this reliably with the game "pause"
// menu, only the main menu (when you initially start the game, or completely exit your
// current game)

// VERSION_EQ safely checks whether the content of `buf'
// (a buffer in the form of a C-style array of unsigned char)
// contains the byte-level content of the string literal `strlit'.
//
// The NUL terminator of the string literal is not considered in
// this equality check.
#define VERSION_EQ(buf, strlit) \
memcmp(buf, strlit, std::min(sizeof(buf), sizeof(strlit)-1)) == 0

// 1.3.1
if (peekProc(pModule + 0x1E6D048, detected_version)
&& strcmp(detected_version, "WILLOW2-PCSAGE-28-CL697606") == 0)
&& VERSION_EQ(detected_version, "WILLOW2-PCSAGE-28-CL697606"))
{
vects_ptr = pModule + 0x1E792B0;
state_ptr = pModule + 0x1E79BC8;
character_name_ptr_loc = pModule + 0x1E7302C;
}
// 1.4.0
else if (peekProc(pModule + 0x1E8D1D8, detected_version)
&& strcmp(detected_version, "WILLOW2-PCSAGE-77-CL711033") == 0)
&& VERSION_EQ(detected_version, "WILLOW2-PCSAGE-77-CL711033"))
{
vects_ptr = pModule + 0x1E993F0;
state_ptr = pModule + 0x1E99D08;
character_name_ptr_loc = pModule + 0x1E93194;
}
// 1.5.0
else if (peekProc(pModule + 0x01E9F338, detected_version)
&& strcmp(detected_version, "WILLOW2-PCLILAC-60-CL721220") == 0)
&& VERSION_EQ(detected_version, "WILLOW2-PCLILAC-60-CL721220"))
{
vects_ptr = pModule + 0x1EAB650;
state_ptr = pModule + 0x1EABF68;
@@ -34,6 +34,7 @@
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#define NOMINMAX
#include <windows.h>
#include <tlhelp32.h>
#include <math.h>

0 comments on commit 9521471

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