Skip to content

Commit 6d4db99

Browse files
authored
Merge pull request BlastHackNet#14 from xARMORx/multiver
Add class CCustomModels and CDownloadWindow methods
2 parents 6ca665c + 7654c05 commit 6d4db99

10 files changed

+208
-6
lines changed
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
This is a SAMP (0.3.DL-1) API project file.
3+
Developers: LUCHARE <[email protected]>, ARMOR
4+
5+
See more here https://github.com/LUCHARE/SAMP-API
6+
7+
Copyright (c) 2018 BlastHack Team <BlastHack.Net>. All rights reserved.
8+
*/
9+
10+
#pragma once
11+
12+
#include "sampapi/sampapi.h"
13+
#include "sampapi/CCustomModelsPool.h"
14+
15+
SAMPAPI_BEGIN_PACKED_V03DL_1
16+
17+
class SAMPAPI_EXPORT CCustomModels {
18+
public:
19+
CCustomModelsPool* m_pModelsPool;
20+
int m_nModelsCount;
21+
bool m_bIsPathInit;
22+
char* m_szPathName;
23+
char field_D[257];
24+
char* m_szLocalPath;
25+
char field_112[8027];
26+
27+
CCustomModels(IDirect3DDevice9* pDevice);
28+
~CCustomModels();
29+
30+
bool InitDirectory();
31+
bool DoesDffExist(unsigned int nDffIndex);
32+
bool DoesTxdExist(unsigned int nTxdIndex);
33+
bool DeleteDff(unsigned int nDffIndex);
34+
bool DeleteTxd(unsigned int nTxdIndex);
35+
bool DeleteTempFile(const char* szFileName);
36+
bool LoadModel(unsigned int nStandartModelId, unsigned int nCustomModelId, unsigned int nDffIndex, unsigned int nTxdIndex);
37+
CCustomModelInfo* GetModelInfo(unsigned int nId);
38+
int GetCount();
39+
bool ResizePool(unsigned int nId);
40+
bool DoesExist(unsigned int nId);
41+
void PushBack(unsigned int nId, CCustomModelInfo* pModelInfo);
42+
void SetModelInfo(unsigned int nId, CCustomModelInfo* pModelInfo);
43+
};
44+
45+
SAMPAPI_EXPORT SAMPAPI_VAR CCustomModels*& RefCustomModels();
46+
47+
SAMPAPI_END_PACKED
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
This is a SAMP (0.3.DL-1) API project file.
3+
Developers: LUCHARE <[email protected]>, ARMOR
4+
5+
See more here https://github.com/LUCHARE/SAMP-API
6+
7+
Copyright (c) 2018 BlastHack Team <BlastHack.Net>. All rights reserved.
8+
*/
9+
10+
#pragma once
11+
12+
#include "sampapi/sampapi.h"
13+
14+
SAMPAPI_BEGIN_PACKED_V03DL_1
15+
16+
class SAMPAPI_EXPORT CCustomModelInfo {
17+
public:
18+
bool m_nIsDff;
19+
bool m_nIsTxd;
20+
unsigned short field_2;
21+
char field_4;
22+
char field_5;
23+
char field_6;
24+
char field_7;
25+
unsigned short field_8;
26+
unsigned short fiend_0A;
27+
int nStandartModelId;
28+
int nCustomModelId;
29+
char field_14[50];
30+
int m_nDffModelIndex;
31+
int m_nTxdModelIndex;
32+
};
33+
34+
class SAMPAPI_EXPORT CCustomModelsPool {
35+
public:
36+
CCustomModelInfo* m_pObject[20000];
37+
};
38+
39+
SAMPAPI_END_PACKED

include/sampapi/0.3.DL-1/CDownloadWindow.h

