Skip to content
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

Merged
merged 4 commits into from
Oct 26, 2023

Conversation

MiranDMC
Copy link
Collaborator

No description provided.

@MiranDMC MiranDMC requested a review from x87 October 26, 2023 14:57
cleo_sdk/CLEO.h Outdated
Comment on lines 134 to 135
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Collaborator Author

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))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodeProcess))
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodePreProcess))


// execute registered callbacks
OpcodeResult callbackResult = OR_NONE;
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodeProcessed))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodeProcessed))
for (void* func : GetInstance().GetCallbacks(eCallbackId::ScriptOpcodePostProcess))

@x87 x87 merged commit 7b17b20 into master Oct 26, 2023
@x87 x87 deleted the add_callbacks_for_opcode_processing_events branch October 27, 2023 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants