Quantcast

Jump to content

» «
Photo

Documenting GTA3/VC memory adresses

1,168 replies to this topic
Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1051

Posted 17 January 2012 - 01:44 PM

Thats a ton of functions. Damn how do you discover them?

ModelingMan
  • ModelingMan

    Crackalacking!

  • Feroci
  • Joined: 23 Jan 2004

#1052

Posted 17 January 2012 - 08:19 PM

Here's a current list of my labelled functions for VC.

Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1053

Posted 18 January 2012 - 06:07 PM Edited by Swoorup, 19 January 2012 - 08:00 AM.

@ModelingMan

I have a request. Can you please convert or upload an txt version of your VC functions instead of htm in your site? I am having very low internet connections right now (dial up tounge.gif ) so I cant download the htm file itself because my Download Manager is unable to query its size (it doesnot download it fully). Perhaps it would if it were a txt.
Also do you have IDB version?

Also I have a question.
At 0x00578640 you have defined the function as
CODE
CSprite2d::Draw((CRect const &,CRGBA const &,CRGBA const &,CRGBA const &,CRGBA const &))


But the idb posted by town civilian defines that function as this
CODE
void __thiscall CTexture__draw(CTexture *, RwRect *posInfo, RwRGBA *v1_color, RwRGBA *v2_color, RwRGBA *v3_color, RwRGBA *v4_color)


I am making a HUD for VICE using this function and found out that void __thiscall CTexture__draw works perfectly. Anyway my question is why is it different, why is CTexture * parameter missing?
My guess for what I have found from site is that it is the hidden this pointer used in member function. But really I am not sure.
Can you please elaborate to me?

Also if you don't mind can you tell me how to initialise the CSprint2D class? Like can I set normal texture with different posInfo and alpha with different posinfo and draw them on to the screen? What I need to do is I need to constantly keep altering the bar value using a normal texture(rectangle shaped) with respect to player's health. And the alpha texture would be used but not altered to keep a rounded borders at the end of the bar( it would have same posinfo every time).

QUOTE (ModelingMan @ Feb 19 2010, 01:51)
I started up a little something I was working on a couple years ago. At first it started off wrapping D3D8 calls to D3D9. After that failed, I turned to redirecting all the referenced Renderware functions of VC to the Renderware 3.6 libs I have, which seems to be working so far.

user posted image

If you've ever used the RW libs you'll recognize the logo in the bottom left corner.

My plan was to use the RW functions from the SA executable and redirect the functions in VC (and probably III) to them. This could allow more advanced graphics hacks for VC and III (HLSL shaders, etc.).


Is this a pipe dream?
Think i'll better make a program that documents VC functions and addresses, opcodes with tons of descriptions actually for my own purpose. so yeah....

EDIT: CRadar uses this function 004C1A20 CRadar::DrawRadarMask((void)) to make alpha mask for radar textures to give a round shape. I am sure this is done dynamically and is exactly what I need to draw that rounded HUD. Try nopping the address that calls 004C1A20 CRadar::DrawRadarMask((void)) and you will see the difference.

004C1A20 CRadar::DrawRadarMask((void)) uses the function 00577D10 CSprite2d::SetMaskVertices((int,float *)) inside it somewhere but I am confused about its parameters and how it works. I need to know how it applies mask to selected texture and about how position data are set. But now I am sure this will get my mod done.

DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#1054

Posted 20 January 2012 - 05:06 PM Edited by DK22Pac, 20 January 2012 - 05:10 PM.

@Swoorup
Because it is thiscall.

Is there any information about CScriptThread in GTA3?

Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1055

Posted 28 January 2012 - 01:11 PM

Just noticed the VCFunctions.txt in your site @ModelingMan.

