Skip to content

Commit b4949ea

Browse files
committed
updates & fixes - 05/07/17
1 parent b9bcb7f commit b4949ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+241
-162
lines changed

injector/assembly.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ namespace injector
152152
template<uintptr_t at, uintptr_t end, class FuncT>
153153
void MakeInline(FuncT func)
154154
{
155-
static FuncT static_func = func; // Stores the func object
156-
static_func = func; //
155+
static std::unique_ptr<FuncT> static_func;
156+
static_func.reset(new FuncT(std::move(func)));
157157

158158
// Encapsulates the call to static_func
159159
struct Caps
160160
{
161161
void operator()(reg_pack& regs)
162-
{ static_func(regs); }
162+
{ (*static_func)(regs); }
163163
};
164164

165165
// Does the actual MakeInline

mingw-build.bat

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
rem Create output directories
2+
if not exist "output/mingw/obj/paths/Debug" md "output/mingw/obj/paths/Debug"
3+
if not exist "output/mingw/obj/paths/Release" md "output/mingw/obj/paths/Release"
4+
if not exist "output/mingw/lib/paths/Debug" md "output/mingw/lib/paths/Debug"
5+
if not exist "output/mingw/lib/paths/Release" md "output/mingw/lib/paths/Release"
6+
if not exist "output/mingw/obj/plugin_vc/Debug" md "output/mingw/obj/plugin_vc/Debug"
7+
if not exist "output/mingw/lib/plugin_vc/Debug" md "output/mingw/lib/plugin_vc/Debug"
8+
if not exist "output/mingw/obj/plugin_vc/Release" md "output/mingw/obj/plugin_vc/Release"
9+
if not exist "output/mingw/lib/plugin_vc/Release" md "output/mingw/lib/plugin_vc/Release"
10+
if not exist "output/mingw/obj/plugin_iii/Debug" md "output/mingw/obj/plugin_iii/Debug"
11+
if not exist "output/mingw/lib/plugin_iii/Debug" md "output/mingw/lib/plugin_iii/Debug"
12+
if not exist "output/mingw/obj/plugin_iii/Release" md "output/mingw/obj/plugin_iii/Release"
13+
if not exist "output/mingw/lib/plugin_iii/Release" md "output/mingw/lib/plugin_iii/Release"
14+
if not exist "output/mingw/obj/plugin_sa/Debug" md "output/mingw/obj/plugin_sa/Debug"
15+
if not exist "output/mingw/lib/plugin_sa/Debug" md "output/mingw/lib/plugin_sa/Debug"
16+
if not exist "output/mingw/obj/plugin_sa/Release" md "output/mingw/obj/plugin_sa/Release"
17+
if not exist "output/mingw/lib/plugin_sa/Release" md "output/mingw/lib/plugin_sa/Release"
18+
rem Build paths.lib
19+
g++ -std=c++14 -c "shared/paths/Paths.cpp" -o "output/mingw/obj/paths/Release/Paths.o" -m32
20+
ar rcs "output/mingw/lib/paths/Release/paths.lib" "output/mingw/obj/paths/Release/Paths.o"
21+
rem build plugin_vc
22+
cd "output/mingw/obj/plugin_vc/Release"
23+
g++ -std=c++14 -c "../../../../../plugin_vc/events/*.cpp" -I "../../../../../plugin_vc" -m32
24+
g++ -std=c++14 -c "../../../../../plugin_vc/extensions/*.cpp" -I "../../../../../plugin_vc" -m32
25+
g++ -std=c++14 -c "../../../../../plugin_vc/game_vc/*.cpp" -I "../../../../../plugin_vc" -m32
26+
g++ -std=c++14 -c "../../../../../plugin_vc/plbase/*.cpp" -I "../../../../../plugin_vc" -m32
27+
cd "../../../../../"
28+
ar rcs "output/mingw/lib/plugin_vc/Release/plugin_vc.lib" "output/mingw/obj/plugin_vc/Release/*.o"
29+
rem build plugin_iii
30+
cd "output/mingw/obj/plugin_iii/Release"
31+
g++ -std=c++14 -c "../../../../../plugin_iii/events/*.cpp" -I "../../../../../plugin_iii" -m32
32+
g++ -std=c++14 -c "../../../../../plugin_iii/extensions/*.cpp" -I "../../../../../plugin_iii" -m32
33+
g++ -std=c++14 -c "../../../../../plugin_iii/game_iii/*.cpp" -I "../../../../../plugin_iii" -m32
34+
g++ -std=c++14 -c "../../../../../plugin_iii/plbase/*.cpp" -I "../../../../../plugin_iii" -m32
35+
cd "../../../../../"
36+
ar rcs "output/mingw/lib/plugin_iii/Release/plugin_iii.lib" "output/mingw/obj/plugin_iii/Release/*.o"
37+
rem build plugin_sa
38+
cd "output/mingw/obj/plugin_sa/Release"
39+
g++ -std=c++14 -c "../../../../../plugin_sa/events/*.cpp" -I "../../../../../plugin_sa" -m32
40+
g++ -std=c++14 -c "../../../../../plugin_sa/extensions/*.cpp" -I "../../../../../plugin_sa" -m32
41+
g++ -std=c++14 -c "../../../../../plugin_sa/game_sa/*.cpp" -I "../../../../../plugin_sa" -m32
42+
g++ -std=c++14 -c "../../../../../plugin_sa/plbase/*.cpp" -I "../../../../../plugin_sa" -m32
43+
cd "../../../../../"
44+
ar rcs "output/mingw/lib/plugin_sa/Release/plugin_sa.lib" "output/mingw/obj/plugin_sa/Release/*.o"
45+
pause

plugin_III/extender/ObjectExtender_III.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,12 @@ namespace plugin {
2727
}
2828
};
2929

