BnB Posted August 12, 2010 Share Posted August 12, 2010 My skills in SA memory handling are low and I need a little help I cannot understand this 0A9F: [email protected] = current_thread_pointer000A: [email protected] += 0x10 how do I know which number I have to use like 0x10. It would be helpful if you help me understand this and please give me an example of his usage. 0AB1: call_scm_func @GetSQR 1 10 $result What does this and when we use it? const NUM = [email protected] end What exactly does this ? I understand that it constructs a variable and instead of using [email protected] we use NUM is this right ? Thanks Link to comment Share on other sites More sharing options...
Jerry123 Posted August 12, 2010 Share Posted August 12, 2010 On const: Yes then we have to use NUM but on the Compiled Script it won't include this it will change it back into the variable! CallScmFunc: This has nothing to do with Memory Handling but it'S useful Read ZAZ's Cleo Tutorial: http://www.gtaforums.com/index.php?showtop...entry1059268222 Link to comment Share on other sites More sharing options...
Adler Posted August 12, 2010 Share Posted August 12, 2010 CLEO 4 has a new opcode that might help make it easier: 0AC6: [email protected] = label @label offset Link to comment Share on other sites More sharing options...
Seemann Posted August 12, 2010 Share Posted August 12, 2010 My skills in SA memory handling are low and I needa little help I cannot understand this 0A9F: [email protected] = current_thread_pointer000A: [email protected] += 0x10 how do I know which number I have to use like 0x10. It would be helpful if you help me understand this and please give me an example of his usage. 0A9F returns an address of the current thread (script) struct at the game memory. What this struct holds you can read there http://www.gtamodding.com/index.php?title=...Block_1:_Script Scroll down till words Thread Memory Dump: 0x00 dword Next Pointer 0x04 dword Previous Pointer 0x08 char[8] Thread Name 0x10 dword Absolute Base Address 0x14 dword Absolute IP 0x18 dword[8] Absolute Return Stack 0x38 word Stack Pointer 0x3A byte[2] (Align) 0x3C dword[32] Local Variables 0xBC dword[2] Local Timers 0xC4 byte (Unknown) 0xC5 byte 'if' statement result 0xC6 byte (Unknown) 0xC7 byte Is External Script 0xC8 byte (Unknown) 0xC9 byte (Unknown) 0xCA byte[2] (Align) 0xCC dword Wakeup Time 0xD0 word 'if' parameter 0xD2 byte 'not' flag 0xD3 byte 'wb_check' flag 0xD4 byte[4] (Unknown) 0xD8 dword Skip Scene Pos (opcode 0707) 0xDC byte Is Mission 0xDD byte[3] (Align) 0xE0 end By adding +10 you get address of the 'Absolute Base Address' value. So, after using 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 [email protected] will hold this value. It's useful to know actual script location in the game memory for some advanced coding tricks. Sanny Builder 3 • SA Memory Handling • OpenIV • gtamodding.com CLEO.li - The CLEO Library - Official site Link to comment Share on other sites More sharing options...
BnB Posted August 12, 2010 Author Share Posted August 12, 2010 (edited) @Jerry123 I already have read it and I want to know more. @Adler Thanks! @Seemann Thanks your post was really helpful can you post an example script with explanation. So, if I use this 0x08 I can get the thread name and change it. Edited August 12, 2010 by BnB Link to comment Share on other sites More sharing options...
BnB Posted August 12, 2010 Author Share Posted August 12, 2010 I tried this script but with no success {$CLEO}thread 'test'0A9F: [email protected] = current_thread_pointer000A: [email protected] += 0x080A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0033E: set_draw_text_position 250.0 40.0 GXT [email protected]: end_custom_thread Link to comment Share on other sites More sharing options...
Deji Posted August 12, 2010 Share Posted August 12, 2010 (edited) {$CLEO}thread 'test'0A9F: [email protected] = current_thread_pointer000A: [email protected] += 0x080A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 00ADF: add_dynamic_GXT_entry "_TEST" text [email protected]: set_draw_text_position 250.0 40.0 GXT "_TEST"0A93: end_custom_thread Only works with CLEO 4. Also, size of 0A8D could be 8, since that's the maximum thread name length... Which is why I can't understand how people get away with really long thread names... @Seemann By the way, thanks for the list.. I've not been able to find a full one anywhere Edited August 12, 2010 by Deji Link to comment Share on other sites More sharing options...
BnB Posted August 13, 2010 Author Share Posted August 13, 2010 Thanks! So, changing the thread name in the middle of the script is this possible? Link to comment Share on other sites More sharing options...
Wesser Posted August 13, 2010 Share Posted August 13, 2010 If you add that offset to the thread pointer you obtain the thread name address which is read/write. Unfortunately, GTA cannot store more than 4 bytes per var so you should use 0A8D twice, once to get the first 4 bytes and once for getting the last 3 bytes (7 chars + null-terminator). Here is the workable script: {$CLEO}thread 'test' 0A9F: [email protected] = [email protected] += 0x8 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 [email protected] += 0x4 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 033E: set_draw_text_position 250.0 40.0 GXT [email protected] 0A93: end_custom_thread 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
james227uk Posted August 13, 2010 Share Posted August 13, 2010 This is helping me too, but what is a real genuine reason for using the current_thread_pointer opcode in a proper script? Link to comment Share on other sites More sharing options...
Seemann Posted August 13, 2010 Share Posted August 13, 2010 It was used mostly to get a label address (see example in CLEO3's test_example.cs). But after CLEO 4 indroduced opcode 0AC6, it becomes almost unnecessary. Still, you can change the thread's name with 0A9F. Sanny Builder 3 • SA Memory Handling • OpenIV • gtamodding.com CLEO.li - The CLEO Library - Official site Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now