+14-4
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,38 @@ class SAMPAPI_EXPORT CDownloadWindow {
2929
CDXUTDialog* m_pDialog;
3030
CDXUTListBox* m_pListbox;
3131
int m_bIsWindowActive;
32-
int field_34;
32+
int m_nRowCount;
3333
char m_szType[129];
3434
char m_szId[129];
3535
char m_szProcess[129];
36-
char field_1BB[145];
36+
char m_szUnused[129];
37+
int m_nSpaceSizeForIdText;
38+
int m_nSpaceSizeForProgressText;
39+
int field_244;
40+
int field_248;
3741
int m_nDownloadedFilesCount_1;
3842
int m_nFilesSum;
3943
int field_254;
4044
int field_258;
4145
float m_fDownloadSpeed;
42-
char field_260;
4346

4447
CDownloadWindow(IDirect3DDevice9* pDevice);
4548
~CDownloadWindow();
4649

4750
void GetScreenRect(CRect* pRect);
4851
void DoesExist(int nFileId);
4952
void Show();
50-
void AddEntry(char nFileType, int nFileId, char nFileState, int nFileDownloaded, int nFileRemainDownload, int a7, int a8);
53+
void AddEntry(char nFileType, int nFileId, char nFileState, int nFileDownloaded, int nFileRemainDownload, int a7);
5154
void Draw();
5255
void ResetDialogControl(CDXUTDialog* pDialog);
5356
void FreePool();
57+
void PushBack(DownloadedFileInfo* pInfo);
58+
void DeleteFile(unsigned int nId);
59+
void ResizePool(unsigned int nId);
60+
int GetFilesCount();
61+
DownloadedFileInfo* GetFileInfo(unsigned int nId);
62+
63+
5464
};
5565

5666
SAMPAPI_EXPORT SAMPAPI_VAR CDownloadWindow*& RefDownloadWindow();

include/sampapi/0.3.DL-1/CDownloadedFilesPool.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct SAMPAPI_EXPORT DownloadedFileInfo {
2121
int m_nFileDownloaded;
2222
int m_nFileRemainDownload;
2323
};
24+
2425
struct SAMPAPI_EXPORT CDownloadedFilesPool {
2526
DownloadedFileInfo *m_pObject[20000];
2627
};

include/sampapi/0.3.DL-1/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@ target_sources(sampapi
5959
CObjectEdit.h
6060
CDownloadedFilesPool.h
6161
CDownloadWindow.h
62+
CCustomModelsPool.h
63+
CCustomModels.h
6264
)

include/sampapi/CCustomModels.h

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#pragma once
2+
#include "sampapi/0.3.DL-1/CCustomModels.h"

include/sampapi/CCustomModelsPool.h

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#pragma once
2+
#include "sampapi/0.3.DL-1/CCustomModelsPool.h"
+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
This is a SAMP (0.3.DL-1) API project file.
3+
Developers: LUCHARE <[email protected]>, ARMOR
4+
5+
See more here https://github.com/LUCHARE/SAMP-API
6+
7+
Copyright (c) 2018 BlastHack Team <BlastHack.Net>. All rights reserved.
8+
*/
9+
10+
#include "sampapi/0.3.DL-1/CCustomModels.h"
11+
12+
SAMPAPI_BEGIN_V03DL_1
13+
14+
SAMPAPI_VAR CCustomModels*& RefCustomModels() {
15+
return *(CCustomModels**)GetAddress(0x2ACA28);
16+
}
17+
18+
CCustomModels::CCustomModels(IDirect3DDevice9* pDevice) {
19+
((void(__thiscall*)(CCustomModels*, IDirect3DDevice9*))GetAddress(0xD890))(this, pDevice);
20+
}
21+
22+
CCustomModels::~CCustomModels() {}
23+
24+
bool CCustomModels::InitDirectory() {
25+
return ((bool(__thiscall*)(CCustomModels*))GetAddress(0xBA40))(this);
26+
}
27+
28+
bool CCustomModels::DoesDffExist(unsigned int nDffIndex) {
29+
return ((bool(__thiscall*)(CCustomModels*, unsigned int))GetAddress(0xBB10))(this, nDffIndex);
30+
}
31+
32+
bool CCustomModels::DoesTxdExist(unsigned int nTxdIndex) {
33+
return ((bool(__thiscall*)(CCustomModels*, unsigned int))GetAddress(0xBBA0))(this, nTxdIndex);
34+
}
35+
36+
bool CCustomModels::DeleteDff(unsigned int nDffIndex) {
37+
return ((bool(__thiscall*)(CCustomModels*, unsigned int))GetAddress(0xC100))(this, nDffIndex);
38+
}
39+
40+
bool CCustomModels::DeleteTxd(unsigned int nTxdIndex) {
41+
return ((bool(__thiscall*)(CCustomModels*, unsigned int))GetAddress(0xC140))(this, nTxdIndex);
42+
}
43+
44+
bool CCustomModels::DeleteTempFile(const char* szFileName) {
45+
return ((bool(__thiscall*)(CCustomModels*, const char*))GetAddress(0xC180))(this, szFileName);
46+
}
47+
48+
bool CCustomModels::LoadModel(unsigned int nStandartModelId, unsigned int nCustomModelId, unsigned int nDffIndex, unsigned int nTxdIndex) {
49+
return ((bool(__thiscall*)(CCustomModels*, unsigned int, unsigned int, unsigned int, unsigned int))GetAddress(0xC1C0))(this, nStandartModelId, nCustomModelId, nDffIndex, nTxdIndex);
50+
}
51+
52+
CCustomModelInfo* CCustomModels::GetModelInfo(unsigned int nId) {
53+
return ((CCustomModelInfo*(__thiscall*)(CCustomModels*, unsigned int))GetAddress(0xC410))(this, nId);
54+
}
55+
56+
int CCustomModels::GetCount() {
57+
return ((int(__thiscall*)(CCustomModels*))GetAddress(0xC430))(this);
58+
}
59+
60+
bool CCustomModels::ResizePool(unsigned int nId) {
61+
return ((bool(__thiscall*)(CCustomModels*, unsigned int))GetAddress(0xC4E0))(this, nId);
62+
}
63+
64+
bool CCustomModels::DoesExist(unsigned int nId) {
65+
return ((bool(__thiscall*)(CCustomModels*, unsigned int))GetAddress(0xCE30))(this, nId);
66+
}
67+
68+
void CCustomModels::PushBack(unsigned int nId, CCustomModelInfo* pModelInfo) {
69+
((void(__thiscall*)(CCustomModels*, unsigned int, CCustomModelInfo*))GetAddress(0xCFF0))(this, nId, pModelInfo);
70+
}
71+
72+
void CCustomModels::SetModelInfo(unsigned int nId, CCustomModelInfo* pModelInfo) {
73+
((void(__thiscall*)(CCustomModels*, unsigned int, CCustomModelInfo*))GetAddress(0xD550))(this, nId, pModelInfo);
74+
}
75+
76+
SAMPAPI_END

