SKYGFX Dumped Functions

January 24, 2022 / episodes

Special YUV to rgb transform martix:

[latex]\begin{bmatrix}
0.299 & -0.168736 & 0.500 \
0.587 & -0.331264 & -0.418688\
0.114 & 0.500 & -0.081312 \
\end{bmatrix}
\begin{bmatrix}
R’ \
G’ \
B’ \
\end{bmatrix}[/latex]

(more…)

归类 Uncategorized

MTA: cStreamer resource loading pipeline

January 17, 2022 / episodes

Here is the cStream reosurces loading pipeline, the client can be any resource contains the “cStream” or “Streamer” in the header.

归类 Uncategorized

SA Model Flag Definition Investigation

January 4, 2022 / episodes

Flags are directly taken from:

GTA-Reversed


//Entity Type (From Entity.h)


enum eEntityType : uint8 {
    ENTITY_TYPE_NOTHING = 0,
    ENTITY_TYPE_BUILDING,
    ENTITY_TYPE_VEHICLE,
    ENTITY_TYPE_PED,
    ENTITY_TYPE_OBJECT,
    ENTITY_TYPE_DUMMY,
    ENTITY_TYPE_NOTINPOOLS
};

//Entity Flags

 struct {
            /* https://github.com/multitheftauto/mtasa-blue/blob/master/Client/game_sa/CEntitySA.h */
            uint32 m_bUsesCollision : 1;               // does entity use collision
            uint32 m_bCollisionProcessed : 1;          // has object been processed by a ProcessEntityCollision function
            uint32 m_bIsStatic : 1;                    // is entity static
            uint32 m_bHasContacted : 1;                // has entity processed some contact forces
            uint32 m_bIsStuck : 1;                     // is entity stuck
            uint32 m_bIsInSafePosition : 1;            // is entity in a collision free safe position
            uint32 m_bWasPostponed : 1;                // was entity control processing postponed
            uint32 m_bIsVisible : 1;                   // is the entity visible

            uint32 m_bIsBIGBuilding : 1;               // Set if this entity is a big building
            uint32 m_bRenderDamaged : 1;               // use damaged LOD models for objects with applicable damage
            uint32 m_bStreamingDontDelete : 1;         // Don't let the streaming remove this
            uint32 m_bRemoveFromWorld : 1;             // remove this entity next time it should be processed
            uint32 m_bHasHitWall : 1;                  // has collided with a building (changes subsequent collisions)
            uint32 m_bImBeingRendered : 1;             // don't delete me because I'm being rendered
            uint32 m_bDrawLast : 1;                    // draw object last
            uint32 m_bDistanceFade : 1;                // Fade entity because it is far away

            uint32 m_bDontCastShadowsOn : 1;           // Don't cast shadows on this object
            uint32 m_bOffscreen : 1;                   // offscreen flag. This can only be trusted when it is set to true
            uint32 m_bIsStaticWaitingForCollision : 1; // this is used by script created entities - they are static until the collision is loaded below them
            uint32 m_bDontStream : 1;                  // tell the streaming not to stream me
            uint32 m_bUnderwater : 1;                  // this object is underwater change drawing order
            uint32 m_bHasPreRenderEffects : 1;         // Object has a prerender effects attached to it
            uint32 m_bIsTempBuilding : 1;              // whether the building is temporary (i.e. can be created and deleted more than once)
            uint32 m_bDontUpdateHierarchy : 1;         // Don't update the animation hierarchy this frame

            uint32 m_bHasRoadsignText : 1;             // entity is roadsign and has some 2dEffect text stuff to be rendered
            uint32 m_bDisplayedSuperLowLOD : 1;
            uint32 m_bIsProcObject : 1;                // set object has been generated by procedural object generator
            uint32 m_bBackfaceCulled : 1;              // has backface culling on
            uint32 m_bLightObject : 1;                 // light object with directional lights
            uint32 m_bUnimportantStream : 1;           // set that this object is unimportant, if streaming is having problems
            uint32 m_bTunnel : 1;                      // Is this model part of a tunnel
            uint32 m_bTunnelTransition : 1;            // This model should be rendered from within and outside the tunnel
        };

