sourcemod/sourcepawn/decompiler/main.cpp
David Anderson 04021ed8b1 Initial import/sketch of opcode analyzer (bug 3279).
Uses single static assignment to recover expression trees from straight-line byte code.
2008-09-23 21:20:40 -07:00

25 lines
522 B
C++

#include <stdio.h>
#include <stdlib.h>
#include "decompiler.h"
int main()
{
int err;
sp_decomp_t *dc;
const char *file = "R:\\sourcemod\\sourcemod-central\\plugins\\test.smx";
if ((dc = Sp_InitDecomp(file, &err)) == NULL)
{
fprintf(stderr, "Could not parse plugin (error %d)\n", err);
exit(1);
}
if ((err = Sp_DecompFunction(dc, dc->plugin->publics[0].code_offs, true)) != SP_ERROR_NONE)
{
fprintf(stderr, "Failed to decode function (error %d)\n", err);
}
Sp_FreeDecomp(dc);
}