-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add callbacks for opcode processing events #7
Conversation
cleo_sdk/CLEO.h
Outdated
ScriptOpcodeProcess, // OpcodeResult WINAPI OnScriptOpcodeProcess(CRunningScript* pScript, DWORD opcode); // return other than OR_NONE to signal that opcode was handled in the callback | ||
ScriptOpcodeProcessed, // OpcodeResult WINAPI OnScriptOpcodeProcessed(CRunningScript* pScript, DWORD opcode, OpcodeResult result); // return other than OR_NONE to overwrite original result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ScriptOpcodeProcess, // OpcodeResult WINAPI OnScriptOpcodeProcess(CRunningScript* pScript, DWORD opcode); // return other than OR_NONE to signal that opcode was handled in the callback | |
ScriptOpcodeProcessed, // OpcodeResult WINAPI OnScriptOpcodeProcessed(CRunningScript* pScript, DWORD opcode, OpcodeResult result); // return other than OR_NONE to overwrite original result | |
ScriptOpcodePreProcess, // OpcodeResult WINAPI OnScriptOpcodeProcess(CRunningScript* pScript, DWORD opcode); // return other than OR_NONE to signal that opcode was handled in the callback | |
ScriptOpcodePostProcess, // OpcodeResult WINAPI OnScriptOpcodeProcessed(CRunningScript* pScript, DWORD opcode, OpcodeResult result); // return other than OR_NONE to overwrite original result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um sounds like preprocessor step. This callback can also do processing by itself.
if(opcode > LastCustomOpcode) | ||
// execute registered callbacks | ||
OpcodeResult result = OR_NONE; | ||
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodeProcess)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodeProcess)) | |
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodePreProcess)) | |
source/CCustomOpcodeSystem.cpp
Outdated
|
||
// execute registered callbacks | ||
OpcodeResult callbackResult = OR_NONE; | ||
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodeProcessed)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodeProcessed)) | |
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodePostProcess)) | |
No description provided.