//IDE Flags (From FileLoader.cpp) 

enum eItemDefinitionFlags {
    IS_ROAD                     = 0x1,
    PAD1                        = 0x2,
    DRAW_LAST                   = 0x4,
    ADDITIVE                    = 0x8,
    PAD2                        = 0x10,
    ANIM_SOMETHING              = 0x20,
    NO_ZBUFFER_WRITE            = 0x40,
    DONT_RECEIVE_SHADOWS        = 0x80,
    PAD3                        = 0x100,
    IS_GLASS_TYPE_1             = 0x200,
    IS_GLASS_TYPE_2             = 0x400,
    IS_GARAGE_DOOR              = 0x800,
    IS_DAMAGEABLE               = 0x1000,
    IS_TREE                     = 0x2000,
    IS_PALM                     = 0x4000,
    DOES_NOT_COLLIDE_WITH_FLYER = 0x8000,
    IS_EXPLOSIVE_UNUSED         = 0x10000,
    IS_COP_BODYPART_UNUSED      = 0x20000,
    PAD6                        = 0x40000,
    IS_UNKNOWN                  = 0x80000,
    IS_TAG                      = 0x100000,
    DISABLE_BACKFACE_CULLING    = 0x200000,
    IS_BREAKABLE_STATUE         = 0x400000
};

struct sItemDefinitionFlags {
    union {
        uint32 dwFlags;
        struct {
            uint32 bIsRoad             : 1;
            uint32 bPad1               : 1;
            uint32 bDrawLast           : 1;
            uint32 bAdditive           : 1;
            uint32 bPad2               : 1;
            uint32 bAnimSomething      : 1;
            uint32 bNoZBufferWrite     : 1;
            uint32 bDontReceiveShadows : 1;

            uint32 bPad3                    : 1;
            uint32 bIsGlassType1            : 1;
            uint32 bIsGlassType2            : 1;
            uint32 bIsGarageDoor            : 1;
            uint32 bIsDamageable            : 1;
            uint32 bIsTree                  : 1;
            uint32 bIsPalm                  : 1;
            uint32 bDoesNotCollideWithFlyer : 1;

            uint32 bIsExplosive_Unused     : 1;
            uint32 bIsCopBodyPart_Unused   : 1;
            uint32 bPad4                   : 1;
            uint32 bIsUnknown              : 1;
            uint32 bIsTag                  : 1;
            uint32 bDisableBackfaceCulling : 1;
            uint32 bisBreakableStatue      : 1;
        };
    };

    inline sItemDefinitionFlags(uint32 flags) : dwFlags(flags) {}
};

归类 C++ MTASA RW Engine

Backlog: HOOKS for Enable Vehicle Sun Glare Effect

January 2, 2022 / episodes

Well, this is a backlog note for enabling or disabling the vehicle sun glare effect presented inside the SA engine, it’s a VC leftover, well some of the memory addresses are lacking documentation e.g. 0x6ABCFD and 0x6ABD04 , if you guys are interesting, welcome to investigate, a good start may from RE3 source.

Known Address

  • void CVehicle::DoSunGlare(void) 0x6DD6F0
  • mid-function hook in CAutomobile::PreRender 0x6ABCFD (Source: CodeNulls)
//Vehicle Sun Glare

//ASM
_declspec(naked) void CVehicle__DoSunGlare(void* this_)
{
    #define EAXJMP(a) {_asm mov eax, a _asm jmp eax}
    EAXJMP(0x6DD6F0);
}

void _declspec(naked) doglare(void)
{

    _asm {
		mov	ecx,esi
		call	CVehicle__DoSunGlare
		mov     [esp+0D4h], edi
		push	6ABD04h
		retn
	}
  
}

//Hooks
HookInstall(0x6ABCFD, (DWORD)doglare, 5);

归类 C++ MTASA RW Engine

CrystalMV’s Traffic Script documentation

December 28, 2021 / episodes

