Jump to content

[Q] Does txd loaded


Recommended Posts

Hello.

Is there any way to check does the texture dictionary loaded? (loaded with opcode 0390: load_txd_dictionary 0@s)

Maybe through the memory?

Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/
Share on other sites

I doubt that 0390 really loads dictionaries into the memory. I believe that it's more like 'use_txd_dictionary', and all textures are loaded on startup.

Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1060241104
Share on other sites

I doubt that 0390 really loads dictionaries into the memory. I believe that it's more like 'use_txd_dictionary', and all textures are loaded on startup.

Hmm, so any ideas what to do?

The problem is that opcode

 

0391: release_txd_dictionary

 

releases all txd's that already loaded...

I thought just not use it in my script, but that opcode is used in other scripts and in main.scm (it used in some sub-missions).

Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1060241199
Share on other sites

It may releases all the loaded txd dictonaries from the current thread.

Nope, it actually globally removes all loaded script textures. I personally implemented something similar by writing a global flag any time I unload all textures, and checking that in the main loop -- if checked, load the textures again.

 

Sadly these texture files are also not streamed, as such the game will stutter for a bit during loading of them. Also, setting a flag would not be an option for a script loaded as a plugin to an existing script (CLEO). It might be easy to check the texture being loaded from memory, however.

Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1060242670
Share on other sites

  • 4 months later...

Hi guys.

I know it's bump, but...colgate.gif

I find a way to check, thx for that idea for people from SB forums.

Here is opcode 0391 code:

user posted image

And here is a code to check if it was used:

 

{$CLEO .cs}0A8C: write_memory 0x4841BB size 1 value 0xE9 virtual_protect true // jmp0AC6: 0@ = label @label offsetdec(0@, 0x4841C0) // offset0A8C: write_memory 0x4841BC size 4 value 0@ virtual_protect true // offset 0AC6: 0@ = label @label offset0AC6: 1@ = label @value offsetinc(0@, 2)0A8C: write_memory 0@ size 4 value 1@ virtual_protect false // offsetwhile true   0A8D: 0@ = read_memory 1@ size 4 virtual_protect false   if       0@ == 1   then       if           88FE: not text_box_displayed       then                       0A8C: write_memory 1@ size 4 value 0 virtual_protect false           0ACE: show_formatted_text_box "%.4X was used" 0x0391           // then, we need to reload txd dictionaries       end   end   003D:end:labelhex   C705 00000000 01000000 // mow dword ptr ds:[00000000], 1   B8 405A4600            // mov eax, 465A40h   FFD0                   // call eax   B8 C0414800            // mov eax, 4841C0h   FFE0                   // jmp eaxend:valuehex   00000000end

 

Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1060442988
Share on other sites

Looks like a tight method. Great work icon14.gif , but I actually don't really see the point for it dontgetit.gif . I mean if you say submissions and other threads may release all textures, why don't you simply load it in the beginning threads always? Maybe additional flags would've done the trick. However, you did this and if I ever need something like this I'd use it. tounge.gif

 

By the way: Why is everyone using interactive disassemblers now nervous.gif

Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1060442998
Share on other sites

Nice find! I guess, this is a more reliable method created on the spot tounge.gif:

 

{ FUNCTIONS INCLUDED:-   isTxdDictionaryLoaded     Type: CHECK       Description: Check if 'Script' TXD Dictionary has been loaded.-   getLabelOffset     Type: GET       Description: Get a label offset.}{$CLEO}0000: NOP// Swap CTexDictionary__txdRemove (0x731E90) with CTexDictionary__remove (0x731CD0)0A8C: write_memory 0x465A93 size 4 value 0x2CC239 virtual_protect 1 while true wait 0  if  0AB1: call_scm_func @isTxdDictionaryLoaded 0 // by SCM (opcode 0390) then   // 'Script' TXD Dictionary has already loaded endend:isTxdDictionaryLoaded{ Parameters:   Passed:     none   Result:     true/false Example:   0AB1: call_scm_func @isTxdDictionaryLoaded 0 }0AB1: call_scm_func @getLabelOffset 1 label @txdScriptName store_to 0@ 0AA7: call_function 0x731850 num_params 1 pop 1 szFileName 0@ nResult 1@ // CTexDictionary__txdIndexByNameif  1@ <> -1 then 0485: return_trueelse 059A: return_falseend0AB2: ret 0 :txdScriptNamehex "script" 00 end:getLabelOffset{ Parameters:   Passed:     0@ - label name   Result:     1@ - label offset Example:   0AB1: call_scm_func @getLabelOffset 1 label @LABEL store_to 1@ }if  0@ <> 0 then 0A9F: 1@ = current_thread_pointer 1@ += 0x10  0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0  0062: 1@ -= 0@ else 1@ = 0 end0AB2: ret 1 1@ 

 

Using this method, the game will release the whole TXD Dictionary instead of all textures contained into it.

Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1060443067
Share on other sites

@Wesser

Thanks, it also works smile.gif

 

What is the difference between

 

CTexDictionary__txdRemove

 

and

 

CTexDictionary__remove

 

?

Edited by DK22Pac
Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1060443076
Share on other sites

Looks like CTexDictionary__txdRemove removes TXD in dictionary, but CTexDictionary__remove vanishes whole dictionary.

I didn't look into IDA, but I think it might be something like deleting all donuts from the box, but leaving a box itself smile.gif

 

Anyway, both methods look very nice.

Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1060443768
Share on other sites

  • 5 months later...

 

Nice find! I guess, this is a more reliable method created on the spot tounge.gif:

Hi, all. I know this topic question was answered some time ago, but i just want to clarify... For example, main.scm has a thread named :POOL2. On one of its labels (:POOL2_1292 in my decompiled main.scm) the game loads txd dictionary 'LD_POOL'. Is it possible to check from a cleo script if that code was executed and the dictionary was loaded (used) using some function? I mean - is it possible to do something like this:

 

:POOL2TXD0AA7: call_function 0x731850 num_params 1 pop 1 szFileName 'LD_POOL' nResult 10@00D6: if 002B:   0 >= 10@0AA1: return_if_false0002: jump @LoadCustomTextures:LoadCustomTextures0391: release_txd_dictionary0390: load_txd_dictionary 'CTXD'038F: load_texture "..." as 1

 

Well, i'm not a programmer, so this code didn't worked during my test... but i hope there is a way to do it.

Edited by Yoda2604
Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1060742505
Share on other sites

  • 4 months later...

Sorry for the bump but I'd like to know...

 

Is it possible to do what Yoda2604 suggested? Or can we check if ANY txd dictionary has loaded/is in use?

 

Looking through the main.scm, I see:

 

 

038F: load_texture "example" as 1                    // Load dictionary with 0390 first038F: load_texture "example" as through           // Load dictionary with 0390 first038F: load_texture "example" as 65                  // Load dictionary with 0390 first

 

 

...are used. I've seen cleo scripts that use a range of 100+ and I think someone here said the limit is 128. I'm aware that numbers get reused but is the assumed full range: 0 through 128 documented anywhere?

 

The sniper scope draws a texture to screen. I have a cleo script that draws textures to screen too and despite checks, it still crashes when attempting to use the sniper's scope. Oddly, using the camera and zooming does not cause a crash. Which makes me wonder... how (by what method) is the sniper scope's texture actually drawn onscreen?

 

Insight would be MOST appreciated, thanks. smile.gif

-Midnightz

Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1061064016
Share on other sites

Try this

 

0@ = 0xA94B68 // texture pointers array1@ = 65 // texture IDdec(1@)1@ *= 4005A: 0@ += 1@0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0if // if(RwTexure)   0@ == 0then   // not existend

 

Edited by DK22Pac
Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1061064063
Share on other sites

Thank you, I will try to implement that. smile.gif

 

It's actually your radio hud code I'm messing with. tounge.gif I wanted to just shut off the default text so I added this line:

 

 

0A8C: write_memory 0x507035 size 5 value 0x90 virtual_protect 1     // DISABLE DEFAULT RADIO TEXT

 

 

It's not in any loops, it works perfectly and yet, it's that line that causes the sniper scope bug. Why? dontgetit.gif

 

Link to comment
https://gtaforums.com/topic/464907-q-does-txd-loaded/#findComment-1061064259
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.