- 300
- 41
- Версия MoonLoader
- Другое
Lua:
ffi.cdef[[
struct CTextDrawData {
float m_fLetterWidth;
float m_fLetterHeight;
unsigned long m_letterColor;
unsigned char unknown;
unsigned char m_bCenter;
unsigned char m_bBox;
float m_fBoxSizeX;
float m_fBoxSizeY;
unsigned long m_boxColor;
unsigned char m_nProportional;
unsigned long m_backgroundColor;
unsigned char m_nShadow;
unsigned char m_nOutline;
unsigned char m_bLeft;
unsigned char m_bRight;
int m_nStyle;
float m_fX;
float m_fY;
unsigned char pad_[8];
unsigned long field_99B;
unsigned long field_99F;
unsigned long m_nIndex;
unsigned char field_9A7;
unsigned short m_nModel;
float m_rotation[3];
float m_fZoom;
unsigned short m_aColor[2];
unsigned char field_9BE;
unsigned char field_9BF;
unsigned char field_9C0;
unsigned long field_9C1;
unsigned long field_9C5;
unsigned long field_9C9;
unsigned long field_9CD;
unsigned char field_9D1;
unsigned long field_9D2;
}__attribute__ ((packed));
struct CTextDraw {
char m_szText[801];
char m_szString[1602];
struct CTextDrawData m_data;
}__attribute__ ((packed));
struct CTextDrawPool {
int m_bNotEmpty[2048 + 256];
struct CTextDraw* m_pObject[2048 + 256];
}__attribute__ ((packed));
typedef unsigned char RwUInt8;
typedef int RwInt32;
typedef short RwInt16;
struct RwRaster {
struct RwRaster *parent;
RwUInt8 *cpPixels;
RwUInt8 *palette;
RwInt32 width, height, depth;
RwInt32 stride;
RwInt16 nOffsetX, nOffsetY;
RwUInt8 cType;
RwUInt8 cFlags;
RwUInt8 privateFlags;
RwUInt8 cFormat;
RwUInt8 *originalPixels;
RwInt32 originalWidth;
RwInt32 originalHeight;
RwInt32 originalStride;
void* texture_ptr;
};
struct RwTexture {
struct RwRaster* raster;
};
typedef unsigned char RwUInt8;
typedef int RwInt32;
typedef short RwInt16;
typedef struct RwRaster RwRaster;
struct RwRaster {
struct RwRaster* parent;
RwUInt8* cpPixels;
RwUInt8* palette;
RwInt32 width, height, depth;
RwInt32 stride;
RwInt16 nOffsetX, nOffsetY;
RwUInt8 cType;
RwUInt8 cFlags;
RwUInt8 privateFlags;
RwUInt8 cFormat;
RwUInt8* originalPixels;
RwInt32 originalWidth;
RwInt32 originalHeight;
RwInt32 originalStride;
void* texture_ptr;
};
typedef struct RwLLLink RwLLLink;
struct RwLLLink
{
void *next;
void *prev;
};
typedef struct RwLinkList RwLinkList;
struct RwLinkList
{
struct RwLLLink link;
};
typedef struct RwObject RwObject;
struct RwObject
{
char type;
char subType;
char flags;
char privateFlags;
struct RwFrame *parent;
};
typedef struct RwTexDictionary RwTexDictionary;
struct RwTexDictionary
{
RwObject object;
RwLinkList texturesInDict;
RwLLLink lInInstance;
};
typedef struct CBaseModelInfo_vtbl CBaseModelInfo_vtbl;
struct CBaseModelInfo_vtbl {
void* destructor;
void* AsAtomicModelInfoPtr;
void* AsDamageAtomicModelInfoPtr;
void* AsLodAtomicModelInfoPtr;
char(__thiscall* GetModelType)(struct CBaseModelInfo*);
};
typedef struct CBaseModelInfo CBaseModelInfo;
struct CBaseModelInfo {
CBaseModelInfo_vtbl* vtbl;
unsigned int m_dwKey;
short m_wUsageCount;
short m_wTxdIndex;
char m_nAlpha;
char m_n2dfxCount;
short m_w2dfxIndex;
short m_wObjectInfoIndex;
unsigned short m_nMdlFlags;
struct CColModel* m_pColModel;
float m_fDrawDistance;
struct RpClump* m_pRwObject;
};
typedef struct TxdDef TxdDef;
struct TxdDef {
RwTexDictionary *m_pRwDictionary;
unsigned short m_wRefsCount;
short m_wParentIndex;
unsigned int m_hash;
};
typedef struct CPool CPool;
struct CPool
{
TxdDef* m_pObjects;
uint8_t* m_byteMap;
int m_nSize;
int top;
char m_bOwnsAllocations;
char bLocked;
short _pad;
};
typedef struct RwTexture RwTexture;
struct RwTexture {
RwRaster* raster;
};
typedef struct CSprite2d CSprite2d;
struct CSprite2d {
RwTexture* m_pTexture;
};
typedef struct CWeaponInfo CWeaponInfo;
struct CWeaponInfo
{
int m_eFireType;
float targetRange;
float m_fWeaponRange;
int dwModelId1;
int dwModelId2;
int nSlot;
int m_nFlags;
int AssocGroupId;
short ammoClip;
short damage;
float* fireOffset;
int skillLevel;
int reqStatLevelToGetThisWeaponSkilLevel;
float m_fAccuracy;
float moveSpeed;
float animLoopStart;
float animLoopEnd;
int animLoopFire;
int animLoop2Start;
int animLoop2End;
int animLoop2Fire;
float breakoutTime;
float speed;
int radius;
float lifespan;
float spread;
char AssocGroupId2;
char field_6D;
char baseCombo;
char m_nNumCombos;
};
]]
local CWeaponInfo__GetWeaponInfo = ffi.cast("CWeaponInfo*(__cdecl*)(uint8_t, uint8_t)", 0x743C60)
local CKeyGen__AppendStringToKey = ffi.cast("unsigned int(__cdecl*)(unsigned int, char*)", 0x53CF70)
local RwTexDictionaryFindHashNamedTexture = ffi.cast("RwTexture*(__cdecl*)(RwTexDictionary*, unsigned int)", 0x734E50)
function getWeaponIconTexture(nWeaponModelId)
local pTexture = ffi.new("RwTexDictionary*");
local pModelInfo = ffi.new("CBaseModelInfo*");
local pWeaponInfo = CWeaponInfo__GetWeaponInfo(nWeaponModelId, 1);
if (pWeaponInfo.dwModelId1 > 0) then
pModelInfo = ffi.cast("CBaseModelInfo**", 0xA9B0C8)[pWeaponInfo.dwModelId1];
local nTxdIndex = pModelInfo.m_wTxdIndex;
local pTxdPool = ffi.cast("CPool**", 0xC8800C)[0];
if ffi.cast("uint8_t", pTxdPool.m_byteMap + nTxdIndex) >= 0 then
pTexture = pTxdPool.m_pObjects[nTxdIndex].m_pRwDictionary;
end
if pTexture ~= nil then
local nAppended = CKeyGen__AppendStringToKey(pModelInfo.m_dwKey, ffi.cast("char*", "ICON"));
local texture = RwTexDictionaryFindHashNamedTexture(pTexture, nAppended);
if texture ~= nil then
return texture.raster.texture_ptr
else
end
end
else
local fistSprite = ffi.cast("CSprite2d*", 0xBAB1FC)[0];
return fistSprite.m_pTexture.raster.texture_ptr
end
return nil;
end
Юзаю это: https://www.blast.hk/threads/13380/post-1483261 вместе с https://www.blast.hk/threads/13380/post-995962
Ругается на строчку ]](208 строчка)
attempt to redefine 'RwRaster' at line 80
stack traceback:
[C]: in function 'cdef'
Последнее редактирование: