- 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.
This commit is contained in:
Christoph Oelckers 2018-06-03 19:28:16 +02:00
parent d425fb2d4a
commit d18f5eecb4
1 changed files with 15 additions and 1 deletions

View File

@ -64,6 +64,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
@ -813,6 +814,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);
}
}
}
@ -2103,12 +2114,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;
}
}
@ -2119,7 +2133,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();