IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

This section is for any editing topics that don't fit into any of the other forums, any questions on how to mod belong in Editing Discussion

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


Pages: (65) « First ... 60 61 [62] 63 64 ... Last »  ( Go to first unread post ) Reply to this topicStart new topicStart Poll

 Documenting GTA-SA memory adresses

 hard coded gets uncovered here
 
Deji  
Posted: Thursday, Mar 15 2012, 21:29
Quote Post


Coding like a Rockstar!
Group Icon
Group: Members
Joined: Dec 24, 2007

ja.gif

XXXXX



@DK22Pac - What d'yeh need help with?

CVehicleModelInfo:
CODE
000002B0 carcols         db 32 dup(?)
000002D0 numPossibleColours db 4 dup(?)
Users WebsitePM
  Top
 

 
DK22Pac  
Posted: Thursday, Mar 15 2012, 22:14
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



Ahh, I understood x)
To increase limit of new colors we just need to change pointer to carcolRGB table xD

Finds:
CModelCars+0x2FA ID of <model name>01.txd
CModelCars+0x2FC ID of <model name>02.txd
CModelCars+0x2FE ID of <model name>03.txd
CModelCars+0x300 ID of <model name>04.txd

CPedIK+0 CPed
Wow, CPedIK was already discovered by MTA developers smile.gif
Another procedure...
CODE
CPhysical *__thiscall CPhysical__attachTo(CPhysical *CPhysical, CPhysical *attachObject, float offsetX, float offsetY, float offsetZ, float rotX, float rotY, float rotZ)
{
 CPhysical *attachObject2; // ebp@1
 CPhysical *CPhysical2; // esi@1
 CPhysical *result; // eax@2
 int immunities; // eax@3
 int someImmunity; // ecx@3
 CMatrix *matrix; // edx@4
 int pPosition; // edx@5
 CPhysical *objectAttachedTo; // edx@9
 unsigned __int8 type; // dl@11

 attachObject2 = attachObject;
 CPhysical2 = CPhysical;
 if ( attachObject )
 {
   CPhysical->AttachedTo = attachObject;
   CEntity__registerReference(&CPhysical->AttachedTo);
   CPhysical2->AttachOffset.x = offsetX;
   CPhysical2->AttachOffset.y = offsetY;
   CPhysical2->AttachOffset.z = offsetZ;
   immunities = CPhysical2->immunities;
   someImmunity = (CPhysical2->immunities >> 6) & 1;
   if ( (CPhysical2->immunities >> 6) & 1 )
   {
     matrix = CPhysical2->__parent.__parent.m_pCoords;
     if ( matrix )
       pPosition = &matrix->matrix.pos;
     else
       pPosition = &CPhysical2->__parent.__parent.placement;
     LODWORD(CPhysical2->AttachRotation.x) = *pPosition;
     LODWORD(CPhysical2->AttachRotation.y) = *(pPosition + 4);
     attachObject2 = attachObject;
     LODWORD(CPhysical2->AttachRotation.z) = *(pPosition + 8);
   }
   else
   {
     CPhysical2->AttachRotation.x = rotX;
     CPhysical2->AttachRotation.y = rotY;
     CPhysical2->AttachRotation.z = rotZ;
   }
   objectAttachedTo = CPhysical2->AttachedTo;
   CPhysical2->field_124 = 0;
   CPhysical2->field_118 = 0;
   CPhysical2->field_11C = 0;
   CPhysical2->field_120 = 0;
   CPhysical2->EntityIgnoredCollision = objectAttachedTo;
   if ( immunities & 4 )
   {
     CPhysical2->immunities = immunities & 0xFFFFFFF7;
     sub_546FF0(CPhysical2);
     result = attachObject2;
   }
   else
   {
     type = attachObject2->__parent.type & 7;
     if ( type > 1u )
     {
       if ( type < 5u )
       {
         if ( attachObject2->immunities & 4 )
         {
           if ( (CPhysical2->__parent.type & 7) == 4 )
           {
             if ( !someImmunity )
             {
               CPhysical2->immunities = immunities | 4;
               CPhysical2->m_fMass = 0x47C34FF3u;// 99999.898
               CPhysical2->m_fTurnMass = 0x47C34FF3u;// 99999.898
             }
           }
         }
       }
     }
     sub_546FF0(CPhysical2);
     result = attachObject2;
   }
 }
 else
 {
   result = 0;
 }
 return result;
}