But unfortunately the link is broken.
Never mind though, I have downloaded the htm file itself a tons of file just to make sure everything was downloaded fully.
The last function was 005B3120 cTransmission::InitGearRatios((void)


towncivilian
  • towncivilian

    Player Hater

  • Members
  • Joined: 04 Aug 2007

#1056

Posted 30 January 2012 - 06:05 AM

QUOTE (towncivilian @ Saturday, Jan 14 2012, 15:54)
QUOTE (Swoorup @ Saturday, Jan 14 2012, 06:52)
Where can I obtain the IDB file (IDA pro) for Vice City

Here is the IDC posted by ModelingMan earlier in this thread (see his post for details): http://www.megaupload.com/?d=DTKYNZ4Q

Here is an IDB I found elsewhere: http://www.megaupload.com/?d=EUUST9SQ

Since Megaupload got megashutdown, here are mirrors:

IDC: http://www.mediafire...tjq3ggtrgngq7t5
IDB: http://www.mediafire...oo7u9yd9y11fm8h

Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1057

Posted 10 February 2012 - 04:03 PM Edited by Swoorup, 11 February 2012 - 03:59 PM.

Anyone anything about memory structures of VC? A lot of things for structures are still undocumented. Camera, Entity. I need things like that desperately.

To have SA like Vehicle Cam: Nop the call at 0x46C62E.
NOP 5 bytes.

Warning: Nop that before you actually start the game.

This works best when you are in bike though.

EDIT: I finally figured out how the radar masking works. But still I need to apply the same technique to my own textures which have not been done yet.

004C1A20 CRadar::DrawRadarMask((void)) is called before every frame rendering if radar is enabled at the menu. The function then uses 00577D10 CSprite2d::SetMaskVertices((int numOfVertices,RwV2D* verticesOfPolygon[numofVertices])) to set up 4 polygons into which the extra radar textures are too be masked/erased out.

The polygons are formed at each of the corners of the square (before masking). In a corner 8 sets of points/vertices are assigned to represent the polygon layer which is to be erased out and the polygon points are passed to CSprite2d::SetMaskVertices((int numOfVertices,RwV2D* verticesOfPolygon[numofVertices])) and some renderware functions are carried out.

CODE
signed int __cdecl CRadar__DrawRadarMask()
{
 signed int v0; // ebx@1
 double v1; // st6@2
 double v2; // st7@2
 double v3; // st4@3
 double fradarDiameterExact; // st5@4
 double v5; // st5@4
 signed int v6; // ebp@5
 long double v7; // st4@6
 long double v8; // st6@6
 __int16 v9; // fps@6
 long double v10; // st4@8
 __int16 v11; // fps@8
 double v12; // st4@10
 float v13; // ST0C_4@10
 double v14; // st5@11
 signed int v15; // eax@12
 double v16; // st5@12
 double v17; // st5@12
 float v19; // [sp+0h] [bp-68h]@8
 unsigned int v20; // [sp+8h] [bp-60h]@1
 unsigned int v22; // [sp+Ch] [bp-5Ch]@1
 unsigned int v24; // [sp+10h] [bp-58h]@1
 unsigned int v26; // [sp+14h] [bp-54h]@1
 unsigned int v27; // [sp+18h] [bp-50h]@1
 unsigned int v25; // [sp+1Ch] [bp-4Ch]@1
 unsigned int v23; // [sp+20h] [bp-48h]@1
 unsigned int v21; // [sp+24h] [bp-44h]@1
 float v28; // [sp+28h] [bp-40h]@3
 float v29[15]; // [sp+2Ch] [bp-3Ch]@5

 v20 = 0x3F800000u;
 v21 = 0xBF800000u;
 v22 = 0xBF800000u;
 v23 = 0xBF800000u;
 v24 = 0x3F800000u;
 v25 = 0x3F800000u;
 v26 = 0x3F800000u;
 v27 = 0xBF800000u;
 RwRenderStateSet(rwRENDERSTATETEXTURERASTER, 0);
 RwRenderStateSet(rwRENDERSTATESRCBLEND, 5);   // nothing
 RwRenderStateSet(rwRENDERSTATEDESTBLEND, 6);  // nothing
 RwRenderStateSet(rwRENDERSTATEFOGENABLE, 0);  // nothing
 RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, 2);// nothing
 RwRenderStateSet(rwRENDERSTATESHADEMODE, 1);  // nothing
 RwRenderStateSet(rwRENDERSTATEZTESTENABLE, 0);// Nothing
 RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, 1);// Results no mask
 RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, 1);// Results black color in masked area
 RwD3D8SetRenderState(0x19u, 8u);
 v0 = 0;
 do
 {
   v2 = *(&v20 + 2 * v0);
   v1 = *(&v22 + 2 * v0);
   if ( CMenu.IsOnMapMenu )
   {
     v28 = (fradarScaleX * CMenu.mapScale * v2 + flt_68FD10 * CMenu.mapScale + CMenu.mapPos.x)
         * SLODWORD(pResolutionX)
         * fradarDiamMultiplier;
     v3 = (CMenu.mapPos.y - flt_68FD1C * CMenu.mapScale - flt_68FD18 * CMenu.mapScale * v1)
        * SLODWORD(ResolutionX)
        * fradarUpScaleMul;
   }
   else
   {
     fradarDiameterExact = SLODWORD(pResolutionX) * fradarDiamMultiplier * fradarDiameterWRT640;
     v28 = v2 * fradarDiameterExact * fradarBy2Divider + fradarDiameterExact * fradarBy2Divider + fradarPosX;
     v5 = SLODWORD(ResolutionX) * fradarUpScaleMul;
     v2 = fradarScaleY * v5;
     v3 = v2 * fradarBy2Divider + SLODWORD(ResolutionX) - fradarPoxYfromBottom * v5 - v1 * v2 * fradarBy2Divider;
   }
   v29[0] = v3;
   v6 = 0;
   do
   {
     v8 = v6 * fradarCurvatureUnk * fradarCurvatureUnk2;
     v7 = cos(v8);
     UNDEF(v9);
     if ( v9 & 1024 )
       v7 = cos(MakeAngleAccute(v2));
     v19 = v7;
     v2 = *(&v20 + 2 * v0) * v19;
     v10 = sin(v8);
     UNDEF(v11);
     if ( v11 & 1024 )
       v10 = sin(MakeAngleAccute(COERCE_FLOAT(COERCE_UNSIGNED_INT64(*(&v20 + 2 * v0) * v19))));
     v13 = v10;
     v12 = *(&v22 + 2 * v0) * v13;
     if ( CMenu.IsOnMapMenu )
     {
       v14 = CMenu.mapScale;
       v29[2 * v6 + 1] = (fradarScaleX * CMenu.mapScale * v2 + flt_68FD10 * CMenu.mapScale + CMenu.mapPos.x)
                       * SLODWORD(pResolutionX)
                       * fradarDiamMultiplier;
       v29[2 * v6 + 2] = (CMenu.mapPos.y - flt_68FD1C * v14 - flt_68FD18 * v14 * v12)
                       * SLODWORD(ResolutionX)
                       * fradarUpScaleMul;
     }
     else
     {
       v15 = LODWORD(ResolutionX);
       v16 = SLODWORD(pResolutionX) * fradarDiamMultiplier * fradarDiameterWRT640;
       v29[2 * v6 + 1] = v2 * v16 * fradarBy2Divider + v16 * fradarBy2Divider + fradarPosX;
       v17 = v15 * fradarUpScaleMul;
       v2 = fradarScaleY * v17;
       v29[2 * v6 + 2] = v2 * fradarBy2Divider + v15 - fradarPoxYfromBottom * v17 - v12 * v2 * fradarBy2Divider;
     }
     ++v6;
   }
   while ( v6 < 7 );
   CSprite2d__SetMaskVertices(8, &v28);
   RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, &vert1_x, 8);
   ++v0;
 }
 while ( v0 < 4 );
 return RwD3D8SetRenderState(25u, 5u);
}


