mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 08:30:49 +00:00
Change disassembly dumps to be controlled from one spot
- Instead of changing three places to turn disassembly dumps on and off, do it with just one place. As a side effect, this now handles the case where the dump file can't be opened.
This commit is contained in:
parent
3f6c3fa927
commit
a69089ffd7
1 changed files with 20 additions and 14 deletions
|
@ -280,7 +280,11 @@ static void FinishThingdef()
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
int codesize = 0;
|
int codesize = 0;
|
||||||
|
|
||||||
|
#if 1
|
||||||
FILE *dump = fopen("disasm.txt", "w");
|
FILE *dump = fopen("disasm.txt", "w");
|
||||||
|
#else
|
||||||
|
FILE *dump = NULL;
|
||||||
|
#endif
|
||||||
for (i = 0; i < StateTempCalls.Size(); ++i)
|
for (i = 0; i < StateTempCalls.Size(); ++i)
|
||||||
{
|
{
|
||||||
FStateTempCall *tcall = StateTempCalls[i];
|
FStateTempCall *tcall = StateTempCalls[i];
|
||||||
|
@ -317,13 +321,15 @@ static void FinishThingdef()
|
||||||
VMScriptFunction *sfunc = buildit.MakeFunction();
|
VMScriptFunction *sfunc = buildit.MakeFunction();
|
||||||
sfunc->NumArgs = NAP;
|
sfunc->NumArgs = NAP;
|
||||||
func = sfunc;
|
func = sfunc;
|
||||||
#if 1
|
|
||||||
|
if (dump != NULL)
|
||||||
|
{
|
||||||
char label[64];
|
char label[64];
|
||||||
int labellen = mysnprintf(label, countof(label), "Function %s.States[%d] (*%d)",
|
int labellen = mysnprintf(label, countof(label), "Function %s.States[%d] (*%d)",
|
||||||
tcall->ActorClass->TypeName.GetChars(), tcall->FirstState, tcall->NumStates);
|
tcall->ActorClass->TypeName.GetChars(), tcall->FirstState, tcall->NumStates);
|
||||||
DumpFunction(dump, sfunc, label, labellen);
|
DumpFunction(dump, sfunc, label, labellen);
|
||||||
codesize += sfunc->CodeSize;
|
codesize += sfunc->CodeSize;
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
for (int k = 0; k < tcall->NumStates; ++k)
|
for (int k = 0; k < tcall->NumStates; ++k)
|
||||||
{
|
{
|
||||||
|
@ -370,8 +376,8 @@ static void FinishThingdef()
|
||||||
dmg->SetFunction(sfunc);
|
dmg->SetFunction(sfunc);
|
||||||
}
|
}
|
||||||
def->Damage = sfunc;
|
def->Damage = sfunc;
|
||||||
#if 1
|
|
||||||
if (sfunc != NULL)
|
if (dump != NULL && sfunc != NULL)
|
||||||
{
|
{
|
||||||
char label[64];
|
char label[64];
|
||||||
int labellen = mysnprintf(label, countof(label), "Function %s.Damage",
|
int labellen = mysnprintf(label, countof(label), "Function %s.Damage",
|
||||||
|
@ -379,13 +385,13 @@ static void FinishThingdef()
|
||||||
DumpFunction(dump, sfunc, label, labellen);
|
DumpFunction(dump, sfunc, label, labellen);
|
||||||
codesize += sfunc->CodeSize;
|
codesize += sfunc->CodeSize;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 1
|
if (dump != NULL)
|
||||||
|
{
|
||||||
fprintf(dump, "\n*************************************************************************\n%i code bytes\n", codesize * 4);
|
fprintf(dump, "\n*************************************************************************\n%i code bytes\n", codesize * 4);
|
||||||
#endif
|
|
||||||
fclose(dump);
|
fclose(dump);
|
||||||
|
}
|
||||||
if (errorcount > 0)
|
if (errorcount > 0)
|
||||||
{
|
{
|
||||||
I_Error("%d errors during actor postprocessing", errorcount);
|
I_Error("%d errors during actor postprocessing", errorcount);
|
||||||
|
|
Loading…
Reference in a new issue