#emit Discussion
#21

There are some functions in amx_assembly for that. They aren't perfect, since it is not possible to always get a function's name, but if it is a public then there's no problem.

PHP код:
new dest[32];
GetPublicNameFromAddress(GetCurrentFrameFunction(), dest); 
You can wrap that in a function, but it gets more complex, because those functions depend on their location in the stack:

PHP код:
GetCurrentFrameFunctionName()
{
    new 
name[32];
    
GetPublicNameFromAddress(GetFrameFunction(GetCurrentFramePreviousFrame()), name);
    return 
name;

However, I'm not 100% sure if that will even work. There are three types of address - relative, absolute, and resolved. Relative addresses are things like "jump 4 bytes forward", absolute addresses are "jump to code at pawn address 128", resolved addresses are "jump to code at real memory address 0x40248238". I don't know which of those "GetPublicNameFromAddress" takes, and which of those "GetFrameFunction" returns - they might not be compatible by default, but there are various conversion functions about.
Reply
#22

@Y_Less: Yes it's good, I'm going to look the codes to understand the logic.
PHP код:
#include "amx\frame_info"
forward FirstCustomFunction();
forward SecondCustomFunction();
main()
{
    
FirstCustomFunction();
}
public 
FirstCustomFunction()
{
    
SecondCustomFunction();
}
public 
SecondCustomFunction()
{
    new 
dest[32]; 
    
GetPublicNameFromAddress(GetFrameFunction(GetCurrentFramePreviousFrame()), dest);
    print(
dest); // FirstCustomFunction
    
GetPublicNameFromAddress(GetCurrentFrameFunction(), dest);
    print(
dest); // SecondCustomFunction

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)