EDIT EDIT: It works happy.gif
If anyone wants the demonstration source code, then I could post it here. smile.gif

atfburner
  • atfburner

    under the trapdoor

  • Members
  • Joined: 19 Sep 2006

#1058

Posted 14 February 2012 - 10:18 PM

wait a sec, so you have mouse free camera on bike working now Swoorup ???

Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1059

Posted 15 February 2012 - 04:01 AM

Yeah, but it is just a simple workaround. What it does is: By disabling the call to find the current entity, the camera entity is always directed at the player. Since we can freely move around with the mouse on player cam, It will do the same thing on vehicle. To make a proper one, the whole CCamera: Process has to be rewritten, I believe.
smile.gif

NRShaggy
  • NRShaggy

    Player Hater

  • Members
  • Joined: 19 Jan 2010
  • Russia

#1060

Posted 27 February 2012 - 07:22 PM

QUOTE (Swoorup @ Wednesday, Feb 15 2012, 04:01)
Yeah, but it is just a simple workaround. What it does is: By disabling the call to find the current entity, the camera entity is always directed at the player. Since we can freely move around with the mouse on player cam, It will do the same thing on vehicle. To make a proper one, the whole CCamera: Process has to be rewritten, I believe.
smile.gif

OR you just can use this when in vehicle:
0159: camera_on_ped $PLAYER_ACTOR 0 2
same effect if i understand: also best in bike

Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1061

Posted 28 February 2012 - 11:50 AM

Yeah, to make it work for any vehicle,
I believe this one would work.

Cam.x+=10.0f
Cam.y+=10.0f
Cam.z+=4.0f
Memory location are documented on GTAModding.com site in Memory Address
Any idea what Strechnutter has done for his Cam hack tool?

Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1062

Posted 08 March 2012 - 03:58 PM Edited by Swoorup, 09 March 2012 - 04:49 AM.

CODE
struct CPed
{
0x338 CPathNode* CurrentWanderingNode;
0x33C CPathNode** NextWanderingNode;
};


