sourcepawn/decompiler/main.cpp
changeset 2320 88550c031d23
child 2325 7a24ee5557fb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sourcepawn/decompiler/main.cpp	Tue Sep 23 21:20:40 2008 -0700
     1.3 @@ -0,0 +1,24 @@
     1.4 +#include <stdio.h>
     1.5 +#include <stdlib.h>
     1.6 +#include "decompiler.h"
     1.7 +
     1.8 +int main()
     1.9 +{
    1.10 +	int err;
    1.11 +	sp_decomp_t *dc;
    1.12 +
    1.13 +	const char *file = "R:\\sourcemod\\sourcemod-central\\plugins\\test.smx";
    1.14 +
    1.15 +	if ((dc = Sp_InitDecomp(file, &err)) == NULL)
    1.16 +	{
    1.17 +		fprintf(stderr, "Could not parse plugin (error %d)\n", err);
    1.18 +		exit(1);
    1.19 +	}
    1.20 +
    1.21 +	if ((err = Sp_DecompFunction(dc, dc->plugin->publics[0].code_offs, true)) != SP_ERROR_NONE)
    1.22 +	{
    1.23 +		fprintf(stderr, "Failed to decode function (error %d)\n", err);
    1.24 +	}
    1.25 +
    1.26 +	Sp_FreeDecomp(dc);
    1.27 +}