This post has been edited by DK22Pac on Friday, Mar 23 2012, 20:57
Users WebsitePM
  Top
 

 
Ify24  
Posted: Saturday, Mar 24 2012, 11:21
Quote Post


0x00000000 --> invisible
Group Icon
Group: Members
Joined: Aug 17, 2011

yu.gif

XXXXX



Hy guys, I have a question.
For what is this memory adress?:

0xFF994400

PM
  Top
 

 
Deji  
Posted: Saturday, Mar 24 2012, 12:39
Quote Post


Coding like a Rockstar!
Group Icon
Group: Members
Joined: Dec 24, 2007

ja.gif

XXXXX



It's invalid. Probably not meant to be a memory address. Where'd you get it from?
Users WebsitePM
  Top
 

 
Ify24  
Posted: Saturday, Mar 24 2012, 12:46
Quote Post


0x00000000 --> invisible
Group Icon
Group: Members
Joined: Aug 17, 2011

yu.gif

XXXXX



From your changing hud colours tutorial biggrin.gif

I have another question:

at http://www.gtamodding.com/index.php?title=...resses_%28SA%29

I found Menu base memory adress:

0xBA6748

and this:

+ 0x78D = [byte] Show menu item hover

How to use this to change color of hover item ? It would be easier if there is a one adress for menu item hover...

This post has been edited by Ify24 on Saturday, Mar 24 2012, 12:52
PM
  Top
 

 
fastman92  
Posted: Saturday, Mar 24 2012, 15:51
Quote Post


фастман92 | ف
Group Icon
Group: Members
Joined: Jul 28, 2009

pl.gif

XXXXX



QUOTE (Ify24 @ Saturday, Mar 24 2012, 12:21)
Hy guys, I have a question.
For what is this memory adress?:

0xFF994400

It's value: RGBA color.
You'll find it here: http://gtag.gtagaming.com/forums/index.php...p=856&#entry856

0xFF994400
0x Alpha Blue Green Red

Red: 0
Green: 0x44
Blue: 0x99
Alpha: 255
Users WebsitePMMSN
  Top
 

 
DK22Pac  
Posted: Saturday, Mar 24 2012, 16:46
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



0x6D55C0 CVehicle__isAnyReasonToEnableLights
CODE
char __thiscall CVehicle__isAnyReasonToEnableLights(CVehicle *vehicle)
{
 char lightsState; // bl@1
 CVehicle *vehicle2; // esi@1
 long double wetGrip; // fst7@7
 CPed *driver; // esi@14
 signed int pedtype; // eax@15

 lightsState = 0;
 vehicle2 = vehicle;
 if ( currentTimeHours > 20u
   || currentTimeHours > 19u && currentTimeMinutes > (vehicle->__parent.__parent.RandomSeed & 0x3F)
   || currentTimeHours < 6u
   || currentTimeHours < 7u && currentTimeMinutes < (vehicle->__parent.__parent.RandomSeed & 0x3F)
   || (wetGrip = vehicle->__parent.__parent.RandomSeed * 0.0000199999994947575, flt_C81300 > wetGrip)
   || wetGripScale_ > wetGrip )
   lightsState = 1;
 if ( *&vehicle->__parent.field_12C < 0.05000000074505806 && dummy_72DDB0() )
 {
   lightsState = 1;
 }
 else
 {
   if ( !lightsState )
     return lightsState;
 }
 driver = vehicle2->pDriver;
 if ( driver )
 {
   pedtype = driver->pedType;
   if ( pedtype >= 7 )
   {
     if ( pedtype <= 16 && driver->__parent.__parent.RandomSeed & 1 && byte_C0BC5C )
       return 0;
   }
 }
 return lightsState;
}
Users WebsitePM
  Top
 

 
Ify24  
Posted: Saturday, Mar 24 2012, 17:00
Quote Post


