1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
// Copyright 2019-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#define MUMBLE_ALLOW_DEPRECATED_LEGACY_PLUGIN_API
#include "../mumble_legacy_plugin.h"
#include "../mumble_positional_audio_main.h"
struct Matrix {
float right[4];
float front[4];
float top[4];
float position[3];
};
static int fetch(float *avatarPosition, float *avatarFront, float *avatarTop, float *cameraPosition, float *cameraFront,
float *cameraTop, std::string &, std::wstring &) {
for (uint8_t i = 0; i < 3; ++i) {
avatarPosition[i] = avatarFront[i] = avatarTop[i] = 0.0f;
}
const auto playerPed = peekProcPtr(0xB7CD98);
if (!playerPed) {
return false;
}
const bool isInCar = (peekProc< uint8_t >(playerPed + 0x46C) == 1);
const auto playerCar = peekProcPtr(playerPed + 0x58C);
const auto matrixAddress = peekProcPtr((isInCar && playerCar ? playerCar : playerPed) + 0x14);
if (!matrixAddress) {
return false;
}
const auto matrix = peekProc< Matrix >(matrixAddress);
/*
Mumble | Game
X | X
Y | Z
Z | Y
*/
avatarPosition[0] = matrix.position[0];
avatarPosition[1] = matrix.position[2];
avatarPosition[2] = matrix.position[1];
avatarFront[0] = matrix.front[0];
avatarFront[1] = matrix.front[2];
avatarFront[2] = matrix.front[1];
avatarTop[0] = matrix.top[0];
avatarTop[1] = matrix.top[2];
avatarTop[2] = matrix.top[1];
for (uint8_t i = 0; i < 3; ++i) {
cameraPosition[i] = avatarPosition[i];
cameraFront[i] = avatarFront[i];
cameraTop[i] = avatarTop[i];
}
return true;
}
static int tryLock(const std::multimap< std::wstring, unsigned long long int > &pids) {
if (!initialize(pids, L"gta_sa.exe")) {
return false;
}
float avatarPosition[3], avatarFront[3], avatarTop[3];
float cameraPosition[3], cameraFront[3], cameraTop[3];
std::string context;
std::wstring identity;
if (fetch(avatarPosition, avatarFront, avatarTop, cameraPosition, cameraFront, cameraTop, context, identity)) {
return true;
} else {
generic_unlock();
return false;
}
}
static const std::wstring longDesc() {
return std::wstring(L"Supports Grand Theft Auto: San Andreas version 1.0.");
}
static std::wstring description(L"Grand Theft Auto: San Andreas (v1.0)");
static std::wstring shortName(L"Grand Theft Auto: San Andreas");
static int tryLock1() {
return tryLock(std::multimap< std::wstring, unsigned long long int >());
}
static MumblePlugin gtasaPlug = { MUMBLE_PLUGIN_MAGIC, description, shortName, nullptr, nullptr, tryLock1,
generic_unlock, longDesc, fetch };
static MumblePlugin2 gtasaPlug2 = { MUMBLE_PLUGIN_MAGIC_2, MUMBLE_PLUGIN_VERSION, tryLock };
extern "C" MUMBLE_PLUGIN_EXPORT MumblePlugin *getMumblePlugin() {
return >asaPlug;
}
extern "C" MUMBLE_PLUGIN_EXPORT MumblePlugin2 *getMumblePlugin2() {
return >asaPlug2;
}
|