It’s a pretty old stuff made with CrystalMV, one of a legendary scripter in MTA commmnity. however, a few documentation were in there, of course, we do need a bit more understanding the basic of how this thing works before we can start doing some magic on that.

Description from CrystalMV’s site

Paths are made of path elements: nodes and connections and forbidden turns.

Node is the coordinate data. It is a white (or red, if highlighted) square with a black outline and a line of direction vector.

Connection is a link between two nodes which contains traffic type, density, lane count and speed parameters. It is a group of arrows for every lane, or a line if there is a single two-way line. Their color depends on the traffic type and transparency depends on density. A number indicating the speed limit is drawn on the connection. Starting and ending points of the arrows are on the lines of direction vectors of nodes. End points of the connection may have traffic light markers which switch their color between green and orange depending on traffic light state. These markers are lines which go in the direction dependent on which traffic lights they are for. For ped traffic lights they are vertical.

Forbidden turn is a link between two connections which disallows peds going along the first connection to turn to go along the second. Forbidden turn is displayed as two lines above the node. They go to the directions where the connections of the forbidden turn go. The line of the second connection has a cross on the ending point.

The data-structure

Binary data-structure

Description

IdentifierTypeDescription
Node Block
Xfloat (4 bytes)X, /1000 for actual value
Yfloat (4 bytes) Y, /1000 for actual value
Zfloat (4 bytes) Z, /1000 for actual value
RXfloat (2 bytes) RotX, /1000 for actual value
RYfloat (2 bytes) RotY, /1000 for actual value
Connection Block
Start int (4 bytes) The Start node index of a connection (Refer by index from node block)
Endint (4 bytes) The End node index of a connection (Refer by index from node block)
Bendint(4 bytes) The blending point of a connection (Refer by index from node block)
Traffic typeunsigned integer (1 byte)Traffic Type, 1: ped, 2: car, 3: boat, 4: plane
Lightsunsigned short (2 bytes)Traffic light direction has two sub value, can obtain them by
light_1= lights % 4 , light_2= floor(lights/4)
it can be:
1: “NS”, 2: “WE”
3: “PED” (Red for all cars, no matter what direction, use when peds are crossing roads)
Speedunsigned integer (1 byte)Value from 0 – 255, indicate the max speed limit when passing through the node
Left laneNumber of left lanes does this node have
Right laneNumber of right lanes does this node have
DensityIndicate the density of how many traffic can generate
forbidden turn Block
C1int (4 bytes) The Start node index of a connection (Refer by index from node block)
C2int (4 bytes) The End node index of a connection (Refer by index from node block)

归类 Uncategorized

BACKLOG: MTASA Resource loading pipeline

October 30, 2021 / episodes

归类 MTASA

Architecture of Singleplayer SA Traffic Zone System

June 23, 2021 / episodes

1.Overview

(more…)

归类 GameDev MTASA

[AWS IoT] Create a device to cloud connection with HTTP protocol

August 5, 2020 / episodes

The HTTP protocol has used rarely in the devices to cloud in the IoT industry. Professionals usually consider MQTT as the standard of messaging protocol used in the Internet of Things (IoT). Few articles have mentioned using HTTP for devices transmission protocols.

This article investigates AWS Rest API and conducts the study about the feasibility of the HTTP protocol used from devices to cloud.

(more…)

归类 Uncategorized

GTA: LCS All Vehicles Image Archives

June 12, 2020 / episodes

This post just archive all the vehicle image from Grand theft Auto: Liberty City Stories

(more…)

归类 GTA LCS MTASA

MTA:SA – RE: Liberty City Stories

May 15, 2020 / episodes


(Nurupo’s Stories Project)
RE: Liberty City Stories

(For latest progress please refer to the thread -> here)

MTASA PORT

This is a project that ports the LCS map into MTASA. I will try to make the map as much as close to the original LCS atmosphere by using the MTASA engine provided. Since the model was ported from a mod : Re: Liberty City Stories, therefore in here, I must give the credit to the original author Ryadica926 for a big appropriate of his hard work! (The original Mod: https://gtaforums.com/topic/887066-re-liberty-city-stories/)

(more…)

归类 Lua Script MTASA