Difference between revisions of "Talk:0413"
Jump to navigation
Jump to search
(One intermediate revision by one other user not shown) | |||
Line 4: | Line 4: | ||
:I had wanted to copy the format of the opcode but there's no CLEO opcode to get the location of the player struct, so I used a memory address directly. 0@ is labeled as a placeholder. Is it better to omit it?--[[User:Spaceeinstein|Spaceeinstein]] ([[User talk:Spaceeinstein|talk]]) 19:09, 2 February 2015 (UTC) | :I had wanted to copy the format of the opcode but there's no CLEO opcode to get the location of the player struct, so I used a memory address directly. 0@ is labeled as a placeholder. Is it better to omit it?--[[User:Spaceeinstein|Spaceeinstein]] ([[User talk:Spaceeinstein|talk]]) 19:09, 2 February 2015 (UTC) | ||
+ | ::0x94AD28 is the starting address of the array of players. Each struct is 368 bytes of length, so I assume you wanted something like this: | ||
+ | <source lang="scm"> | ||
+ | :opcode_0413 | ||
+ | // 0@ - input param (player handle) | ||
+ | // 1@ - input param (flag) | ||
+ | 0@ *= 368 | ||
+ | 0@ += 0x94AD28 | ||
+ | 0@ += 0x145 | ||
+ | 05DF: write_memory 0@ size 1 value 1@ virtual_protect 0 | ||
+ | 05F6: ret 0 | ||
+ | </source> | ||
+ | Otherwise you can just omit the first parameter passed into the function. [[User:Seemann|Seemann]] ([[User talk:Seemann|talk]]) 20:18, 2 February 2015 (UTC) | ||
+ | |||
+ | :Yes, that is I wanted. Thanks :) --[[User:Spaceeinstein|Spaceeinstein]] ([[User talk:Spaceeinstein|talk]]) 20:36, 2 February 2015 (UTC) |
Latest revision as of 20:36, 2 February 2015
Code snippet
I see something wrong with the code. The first parameter (0@) gets new value in the function's top, so its value is rewritten. What's the point of passing a player handle then? Seemann (talk) 11:38, 2 February 2015 (UTC)
- I had wanted to copy the format of the opcode but there's no CLEO opcode to get the location of the player struct, so I used a memory address directly. 0@ is labeled as a placeholder. Is it better to omit it?--Spaceeinstein (talk) 19:09, 2 February 2015 (UTC)
- 0x94AD28 is the starting address of the array of players. Each struct is 368 bytes of length, so I assume you wanted something like this:
:opcode_0413
// 0@ - input param (player handle)
// 1@ - input param (flag)
0@ *= 368
0@ += 0x94AD28
0@ += 0x145
05DF: write_memory 0@ size 1 value 1@ virtual_protect 0
05F6: ret 0
Otherwise you can just omit the first parameter passed into the function. Seemann (talk) 20:18, 2 February 2015 (UTC)
- Yes, that is I wanted. Thanks :) --Spaceeinstein (talk) 20:36, 2 February 2015 (UTC)