There might not be easy way to increase the paths. The path's coordinates from ipl file is truncated and is multiplied by 8 (after multiplying it by 1/16) and stored in a signed 2 bytes space in PathNode struct.
Now the signed values have limits ranging from -32767 to 32767. So the limits for path coords would be -4095 to +4095 after division by 8.
The 16 bit limit is same for GTA SA and the values are stored after multiplying by 8

QUOTE

GTA Vice City
From (-2300,-1900,-INF.) to (1540,1900,INF.) approximately, standard units.
Total area: 14.6 square kilometers.
GTA San Andreas
From (-3000,-3000,-INF.) to (3000,3000,INF.) standard units.
Total area: 36.0 square kilometers


The 16x multiplier hack may be able to increase the original limits but it would increase not above that number.
The solution to this may be redirecting every function that accesses this struct. But that would of course take a very long time.

CODE

struct CPathNode //size 0x14
{
_uint16 unk1; Always 0xFFFF
_uint16 unk2; Current Index?
_int16 x;  Divided by 8
_int16 y;
_int16 z;
_int8 unk3;
_int8 unk4;
_int16 nextPointIndex;
_int8 unk5;
_int8 unk6
_int8 flags;
_int8 unk7
_int8 unk8
_int8 unk9;
}


As for the nodes not connecting properly after 16x multiplier hack, It might have to do something with the closest Node search radius. This function CPathFind::FindNodeClosestToCoors returns -1 if the node is not found. If it finds it would return a pointer to a pathnode struct.

This might be occuring with the vehicle paths only since the peds path are close to each other in every nodes (Or most of the nodes I should say). Vehicles node tends to break up in a straight highway since the nodes are placed very far to each other.
Also there might be an angle problem while taking a turn.
I have not seen this issue with peds path though.

I have fairly decompiled that function.
CODE

signed int __userpurge CPathFind__FindNodeClosestToCoors<eax>(GlobalMap *global<ecx>, signed int curObjecttypetIndex<ebx>, signed int LastObjecttypeIndex<edi>, float x, float y, float z, char type, float searchRadius, char skipForbidden, char flag2, char flag3, char flag4)
{
 signed int v12; // esi@1
 double v2; // st5@1
 double VfY; // st7@1
 signed int _curObjecttypetIndex; // ebp@4
 CPathNode *curRouteNode; // edx@5
 int curRouteNodeOffset; // ebx@5
 double curRouteNodeY; // st3@13
 float curRouteNodeX; // ST0C_4@16
 double v3; // st2@14
 double v21; // st2@16
 double xOffset; // st3@16
 double yOffset; // st4@16
 double curRouteNodeZOffset; // st6@18
 double zOffset; // st2@19
 double v26; // st6@21
 signed int result; // eax@25

 v12 = 0;
 VfY = y;
 v2 = f10000;
 switch ( type )
 {
   case 0:                                     // For vehicles
     curObjecttypetIndex = 0;
     LastObjecttypeIndex = global->lastVehicleRoutePointIndex;
     break;
   case 1:                                     // For Peds
     LastObjecttypeIndex = global->lastPedRoutePointIndex;
     curObjecttypetIndex = global->lastVehicleRoutePointIndex;
     break;
   default:
     break;
 }
 _curObjecttypetIndex = curObjecttypetIndex;
 if ( curObjecttypetIndex < LastObjecttypeIndex )
 {
   curRouteNodeOffset = 20 * curObjecttypetIndex;// Since size of CPathNode is 0x14 = 20
   curRouteNode = (global->paths + curRouteNodeOffset);
   do
   {
     if ( !skipForbidden || !((curRouteNode->flags >> 5) & 1) )
     {
       if ( !flag2 || !((curRouteNode->flags >> 6) & 1) )
       {
         if ( !flag3 || !((curRouteNode->field_11 >> 2) & 1) )
         {
           if ( flag4 == (curRouteNode->field_11 & 1) )
           {
             curRouteNodeY = *(&global->paths[0]._y + curRouteNodeOffset) * f8Divider;
             if ( curRouteNodeY - VfY < f0 )
               v3 = curRouteNodeY - VfY;
             else
               v3 = -(curRouteNodeY - VfY);
             yOffset = v3;
             curRouteNodeX = *(&global->paths[0]._x + curRouteNodeOffset) * f8Divider;
             v21 = curRouteNodeX - x;
             xOffset = v21;
             if ( v21 >= f0 )
               xOffset = -v21;
             curRouteNodeZOffset = *(&global->paths[0]._z + curRouteNodeOffset) * f8Divider - z;
             if ( curRouteNodeZOffset < f0 )
               zOffset = curRouteNodeZOffset;
             else
               zOffset = -curRouteNodeZOffset;
             v26 = xOffset + yOffset + f3 * zOffset;
             if ( v26 >= v2 )
             {
               v2 = v26;
               v12 = _curObjecttypetIndex;
             }
           }
         }
       }
     }
     ++_curObjecttypetIndex;
     ++curRouteNode;
     curRouteNodeOffset += 20;
   }
   while ( _curObjecttypetIndex < LastObjecttypeIndex );
 }
 if ( v2 < searchRadius )
   result = -1;
 else
   result = v12;
 return result;
}


