Quantcast

Jump to content

» «
Photo

Documenting GTA3/VC memory addresses

1,204 replies to this topic
HM128
  • HM128

    alovelyday

  • 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

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution 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
  • HM128 likes this

HM128
  • HM128

    alovelyday

  • 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

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

#1204

Posted 17 March 2017 - 07:01 PM

GTA 3 idb by Kenking

  • HM128 and thehambone like this

HM128
  • HM128

    alovelyday

  • 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);




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users