Quantcast

Jump to content

» «
Photo

[Question] Offset of AdditionalVariables?

11 replies to this topic
MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#1

Posted 15 January 2014 - 03:39 PM

there are several ways for making new local variables but base of all of them is arrays (or

at least like arrays)

so, how can i determine offset of their additional variables?

 

thanks in advance. : )


fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • Poland
  • Best Conversion 2016 [GTA: Underground] [Contribution]
    Contribution Award [Mods]

#2

Posted 15 January 2014 - 10:41 PM


Man, this is easy!
In case of int var determine memory ofsset of base.
Then let x = array index read from second var * 4
Add this value to memory address.
  • MasterHK likes this

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#3

Posted 16 January 2014 - 02:47 AM

Thank You : )


MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#4

Posted 16 January 2014 - 03:03 AM

But I don't understand... :catspider:

Could you write an example, plz?


Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown
  • Contribution Award [Mods]

#5

Posted 16 January 2014 - 10:41 AM

He mean something like this:
0A90: [email protected] = LVAR_INDEX * 0x04 // Var offset.
0A8E: [email protected] = [email protected] + [email protected] // Var pointer.
  • MasterHK likes this

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#6

Posted 16 January 2014 - 02:53 PM

Tnx...

 

LVAR_INDEX is the array index as [email protected] in [email protected]([email protected],1i) ?


fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • Poland
  • Best Conversion 2016 [GTA: Underground] [Contribution]
    Contribution Award [Mods]

#7

Posted 16 January 2014 - 06:25 PM Edited by fastman92, 16 January 2014 - 06:27 PM.

Tnx...
 
LVAR_INDEX is the array index as [email protected] in [email protected]([email protected],1i) ?

Value from [email protected]

Perhaps this opcode works with arrays:
0AC7: [email protected] = var [email protected]([email protected],1i) offset
But I never tested.
  • MasterHK likes this

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#8

Posted 16 January 2014 - 07:22 PM

OK.

in fact i want to load values from another thread; the thread that load textures from an external dic using DK's opcodes.

i want handle(?) of those textures; currently i made several threads but if this way work it will be easier.


fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • Poland
  • Best Conversion 2016 [GTA: Underground] [Contribution]
    Contribution Award [Mods]

#9

Posted 16 January 2014 - 08:30 PM

0AAA: [email protected] = thread 'OTB' pointer


This opcode returns a pointer to CRunningScript object of script identified by a name.
Name must be altered by an opcode 03A4 previously.

03A4: name_thread 'MAIN'
:getLocalVarOffset
{
 Parameters:
   Passed:
     [email protected] - thread pointer
     [email protected] - var number
   Result:
     [email protected] - var value

 Example:
   0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected] 
}
[email protected] *= 4
[email protected] += 60
005A: [email protected] += [email protected]  // (int)
0AB2: ret 1 [email protected]
When you have variable number and script pointer, you can use this function.

As you know in case of arrays, the variable ID is base variable ID + index read from secondary variable.
  • MasterHK likes this

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#10

Posted 17 January 2014 - 03:50 AM

oh, i had seen that func some time ago but i need a func to get offset of variables that this func have made them:

 

:MakeMoreVariables
[email protected] = Thread.Pointer()
[email protected] += 60
{[email protected] = Thread.Pointer()
[email protected] += 16
[email protected] = Memory.Read([email protected], 4, 0)
0062: [email protected] -= [email protected] // (int)}
0AC6: [email protected] = label [email protected] offset
0062: [email protected] -= [email protected] // (int)
[email protected] /= 16
[email protected] += 1
[email protected] *= 16
0072: [email protected] /= [email protected] // (int)
ret 1 [email protected]
 

 

Currently i'm using a funny function for that intent;

like this:

 

[email protected] = Actor.CurrentWeapon($3)
call_scm_func @draw 1 [email protected]
...
:draw
if
    [email protected] < 32
then
    [email protected] = Thread.PointerByName('HUDPIC2')
    [email protected] -= 32        
else
    [email protected] = Thread.PointerByName('HUDPIC1')
end
[email protected] = Thread.GetLocalVar([email protected], [email protected])
if
    [email protected] <> 0
then
DRAW IT

and content of HUDPIC1/2:

 

Thread.SetName('HUDPIC1')
[email protected] = Texture.LoadByTXDName("Fist", "MYTXD")
...
[email protected] = Texture.LoadByTXDName("M4", "MYTXD")

 

Thread.SetName('HUDPIC2')
[email protected] = Texture.LoadByTXDName("TEC9", "MYTXD")
...

 

works correctly but in this case i need at least 3 threads and it's Not So Good.

 

hopefully anyone can, help me... : (


madleg
  • madleg

    Crackhead

  • Members
  • Joined: 01 Jan 2014
  • Russia

#11

Posted 17 January 2014 - 11:40 AM Edited by madleg, 17 January 2014 - 11:54 AM.

lol, you just need to create hex...end construction with empty bites and mark his start with a label. all other things will be like with your threads, just in the beginning you need to save your vars in it. an example:

//i have to load 4 textures, so i need (4handlers)*(4bites.each.var)=(16bites.free.space)
[email protected] = label @some_memory offset
[email protected]=load texture 'blabla1'
write memory [email protected] value [email protected]
[email protected] += 4
[email protected]=load texture 'blabla2'
write memory [email protected] value [email protected]
[email protected] += 4
...etc

// btw, i hardly recommend to rename textures with repeating name+index string 
// and replace this shi with some for..end with editing of this dynamic string in it

while true
   wait 0
   [email protected] = label @some_memory offset
   [email protected] = actor weapone 
// ill skip checks here
   [email protected] *= 4
   [email protected] += [email protected]
   [email protected] = read mem [email protected]
   draw texture [email protected]
end

:some_memory
hex
00 00 00 00
00 00 00 00
00 00 00 00
00 00 00 00
end
  • MasterHK likes this

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#12

Posted 17 January 2014 - 12:11 PM

Yes, an good replace for my purpose.

But i'm still searching for get offset of them,

... however thank you so much for lost your time in writing answer. :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users