Anyone could give a suggestion to do those hacks?

DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#1063

Posted 09 March 2012 - 07:52 AM Edited by DK22Pac, 09 March 2012 - 07:55 AM.

QUOTE
The solution to this may be redirecting every function that accesses this struct. But that would of course take a very long time.

Yeah, you know how to do this tounge2.gif
Possibly you need to change this full struct (as you need to increase it size).
I had same problem with SA, where TextDrawer.textureID has 2 bytes biggrin.gif

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#1064

Posted 09 March 2012 - 11:13 AM Edited by Deji, 02 April 2012 - 08:12 PM.

EDIT: Failed to notice this is the GTA3/VC topic.

Do you have any documentation on CPathFind, then? What is GlobalMap supposed to be? tounge.gif

CODE
00000000 CVehicle        struc; (sizeof=0x5A0)
00000000 __physical      CPhysical ?
00000138 vehicleData     db 588 dup(?)
00000384 pVehicleHandling dd ?
00000388 pPlaneHandling  dd ?
0000038C dwHandlingFlags dd ?
00000390 m_CCarCtrl      CCarCtrl ?  (probably not CCarCtrl, thats just a temp name I gave it)


CODE
00000000 CCarCtrl        struc; (sizeof=0x38)
00000000 field_0         dd ?                  ; offset
00000004 field_4         dd ?
00000008 field_8         dw ?
0000000A                 db ?; undefined
0000000B                 db ?; undefined
0000000C field_C         dd ?
00000010 field_10        dd ?
00000014 currentPathPointIndex dw ?
00000016 nextPathPointIndex dw ?
00000018 previousPathPointIndex dw ?
0000001A field_1A        dw ?
0000001C dwLastMissionStartTime dd ?
00000020 ?dwDrivingTime  dd ?
00000024 field_24        db ?
00000025 field_25        db ?
00000026 field_26        db ?
00000027 field_27        db ?
00000028 field_28        db ?
00000029 drivingStyle    db ?
0000002A mission         db ?
0000002B action          db ?
0000002C actionFinishTime dd ?
00000030 field_30        dd ?
00000034 field_34        dd ?
00000038 CCarCtrl        ends


The annoying thing is that many functions access word values as dwords, which makes it really confusing to decompile.

Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1065

Posted 09 March 2012 - 11:20 AM Edited by Swoorup, 09 March 2012 - 05:56 PM.

Pic from GTA SOL.
user posted image
Isnt this beautiful? Only Peds path work though and liberty city is very high up north of Vice city

DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#1066

Posted 24 March 2012 - 09:08 PM