0x00000000 --> invisible
Group Icon
Group: Members
Joined: Aug 17, 2011

yu.gif

XXXXX



I have another question:

at http://www.gtamodding.com/index.php?title=...resses_%28SA%29

I found Menu base memory adress:

0xBA6748

and this:

+ 0x78D = [byte] Show menu item hover

How to use this to change color of hover item ? It would be easier if there is a one adress for menu item hover...
PM
  Top
 

 
DK22Pac  
Posted: Sunday, Mar 25 2012, 00:02
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



0x723750 void __cdecl CBulletTraces__AddTrace(RwV3D *pStartPoint, RwV3D *pEndPoint, int radius, unsigned int dissapearTime, char alpha)
0x723C10 int __cdecl CBulletTraces__Render()
0x723FB0 int __cdecl CBulletTrace__Update()

With original R* names inlove.gif
Gonna compare these procs with gta3's ones later.
Users WebsitePM
  Top
 

 
juarez  
Posted: Sunday, Mar 25 2012, 09:19
Quote Post


Rat
Group Icon
Group: Members
Joined: Jun 11, 2011

pl.gif

XXXXX



My finds smile.gif

sub_456A70 -> snapshot taken
sub_58AA50 -> draw zone name
sub_49CEC0 -> tag sprayed

This post has been edited by juarez on Sunday, Mar 25 2012, 17:18
Users WebsitePM
  Top
 

 
DK22Pac  
Posted: Tuesday, Mar 27 2012, 23:40
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



6F6BD0 int __cdecl GetTrainNodeNearPoint(float fX, float fY, float fZ, int pTrackIDresult)
Named by MTA developers.
CODE
int __cdecl GetTrainNodeNearPoint(float fX, float fY, float fZ, int pTrackIDresult)
{
 int trackLineResult; // edi@1
 signed int trackID; // esi@1
 int zero; // ST14_4@1
 int trackLine; // ecx@2
 int pPoint; // edx@3
 int pStartPointsData; // eax@4
 long double distance; // fst5@4
 signed int point.x; // ebp@4
 int pPointData; // eax@4
 float point.z; // ST2C_4@4
 float subX; // ST18_4@4
 long double subY; // fst7@4
 float resultDistance; // [sp+10h] [bp-20h]@1

 trackLineResult = zero;
 LODWORD(resultDistance) = 0x47C34FF3u;        // 99999.898
 trackID = 0;
 do
 {
   trackLine = 0;
   if ( tracksDatLineCount[trackID] > 0 )
   {
     pPoint = 0;
     do
     {
       pStartPointsData = tracksDatContents[trackID];
       point.x = *(pStartPointsData + pPoint);
       pPointData = pPoint + pStartPointsData;
       point.z = *(pPointData + 4) * 0.125;
       subX = fX - point.x * 0.125;
       subY = fY - *(pPointData + 2) * 0.125;
       distance = sqrt((fZ - point.z) * (fZ - point.z) + subY * subY + subX * subX);
       if ( distance < resultDistance )
       {
         resultDistance = distance;
         trackLineResult = trackLine;
         *pTrackIDresult = trackID;
       }
       ++trackLine;
       pPoint += 10;
     }
     while ( trackLine < tracksDatLineCount[trackID] );
   }
   ++trackID;
 }
 while ( trackID < 4 );
 return trackLineResult;
}


CODE
00000000 CTrainNodePoint struc; (sizeof=0xA)
00000000 x               dw ?
00000002 y               dw ?
00000004 z               dw ?
00000006 distanceFromStart dw ?
00000008 field_8         dw ?
0000000A CTrainNodePoint ends

Gonna hack all train-limits biggrin.gif

PS Anyone knows how to generate eNums for IDA from, f.e., text-file? Maybe there some IDC scripts or something?

This post has been edited by DK22Pac on Wednesday, Mar 28 2012, 20:48
Users WebsitePM
  Top
 

 
juarez  
Posted: Thursday, Mar 29 2012, 09:02
Quote Post


Rat
Group Icon
Group: Members
Joined: Jun 11, 2011

pl.gif

XXXXX



