-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (57 loc) · 1.93 KB
/
main.cpp
File metadata and controls
62 lines (57 loc) · 1.93 KB
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
#include <mod/amlmod.h>
#include <mod/logger.h>
#include <mod/config.h>
#include <dlfcn.h>
#include <sautils.h>
#include <sautils_2_10.h>
/* Same name but can be used for VC too! */
MYMOD(net.rusjj.gtasa.utils, SAUtils, 1.6, RusJJ)
uintptr_t pGameLib = 0;
void* pGameHandle = NULL;
extern "C" void OnModPreLoad() // PreLoad is a place for interfaces registering
{
#ifdef AML32
logger->SetTag("SAUtils");
#else
logger->SetTag("SAUtils64");
#endif
pGameLib = aml->GetLib("libGTASA.so");
pGameHandle = aml->GetLibHandle("libGTASA.so");
if(pGameLib && pGameHandle)
{
#ifdef AML32
if(*(uint32_t*)(pGameLib + 0x202020) == 0xE8BDB001)
{
((SAUtils*)sautils)->m_eLoadedGame = GTASA_2_00;
((SAUtils*)sautils)->InitializeSAUtils();
}
else if(*(uint32_t*)(pGameLib + 0x202020) == 0x61766E49)
{
((SAUtils_2_10*)sautils)->m_eLoadedGame = GTASA_2_10;
((SAUtils_2_10*)sautils)->InitializeSAUtils();
}
#else
((SAUtils*)sautils)->m_eLoadedGame = GTASA_2_10;
((SAUtils*)sautils)->InitializeSAUtils();
#endif
}
else
{
//pGameLib = aml->GetLib("libGTAVC.so");
//pGameHandle = dlopen("libGTAVC.so", RTLD_LAZY);
//if(pGameLib && pGameHandle)
//{
// ((SAUtils*)sautils)->m_eLoadedGame = GTAVC_1_09;
// ((SAUtils*)sautils)->InitializeVCUtils();
//}
//else
{
((SAUtils*)sautils)->m_eLoadedGame = Unknown;
logger->Error("Cannot determine the working game or this one is not supported!");
return;
}
}
((SAUtils*)sautils)->m_pHasFLA = aml->GetLib("libplugin_fastman92limitAdjuster_ANDROID_ARM32.so");
if(!((SAUtils*)sautils)->m_pHasFLA) ((SAUtils*)sautils)->m_pHasFLA = aml->GetLib("libplugin_fastman92limitAdjuster.so");
RegisterInterface("SAUtils", sautils);
}