GTA3, some procedure which selects colors for vehicle materials. I think Ive named all stuff ~correctly, but I still can't understand how vehicle materials render process works in general suicidal.gif
CODE
unsigned __int8 __thiscall SetVehicleColour__17CVehicleModelInfoFUcU(CVehicleModelInfo *CVehicleModelInfo, unsigned __int8 color1ID, unsigned __int8 color2ID)
{
 CVehicleModelInfo *vehModel; // ebp@1
 char green; // bl@2
 int texture; // edi@2
 RpMaterial **pMaterial; // esi@2
 RpMaterial *material; // ecx@8
 unsigned __int8 result; // al@10
 char green2; // bl@11
 int texture2; // edi@11
 int pMaterial2; // esi@11
 RpMaterial *material2; // edx@17
 char blue; // [sp+0h] [bp-28h]@2
 char blue2; // [sp+4h] [bp-24h]@11
 char red; // [sp+14h] [bp-14h]@2
 char red2; // [sp+14h] [bp-14h]@11

 vehModel = CVehicleModelInfo;
 if ( color1ID != CVehicleModelInfo->renderColor1 )
 {
   texture = carColorTexture[color1ID];
   pMaterial = &CVehicleModelInfo->color1material;
   red = carcols_red[4 * color1ID];
   green = carcols_green[4 * color1ID];
   blue = carcols_blue[4 * color1ID];
   while ( 1 )
   {
     material = *pMaterial;
     if ( !*pMaterial )
       break;
     if ( material->texture && *(material->texture + 0x10) != '@' )
     {
       material->color.red = red;
       (*pMaterial)->color.green = green;
       (*pMaterial)->color.blue = blue;
     }
     else
     {
       RpMaterialSetTexture(material, texture);
     }
     ++pMaterial;
   }
   vehModel->renderColor1 = color1ID;
 }
 result = color2ID;
 if ( color2ID != vehModel->renderColor2 )
 {
   pMaterial2 = &vehModel->color2material;
   red2 = carcols_red[4 * color2ID];
   texture2 = carColorTexture[color2ID];
   green2 = carcols_green[4 * color2ID];
   blue2 = carcols_blue[4 * color2ID];
   while ( 1 )
   {
     material2 = *pMaterial2;
     if ( !*pMaterial2 )
       break;
     if ( material2->texture && *(material2->texture + 0x10) != '@' )
     {
       material2->color.red = red2;
       *(*pMaterial2 + 5) = green2;
       *(*pMaterial2 + 6) = blue2;
     }
     else
     {
       RpMaterialSetTexture(material2, texture2);
     }
     pMaterial2 += 4;
   }
   result = color2ID;
   vehModel->renderColor2 = color2ID;
 }
 return result;
}

maxorator
  • maxorator

    VC:MP lead developer

  • Members
  • Joined: 24 Feb 2006
  • None

#1067

Posted 25 March 2012 - 11:47 AM Edited by maxorator, 07 April 2012 - 11:31 AM.

GTA3/VC creates a list of materials that use the primary colour and a list of materials that use the secondary colour. Before a vehicle is rendered, it calls that function to change the colour of those materials to the colours of that specific car.

In VC, the function is a bit simpler, because it doesn't change the texture:
CODE
void CVehicleModelInfo::SetVehicleColour(unsigned char uPrimaryColour, unsigned char uSecondaryColour) {
   if(uPrimaryColour != this->uLastPrimaryColour){
       for(int i = 0; this->pPriColourMaterials[i]; i++) {
           this->pPriColourMaterials[i]->rgbColour.cRed = stCarCol.rgbColours[uPrimaryColour].cRed;
           this->pPriColourMaterials[i]->rgbColour.cGreen = stCarCol.rgbColours[uPrimaryColour].cRed;
           this->pPriColourMaterials[i]->rgbColour.cBlue = stCarCol.rgbColours[uPrimaryColour].cRed;
       }
       
       this->uLastPrimaryColour = uPrimaryColour;
   }

   if(nSecondaryColour != this->uLastSecondaryColour) {
       for(int i = 0; this->pSecColourMaterials[i]; i++) {
           this->pSecColourMaterials[i]->rgbColour.cRed = stCarCol.rgbColours[uSecondaryColour].cRed;
           this->pSecColourMaterials[i]->rgbColour.cGreen = stCarCol.rgbColours[uSecondaryColour].cGreen;
           this->pSecColourMaterials[i]->rgbColour.cBlue = stCarCol.rgbColours[uSecondaryColour].cBlue;
       }
       
       this->uLastSecondaryColour = uSecondaryColour;
   }
}

Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1068

Posted 25 March 2012 - 04:34 PM

A 10 pages ago, I saw Modelling Man's post about changing an exe into a DLL. Is it any easier?

http://keeper.lubie...._exe_to_dll.htm

Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1069

Posted 02 April 2012 - 06:11 PM Edited by Swoorup, 03 June 2012 - 12:22 PM.

EDIT:

Swoorup
  • Swoorup

    innovator

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#1070

Posted 07 April 2012 - 04:45 PM

user posted image
user posted image
user posted image

But I still couldn't get my custom grids connected. I relooked at the VC paths function to increase the path data index which is originally 2 bytes in size. There are also some bitwise operations in it, and couldn't understand what were they doing there. The 2 leftmost bits are used for somethings else, whereas the rest bits are used for indexing the paths.

NewportByChrysler
  • NewportByChrysler

    LC R29

  • BUSTED!
  • Joined: 21 Feb 2012

#1071

Posted 16 April 2012 - 09:27 PM

Would anybody know the address for the headlight flares in the GTA3 .exe?

DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#1072

Posted 05 May 2012 - 09:45 PM Edited by DK22Pac, 06 May 2012 - 09:03 AM.

