Quantcast

Jump to content

» «
Photo

Documenting GTA3/VC memory addresses

1,211 replies to this topic
KNN.
  • KNN.

    ▓▒░_watch yerself_░▒▓

  • Feroci
  • Joined: 09 Jul 2006
  • European-Union
  • Best Map 2013 "ViceCityStories PC Edition"

#1201

Posted 23 February 2017 - 10:55 PM Edited by HM128, 24 February 2017 - 08:02 AM.

VC

struct CBuildingModel
{
0x00 __parent        CModel ?
0x2C                 db ? ; undefined
0x2D                 db ? ; undefined
0x2E                 db ? ; undefined
0x2F                 db ? ; undefined
0x30 weaponId        dd ?
0x34 field_34        dd ?
0x38                 db ? ; undefined
0x39                 db ? ; undefined
0x3A                 db ? ; undefined
0x3B                 db ? ; undefined
0x3C                 db ? ; undefined
0x3D                 db ? ; undefined
0x3E                 db ? ; undefined
0x3F                 db ? ; undefined
0x40 field_40        db ?
0x41                 db ? ; undefined
0x42 flags           dw ?
0x44 minGameHoursWhenRendering db ?
0x45                 db ? ; undefined
0x46                 db ? ; undefined
0x47                 db ? ; undefined
0x48 maxGameHoursWhenRendering db ?
};


Does anyone has more?

 

BTW, LODs function, it's described and commented how the LODs works, they are getting the value of draw distance of short distance object when from which far they should appear.

Spoiler

0x0056F516 set to 299.0 to use multilods in Vice City.


DK22Pac
  • DK22Pac

    𝘉eчнo 𝘔oлoдoй...

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]
    Helpfulness Award [Mods]

#1202

Posted 24 February 2017 - 03:17 PM Edited by DK22Pac, 25 February 2017 - 09:39 AM.

Does anyone has more?

CModel => CBaseModelInfo

There are few classes that are inherited from CBaseModelInfo: CVehicleModelInfo (vehicle models), CPedModelInfo (peds), CSimpleModelInfo (objects), CTimeModelInfo (time objects ('tobj')), CWeaponModelInfo, etc.

The class you showed here (named "CBuildingModel") includes members from some of these different classes.

The function you showed here (named "findSODtoLOD") is a method SetupBigBuilding of a class CSimpleModelInfo

Spoiler

 
UP:
 
VC Model classes hierarchy
 
                           CBaseModelInfo
                                  |
               +------------------+------------------+
               |                                     |
       CSimpleModelInfo                       CClumpModelInfo
               |                                     |
       +-------+------+                      +-------+------+
       |              |                      |              |
CTimeModelInfo  CWeaponModelInfo     CVehicleModelInfo  CPedModelInfo
  • KNN. likes this

KNN.
  • KNN.

    ▓▒░_watch yerself_░▒▓

  • Feroci
  • Joined: 09 Jul 2006
  • European-Union
  • Best Map 2013 "ViceCityStories PC Edition"

#1203

Posted 09 March 2017 - 11:39 AM Edited by HM128, 18 March 2017 - 11:13 AM.

Thank You DK

 

VC 1.0

 

Sometimes modded game keeps crashing with "unloaded" message, so I have found that the

.text:0060063C 0E0 push    eax             ; hWnd
.text:0060063D 0E4 call    ds:DestroyWindow ; Indirect Call Near Procedure

Makes crash more often. After nopping the call:

0x0060063C NOP
0x0060063D NOP 6

This minimized the occurs to zero.

I still don't know if it's right to do such thing but it seems to work.

 

//EDIT:

Just to be clear, to get rid of crashes after game quit, NOP the function above.


DK22Pac
  • DK22Pac

    𝘉eчнo 𝘔oлoдoй...

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]
    Helpfulness Award [Mods]

#1204

Posted 17 March 2017 - 07:01 PM

GTA 3 idb by Kenking

  • KNN. and thehambone like this

KNN.
  • KNN.

    ▓▒░_watch yerself_░▒▓

  • Feroci
  • Joined: 09 Jul 2006
  • European-Union
  • Best Map 2013 "ViceCityStories PC Edition"

#1205

Posted 18 March 2017 - 11:22 AM Edited by HM128, 23 March 2017 - 07:08 PM.

Very well documented

 

But I think there are few mistakes with typecast of CSprite2D and RwRect.

 

//EDIT:

(III) 1.0

Loading and drawing own font example:

// TxdStore Class
auto CTxdStore__FindTxdSlot = (int(__cdecl *)(char *name))0x5275D0;
auto CTxdStore__SetCurrent = (int(__cdecl *)(int index))0x5278C0;
auto CTxdStore__RwTextureRead = (CSprite2d *(__cdecl*)(char *name, char *mask))0x5A7580;
auto CTxdStore__PushCurrentTxd = (int(*)(void))0x527900;
auto CTxdStore__PopCurrentTxd = (int(*)(void))0x527910;

// Sprite2d Class
class CSprite2d;
auto CSprite2d__AddSpriteToBank = (void(__cdecl *)(WORD textureId, RwRect const&posInfo, RwRGBA const&color, float u1, float v1, float u2, float v2, float u3, float v3, float u4, float v4))0x51EBC0;
auto CSprite2d__DrawBank = (int(__cdecl *)(CSprite2d *))0x51EC50;
auto CSprite2d__GetBank = (int(__cdecl *)(int a1, int texAddr))0x51EB70;


//Load texture on init
CTxdStore__PushCurrentTxd();
CTxdStore__SetCurrent(CTxdStore__FindTxdSlot("fonts"));
CSprite2d *tex = CTxdStore__RwTextureRead("font3", 0);
CTxdStore__PopCurrentTxd();