src/sampapi/0.3.DL-1/CDownloadWindow.cpp

+24-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ void CDownloadWindow::DoesExist(int nFileId) {
3131
((void(__thiscall*)(CDownloadWindow*, int))GetAddress(0x6A610))(this, nFileId);
3232
}
3333

34-
void CDownloadWindow::AddEntry(char nFileType, int nFileId, char nFileState, int nFileDownloaded, int nFileRemainDownload, int a7, int a8) {
35-
((void(__thiscall*)(CDownloadWindow*, char, int, char, int, int, int, int))GetAddress(0x6A720))(this, nFileType, nFileId, nFileState, nFileDownloaded, nFileRemainDownload, a7, a8);
34+
void CDownloadWindow::AddEntry(char nFileType, int nFileId, char nFileState, int nFileDownloaded, int nFileRemainDownload, int a7) {
35+
((void(__thiscall*)(CDownloadWindow*, char, int, char, int, int, int))GetAddress(0x6A720))(this, nFileType, nFileId, nFileState, nFileDownloaded, nFileRemainDownload, a7);
3636
}
3737

3838
void CDownloadWindow::Show() {
@@ -50,4 +50,26 @@ void CDownloadWindow::Draw() {
5050
void CDownloadWindow::FreePool() {
5151
((void(__thiscall*)(CDownloadWindow*))GetAddress(0x6A6E0))(this);
5252
}
53+
54+
void CDownloadWindow::PushBack(DownloadedFileInfo* pInfo) {
55+
((void(__thiscall*)(CDownloadWindow*, DownloadedFileInfo*))GetAddress(0x6A650))(this, pInfo);
56+
}
57+
58+
void CDownloadWindow::DeleteFile(unsigned int nId) {
59+
((void(__thiscall*)(CDownloadWindow*, unsigned int))GetAddress(0x6A6B0))(this, nId);
60+
}
61+
62+
void CDownloadWindow::ResizePool(unsigned int nId) {
63+
((void(__thiscall*)(CDownloadWindow*, unsigned int))GetAddress(0x6A450))(this, nId);
64+
}
65+
66+
int CDownloadWindow::GetFilesCount() {
67+
return ((int(__thiscall*)(CDownloadWindow*))GetAddress(0x6A440))(this);
68+
}
69+
70+
71+
DownloadedFileInfo* CDownloadWindow::GetFileInfo(unsigned int nId) {
72+
return ((DownloadedFileInfo*(__thiscall*)(CDownloadWindow*, unsigned int))GetAddress(0x6A420))(this, nId);
73+
}
74+
5375
SAMPAPI_END

src/sampapi/0.3.DL-1/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@ target_sources(sampapi
5757
CObjectEdit.cpp
5858
RPCHandlers.cpp
5959
CDownloadWindow.cpp
60+
CCustomModels.cpp
6061
)

0 commit comments

Comments
 (0)