GTA3 1.0
CODE
0x5197A0 CBrightLights::CleanNumOfBrightLights()
0x5197B0 CBrightLights::Render()
0x51A3B0 CBrightLights::RenderOne()
0x51A410 CBrightLights::RegisterOne(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, char red, char green, char blue, char alpha)

0x8F2C70 NumBrightLights
0x733A68 aBrightLights    CBrightLight[32]

CBrightLight    struc; (sizeof=0x38)
0x00 pointAA         RwV3D
0x0C pointAB         RwV3D
0x18 pointBA         RwV3D
0x24 pointBB         RwV3D
0x30 distanceToCamera dd
0x34 color           RwRGBA

Vice 1.0
CODE
0x5719B0 CBrightLights::Render()
0x571820 CBrightLights::RegisterOne(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, char red, char green, char blue, char alpha)

0x97F2BC NumBrightLights
0x818848 aBrightLights    CBrightLight[32]

The struct is same.

maxorator
  • maxorator

    VC:MP lead developer

  • Members
  • Joined: 24 Feb 2006
  • None

#1073

Posted 06 May 2012 - 10:50 AM

The CBrightLights class is actually just the rectangular boxes near the lights, they don't affect the actual light coming out. They do, however, make the lights seem a bit more realistic as without them there would be the light, but the source of the light would look rather dark, which makes no sense. In SA this is done differently, by actually changing the texture of lights to a lighter texture. If you want to affect the actual light coming out, then you should look into CCoronas and CPointLights classes. It is also possible that some of the surface lighting (ground in front of the lights) is handled internally as shadows.

DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#1074

Posted 06 May 2012 - 11:08 AM

Yeah. In SA, also, some material settings are changed (as I remember, "material diffuse" value).
This bright light is really weird thing for me. After I removed them, vehicles look better at night. colgate.gif
I thought about making new headlight coronas for GTAIII, since I dont like that light line.
Also, about pointligths, in SA, for vehicle lights they are really "direct lights". And it's a cool thing. But it affects only dynamic stuff, like peds and vehicles...
And about "surface lighting", like you called it, it creates 3d prim based on nearest entities' vertices. For SA, I documented CShadows struct here. Just one bad thing - these shadows could be created only on the ground, only ped shadows are drawed on the walls.

maxorator
  • maxorator

    VC:MP lead developer

  • Members
  • Joined: 24 Feb 2006
  • None

#1075

Posted 06 May 2012 - 12:00 PM

Yeah, actually it will be a feature in the next version of my vehicle loader to disable the light boxes either separately for new vehicles or globally.

By the way, maybe you should also add all of that to the English GTAModding wiki. wink.gif

juarez
  • juarez

    Memory Hacking

  • Members
  • Joined: 11 Jun 2011
  • Poland

#1076

Posted 27 May 2012 - 09:17 AM Edited by juarez, 27 May 2012 - 11:27 AM.

Version 1.0

sub_5427A0 -> CCoronas__addCorona
sub_43D910 -> _?pickupTaken
sub_42EDE0 -> ShowGarageText
sub_42F2B0 -> DrawGarageText

//draw text above clothes and bigdollar pickups
sub_43E5E0 -> _?DrawPickupText

Jack
  • Jack

    wanted level modifications

  • Feroci
  • Joined: 06 Dec 2011
  • Serbia

#1077

Posted 07 June 2012 - 04:17 AM

Hi. I found these recently:
gta3 v1.0:
CODE
0x4C1E99 - COP weapon model - default value 2
0x4C1200 - COP pistol - default value 2
0x4C1234 - COP weapon accuracy - default value 60

0x4C125F - SWAT uzi - default value 3
0x4C126A - SWAT weapon model load - default value 3
0x4C124F - SWAT pistol - default value 2
0x4C1293 - SWAT weapon accuracy - default value 68

0x4C12BE - FBI AK47 - default value 5
0x4C12C9 - FBI weapon model load - default value 5
0x4C12AE - FBI pistol - default value 2
0x4C12F2 - FBI weapon accuracy - default value 76

0x4C131A - ARMY M16 - default value 6
0x4C1332 - ARMY weapon model load - default value 6
0x4C130A - ARMY pistol - default value 2
0x4C135B - Army weapon accuracy - default value 84

Accuracy values from 0 to 100.
Weapon values from 0 to 11:
CODE
0 - unarmed
1 - bat
2 - pistol
3 - uzi
4 - shotgun
5 - AK47
6 - M16
7 - sniper
8 - rocket launcher
9 - flamethrower
10 -molotov coctail
11 -bomb