sub_60A440 -> CPed_saveGroup
sub_409C10 -> CStreaming__releaseModel
Users WebsitePM
  Top
 

 
Swoorup  
Posted: Thursday, Mar 29 2012, 11:10
Quote Post


innovator
Group Icon
Group: Members
Joined: Oct 28, 2008

au.gif

XXXXX



Can anyone give me some detail on how SA streams nodes.dat and connects the path node in between different zones properly?
PMMSNYahoo
  Top
 

 
Deji  
Posted: Thursday, Mar 29 2012, 16:50
Quote Post


Coding like a Rockstar!
Group Icon
Group: Members
Joined: Dec 24, 2007

ja.gif

XXXXX



QUOTE (DK22Pac @ Tuesday, Mar 27 2012, 23:40)
PS Anyone knows how to generate eNums for IDA from, f.e., text-file? Maybe there some IDC scripts or something?

Like this?
Users WebsitePM
  Top
 

 
Swoorup  
Posted: Friday, Mar 30 2012, 12:16
Quote Post


innovator
Group Icon
Group: Members
Joined: Oct 28, 2008

au.gif

XXXXX



You should be able to produce a C header file which lists structures and enum members defined in the database.

File Menu -> Produce File -> Create C header file

This post has been edited by Swoorup on Sunday, Apr 1 2012, 05:44
PMMSNYahoo
  Top
 

 
DK22Pac  
Posted: Wednesday, Apr 4 2012, 17:37
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



0x563470 int __cdecl CWorld__ClearScanCodes()
0x70A960 int __cdecl CShadows__RenderStoredShadows()
Original R* names.
Has anyone some information about *stream sectors*?
Users WebsitePM
  Top
 

 
fastman92  
Posted: Wednesday, Apr 4 2012, 17:45
Quote Post


фастман92 | ف
Group Icon
Group: Members
Joined: Jul 28, 2009

pl.gif

XXXXX



QUOTE (DK22Pac @ Wednesday, Apr 4 2012, 18:37)
Has anyone some information about *stream sectors*?

I forgot where was that. Can you tell me EXE address?
Users WebsitePMMSN
  Top
 

 
DK22Pac  
Posted: Wednesday, Apr 4 2012, 17:58
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



0xB7D0B8 streamSectors array
0x70A7E0 CShadows__CastPedShadowSectorList First param is *stream sector* pointer to streamSector.
StreamSector contain some array of pointers to CEntity.
Maybe
CODE
CStreamSector
+0x0 entityPtrList
+0x4 entityPtrList2


CODE
CPed+0x134 pedShadowData?


This post has been edited by DK22Pac on Friday, Apr 27 2012, 16:22
Users WebsitePM
  Top
 

 
Wesser  
Posted: Friday, Apr 27 2012, 12:09
Quote Post


The complexity simplifier, the efficiency optimizer
Group Icon
Group: Members
Joined: Aug 19, 2006

eu.gif

Member Award




Some outdated findings:

ENTITY

CEntity + 0x36 - [byte] Entity type
0x02 = Player as driver
0x12 = Quiet driver
0x1A = Suspicious driver (when slightly or heavily collided, unlike cops who are never quiet)
0x22 = No driver
0x2A = Destroyed
0x4A = Player as driver is exiting or being wasted, busted or hijacked

PED

0x5E3B60 - BYTE __thiscall CPed__getWeaponSkillIndexByType(short sType)
0x5E6580 - BYTE __thiscall CPed__getWeaponSkillIndex()

VEHICLE

CVehicle + 0x37C - [bool] Nitro on/off (read-only)

CVehicle + 0x38C - [dword] Some flag
0x80000 = nitro installed

CVehicle + 0x48A - [byte] Nitro Slots
2/5/10 = nitros normal slots (n - 1)
101 = special nitro (cheat)

CVehicle + 0x8A4 - [float] Nitro timer

