Skip to content

Commit dda6bf3

Browse files
committed
Add SAMP 0.3.7-R2, R5, DL support
1 parent d5e8109 commit dda6bf3

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

src/libs/samp/samp.hpp

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ enum SAMPVER {
1111
SAMP_NOT_LOADED,
1212
SAMP_UNKNOWN,
1313
SAMP_037_R1,
14+
SAMP_037_R2,
1415
SAMP_037_R3_1,
15-
SAMP_037_R4_2
16+
SAMP_037_R4_2,
17+
SAMP_037_R5_1,
18+
SAMP_037_DL
1619
};
1720

1821
inline uintptr_t sampGetBase()
@@ -39,12 +42,21 @@ inline SAMPVER sampGetVersion()
3942
case 0x31DF13:
4043
sampVersion = SAMPVER::SAMP_037_R1;
4144
break;
45+
case 0x3195DD:
46+
sampVersion = SAMPVER::SAMP_037_R2;
47+
break;
4248
case 0xCC4D0:
4349
sampVersion = SAMPVER::SAMP_037_R3_1;
4450
break;
4551
case 0xCBCB0:
4652
sampVersion = SAMPVER::SAMP_037_R4_2;
4753
break;
54+
case 0xCBC90:
55+
sampVersion = SAMPVER::SAMP_037_R5_1;
56+
break;
57+
case 0xFDB60:
58+
sampVersion = SAMPVER::SAMP_037_DL;
59+
break;
4860
default:
4961
sampVersion = SAMPVER::SAMP_UNKNOWN;
5062
#ifdef _DEBUG
@@ -71,17 +83,23 @@ enum class SampAddresses {
7183

7284
struct SampAddress
7385
{
74-
uintptr_t R1, R3, R4;
86+
uintptr_t R1, R2, R3, R4, R5, DL;
7587

7688
uintptr_t get() {
7789
switch (sampGetVersion())
7890
{
7991
case SAMPVER::SAMP_037_R1:
8092
return R1;
93+
case SAMPVER::SAMP_037_R2:
94+
return R2;
8195
case SAMPVER::SAMP_037_R3_1:
8296
return R3;
8397
case SAMPVER::SAMP_037_R4_2:
8498
return R4;
99+
case SAMPVER::SAMP_037_R5_1:
100+
return R5;
101+
case SAMPVER::SAMP_037_DL:
102+
return DL;
85103
default:
86104
#ifdef _DEBUG
87105
assert(0);
@@ -93,24 +111,24 @@ struct SampAddress
93111

94112
constexpr SampAddress sampGetAddress(SampAddresses element)
95113
{
96-
#define ENTRY(name, r1, r3, r4) case SampAddresses::name: return {r1, r3, r4};
114+
#define ENTRY(name, r1, r2, r3, r4, r5, dl) case SampAddresses::name: return {r1, r2, r3, r4, r5, dl};
97115
switch (element)
98116
{
99-
ENTRY(CNetGame, 0x21A0F8, 0x26E8DC, 0x26EA0C);
100-
ENTRY(StringWriteEncoder, 0x506B0, 0x53A60, 0x541A0 );
101-
ENTRY(StringReadDecoder, 0x507E0, 0x53B90, 0x542D0 );
102-
ENTRY(CompressorPtr, 0x10D894, 0x121914, 0x121A3C);
103-
ENTRY(HandleRpc, 0x372F0, 0x3A6A0, 0x3ADE0 );
104-
ENTRY(RakClientIntfConstr, 0x33DC0, 0x37170, 0x378B0 );
105-
ENTRY(alloc_packet, 0x347E0, 0x37B90, 0x382D0 );
106-
ENTRY(write_lock, 0x35B10, 0x38EC0, 0x39600 );
107-
ENTRY(write_unlock, 0x35B50, 0x38F00, 0x39640 );
117+
ENTRY(CNetGame, 0x21A0F8, 0x21A100, 0x26E8DC, 0x26EA0C, 0x26EB94, 0x2ACA24);
118+
ENTRY(StringWriteEncoder, 0x506B0, 0x50790, 0x53A60, 0x541A0, 0x541A0, 0x53C60 );
119+
ENTRY(StringReadDecoder, 0x507E0, 0x508C0, 0x53B90, 0x542D0, 0x542D0, 0x53D90 );
120+
ENTRY(CompressorPtr, 0x10D894, 0x10D894, 0x121914, 0x121A3C, 0x121A3C, 0x15FA54);
121+
ENTRY(HandleRpc, 0x372F0, 0x373D0, 0x3A6A0, 0x3ADE0, 0x3ADE0, 0x3A8A0 );
122+
ENTRY(RakClientIntfConstr, 0x33DC0, 0x33F10, 0x37170, 0x378B0, 0x378B0, 0x37370 );
123+
ENTRY(alloc_packet, 0x347E0, 0x348C0, 0x37B90, 0x382D0, 0x382D0, 0x37D90 );
124+
ENTRY(write_lock, 0x35B10, 0x35BF0, 0x38EC0, 0x39600, 0x39600, 0x390C0 );
125+
ENTRY(write_unlock, 0x35B50, 0x35C30, 0x38F00, 0x39640, 0x39640, 0x39100 );
108126
}
109127
#undef ENTRY
110128
#ifdef _DEBUG
111129
assert(0);
112130
#endif
113-
return { 0, 0 };
131+
return { 0, 0, 0, 0, 0, 0 };
114132
}
115133

116134
#define SAMP_OFFSET(name) sampGetAddress(SampAddresses::name).get()

src/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ void initEnums(sol::state_view& lua)
2020
{ "SAMP_NOT_LOADED", SAMPVER::SAMP_NOT_LOADED },
2121
{ "SAMP_UNKNOWN", SAMPVER::SAMP_UNKNOWN },
2222
{ "SAMP_037_R1", SAMPVER::SAMP_037_R1 },
23+
{ "SAMP_037_R2", SAMPVER::SAMP_037_R2 },
2324
{ "SAMP_037_R3_1", SAMPVER::SAMP_037_R3_1 },
25+
{ "SAMP_037_R4_2", SAMPVER::SAMP_037_R4_2 },
26+
{ "SAMP_037_R5_1", SAMPVER::SAMP_037_R5_1 },
27+
{ "SAMP_037_DL", SAMPVER::SAMP_037_DL },
2428
}
2529
);
2630

@@ -234,7 +238,7 @@ sol::table open(sol::this_state ts)
234238
gRakLua.initialize();
235239

236240
sol::table module = lua.create_table();
237-
module["VERSION"] = 2.12;
241+
module["VERSION"] = 2.13;
238242
module.set_function("getState", &getState);
239243

240244
module.set_function("registerHandler", &registerHandler);

0 commit comments

Comments
 (0)