NOTE: Wanted level personel don't know how to use sniper and rocketlauncher - they just punching you in the face with these two guns - that's too bad. However they know everything else - even a molotov or a bomb. Also I have no idea how to change both primary and secondary weapon of these peds because for example when I change FBI AK47 to M16 - the only way to change FBI pistol is to M16 because I found only one address for a weapon model for every wanted level ped - so I got a strange feeling that something is missing here.
Also I was bored so I found the same for the v1.1:
CODE
0x4C12F0 - COP pistol
0x4C1F39 - COP pistol model
0x4C1324 - COP weapon accuracy (60)

0x4C134F - SWAT uzi
0x4C135A - SWAT weapon model
0x4C133F - SWAT pistol
0x4C1383 - SWAT weapon accuracy (68)

0x4C13AE - FBI AK47
0x4C13B9 - FBI weapon model
0x4C139E - FBI pistol
0x4C13E2 - FBI weapon accuracy (76)

0x4C140A - Army M16
0x4C1422 - Army weapon model
0x4C13FA - Army pistol
0x4C144B - Army weapon accuracy (84)

MW_29
  • MW_29

    i came to play

  • Members
  • Joined: 19 Jan 2008
  • None

#1078

Posted 08 June 2012 - 09:35 PM

QUOTE (JACK JONES @ Thursday, Jun 7 2012, 04:17)
Hi. I found these recently:
gta3 v1.0:
CODE
0x4C1E99 - COP weapon model - default value 2
0x4C1200 - COP pistol - default value 2
0x4C1234 - COP weapon accuracy - default value 60

0x4C125F - SWAT uzi - default value 3
0x4C126A - SWAT weapon model load - default value 3
0x4C124F - SWAT pistol - default value 2
0x4C1293 - SWAT weapon accuracy - default value 68

0x4C12BE - FBI AK47 - default value 5
0x4C12C9 - FBI weapon model load - default value 5
0x4C12AE - FBI pistol - default value 2
0x4C12F2 - FBI weapon accuracy - default value 76

0x4C131A - ARMY M16 - default value 6
0x4C1332 - ARMY weapon model load - default value 6
0x4C130A - ARMY pistol - default value 2
0x4C135B - Army weapon accuracy - default value 84

Accuracy values from 0 to 100.
Weapon values from 0 to 11:
CODE
0 - unarmed
1 - bat
2 - pistol
3 - uzi
4 - shotgun
5 - AK47
6 - M16
7 - sniper
8 - rocket launcher
9 - flamethrower
10 -molotov coctail
11 -bomb

NOTE: Wanted level personel don't know how to use sniper and rocketlauncher - they just punching you in the face with these two guns - that's too bad. However they know everything else - even a molotov or a bomb. Also I have no idea how to change both primary and secondary weapon of these peds because for example when I change FBI AK47 to M16 - the only way to change FBI pistol is to M16 because I found only one address for a weapon model for every wanted level ped - so I got a strange feeling that something is missing here.
Also I was bored so I found the same for the v1.1:
CODE
0x4C12F0 - COP pistol
0x4C1F39 - COP pistol model
0x4C1324 - COP weapon accuracy (60)

0x4C134F - SWAT uzi
0x4C135A - SWAT weapon model
0x4C133F - SWAT pistol
0x4C1383 - SWAT weapon accuracy (68)

0x4C13AE - FBI AK47
0x4C13B9 - FBI weapon model
0x4C139E - FBI pistol
0x4C13E2 - FBI weapon accuracy (76)

0x4C140A - Army M16
0x4C1422 - Army weapon model
0x4C13FA - Army pistol
0x4C144B - Army weapon accuracy (84)

Useful findings. If You have a time, then maybe try to find similar things for VC wink.gif

...by the way, have anyone so far found memory address for color of this GREEN MENU SELECTOR rectangle???

NewportByChrysler
  • NewportByChrysler

    LC R29

  • BUSTED!
  • Joined: 21 Feb 2012

#1079

Posted 08 June 2012 - 10:44 PM

So, through memory editing, would it be possible to re-enable headlight coronas in GTAIII?

MW_29
  • MW_29

    i came to play

  • Members
  • Joined: 19 Jan 2008
  • None

#1080

Posted 09 June 2012 - 11:40 AM

QUOTE (NewportByChrysler @ Friday, Jun 8 2012, 22:44)
So, through memory editing, would it be possible to re-enable headlight coronas in GTAIII?

Well, as guys previously posted here, i assume it could be done. Maybe then it 'd be worth releasing this as official mod, not only pieces of code in this topic, i mean wink.gif Anyways, keep up icon14.gif




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users