When nitro is activated, it is set to 0.0 and decreased by -1e-06. Once it overcomes -1.0, the game automatically sets it to 0.0 and it gets increased by 1e-06 (it rises faster if player doesn't accelerate and twice if he decelerates, possible bug).

CVehicle + 0x978 - [dword] Nitro particle 1 (mono exhaust)

CVehicle + 0x97C - [dword] Nitro particle 2 (dual exhaust)

0x6A3EA0 - void __thiscall CAutomobile__processNitro(BYTE bSlots)

PATHFIND

0x96F050 - CPathFind

0x420A10 - void *__thiscall CPathFind__getNodePosition(void *pCoords) (from MTA's source)

0x420AC0 - void *__thiscall CPathFind__getNodePointer(DWORD dwNodeAddr) (from MTA's source)

0x44E4F0 - void __thiscall CPathFind__popRouteNodesFartherFrom(float fOriginX, float fOriginY, float fOriginZ, DWORD *pNodeList[], short *pSteps)

fOriginZ - It's unused in the whole function.

0x4515D0 - void __thiscall CPathFind__findShortestRouteNodes(BYTE bType, float fOriginX, float fOriginY, float fOriginZ, DWORD dwFirstNode, float fDestX, float fDestY, float fDestZ, DWORD *pNodeList[], short *pSteps, short sMaxSteps, float *pDistance, float fMinRadius, DWORD dwLastNode, float fMaxRadius, bool bFollowPath, WORD wFlag, bool bUnk, bool bUnk)

bType - Route type
0 = vehicle
1 = pedestrian
pNodeList - An array containing all route nodes found between the start and destination points.
pSteps - The number of route nodes found.
sMaxSteps - The length of pNodeList array.
fMinRadius - The minimum radius the first node and the next nearest one must have to start searching from the origin. It needs confirmation, though.
fMaxRadius - The maximum radius to start searching from the destination.
bFollowPath - If set, route nodes respect lanes, otherwise the best shortest route is found.
wFlag - It's still unknown. Maybe it defines the type the search nodes do have. Default value is 0xFFFF.

CONTROLS

0x53FF90 - bool __thiscall CPad__firePressed()
0x53FDD0 - bool __thiscall CPad__lookLeftPressed()
0x53FE10 - bool __thiscall CPad__lookRightPressed()
0x53FE70 - bool __thiscall CPad__lookBehindPressed()

MATRIX

0x59BD10 - void __thiscall CMatrix__copyFromRwMatrix(RwMatrix *pMatrix, BYTE bUnk)
0x59BD90 - void __thiscall CMatrix__copyToRwMatrix(RwMatrix *pMatrix, BYTE bUnk)

PARTICLE

CParticle (size = 0x84?)
+ 0x0 - [dword] Pointer to next CParticle
+ 0x4 - [dword] Pointer to previous CParticle
+ 0x8 - [dword] Unknown pointer to CParticleData
+ 0xC - [dword] Attaching matrix
+ 0x10-0x50 - [RwMatrix] Matrix
+ 0x50 - [byte] Status:
0 = visible
1 = inactive
>=2 = unknown
+ 0x51 - [byte] Unknown status
+ 0x52-0x53 - [byte] Unknown
+ 0x54 - [dword] Unknown
+ 0x58 - [float] Distance from camera
+ 0x5C - [short] Time (0.0 to 1.0) * 256
+ 0x5E - [short] Frequency/Intensity (0.0 to 1.0) * 1000
+ 0x60 - [short] Speed (0.0 to 1.0) * 1000
+ 0x62 - [byte] Flag
+ 0x63 - [byte] Unknown
+ 0x64 - [float] Unknown ((rand() % 10000) * 0.0001 * (pParticle.matrix.right.y - pParticle.matrix.right.x) + pParticle.matrix.right.x)
+ 0x68-0x70 - [dword] Unknown
+ 0x74-0x84 - [dword] Unknown pointer

BULLET

0x735FD0 - void __cdecl CBullet__releaseAll()
0x736010 - bool __cdecl CBullet__create(CPed *pEntity, short sWeaponType, float fOriginX, float fOriginY, float fOriginZ, float fVelocityX, float fVelocityY, float fVelocityZ)

WEAPONINFO

0x743C60 - void *__cdecl CWeaponInfo__getInfo(short sType, BYTE bSkillIndex)
0x743CD0 - short __cdecl CWeaponInfo__getSkillStat(short sType)

PLACEABLE

0x50A360 - void __stdcall CPlaceable__getPitchYaw(RwV3d *vOffset, float *fPitch, float *fYaw) (unreferenced)
0x59C790 - void __cdecl CPlaceable__transformRelToAbsOffset(RwV3d *vPoint, RwMatrix *pMatrix, RwV3d *vOffset)
0x59C810 - void __cdecl CPlaceable__transformAbsToRelOffset(RwV3d *vPoint, RwV3d *vOffset, RwMatrix *pMatrix)

STRING

0x718600 - char *__cdecl CStr__gtaStrCpy(const char *szSource char *szDest)
0x718630 - char *__cdecl CStr__gtaStrCat(char *szDest const char *szSource)
0x718660 - char *__cdecl CStr__gtaStrCpy(char *szDest const char *szSource)
0x718690 - DWORD __cdecl CStr__gtaStrLen(const char *szString)
0x7186B0 - char *__cdecl CStr__gtaStrReplace(char *szDest const char *szSource, DWORD dwPos)
0x7186E0 - char *__cdecl CStr__gtaUCasePtr(char *szDest const char *szSource)
0x718710 - void __cdecl CStr__gtaUCase(const char *szString)
0x718740 - void __cdecl CStr__gtaLCase(const char *szString)

2DTEXT

0x719380 - void __cdecl C2DText__setSize(float fWidth, float fHeight)
0x719430 - void __cdecl C2DText__setRGBA(DWORD dwColor)
0x719490 - void __cdecl C2DText__setFont(BYTE bType)
0x7194E0 - void __cdecl C2DText__setBackgroundWidth(float fWidth)
0x719510 - void __cdecl C2DText__setShadowRGBA(DWORD dwColor)
0x719590 - void __cdecl C2DText__setShadowSize(BYTE bSize)
0x7195B0 - void __cdecl C2DText__setMinimized(bool bToggle)
0x7195C0 - void __cdecl C2DText__setBackground(bool bWidth, bool bMultiline)
0x719610 - void __cdecl C2DText__setAlignment(BYTE bType)
0 = center
1 = right
2 = left

2DRENDER

0x728640 - void __cdecl C2DRender__drawBarChart(float fPosX, float fPosY, WORD wWidth, BYTE bHeight, float fPercentage, BYTE bRightBorderWidth, bool bPercentage, bool bBorder, DWORD dwForeColor, DWORD dwRightBorderColor) (from MTA's source)

SCREEN

0x859520 - [float] Width scale (1/640)
0x859524 - [float] Height scale (1/448)
0x865394 - [float] Half width scale (1/320)
0x865398 - [float] Half height scale (1/224)

0x70CE30 - bool __cdecl CScreen__transform3DTo2DPoint(RwV3d *vPoint, RwV2d *vScreen, float *pMultX, float *pMultY, bool bNearClip, bool bFarClip)
0x71DA00 - bool __cdecl CScreen__transform3DTo2DPoint(RwV3d *vPoint, RwV2d *vScreen, float *pMultX, float *pMultY)
0x71DAB0 - bool __cdecl CScreen__transform3DTo2DPoint(RwV3d *vPoint, RwV2d *vScreen)

Here is the updated version according to this script:
CODE

{
 FUNCTIONS INCLUDED:

-   getScreenXYFrom3DCoords
     Type: GET
       Description: Get screen 2D coords from world 3D coords.

-   get3DCoordsFromScreenXY
     Type: GET
       Description: Get world 3D coords from screen 2D coords by a fixed distance.

-   getFullScreenXY
     Type: GET
       Description: Get screen XY from current resolution.

-   getLocalVarOffset
     Type: GET
       Description: Get local var offset from thread pointer.
}

{$CLEO}

0000: NOP

03F0: enable_text_draw 1

while true
 wait 0
 04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 1.0
 0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ 1@ 2@ 3@ store_to 4@ 5@
 0AB1: call_scm_func @get3DCoordsFromScreenXY 3 coords_XY 4@ 5@ distance 1.0 store_camera_to 1@ 2@ 3@ point_to 1@ 2@ 3@
 0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ 1@ 2@ 3@ store_to 4@ 5@
 054C: use_GXT_table 'SWEET6'
 0341: unknown_text_draw_flag 0
 0342: enable_text_draw_centered 1
 033E: set_draw_text_position 4@ 5@ GXT 'SWE6B34'
end

:getScreenXYFrom3DCoords
{
 Parameters:
   Passed:
     0@ - position X
     1@ - position Y
     2@ - position Z
   Result:
     3@ - screen X
     4@ - screen Y

 Example:
   0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ 2488.562 -1666.865 12.8757 store_to 1@ 2@
}
0AB1: call_scm_func @getLocalVarOffset 1 var 0 store_to 7@
0AB1: call_scm_func @getLocalVarOffset 1 var 3 store_to 8@
0AB1: call_scm_func @getLocalVarOffset 1 var 5 store_to 9@
0AB1: call_scm_func @getLocalVarOffset 1 var 6 store_to 10@
0AA5: call 0x70CE30 num_params 6 pop 6 bFarClip 0 bNearClip 0 pMultY 10@ pMultX 9@ pScreen 8@ pCoords 7@
0AB1: call_scm_func @getScreenXY 2 coords_XY 3@ 4@ store_to 3@ 4@
0AB2: ret 2 3@ 4@

:get3DCoordsFromScreenXY
{
 Parameters:
   Passed:
     0@ - screen X
     1@ - screen Y
     2@ - distance
   Result:
     9@ - camera X
     10@ - camera Y
     11@ - camera Z
     18@ - position X
     19@ - position Y
     20@ - position Z

 Example:
   0AB1: call_scm_func @get3DCoordsFromScreenXY 3 coords_XY 320.0 224.0 distance 1.0 store_camera_to 1@ 2@ 3@ point_to 4@ 5@ 6@
}
0A8D: 3@ = read_memory 0x8D5038 size 4 virtual_protect 0 // field of view
3@ *= 0.5
02F6: 4@ = sine 3@
02F7: 5@ = cosine 3@
0073: 4@ /= 5@ // tangent line
0A8D: 6@ = read_memory 0x865394 size 4 virtual_protect 0 // half screen X scale
006B: 6@ *= 0@
6@ -= 1.0
0097: make 6@ absolute_float
006B: 6@ *= 4@
0A8D: 7@ = read_memory 0x865398 size 4 virtual_protect 0 // half screen Y scale
006B: 7@ *= 1@
7@ -= 1.0
0097: make 7@ absolute_float
006B: 7@ *= 4@
0A8D: 8@ = read_memory 0xC3EFA4 size 4 virtual_protect 0 // screen aspect ratio
0073: 7@ /= 8@
0087: 9@ = 6@
0087: 10@ = 2@
0087: 11@ = 7@
0AB1: call_scm_func @getLocalVarOffset 1 var 9 store_to 12@
0A8D: 13@ = read_memory 0xB6F03C size 4 virtual_protect 0 // camera matrix
0AA5: call 0x59C890 num_params 3 pop 3 pOffsets 12@ pMatrix 13@ pPoint 12@ // CPlaceable__transformPoint
006B: 6@ *= 2@
006B: 7@ *= 2@
0087: 14@ = 6@
0087: 15@ = 2@
0087: 16@ = 7@
0AB1: call_scm_func @getLocalVarOffset 1 var 14 store_to 17@
0AA5: call 0x59C890 num_params 3 pop 3 pOffsets 17@ pMatrix 13@ pPoint 17@ // CPlaceable__transformPoint
0AB2: ret 6 9@ 10@ 11@ 14@ 15@ 16@

:getScreenXY
{
 Parameters:
   Passed:
     0@ - full screen X
     1@ - full screen Y
   Result:
     0@ - screen X
     1@ - screen Y

 Example:
   0AB1: call_scm_func @getScreenXY 2 coords_XY 512.0 384.0 store_to 1@ 2@
}
0A8D: 2@ = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X
0A8D: 3@ = read_memory 0x859520 size 4 virtual_protect 0 // screen X scale
0093: 2@ = integer 2@ to_float
006B: 2@ *= 3@
0073: 0@ /= 2@
0A8D: 5@ = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y
0A8D: 6@ = read_memory 0x859524 size 4 virtual_protect 0 // screen Y scale
0093: 5@ = integer 5@ to_float
006B: 5@ *= 6@
0073: 1@ /= 5@
0AB2: ret 2 0@ 1@

:getLocalVarOffset
{
 Parameters:
   Passed:
     0@ - var number
   Result:
     0@ - var pointer

 Example:
   0AB1: call_scm_func @getLocalVarOffset 1 var 0 store_to 1@
}
0@ *= 0x4
0A9F: 1@ = current_thread_pointer
0A8E: 2@ = 1@ + 0xDC
0A8D: 2@ = read_memory 2@ size 1 virtual_protect 0 // bMissionFlag
if
 2@ == 1
then
 0@ += 0xA48960 // pMissionLocals
else
 005A: 0@ += 1@
 0@ += 0x3C // pThreadLocals
end
0AB2: ret 1 0@


This post has been edited by Wesser on Saturday, Apr 6 2013, 14:55
PMMSNPlayStation Network
  Top
 

 
DK22Pac  
Posted: Wednesday, May 2 2012, 15:04
Quote Post


Assembly!
Group Icon
Group: Members
Joined: Apr 12, 2009

un.gif

XXXXX



@Wesser wow, good work with particleData documenting)

0x5E5ED0 void __thiscall CPed__addWeaponModel(CPed *ped, int modelID)
CODE
void __thiscall CPed__addWeaponModel(CPed *ped, int modelID)
{
 CPed *_ped;
 CBaseModelInfo *weaponModel;
 int weapClump;
 int pedtype;
 int weapSlotOffset;
 CWeaponSlot *weapSlot;
 int hAnimHier;
 int boneIndex;
 int pMatrices;
 int molotovPrt;
 RwV3D pos;

 _ped = ped;
 if ( modelID != -1 )
 {
   if ( !ped->weaponSlots[ped->m_bActiveWeapon].field_15 )
   {
     weaponModel = modelPtrs[modelID];
     if ( ped->WeaponClump )
       CPed__removeWeaponModel(ped, -1);
     weapClump = (*(weaponModel->__vmt + 0x2C))(weaponModel); // CModelBase::createInstance
     _ped->WeaponClump = weapClump;
     if ( weapClump )
       _ped->WeaponGunflashClump = findObjectByNodeName(weapClump, "gunflash");
     else
       _ped->WeaponGunflashClump = 0;
     CModelBase__addRef(weaponModel);
     pedtype = _ped->pedType;
     _ped->field_740 = modelID;
     if ( !pedtype || pedtype == 1 )
     {
       weapSlotOffset = 28 * _ped->m_bActiveWeapon;
       weapSlot = (_ped->weaponSlots + weapSlotOffset);
       if ( weapSlot->type == WEAPON_MOLOTOV )
       {
         if ( modelID == MODEL_MOLOTOV )
         {
           if ( !*(&_ped->weaponSlots[0].particle + weapSlotOffset) )
           {
             hAnimHier = clumpGetFirstSkinAtomicHAnimHierarchy(_ped->__parent.__parent.m_pRWObject);
             boneIndex = RpHAnimIDGetIndex(hAnimHier, BONE_RIGHTWRIST);
             pMatrices = RpHAnimHierarchyGetMatrixArray(hAnimHier);
             LODWORD(pos.x) = 0;
             LODWORD(pos.y) = 0;
             LODWORD(pos.z) = 0;
             molotovPrt = createParticle("molotov_flame", &pos, ((boneIndex * 64) + pMatrices), 0);
             weapSlot->particle = molotovPrt;
             if ( molotovPrt )
             {
               sub_4AA910(1);
               dummy_4AA890(weapSlot->particle);
               CParticle__init(weapSlot->particle);
             }
           }
         }
       }
     }
   }
 }
}


PS
entity->type & 7
CODE
1 - building
2 - vehicle
3 - ped
7 - boat


This post has been edited by DK22Pac on Wednesday, May 2 2012, 15:10
Users WebsitePM
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Pages: (65) « First ... 60 61 [62] 63 64 ... Last »

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG