Quantcast

Jump to content

» «
Photo

Usage of textures inside effectsPC.txd

4 replies to this topic
_DK
  • _DK

    gta3 cleo

  • Members
  • Joined: 12 Apr 2009
  • None

#1

Posted 10 April 2012 - 05:11 PM

Here we go tounge.gif
CODE
{$CLEO}
0000:
while true
   wait 0
   0AA7: call_function 0x731850 num_params 1 pop 1 "fx" 5@
   if
       5@ <> -1
   then
       0AB1: @txdIndexToRwTexDictionary 1 5@ 6@
       if
           6@ <> 0
       then
           0AA7: call_function 0x7F39F0 num_params 2 pop 2 "Overdoseeffects" 6@ 7@
           if
               7@ > 0
           then
               // Now, we have RwTexture adress in 7@
               // I gonna change coronastar's adress to this
               0A8C: write_memory 0xC3E000 size 4 value 7@ virtual_protect 0
           end
       end
   end      
end                                                                        
               
:txdIndexToRwTexDictionary
0A8D: 1@ = read_memory 0xC8800C size 4 virtual_protect 0                                                                                
0A8E: 2@ = 1@ + 4
0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
005A: 2@ += 0@
0A8D: 2@ = read_memory 2@ size 1 virtual_protect 0
if
   2@ > 0
then
   0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
   0@ *= 12
   005A: 1@ += 0@
   0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
else
   1@ = 0
end
0AB2: ret 1 1@

user posted image

Joni2030
  • Joni2030

    Prankster

  • Members
  • Joined: 06 Jul 2011

#2

Posted 11 April 2012 - 04:28 PM

this is wrong section put it modding tutorials

LINK/2012
  • LINK/2012

    LIVIN' IN CODE

  • Feroci Racing
  • Joined: 30 Jan 2011
  • Brazil

#3

Posted 11 April 2012 - 04:37 PM

QUOTE (Joni2030 @ Wednesday, Apr 11 2012, 13:28)
this is wrong section put it modding tutorials

It's a trick, not a tutorial, tutorial explains things.

btw, Very good DK smile.gif

_DK
  • _DK

    gta3 cleo

  • Members
  • Joined: 12 Apr 2009
  • None

#4

Posted 17 April 2012 - 04:17 PM Edited by DK22Pac, 17 April 2012 - 04:28 PM.

Yay! I've bring better example, but in all, code just looking trash, I hope I'll have time to write my own textDrawer (actually, "shape-drawer" colgate.gif ) with many functions later.
CODE
{$CLEO}
gosub @_patch

// main loop
while true
   wait 0
   0@v = "fx"
   4@v = "OverdoseEffects"
   0AB1: call_scm_func @drawTexture 16 txd_name 0@ 1@ 2@ 3@ texture_name 4@ 5@ 6@ 7@ position 100.0 100.0 size 80.0 80.0 RGBA 255 255 255 255
   0@v = "fonts"
   4@v = "font1"
   0AB1: call_scm_func @drawTexture 16 txd_name 0@ 1@ 2@ 3@ texture_name 4@ 5@ 6@ 7@ position 100.0 200.0 size 80.0 80.0 RGBA 255 255 255 255
   0@v = "sniper"
   4@v = "SNIPERcrosshair"
   0AB1: call_scm_func @drawTexture 16 txd_name 0@ 1@ 2@ 3@ texture_name 4@ 5@ 6@ 7@ position 100.0 300.0 size 80.0 80.0 RGBA 255 255 255 255
   0@v = "male01"
   4@v = "male01"
   0AB1: call_scm_func @drawTexture 16 txd_name 0@ 1@ 2@ 3@ texture_name 4@ 5@ 6@ 7@ position 100.0 400.0 size 80.0 80.0 RGBA 255 255 255 255
end

// trash
:drawTexture
0AA7: call_function 0x731850 num_params 1 pop 1 0@v 25@
if
   25@ <> -1
then
   0AB1: @txdIndexToRwTexDictionary 1 25@ 26@
   if
       26@ <> 0
   then
       0AA7: call_function 0x7F39F0 num_params 2 pop 2 4@v 26@ 27@
       if
           27@ > 0
       then
           03F0: enable_text_draw 1
           0A8C: write_memory 0x46E62A size 2 value 0x04EB vp 1
           074B: draw_texture -1 position 8@ 9@ scale 10@ 11@ texture 27@ color_RGBA 12@ 13@ 14@ 15@
           0A8C: write_memory 0x46E62A size 2 value 0x0DD8 vp 1
       end
   end
end
0AB2: ret 0                
:txdIndexToRwTexDictionary
0A8D: 1@ = read_memory 0xC8800C size 4 virtual_protect 0                                                                                
0A8E: 2@ = 1@ + 4
0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
005A: 2@ += 0@
0A8D: 2@ = read_memory 2@ size 1 virtual_protect 0
if
   2@ > 0
then
   0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
   0@ *= 12
   005A: 1@ += 0@
   0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
else
   1@ = 0
end
0AB2: ret 1 1@
:_patch
0AC6: 0@ = label @__newTypeTexDrawer offset
0AC6: 1@ = label @__jmp offset
0AB1: call_scm_func @asmdef 4 asm_inj 0@ jump_from 0x46499D then_jump 0x4649A3 offset_jump_in_asm 1@
return
:asmdef
0A8C: write_memory 1@ size 1 value 0xE9 virtual_protect 1
0085: 4@ = 1@
4@ += 5
0062: 0@ -= 4@
1@ += 1
0A8C: write_memory 1@ size 4 value 0@ virtual_protect 1
0085: 4@ = 3@
4@ += 5
0062: 2@ -= 4@
3@ += 1
0A8C: write_memory 3@ size 4 value 2@ virtual_protect 1
0AB2: ret 0
:__newTypeTexDrawer
hex
   66 81 7E 06 FF FF 74 36 D9 46 0C 8B 56 08 8D 46 1C D9 5C 24 50 D9 46 10 50 8D 4C 24 48 51 8D 4E 18 D9
   5C 24 54 89 54 24 4C D9 46 14 D9 5C 24 50 B8 50 83 72 00 FF D0 B8 84 4B 46 00 FF E0 8B 06 48 83 F8 04
end
:__jmp
hex
   E9 00 00 00 00
end

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#5

Posted 17 April 2012 - 09:08 PM

Wouldn't it be much better to use pointers than that really weird method of passing each var containing parts of the string? tounge2.gif




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users