30-
std::vector<ExtenderInterface<CObject> *> ObjectExtendersHandler::extenders;
31-
bool ObjectExtendersHandler::injected;
32-
3330
template <typename T> class ObjectExtendedData : public ExtenderInterface<CObject> {
3431
T **blocks;
3532
unsigned int numBlocks;
3633

3734
void AllocateBlocks() {
38-
numBlocks = CPools::ms_pObjectPool->m_Size;
35+
numBlocks = CPools::ms_pObjectPool->m_nSize;
3936
blocks = new T*[numBlocks];
4037
for (unsigned int i = 0; i < numBlocks; i++)
4138
blocks[i] = 0;

plugin_III/extender/PedExtender_III.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,12 @@ namespace plugin {
2727
}
2828
};
2929

30-
std::vector<ExtenderInterface<CPed> *> PedExtendersHandler::extenders;
31-
bool PedExtendersHandler::injected;
32-
3330
template <typename T> class PedExtendedData : public ExtenderInterface<CPed> {
3431
T **blocks;
3532
unsigned int numBlocks;
3633

3734
void AllocateBlocks() {
38-
numBlocks = CPools::ms_pPedPool->m_Size;
35+
numBlocks = CPools::ms_pPedPool->m_nSize;
3936
blocks = new T*[numBlocks];
4037
for (unsigned int i = 0; i < numBlocks; i++)
4138
blocks[i] = 0;

plugin_III/extender/VehicleExtender_III.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,12 @@ namespace plugin {
2727
}
2828
};
2929

30-
std::vector<ExtenderInterface<CVehicle> *> VehicleExtendersHandler::extenders;
31-
bool VehicleExtendersHandler::injected;
32-
3330
template <typename T> class VehicleExtendedData : public ExtenderInterface<CVehicle> {
3431
T **blocks;
3532
unsigned int numBlocks;
3633

3734
void AllocateBlocks() {
38-
numBlocks = CPools::ms_pVehiclePool->m_Size;
35+
numBlocks = CPools::ms_pVehiclePool->m_nSize;
3936
blocks = new T*[numBlocks];
4037
for (unsigned int i = 0; i < numBlocks; i++)
4138
blocks[i] = 0;

plugin_III/extensions/Config.cpp

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -226,19 +226,23 @@ config_param_line::config_param_line(std::string paramName, std::string value, b
226226
}
227227

228228
bool config_file::pathEmpty() {
229+
#ifdef _MSC_VER
229230
if (_bWidePath)
230231
return _widePath.empty();
231232
else
233+
#endif
232234
return _path.empty();
233235
}
234236

235237
void config_file::prepareData() {
236238
if (_dataRead || pathEmpty())
237239
return;
238240
std::ifstream in;
241+
#ifdef _MSC_VER
239242
if (_bWidePath)
240243
in.open(_widePath);
241244
else
245+
#endif
242246
in.open(_path);
243247
if (in.is_open()) {
244248
unsigned int lineId = 0;
@@ -349,9 +353,11 @@ void config_file::writeData() {
349353
if (pathEmpty())
350354
return;
351355
std::ofstream out;
356+
#ifdef _MSC_VER
352357
if (_bWidePath)
353358
out.open(_widePath);
354359
else
360+
#endif
355361
out.open(_path);
356362
if (out.is_open()) {
357363
unsigned int maxStrLen = 0;
@@ -379,33 +385,27 @@ void config_file::writeData() {
379385
}
380386

381387
config_file::config_file() {
388+
#ifdef _MSC_VER
382389
_bWidePath = false;
390+
#endif
383391
_dataRead = false;
384392
_useAlignment = true;
385393
_useEqualitySign = false;
386394
}
387395

388396
void config_file::open(std::string fileName) {
389397
_path = fileName;
398+
#ifdef _MSC_VER
390399
_bWidePath = false;
391-
prepareData();
392-
}
393-
394-
void config_file::open(std::wstring fileName) {
395-
_widePath = fileName;
396-
_bWidePath = true;
400+
#endif
397401
prepareData();
398402
}
399403

400404
void config_file::open(std::string fileName, bool readOnly, bool equalitySign, bool alignment) {
401405
_path = fileName;
406+
#ifdef _MSC_VER
402407
_bWidePath = false;
403-
prepareData();
404-
}
405-
406-
void config_file::open(std::wstring fileName, bool readOnly, bool equalitySign, bool alignment) {
407-
_widePath = fileName;
408-
_bWidePath = true;
408+
#endif
409409
prepareData();
410410
}
411411

@@ -416,12 +416,26 @@ config_file::config_file(std::string fileName) {
416416
open(fileName);
417417
}
418418

419+
#ifdef _MSC_VER
420+
void config_file::open(std::wstring fileName) {
421+
_widePath = fileName;
422+
_bWidePath = true;
423+
prepareData();
424+
}
425+
426+
void config_file::open(std::wstring fileName, bool readOnly, bool equalitySign, bool alignment) {
427+
_widePath = fileName;
428+
_bWidePath = true;
429+
prepareData();
430+
}
431+
419432
config_file::config_file(std::wstring fileName) {
420433
_dataRead = false;
421434
_useAlignment = true;
422435
_useEqualitySign = false;
423436
open(fileName);
424437
}
438+
#endif
425439

426440
void config_file::save() {
427441
if (_dataRead)

plugin_III/extensions/Config.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#include <vector>
1111
#include <fstream>
1212
#include <sstream>
13-
#include "game_III\CVector.h"
14-
#include "game_III\CVector2D.h"
15-
#include "game_III\CRect.h"
16-
#include "game_III\CRGBA.h"
13+
#include "game_iii\CVector.h"
14+
#include "game_iii\CVector2D.h"
15+
#include "game_iii\CRect.h"
16+
#include "game_iii\CRGBA.h"
1717

1818
namespace plugin {
1919

@@ -90,8 +90,10 @@ namespace plugin {
9090
class config_file {
9191
public:
9292
std::string _path;
93+
#ifdef _MSC_VER
9394
std::wstring _widePath;
9495
bool _bWidePath;
96+
#endif
9597
bool _useEqualitySign;
9698
bool _useAlignment;
9799
bool _dataRead;
@@ -108,11 +110,13 @@ namespace plugin {
108110
public:
109111
config_file();
110112
void open(std::string fileName);
111-
void open(std::wstring fileName);
112113
void open(std::string fileName, bool readOnly, bool equalitySign, bool alignment);
113-
void open(std::wstring fileName, bool readOnly, bool equalitySign, bool alignment);
114114
config_file(std::string fileName);
115+
#ifdef _MSC_VER
116+
void open(std::wstring fileName);
117+
void open(std::wstring fileName, bool readOnly, bool equalitySign, bool alignment);
115118
config_file(std::wstring fileName);
119+
#endif
116120
void save();
117121
config_parameter &operator[](std::string name);
118122
void setUseEqualitySign(bool enable);

plugin_III/extensions/ScriptCommands.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ScriptCode::ScriptCode(short commandId) {
1616
capacity = 32;
1717
data = new unsigned char[32];
1818
size = 0;
19+
varIndexCounter = 0;
1920
if (commandId != -1) {
2021
AddBytes(reinterpret_cast<unsigned char *>(&commandId), 2);
2122
}

plugin_III/extensions/ScriptCommands.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "scripting\ScriptCommandNames.h"
99
#include "game_III\CRunningScript.h"
1010
#include <vector>
11+
#include <string.h>
1112

1213
namespace plugin {
1314

plugin_III/game_III/CFont.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Do not delete this comment block. Respect others' work!
88

99
CFontDetails &CFont::Details = *(CFontDetails *)0x8F317C;
1010
CSprite2d *CFont::Sprite = (CSprite2d *)0x95CC04;
11-
short &CFont::NewLine = *(_int16 *)0x95CC94;
11+
short &CFont::NewLine = *(short *)0x95CC94;
1212
char *aStr = (char *)0x64C624;
1313

1414
// Converted from cdecl void CFont::DrawFonts(void) 0x501B50

0 commit comments

Comments
 (0)