fix: better handling for ORIG() calls in HOOK macro

This commit is contained in:
goat 2021-05-03 04:16:38 +02:00
parent 90a0651458
commit 8851385c14
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -204,13 +204,18 @@ public class ScratchPlugin : IDalamudPlugin {
hookDetour +=
$"private {hook.RetType} Hook{i}Detour({hook.Arguments}) {{\n" +
$"try {{\n" +
$" {hook.Body}\n" +
$"}} catch(Exception ex) {{\n" +
$" PluginLog.Error(ex, \"Exception in Hook{i}Detour!!\");\n" +
$"}}\n" +
$"{originalCall}" +
$"\n}}\n";
(!string.IsNullOrEmpty(originalCall) ? "try {\n" : string.Empty) +
$" {hook.Body}\n";
if (!string.IsNullOrEmpty(originalCall))
{
hookDetour += "} catch(Exception ex) {\n" +
$" PluginLog.Error(ex, \"Exception in Hook{i}Detour!!\");\n" +
"}\n" +
$"{originalCall}";
}
hookDetour += $"\n}}\n";
hookDispose += $"this.hook{i}Inst.Dispose();\n";
}