mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
feat: rewrite "ORIG(" in hook macro to original call
This commit is contained in:
parent
92b825104e
commit
7d30a60a5e
1 changed files with 7 additions and 1 deletions
|
|
@ -190,12 +190,18 @@ public class ScratchPlugin : IDalamudPlugin {
|
||||||
if (hook.RetType != "void")
|
if (hook.RetType != "void")
|
||||||
originalCall = "return " + originalCall;
|
originalCall = "return " + originalCall;
|
||||||
|
|
||||||
if (hook.Body.Contains("hook{i}Inst.Original"))
|
if (hook.Body.Contains($"hook{i}Inst.Original(") || hook.Body.Contains("ORIG("))
|
||||||
{
|
{
|
||||||
PluginLog.Warning($"Attention! A manual call to Original() in Hook #{i} was detected. Original calls will not be managed for you.");
|
PluginLog.Warning($"Attention! A manual call to Original() in Hook #{i} was detected. Original calls will not be managed for you.");
|
||||||
originalCall = string.Empty;
|
originalCall = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hook.Body.Contains("ORIG("))
|
||||||
|
{
|
||||||
|
PluginLog.Warning($"Normalizing Original() call in Hook #{i}.");
|
||||||
|
hook.Body = hook.Body.Replace("ORIG(", $"this.hook{i}Inst.Original(");
|
||||||
|
}
|
||||||
|
|
||||||
hookDetour +=
|
hookDetour +=
|
||||||
$"private {hook.RetType} Hook{i}Detour({hook.Arguments}) {{\n" +
|
$"private {hook.RetType} Hook{i}Detour({hook.Arguments}) {{\n" +
|
||||||
$"try {{\n" +
|
$"try {{\n" +
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue