diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 25b42632e..9688d3cab 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -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 &args = sym->Variants[0].ArgFlags; unsigned numargs = sym->GetImplicitArgs();