Skip to content

Commit df50ead

Browse files
Upd iv
1 parent 4a71dee commit df50ead

File tree

12 files changed

+96
-20
lines changed

12 files changed

+96
-20
lines changed

plugin_IV/game_IV/CPedFactoryNY.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ class CControlledByInfo {
1313
uint8_t m_playerIndex;
1414
uint8_t m_isPlayer;
1515
uint8_t field_3;
16-
17-
public:
18-
CControlledByInfo() = default;
19-
2016
};
2117

2218
class CPedFactoryNY : CPedFactory {

plugin_IV/game_IV/CTask.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#pragma once
88
#include "PluginBase.h"
99
#include "eTasks.h"
10+
#include "CPools.h"
1011

1112
enum eAbortPriority {
1213
ABORT_PRIORITY_LEISURE = 0,
@@ -21,6 +22,13 @@ class CTask {
2122
public:
2223
virtual ~CTask() {}
2324

25+
static void* operator new(size_t size) {
26+
return CPools::ms_pTaskPool->New();
27+
}
28+
29+
static void operator delete(void* ptr) {
30+
CPools::ms_pTaskPool->Delete(ptr);
31+
}
2432
};
2533

2634
VALIDATE_SIZE(CTask, 0x8);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
Plugin-SDK (Grand Theft Auto IV) source 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 "CTaskComplexCombat.h"
8+
9+
CTaskComplexCombat::CTaskComplexCombat(CPed* target, int32_t unk) {
10+
plugin::CallMethodDyn(gpattern("53 56 57 8B F1 E8 ? ? ? ? 8B 44 24 ? F3 0F 10 44 24"), this, target, unk);
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
Plugin-SDK (Grand Theft Auto IV) 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+
#pragma once
8+
#include "PluginBase.h"
9+
#include "CTaskComplex.h"
10+
11+
class CPed;
12+
13+
class CTaskComplexCombat : public CTaskComplex {
14+
public:
15+
CTaskComplexCombat(CPed* target, int32_t unk);
16+
};

plugin_IV/game_IV/CUserDisplay.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
Plugin-SDK (Grand Theft Auto IV) source 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+
*/
17
#include "CUserDisplay.h"
28

39
CAreaName& CUserDisplay::DisplayAreaName = *gpatternt(CAreaName, "B9 ? ? ? ? E8 ? ? ? ? 84 C0 74 ? 8B 0D ? ? ? ? 68 ? ? ? ? 8B 0C 8D ? ? ? ? E8 ? ? ? ? A1 ? ? ? ? 6A ? 8B 04 85 ? ? ? ? 6A ? C7 40 ? ? ? ? ? A1 ? ? ? ? 8B 04 85 ? ? ? ? C7 40 ? ? ? ? ? 8B 0D ? ? ? ? 8B 0C 8D ? ? ? ? E8 ? ? ? ? 8B 0D ? ? ? ? 6A ? 8B 0C 8D ? ? ? ? 6A ? E8 ? ? ? ? B9 ? ? ? ? E8 ? ? ? ? 84 C0 74 ? 8B 0D ? ? ? ? 68 ? ? ? ? 8B 0C 8D ? ? ? ? E8 ? ? ? ? A1 ? ? ? ? 6A ? 8B 04 85 ? ? ? ? 6A ? C7 40 ? ? ? ? ? A1 ? ? ? ? 8B 04 85 ? ? ? ? C7 40 ? ? ? ? ? 8B 0D ? ? ? ? 8B 0C 8D ? ? ? ? E8 ? ? ? ? 8B 0D ? ? ? ? 6A ? 8B 0C 8D ? ? ? ? 6A ? E8 ? ? ? ? B9", 1);

plugin_IV/game_IV/rage/CTextureDecodeRequestDesc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class CTextureDecodeRequestDesc {
2323
UNKNOWN = 0x0,
2424
JPEG_BUFFER = 0x1,
2525
DDS_BUFFER = 0x2,
26+
UNK_BUFFER3 = 0x3,
27+
UNK_BUFFER4 = 0x4,
2628
};
2729

2830
char* m_TxdName;

plugin_IV/game_IV/rage/grcDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace rage {
1111
class grcDevice {
1212
public:
13-
enum MSAAModeEnum {
13+
enum MSAAModeEnum : int32_t {
1414
MSAA_None = 0x0,
1515
MSAA_NonMaskAble = 0x1,
1616
MSAA_2 = 0x2,

plugin_IV/game_IV/rage/grcImage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ rage::grcImage::~grcImage() {
1010
plugin::CallMethodDyn(gpattern("56 8B F1 57 8B 4E 1C 85 C9"), this);
1111
}
1212

13-
rage::grcImage* rage::grcImage::Create(uint32_t width, uint32_t height, rage::grcImage::Format format, rage::grcImage::ImageType type, int32_t extraMipmaps, int32_t extraLayers, int32_t unused) {
14-
return plugin::CallAndReturnDyn<rage::grcImage*>(gpattern("53 8B 5C 24 08 55 8B 6C 24 18"), width, height, format, type, extraMipmaps, extraLayers, unused);
13+
rage::grcImage* rage::grcImage::Create(uint32_t width, uint32_t height, uint32_t depth, rage::grcImage::Format format, rage::grcImage::ImageType type, int32_t extraMipmaps, int32_t extraLayers, int32_t unused) {
14+
return plugin::CallAndReturnDyn<rage::grcImage*>(gpattern("53 8B 5C 24 08 55 8B 6C 24 18"), width, height, depth, format, type, extraMipmaps, extraLayers, unused);
1515
}
1616

1717
rage::grcImage* rage::grcImage::LoadJPEG(const char* path, rage::grcImage* image) {

plugin_IV/game_IV/rage/grcImage.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ namespace rage {
3939
uint16_t m_Stride;
4040
uint8_t m_Depth;
4141
uint8_t m_StrideHi;
42-
uint8_t *m_Bits;
43-
Color32 *m_Lut;
44-
grcImage *m_Next;
45-
grcImage *m_NextLayer;
42+
uint8_t* m_Bits;
43+
Color32* m_Lut;
44+
grcImage* m_Next;
45+
grcImage* m_NextLayer;
4646
int32_t m_RefCount;
4747
int32_t pad0;
4848
int32_t pad1;
@@ -64,10 +64,13 @@ namespace rage {
6464
}
6565

6666
public:
67-
static grcImage* Create(uint32_t width, uint32_t height, Format format, ImageType type, int32_t extraMipmaps, int32_t extraLayers, int32_t unused);
67+
static grcImage* Create(uint32_t width, uint32_t height, uint32_t depth, Format format, ImageType type, int32_t extraMipmaps, int32_t extraLayers, int32_t unused);
6868
static grcImage* LoadJPEG(const char* path, grcImage* image = nullptr);
6969
static grcImage* LoadJPEG(rage::fiStream* S, grcImage* image = nullptr);
7070
static grcImage* LoadDDS(const char* path);
7171
static grcImage* Load(const char* path); // dds only
7272
};
7373
}
74+
75+
76+

plugin_IV/game_IV/rage/grcTextureFactory.h

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,29 @@ namespace rage {
5353
uint8_t field_29;
5454
uint8_t field_2A;
5555
grcTextureFormat Format;
56+
57+
CreateParams()
58+
: UseFloat(0)
59+
, Multisample(grcDevice::MSAA_None)
60+
, MultisampleQuality(1)
61+
, MipLevels(1)
62+
, IsResolvable(1)
63+
, IsRenderable(1)
64+
, field_1C(1)
65+
, field_24(1)
66+
, field_26(1)
67+
, field_28(1)
68+
, HasParent(0)
69+
, Parent(0)
70+
, field_18(0)
71+
, field_20(0)
72+
, field_25(0)
73+
, field_27(0)
74+
, field_29(0)
75+
, field_2A(0)
76+
, Format(grctfNone)
77+
{
78+
}
5679
};
5780

5881
public:
@@ -101,24 +124,28 @@ namespace rage {
101124
return plugin::CallVirtualMethodAndReturn<grcTexturePC*, 1>(this, width, height, format, arg4, arg5);
102125
}
103126

104-
grcTexturePC* Create(const char* path, grcImage* image) {
105-
return plugin::CallVirtualMethodAndReturn<grcTexturePC*, 3>(this, path, image);
127+
grcTexturePC* Create(grcImage* image, void* unk) {
128+
return plugin::CallVirtualMethodAndReturn<grcTexturePC*, 2>(this, image, unk);
129+
}
130+
131+
grcTexturePC* CreateFromFile(const char* name, grcImage* image) {
132+
return plugin::CallVirtualMethodAndReturn<grcTexturePC*, 3>(this, name, image);
106133
}
107134

108-
grcRenderTarget* GetBackBuffer() {
109-
return plugin::CallVirtualMethodAndReturn<grcRenderTarget*, 5>(this);
135+
grcRenderTargetPC* GetBackBuffer() {
136+
return plugin::CallVirtualMethodAndReturn<grcRenderTargetPC*, 5>(this);
110137
}
111138

112139
grcRenderTargetPC* CreateRenderTarget(const char* name, int32_t type, int32_t width, int32_t height, int32_t bitsPerPixel, CreateParams* params) {
113140
return plugin::CallVirtualMethodAndReturn<grcRenderTargetPC*, 14>(this, name, type, width, height, bitsPerPixel, params);
114141
}
115142

116-
void LockRenderTarget(int32_t index, grcRenderTarget* target, grcRenderTarget* depth, uint32_t layer, bool lockDepth, uint32_t mipToLock) {
117-
plugin::CallVirtualMethod<15>(index, target, depth, layer, lockDepth, mipToLock);
143+
void LockRenderTarget(int32_t index, grcRenderTargetPC* target, grcRenderTargetPC* depth, uint32_t layer, bool lockDepth, uint32_t mipToLock) {
144+
plugin::CallVirtualMethod<15>(this, index, target, depth, layer, lockDepth, mipToLock);
118145
}
119146

120147
void UnlockRenderTarget(int32_t index, grcDevice::grcResolveFlags* resolveFlags, int32_t unused) {
121-
plugin::CallVirtualMethod<16>(index, resolveFlags, unused);
148+
plugin::CallVirtualMethod<16>(this, index, resolveFlags, unused);
122149
}
123150

124151
public:

0 commit comments

Comments
 (0)