Quantcast

Jump to content

» «
Photo

SA: Getting OBJECTS in pool

12 replies to this topic
343 guilty spark
  • 343 guilty spark

    Player Hater

  • Members
  • Joined: 26 Nov 2013

#1

Posted 26 November 2013 - 05:46 PM Edited by 343 guilty spark, 26 November 2013 - 06:00 PM.

i cant find any memory addresses for objects, i mean there are for cars and peds, but not for Objects? :cry:

 

ex:

CARS:

0xB74494 - Contains a pointer to main struct

This struct:

+0 = Contains a pointer to the first element in the pool

+4 = Contains a pointer to a byte map indicating which elements are in use

+8 = [dword] Is the maximum number of elements in the pool

+12 = [dword] Is the current number of elements in the pool

Each vehicle object is 2584 (0xA18) bytes. It starts at 0xC502AA0.

 

can you please post the memory addressess for Objects (objects like #MISSILE, not something else)

 

GAME: SA


Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#2

Posted 26 November 2013 - 06:20 PM

Objects pool pointer is located at 0xB7449C, each entry is 0x19C bytes big.
  • 343 guilty spark likes this

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown

#3

Posted 26 November 2013 - 06:36 PM

Your question is a bit vague. Are you trying to get the memory addresses of all spawned missiles? If so, take this CLEO3-friendly code (untested):
0AB1: call_scm_func @loopThroughPool 2 pool_ptr 0x00B7449C gosub_loop @ObjectIter

[...]

:ObjectIter
// 3@ - Entity's SCM handle
// 4@-31@ - Free local variables
if 
09CC:  object 3@ model_is #MISSILE
then
    0A98: 4@ = object 3@ struct
end
return

:loopThroughPool
{
    Parameters:
        Passed:
            0@ - pool pointer
            1@ - gosub label offset
        Result:
            none

    Example:
        0AB1: call_scm_func @loopThroughPool 2 pool_ptr 0x00000000 gosub_loop @label
}
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 // CPool<T> *pclTPool = (CPool<T> *)uiOpcodeArgs[0];
0@ += 0x08 // CPool.m_iSize
0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0 // int iSize = pclTPool->m_iSize;
if 
    3@ > 0 // if(iSize > 0)
then
    0@ -= 0x04 // CPool.m_paucFlags
    0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 // unsigned char *paucFlags = pclTPool->m_paucFlags;
    3@ -= 1 
    005A: 0@ += 3@ // paucFlags += --iSize;
    3@ *= 0x0100 
    for 2@ = 3@ downto 0 step 0x0100 // for(int i = iSize << 8; i >= 0; i -= 0x0100)
        0A8D: 3@ = read_memory 0@ size 1 virtual_protect 0 // unsigned char ucFlag = *paucFlags--;
        0@ -= 1 
        if 
        88B7:  not test 3@ bit 7 // if(ucFlag >= 0x00)
        then
            005A: 3@ += 2@ // unsigned int uiHandle = i + ucFlag;
            gosub 1@ // SCM handle is 3@ (28 free locals)
        end
    end
end
0AB2: ret 0
  • 343 guilty spark likes this

343 guilty spark
  • 343 guilty spark

    Player Hater

  • Members
  • Joined: 26 Nov 2013

#4

Posted 27 November 2013 - 01:06 PM Edited by 343 guilty spark, 27 November 2013 - 01:20 PM.

{not working} BUT Thanks :colgate:

That is what i wanted, i want to get all objects in game. check if the object is a missile then find it in the missiles, locate the target. then boost the speed!

Last time I fired a missile after locking on a moving car i missed because it was too slow, not even faster than bikes (BULLS@#t). I WILL WRITE AN ASI mod in c (for speed).

i just could not find first element and entry, now i do.


Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown

#5

Posted 27 November 2013 - 01:38 PM

I have just tested the script, it works like expected. It's likely you did something wrong. :p

343 guilty spark
  • 343 guilty spark

    Player Hater

  • Members
  • Joined: 26 Nov 2013

#6

Posted 27 November 2013 - 01:51 PM Edited by 343 guilty spark, 27 November 2013 - 03:59 PM.

This one works! i am not good in cleo scripts, witch is why i use c/c++

 

{$CLEO .cs}

wait 0

while true

    wait 0

    //0xB7449C pool

    //0x19C    element size

    //1@ first object

    //2@ max objects

    0A8D: 1@ = read_memory 0xB7449C size 4 virtual_protect 0

    1@ += 8

    0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0

    1@ -= 8

    0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0

    2@ -= 1

    for 3@ = 0 to 2@ // step 1

        0AEC: 4@ = object_struct 1@ handle

        IF

            03CA:   object 4@ exists

        then

            if

                09CC:   object 4@ model_is #MISSILE

            then

                Object.Throw(4@ , 0.0, 0.0, 0.0);  // freeze! Slowsh*t!

            end

        end

        1@ += 0x19C

    end // for

end


343 guilty spark
  • 343 guilty spark

    Player Hater

  • Members
  • Joined: 26 Nov 2013

#7

Posted 27 November 2013 - 01:53 PM Edited by 343 guilty spark, 27 November 2013 - 04:54 PM.

I have just tested the script, it works like expected. It's likely you did something wrong. :p

maybe, i dont know. cleo scripting aint my thing man!

btw, do you know how can i get the object model, and set its velocity form memory? offsets are not Available in the documentation.


Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown

#8

Posted 27 November 2013 - 02:18 PM Edited by Wesser, 27 November 2013 - 02:18 PM.

This one works!

Be careful the entity's index must be 0-based (do not forget to subtract a unit from the pool size).
 

btw, do you know how can i get the object model, and set its velocity form memory? offsets are Available in the documentation.

The model index is at CEntity + 0x22, while the object velocity is at CPhysical + 0x44.
  • 343 guilty spark likes this

343 guilty spark
  • 343 guilty spark

    Player Hater

  • Members
  • Joined: 26 Nov 2013

#9

Posted 27 November 2013 - 02:31 PM

thank you!


DK22Pac
  • DK22Pac

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

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#10

Posted 27 November 2013 - 02:55 PM

All projectile objects are stored in this array.
0xC89110 ; CObject *CProjectileInfo::ms_apProjectile[32]
  • 343 guilty spark likes this

343 guilty spark
  • 343 guilty spark

    Player Hater

  • Members
  • Joined: 26 Nov 2013

#11

Posted 27 November 2013 - 03:06 PM Edited by 343 guilty spark, 27 November 2013 - 05:31 PM.

All projectile objects are stored in this array.

0xC89110 ; CObject *CProjectileInfo::ms_apProjectile[32]

that' s cool. can you tell me where did you get this address?

this one is like Big Smoke! (full of s@#t)

http://www.gtamoddin..._Addresses_(SA)

 

i don't have enough info to use this


343 guilty spark
  • 343 guilty spark

    Player Hater

  • Members
  • Joined: 26 Nov 2013

#12

Posted 27 November 2013 - 04:00 PM Edited by 343 guilty spark, 27 November 2013 - 04:50 PM.

Be careful the entity's index must be 0-based (do not forget to subtract a unit from the pool size).

C++ / java                  for(int i = 0; i < PoolSize; i++) {}

Old School carp         for i = 0 to PoolSize - 1 step 1

 

The model index is at CEntity + 0x22, while the object velocity is at CPhysical + 0x44.

 

how can i get the pointer of CEntity and CPhysical??!!?? :panic:

 

do you have THE SOURCE OF GTA SA or some sh*t like that? (i know what you are thinking: is he crazy? well let me ask you this: are you a doctor?)


343 guilty spark
  • 343 guilty spark

    Player Hater

  • Members
  • Joined: 26 Nov 2013

#13

Posted 27 November 2013 - 04:46 PM Edited by 343 guilty spark, 27 November 2013 - 05:13 PM.

so this is the basic idea

i need memory addresses so i can convert it to C (not sea! i mean the programing language!). (dll -> asi)

 

{$CLEO .cs}
wait 0
while true
    wait 0
    //0xB7449C pool
    //0x19C    element size
    //1@ first object
    //2@ max objects
    0A8D: 1@ = read_memory 0xB7449C size 4 virtual_protect 0
    1@ += 8
    0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0
    1@ -= 8
    0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
    2@ -= 1
    for 3@ = 0 to 2@ // step 1
        0AEC: 4@ = object_struct 1@ handle
        if
        03CA:   object 4@ exists
        then
            if
                09CC:   object 4@ model_is #MISSILE
            then
               059F: get_object 4@ velocity_in_direction 10@ 11@ 12@
               14@ = 0.0
               13@ = 1.0
               006B: 13@ *= 10@ // (float)
               006B: 13@ *= 10@ // (float)
               005B: 14@ += 13@ // (float)
               13@ = 1.0
               006B: 13@ *= 11@ // (float)
               006B: 13@ *= 11@ // (float)
               005B: 14@ += 13@ // (float)
               13@ = 1.0
               006B: 13@ *= 12@ // (float)
               006B: 13@ *= 12@ // (float)
               005B: 14@ += 13@ // (float)
               if
                   14@ < 10000.0 // maxSpeed^2
               then
                   10@ *= 2.0
                   11@ *= 2.0
                   12@ *= 2.0
                   Object.Throw(4@ , 10@, 11@, 12@);  // Boost sh*t!!
               end
            end
        end
        1@ += 0x19C
    end // for
end

 

this is a 30 sec code, it all raggedy and sh*t! but it gets the job done!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users