All pastes #280631 Raw Edit

Miscellany

public cpp v1 · immutable
#280631 ·published 2006-12-16 01:30 UTC
rendered paste body
char *op_unknown = "unknown";char *optypenames[] = {	op_unknown,	op_unknown,	"jump",	op_unknown,	op_unknown,	"local",	"global",	"constant",	"pop",	op_unknown,	op_unknown, // 10	"clean stack",	"eval",	"retval",	"getvar",	op_unknown,	"getvar[]",	"setvar",	"setvar[]",	"push",	"setarg2?",	"callnative",	"callfunc",	"typecast",	op_unknown,	op_unknown,	op_unknown,	op_unknown,	"<=",	op_unknown,	"<",	">",	"add",	"subtract",	"multiply",	"divide",	op_unknown,	"negate",	"bnot",	"return",	"jump dest",	"jump if true",	"jump if false",	op_unknown,	op_unknown,	op_unknown};void __stdcall JassVMSwitchTableHook(JassInstance *inst){	if (true)	{		JassOpcode *op = inst->op;		CompilerInstance *comp = inst->comp;		char *symname;		char msg[200];		switch (op->type)		{		case 0x05:		case 0x06:		case 0x07:		case 0x08:		//case 0x0c: // symbolid for eval is actually the value we are evaluating		case 0x0e:		case 0x0f:		case 0x10:		case 0x11:		case 0x12:		//case 0x13: // always displays a null string for push opcode??		case 0x15:		case 0x16:		//case 0x28:		case 0x29:		//case 0x2a:		//case 0x2b:			__asm			{				mov ecx, comp				mov eax, op				mov eax, dword ptr ds:[eax + 4]				push eax				mov eax, 0x6f69dfe0				call eax				mov symname, eax			}			wsprintf(msg, "%.2x %.2x %.2x  %2x:%-20s %s\n", op->param1, op->param2, op->param3, op->type, optypenames[op->type], symname);			break;		default:			if (op->type == 0x0c || op->param4 != 0)				wsprintf(msg, "%.2x %.2x %.2x  %2x:%-20s %.8x\n", op->param1, op->param2, op->param3, op->type, optypenames[op->type], op->param4);			else				wsprintf(msg, "%.2x %.2x %.2x  %2x:%-20s\n", op->param1, op->param2, op->param3, op->type, optypenames[op->type]);			break;		}		if (show_em)		{			GamePrintUIMessage(msg, 100.0f, 0xFFFFFFFF);			std::cout << msg;		}		fwrite(msg, 1, strlen(msg), f);		fflush(f);	}}