//Redirect call at 0x0048C8D7 and 0x005928BF by
int _ZN5CFont12InitPerFrameEv()
{
    *(DWORD*)0x8F31B4 = CSprite2d__GetBank(30, *(DWORD*)0x95CC04);
    CSprite2d__GetBank(15, *(DWORD*)0x95CC08);
    CSprite2d__GetBank(15, *(DWORD*)0x95CC0C);
    CSprite2d__GetBank(15, *(DWORD*)tex);
    return true;
}

//Draw symbols as the part of textures in loop
//DWORD texAddr = CSprite2d__GetBank(10, *(DWORD*)tex); //the 10 number is slot probably, improper can be crashy
int textAddr = 3; //added new font texture
CSprite2d__AddSpriteToBank(texAddr, rect, color, U1lef, V1bot, U2rig, V2bot, U3lef, V3top, U4rig, V4top);
CSprite2d__DrawBank((CSprite2d *)texAddr);

Cell Tennyson
  • Cell Tennyson

    Co Con Co CONN!!

  • Members
  • Joined: 22 Oct 2012
  • India

#1206

Posted 07 August 2017 - 06:58 AM

Any memory address which increases the chances of 3 or 4 peds sitting in a 4 seater car? Like in FBI Rancher.


Nick007J
  • Nick007J

    Mark Chump

  • Members
  • Joined: 17 Jan 2010
  • Russia

#1207

Posted 07 August 2017 - 11:17 AM

Game uses a probability for a passenger seat be taken (0.125). Increasing it would cause generally higher number of passenger in a vehicle, including 4 seater cars. Constant itself is used in multiple places, so you would have to find unused 4 bytes, fill them with required float, and then substitute address at 0x428DE3 to address of new float. Originally it refers to 0x687050, which contains 0.125.

Example: set 0x6874EC to a required float, then set value at 0x428DE3 to 0x6874EC (4 bytes). If the float is 1.0, all spawned random vehicles will have maximum passengers (except hardcoded exceptions, like taxis and limos can only have passengers in back seats).
  • Cell Tennyson likes this

Cell Tennyson
  • Cell Tennyson

    Co Con Co CONN!!

  • Members
  • Joined: 22 Oct 2012
  • India

#1208

Posted 07 August 2017 - 02:10 PM

Game uses a probability for a passenger seat be taken (0.125). Increasing it would cause generally higher number of passenger in a vehicle, including 4 seater cars. Constant itself is used in multiple places, so you would have to find unused 4 bytes, fill them with required float, and then substitute address at 0x428DE3 to address of new float. Originally it refers to 0x687050, which contains 0.125.

Example: set 0x6874EC to a required float, then set value at 0x428DE3 to 0x6874EC (4 bytes). If the float is 1.0, all spawned random vehicles will have maximum passengers (except hardcoded exceptions, like taxis and limos can only have passengers in back seats).

 

Nice I got it thanks.


China·XMDS
  • China·XMDS

    Rat

  • Members
  • Joined: 18 Jan 2016
  • China

#1209

Posted 17 August 2017 - 11:39 AM

Have a memory address can change model(object)size?

DK22Pac
  • DK22Pac

    𝘉eчнo 𝘔oлoдoй...

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]
    Helpfulness Award [Mods]

#1210

Posted 25 August 2017 - 02:13 AM Edited by DK22Pac, 25 August 2017 - 02:17 AM.

There are no memory addresses for 'everything'.
 
That's something similar to SA's object scaling (08D2)
#include "plugin_vc.h"
 
class ScaledObject {
public:
    ScaledObject() {
        plugin::Events::objectRenderEvent.before += [](CObject *object) {
            if (object->m_pRwObject && object->m_nModelIndex == 337) { // money model
                object->m_placement.UpdateRW();
                RwFrame *frame = reinterpret_cast<RwFrame *>(object->m_pRwObject->parent);
                RwV3d scale = { 5.0f, 5.0f, 5.0f };
                RwMatrixScale(&frame->modelling, &scale, rwCOMBINEPRECONCAT);
                RwFrameUpdateObjects(frame);
            }
        };
    }
} plg;
 
6TQSxeX.png
 
Or, if you want it as a separate function:
Spoiler

China·XMDS
  • China·XMDS

    Rat

  • Members
  • Joined: 18 Jan 2016
  • China

#1211

Posted 07 October 2017 - 06:04 PM

There are no memory addresses for 'everything'.
 
That's something similar to SA's object scaling (08D2)

#include "plugin_vc.h"
 
class ScaledObject {
public:
    ScaledObject() {
        plugin::Events::objectRenderEvent.before += [](CObject *object) {
            if (object->m_pRwObject && object->m_nModelIndex == 337) { // money model
                object->m_placement.UpdateRW();
                RwFrame *frame = reinterpret_cast<RwFrame *>(object->m_pRwObject->parent);
                RwV3d scale = { 5.0f, 5.0f, 5.0f };
                RwMatrixScale(&frame->modelling, &scale, rwCOMBINEPRECONCAT);
                RwFrameUpdateObjects(frame);
            }
        };
    }
} plg;
 
6TQSxeX.png
 
Or, if you want it as a separate function:
Spoiler

I do not understand the c/c + +, can you tell me how to use it in cleo

DK22Pac
  • DK22Pac

    𝘉eчнo 𝘔oлoдoй...

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]
    Helpfulness Award [Mods]

#1212

Posted 09 October 2017 - 05:58 AM

Sorry, I don't understand cleo.
  • Shagg_E likes this




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users