[Scummvm-cvs-logs] SF.net SVN: scummvm:[51530] tools/branches/gsoc2010-decompiler/decompiler

pidgeot at users.sourceforge.net pidgeot at users.sourceforge.net
Sat Jul 31 03:18:16 CEST 2010


Revision: 51530
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51530&view=rev
Author:   pidgeot
Date:     2010-07-31 01:18:16 +0000 (Sat, 31 Jul 2010)

Log Message:
-----------
Output parameters to jumps in hexadecimal

Modified Paths:
--------------
    tools/branches/gsoc2010-decompiler/decompiler/disassembler.cpp
    tools/branches/gsoc2010-decompiler/decompiler/graph.h

Modified: tools/branches/gsoc2010-decompiler/decompiler/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/disassembler.cpp	2010-07-31 01:14:22 UTC (rev 51529)
+++ tools/branches/gsoc2010-decompiler/decompiler/disassembler.cpp	2010-07-31 01:18:16 UTC (rev 51530)
@@ -41,9 +41,26 @@
 		for (param = inst->_params.begin(); param != inst->_params.end(); ++param) {
 			if (param != inst->_params.begin())
 				output << ",";
-			output << " " << param->_value;
+			if (inst->_type == kCondJump || inst->_type == kCondJumpRel || inst->_type == kJump || inst->_type == kJumpRel) {
+				switch (param->_type) {
+				case kSByte:
+				case kShort:
+				case kInt:
+					output << boost::format(" 0x%X") % param->getSigned();
+					break;
+				case kByte:
+				case kUShort:
+				case kUInt:
+					output << boost::format(" 0x%X") % param->getUnsigned();
+					break;
+				default:
+					output << " " << param->_value;
+					break;
+				}
+			} else
+				output << " " << param->_value;
 		}
-		output << boost::format(" (%d)") % inst->_stackChange << "\n";	
+		output << boost::format(" (%d)") % inst->_stackChange << "\n";
 	}
 }
 

Modified: tools/branches/gsoc2010-decompiler/decompiler/graph.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/graph.h	2010-07-31 01:14:22 UTC (rev 51529)
+++ tools/branches/gsoc2010-decompiler/decompiler/graph.h	2010-07-31 01:18:16 UTC (rev 51530)
@@ -308,9 +308,26 @@
 				if (param != inst->_params.begin())
 					output << ",";
 				output << " ";
-				if (param->_type != kString)
-					output << param->_value;
-				else {
+				if (param->_type != kString) {
+					if (inst->_type == kCondJump || inst->_type == kCondJumpRel || inst->_type == kJump || inst->_type == kJumpRel) {
+						switch (param->_type) {
+						case kSByte:
+						case kShort:
+						case kInt:
+							output << boost::format(" 0x%X") % param->getSigned();
+							break;
+						case kByte:
+						case kUShort:
+						case kUInt:
+							output << boost::format(" 0x%X") % param->getUnsigned();
+							break;
+						default:
+							output << " " << param->_value;
+							break;
+						}
+					} else
+						output << " " << param->_value;
+				} else {
 					std::string s = param->getString();
 					for (std::string::iterator it = s.begin(); it != s.end(); ++it)
 						if (*it == '"')


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list