- Fixed: Dehacked must not validate parameters for MBF special functions.

These won't match the conditions.
Additionally this adds disassembly output for the synthesized replacement functions for diagnostics purposes.

(cherry picked from commit d18f5eecb4)
This commit is contained in:
Christoph Oelckers 2018-06-03 19:28:16 +02:00 committed by drfrag666
parent a166f6a7ae
commit fccd77500f

View file

@ -75,6 +75,7 @@
#include "v_text.h"
#include "backend/vmbuilder.h"
#include "types.h"
#include "m_argv.h"
// [SO] Just the way Randy said to do it :)
// [RH] Made this CVAR_SERVERINFO
@ -824,6 +825,16 @@ void SetDehParams(FState *state, int codepointer)
sfunc->ImplicitArgs = numargs;
state->SetAction(sfunc);
sfunc->PrintableName.Format("Dehacked.%s.%d.%d", MBFCodePointers[codepointer].name.GetChars(), value1, value2);
if (Args->CheckParm("-dumpdisasm"))
{
FILE *dump = fopen("disasm.txt", "a");
if (dump != nullptr)
{
DumpFunction(dump, sfunc, sfunc->PrintableName.GetChars(), (int)sfunc->PrintableName.Len());
}
fclose(dump);
}
}
}
@ -2114,12 +2125,15 @@ static int PatchCodePtrs (int dummy)
symname.Format("A_%s", Line2);
// Let's consider as aliases some redundant MBF pointer
bool ismbfcp = false;
for (unsigned int i = 0; i < MBFCodePointers.Size(); i++)
{
if (!symname.CompareNoCase(MBFCodePointers[i].alias))
{
symname = MBFCodePointers[i].name;
DPrintf(DMSG_SPAMMY, "%s --> %s\n", MBFCodePointers[i].alias, MBFCodePointers[i].name.GetChars());
ismbfcp = true;
break;
}
}
@ -2130,7 +2144,7 @@ static int PatchCodePtrs (int dummy)
{
Printf(TEXTCOLOR_RED "Frame %d: Unknown code pointer '%s'\n", frame, Line2);
}
else
else if (!ismbfcp) // MBF special code pointers will produce errors here because they will receive some args and won't match the conditions here.
{
TArray<uint32_t> &args = sym->Variants[0].ArgFlags;
unsigned numargs = sym->GetImplicitArgs();