Skip to content

Commit 5198f68

Browse files
Merge pull request #242 from cleolibrary/CText_Get_update
Address translation for CText::Get
2 parents 89df226 + 2b10142 commit 5198f68

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

plugin_sa/game_sa/CText.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
*/
77
#include "CText.h"
88

9+
PLUGIN_SOURCE_FILE
10+
911
#define VAR_TheText 0xC1B340;
1012

1113
#define FUNC_CText__Constructor 0x6A00F0
1214
#define FUNC_CText__Destructor 0x6A0140
13-
#define FUNC_CText__Get 0x6A0050
1415
#define FUNC_CText__Load 0x6A01A0
1516
#define FUNC_CText__LoadMissionTable 0x69FBF0
1617
#define FUNC_CText__LoadMpack 0x69F9A0
@@ -93,10 +94,12 @@ CText::~CText()
9394
((void (__thiscall*)(CText*)) FUNC_CText__Destructor )(this);
9495
}
9596

97+
int addrof(CText::Get) = ADDRESS_BY_VERSION(0x6A0050, 0, 0x6A0050, 0x6A0870, 0x6CCCE0, 0);
98+
int gaddrof(CText::Get) = GLOBAL_ADDRESS_BY_VERSION(0x6A0050, 0, 0x6A0050, 0x6A0870, 0x6CCCE0, 0);
99+
96100
// Returns text pointer by GXT key
97-
char *__thiscall CText::Get(const char *key)
98-
{
99-
return ( (char *(__thiscall*)(CText*, const char *key)) FUNC_CText__Get )(this, key);
101+
const char* CText::Get(const char* key) {
102+
return plugin::CallMethodAndReturnDynGlobal<const char*, CText*, const char*>(gaddrof(CText::Get), this, key);
100103
}
101104

102105
// Reads MPACK tag

plugin_sa/game_sa/CText.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class PLUGIN_API CText
100100
~CText();
101101

102102
// Returns text pointer by GXT key
103-
char *__thiscall Get(const char *key);
103+
SUPPORTED_10US_10EU_11EU_SR2 const char* Get(const char* key);
104104

105105
// Reads MPACK tag
106106
static void __stdcall readTag(char *buf, FILE *file, int *pFileOffset, bool dontRead);
@@ -122,4 +122,6 @@ class PLUGIN_API CText
122122
};
123123
VALIDATE_SIZE(CText, 0xA90);
124124

125-
extern PLUGIN_API CText& TheText;
125+
extern PLUGIN_API CText& TheText;
126+
127+
#include "meta/meta.CText.h"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Plugin-SDK (Grand Theft Auto San Andreas) header file
3+
Authors: GTA Community. See more here
4+
https://github.com/DK22Pac/plugin-sdk
5+
Do not delete this comment block. Respect others' work!
6+
*/
7+
#include "PluginBase.h"
8+
9+
namespace plugin {
10+
11+
META_BEGIN(CText::Get)
12+
static int address;
13+
static int global_address;
14+
static const int id = 0x6A0050;
15+
static const bool is_virtual = false;
16+
static const int vtable_index = -1;
17+
using mv_addresses_t = MvAddresses<0x6A0050, 0, 0x6A0050, 0x6A0870, 0x6CCCE0, 0>;
18+
using refs_t = RefList<>;
19+
using def_t = const char* (CText*, const char*);
20+
static const int cb_priority = PRIORITY_BEFORE;
21+
using calling_convention_t = CallingConventions::Thiscall;
22+
using args_t = ArgPick<ArgTypes<CText*, const char*>, 0, 1>;
23+
META_END
24+
25+
}

0 commit comments

Comments
 (0)