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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri Jun 18 04:36:45 CEST 2010


Revision: 50005
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50005&view=rev
Author:   lordhoto
Date:     2010-06-18 02:36:45 +0000 (Fri, 18 Jun 2010)

Log Message:
-----------
Rest of the style fixes :-P.

Modified Paths:
--------------
    tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
    tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp
    tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp
    tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.cpp
    tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h

Modified: tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp	2010-06-18 02:30:19 UTC (rev 50004)
+++ tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp	2010-06-18 02:36:45 UTC (rev 50005)
@@ -79,28 +79,28 @@
 }
 
 void ControlFlow::merge(GraphVertex g1, GraphVertex g2) {
-	//Update property
+	// Update property
 	Group gr1 = GET(g1);
 	Group gr2 = GET(g2);
 	gr1._end = gr2._end;
 	PUT(g1, gr1);
 
-	//Update address map
+	// Update address map
 	InstIterator it = gr2._start;
 	do {
 		_addrMap[it->_address] = g1;
 		++it;
 	} while (gr2._start != gr2._end && it != gr2._end);
 
-	//Add outgoing edges from g2
+	// Add outgoing edges from g2
 	EdgeRange r = boost::out_edges(g2, _g);
 	for (OutEdgeIterator e = r.first; e != r.second; e++) {
 		boost::add_edge(g1, boost::target(*e, _g), _g);
 	}
 
-	//Remove edges to/from g2
+	// Remove edges to/from g2
 	boost::clear_vertex(g2, _g);
-	//Remove vertex
+	// Remove vertex
 	boost::remove_vertex(g2, _g);
 }
 
@@ -143,7 +143,7 @@
 
 		stackLevel += curInst->_stackChange;
 
-		//Group ends after a jump
+		// Group ends after a jump
 		if (curInst->_type == kJump || curInst->_type == kJumpRel || curInst->_type == kCondJump || curInst->_type == kCondJumpRel) {
 /*			if (stackLevel != expectedStackLevel) {
 				s.push(expectedStackLevel);
@@ -153,7 +153,7 @@
 			continue;
 		}
 
-		//Group ends before target of a jump
+		// Group ends before target of a jump
 		if (in_degree(next, _g) != 1) {
 /*			if (stackLevel != expectedStackLevel) {
 				s.push(expectedStackLevel);
@@ -163,12 +163,12 @@
 			continue;
 		}
 
-		//Group ends when stack is balanced, unless just before conditional jump
+		// Group ends when stack is balanced, unless just before conditional jump
 		if (stackLevel == expectedStackLevel && nextInst->_type != kCondJump && nextInst->_type != kCondJumpRel) {
 			continue;
 		}
 
-		//All checks passed, merge groups
+		// All checks passed, merge groups
 		merge(cur, next);
 	}
 }

Modified: tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp	2010-06-18 02:30:19 UTC (rev 50004)
+++ tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp	2010-06-18 02:36:45 UTC (rev 50005)
@@ -62,7 +62,7 @@
 
 		po::variables_map vm;
 		try {
-			//FIXME: If specified as the last parameter before the input file name, -d currently requires a filename to specified. -d must be specified earlier than that if outputting to stdout.
+			// FIXME: If specified as the last parameter before the input file name, -d currently requires a filename to specified. -d must be specified earlier than that if outputting to stdout.
 			po::store(po::command_line_parser(argc, argv).options(args).positional(fileArg).run(), vm);
 			po::notify(vm);    
 		} catch (std::exception& e) {
@@ -97,7 +97,7 @@
 		Engine *engine = engineFactory.create(vm["engine"].as<std::string>());
 		std::string inputFile = vm["input-file"].as<std::string>();
 
-		//Disassembly
+		// Disassembly
 		Disassembler *disassembler = engine->getDisassembler();
 		disassembler->open(inputFile.c_str());
 
@@ -118,7 +118,7 @@
 
 		delete disassembler;
 
-		//Control flow analysis
+		// Control flow analysis
 		ControlFlow *cf = new ControlFlow(insts, engine);
 		cf->createGroups();
 		Graph g = cf->analyze();
@@ -139,7 +139,7 @@
 
 		delete cf;
 
-		//TODO: Code generation
+		// TODO: Code generation
 	} catch (std::exception& e) {
 		std::cerr << "ERROR: " << e.what() << "\n";
 		return 3;

Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp	2010-06-18 02:30:19 UTC (rev 50004)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp	2010-06-18 02:36:45 UTC (rev 50005)
@@ -93,9 +93,9 @@
 		OPCODE(0x5B, "wordArrayDec", kArithmetic, -1, "w");
 		OPCODE(0x5C, "jumpTrue", kCondJumpRel, -1, "s");
 		OPCODE(0x5D, "jumpFalse", kCondJumpRel, -1, "s");
-		OPCODE(0x5E, "startScript", kSpecial, 0x1020, ""); //Variable stack arguments
-		OPCODE(0x5F, "startScriptQuick", kSpecial, 0x1010, ""); //Variable stack arguments
-		OPCODE(0x60, "startObject", kSpecial, 0x1030, ""); //Variable stack arguments
+		OPCODE(0x5E, "startScript", kSpecial, 0x1020, ""); // Variable stack arguments
+		OPCODE(0x5F, "startScriptQuick", kSpecial, 0x1010, ""); // Variable stack arguments
+		OPCODE(0x60, "startObject", kSpecial, 0x1030, ""); // Variable stack arguments
 		OPCODE(0x61, "drawObject", kSpecial, -2, "");
 		OPCODE(0x62, "drawObjectAt", kSpecial, -3, "");
 		OPCODE(0x63, "drawBlastObject", kSpecial, 0, "");
@@ -103,10 +103,10 @@
 		OPCODE(0x65, "stopObjectCodeA", kSpecial, 0, "");
 		OPCODE(0x66, "stopObjectCodeB", kSpecial, 0, "");
 		OPCODE(0x67, "endCutscene", kSpecial, 0, "");
-		OPCODE(0x68, "beginCutscene", kSpecial, 0x1000, ""); //Variable stack arguments
+		OPCODE(0x68, "beginCutscene", kSpecial, 0x1000, ""); // Variable stack arguments
 		OPCODE(0x69, "stopMusic", kSpecial, 0, "");
 		OPCODE(0x6A, "freezeUnfreeze", kSpecial, -1, "");
-		START_SUBOPCODE(0x6B); //cursorCommand
+		START_SUBOPCODE(0x6B); // cursorCommand
 			OPCODE(0x90, "cursorCmd_CursorOn", kSpecial, 0, "");
 			OPCODE(0x91, "cursorCmd_CursorOff", kSpecial, 0, "");
 			OPCODE(0x92, "cursorCmd_UserputOn", kSpecial, 0, "");
@@ -118,12 +118,12 @@
 			OPCODE(0x99, "cursorCmd_Image", kSpecial, -2, "");
 			OPCODE(0x9A, "cursorCmd_Hotspot", kSpecial, -2, "");
 			OPCODE(0x9C, "cursorCmd_CharsetSet", kSpecial, -1, "");
-			OPCODE(0x9D, "cursorCmd_CharsetColors", kSpecial, 0x1000, ""); //Variable stack arguments
+			OPCODE(0x9D, "cursorCmd_CharsetColors", kSpecial, 0x1000, ""); // Variable stack arguments
 			OPCODE(0xD6, "cursorCmd_Transparent", kSpecial, -1, "");
 		END_SUBOPCODE;
 		OPCODE(0x6C, "breakHere", kSpecial, 0, "");
-		OPCODE(0x6D, "ifClassOfIs", kSpecial, 0x1011, ""); //Variable stack arguments
-		OPCODE(0x6E, "setClass", kSpecial, 0x1010, ""); //Variable stack arguments
+		OPCODE(0x6D, "ifClassOfIs", kSpecial, 0x1011, ""); // Variable stack arguments
+		OPCODE(0x6E, "setClass", kSpecial, 0x1010, ""); // Variable stack arguments
 		OPCODE(0x6F, "getState", kSpecial, 0, "");
 		OPCODE(0x70, "setState", kSpecial, -2, "");
 		OPCODE(0x71, "setOwner", kSpecial, -2, "");
@@ -164,9 +164,9 @@
 		OPCODE(0x96, "endOverride", kSpecial, 0, "");
 		OPCODE(0x97, "setObjectName", kSpecial, -1, "c");
 		OPCODE(0x98, "isSoundRunning", kSpecial, 0, "");
-		OPCODE(0x99, "setBoxFlags", kSpecial, 0x1100, ""); //Variable stack arguments
+		OPCODE(0x99, "setBoxFlags", kSpecial, 0x1100, ""); // Variable stack arguments
 		OPCODE(0x9A, "createBoxMatrix", kSpecial, 0, "");
-		START_SUBOPCODE(0x9B); //resourceRoutines
+		START_SUBOPCODE(0x9B); // resourceRoutines
 			OPCODE(0x64, "resRoutine_loadScript", kSpecial, -1, "");
 			OPCODE(0x65, "resRoutine_loadSound", kSpecial, -1, "");
 			OPCODE(0x66, "resRoutine_loadCostume", kSpecial, -1, "");
@@ -187,7 +187,7 @@
 			OPCODE(0x76, "resRoutine_nukeCharset", kSpecial, -1, "");
 			OPCODE(0x77, "resRoutine_loadFlObject", kSpecial, -2, "");
 		END_SUBOPCODE;
-		START_SUBOPCODE(0x9C); //roomOps
+		START_SUBOPCODE(0x9C); // roomOps
 			OPCODE(0xAC, "roomOp_roomScroll", kSpecial, -2, "");
 			OPCODE(0xAE, "roomOp_setScreen", kSpecial, -2, "");
 			OPCODE(0xAF, "roomOp_setPalColor", kSpecial, -4, "");
@@ -203,10 +203,10 @@
 			OPCODE(0xD5, "roomOp_setPalette", kSpecial, -1, "");
 			OPCODE(0xDC, "roomOp_copyPalColor", kSpecial, -2, "");
 		END_SUBOPCODE;
-		START_SUBOPCODE(0x9D); //actorOps
+		START_SUBOPCODE(0x9D); // actorOps
 			OPCODE(0x4C, "actorOp_setCostume", kSpecial, -1, "");
 			OPCODE(0x4D, "actorOp_setWalkSpeed", kSpecial, -2, "");
-			OPCODE(0x4E, "actorOp_setSound", kSpecial, 0x1000, ""); //Variable stack arguments
+			OPCODE(0x4E, "actorOp_setSound", kSpecial, 0x1000, ""); // Variable stack arguments
 			OPCODE(0x4F, "actorOp_setWalkFrame", kSpecial, -1, "");
 			OPCODE(0x50, "actorOp_setTalkFrame", kSpecial, -2, "");
 			OPCODE(0x51, "actorOp_setStandFrame", kSpecial, -1, "");
@@ -242,7 +242,7 @@
 			OPCODE(0xEA, "actorOp_unfreeze", kSpecial, 0, "");
 			OPCODE(0xEB, "actorOp_setTalkScript", kSpecial, -1, "");
 		END_SUBOPCODE;
-		START_SUBOPCODE(0x9E); //verbOps
+		START_SUBOPCODE(0x9E); // verbOps
 			OPCODE(0x7C, "verbOp_loadImg", kSpecial, -1, "");
 			OPCODE(0x7D, "verbOp_loadString", kSpecial, 0, "c");
 			OPCODE(0x7E, "verbOp_setColor", kSpecial, -1, "");
@@ -264,15 +264,15 @@
 		END_SUBOPCODE;
 		OPCODE(0x9F, "getActorFromXY", kSpecial, -1, "");
 		OPCODE(0xA0, "findObject", kSpecial, -1, "");
-		OPCODE(0xA1, "pseudoRoom", kSpecial, 0x1010, ""); //Variable stack arguments
+		OPCODE(0xA1, "pseudoRoom", kSpecial, 0x1010, ""); // Variable stack arguments
 		OPCODE(0xA2, "getActorElevation", kSpecial, 0, "");
 		OPCODE(0xA3, "getVerbEntrypoint", kSpecial, -1, "");
-		START_SUBOPCODE(0xA4); //arrayOps
+		START_SUBOPCODE(0xA4); // arrayOps
 			OPCODE(0xCD, "arrayOp_assignString", kSpecial, -1, "wc");
-			OPCODE(0xD0, "arrayOp_assignIntList", kSpecial, 0x1100, "w"); //Variable stack arguments
-			OPCODE(0xD4, "arrayOp_assign2DimList", kSpecial, 0x1100, "w"); //Variable stack arguments
+			OPCODE(0xD0, "arrayOp_assignIntList", kSpecial, 0x1100, "w"); // Variable stack arguments
+			OPCODE(0xD4, "arrayOp_assign2DimList", kSpecial, 0x1100, "w"); // Variable stack arguments
 		END_SUBOPCODE;
-		START_SUBOPCODE(0xA5); //saveRestoreVerbs
+		START_SUBOPCODE(0xA5); // saveRestoreVerbs
 			OPCODE(0x8D, "srVerb_saveVerbs", kSpecial, -3, "");
 			OPCODE(0x8E, "srVerb_restoreVerbs", kSpecial, -3, "");
 			OPCODE(0x8F, "srVerb_deleteVerbs", kSpecial, -3, "");
@@ -280,7 +280,7 @@
 		OPCODE(0xA6, "drawBox", kSpecial, -5, "");
 		OPCODE(0xA7, "pop", kStack, -1, "");
 		OPCODE(0xA8, "getActorWidth", kSpecial, 0, "");
-		START_SUBOPCODE(0xA9); //wait
+		START_SUBOPCODE(0xA9); // wait
 			OPCODE(0xA8, "waitForActor", kSpecial, -1, "s");
 			OPCODE(0xA9, "waitForMessage", kSpecial, 0, "");
 			OPCODE(0xAA, "waitForCamera", kSpecial, 0, "");
@@ -290,9 +290,9 @@
 		END_SUBOPCODE;
 		OPCODE(0xAA, "getActorScaleX", kSpecial, 0, "");
 		OPCODE(0xAB, "getActorAnimCounter", kSpecial, 0, "");
-		OPCODE(0xAC, "soundKludge", kSpecial, 0x1000, ""); //Variable stack arguments
-		OPCODE(0xAD, "isAnyOf", kSpecial, 0x1011, ""); //Variable stack arguments
-		START_SUBOPCODE(0xAE); //systemOps
+		OPCODE(0xAC, "soundKludge", kSpecial, 0x1000, ""); // Variable stack arguments
+		OPCODE(0xAD, "isAnyOf", kSpecial, 0x1011, ""); // Variable stack arguments
+		START_SUBOPCODE(0xAE); // systemOps
 			OPCODE(0x9E, "systemOp_restartGame", kSpecial, 0, "");
 			OPCODE(0x9F, "systemOp_pauseGame", kSpecial, 0, "");
 			OPCODE(0xA0, "systemOp_shutDown", kSpecial, 0, "");
@@ -302,7 +302,7 @@
 		OPCODE(0xB1, "delaySeconds", kSpecial, -1, "");
 		OPCODE(0xB2, "delayMinutes", kSpecial, -1, "");
 		OPCODE(0xB3, "stopSentence", kSpecial, 0, "");
-		START_SUBOPCODE(0xB4); //printLine
+		START_SUBOPCODE(0xB4); // printLine
 			OPCODE(0x41, "printLineXY", kSpecial, -2, "");
 			OPCODE(0x42, "printLineColor", kSpecial, -1, "");
 			OPCODE(0x43, "printLineRight", kSpecial, -1, "");
@@ -314,7 +314,7 @@
 			OPCODE(0xFE, "printLineBegin", kSpecial, 0, "");
 			OPCODE(0xFF, "printLineEnd", kSpecial, 0, "");
 		END_SUBOPCODE;
-		START_SUBOPCODE(0xB5); //printText
+		START_SUBOPCODE(0xB5); // printText
 			OPCODE(0x41, "printTextXY", kSpecial, -2, "");
 			OPCODE(0x42, "printTextColor", kSpecial, -1, "");
 			OPCODE(0x43, "printTextRight", kSpecial, -1, "");
@@ -326,7 +326,7 @@
 			OPCODE(0xFE, "printTextBegin", kSpecial, 0, "");
 			OPCODE(0xFF, "printTextEnd", kSpecial, 0, "");
 		END_SUBOPCODE;
-		START_SUBOPCODE(0xB6); //printDebug
+		START_SUBOPCODE(0xB6); // printDebug
 			OPCODE(0x41, "printDebugXY", kSpecial, -2, "");
 			OPCODE(0x42, "printDebugColor", kSpecial, -1, "");
 			OPCODE(0x43, "printDebugRight", kSpecial, -1, "");
@@ -338,7 +338,7 @@
 			OPCODE(0xFE, "printDebugBegin", kSpecial, 0, "");
 			OPCODE(0xFF, "printDebugEnd", kSpecial, 0, "");
 		END_SUBOPCODE;
-		START_SUBOPCODE(0xB7); //printSystem
+		START_SUBOPCODE(0xB7); // printSystem
 			OPCODE(0x41, "printSystemXY", kSpecial, -2, "");
 			OPCODE(0x42, "printSystemColor", kSpecial, -1, "");
 			OPCODE(0x43, "printSystemRight", kSpecial, -1, "");
@@ -436,7 +436,7 @@
 
 void Scumm::v6::Disassembler::readParameter(Parameter *p, char type) {
 	switch (type) {
-	case 'c': { //Character string
+	case 'c': { // Character string
 		byte cmd;
 		bool inStr = false;
 		std::stringstream s;
@@ -465,7 +465,7 @@
 				case 6:     // addNameToStack
 				case 7: {   // addStringToStack
 					uint16 var = _f.readUint16LE();
-					//TODO: Clean output similar to descumm
+					// TODO: Clean output similar to descumm
 					s << ":addToStack=" << var << ":";
 					_address += 4;
 					}

Modified: tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.cpp	2010-06-18 02:30:19 UTC (rev 50004)
+++ tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.cpp	2010-06-18 02:36:45 UTC (rev 50005)
@@ -33,52 +33,52 @@
 
 void SimpleDisassembler::readParameter(Parameter *p, char type) {
 	switch (type) {
-	case 'b': //signed byte
+	case 'b': // signed byte
 		p->_type = kSByte;
 		p->_value = _f.readChar();
 		_address++;
 		break;
-	case 'B': //unsigned byte
+	case 'B': // unsigned byte
 		p->_type = kByte;
 		p->_value = (uint32)_f.readByte();
 		_address++;
 		break;
-	case 's': //16-bit signed integer (short), little-endian
+	case 's': // 16-bit signed integer (short), little-endian
 		p->_type = kShort;
 		p->_value = _f.readSint16LE();
 		_address += 2;
 		break;
-	case 'S': //16-bit signed integer (short), big-endian
+	case 'S': // 16-bit signed integer (short), big-endian
 		p->_type = kShort;
 		p->_value = _f.readSint16BE();
 		_address += 2;
 		break;
-	case 'w': //16-bit unsigned integer (word), little-endian
+	case 'w': // 16-bit unsigned integer (word), little-endian
 		p->_type = kUShort;
 		p->_value = (uint32)_f.readUint16LE();
 		_address += 2;
 		break;
-	case 'W': //16-bit unsigned integer (word), big-endian
+	case 'W': // 16-bit unsigned integer (word), big-endian
 		p->_type = kUShort;
 		p->_value = (uint32)_f.readUint16BE();
 		_address += 2;
 		break;
-	case 'i': //32-bit signed integer (int), little-endian
+	case 'i': // 32-bit signed integer (int), little-endian
 		p->_type = kInt;
 		p->_value = _f.readSint32LE();
 		_address += 4;
 		break;
-	case 'I': //32-bit signed integer (int), big-endian
+	case 'I': // 32-bit signed integer (int), big-endian
 		p->_type = kInt;
 		p->_value = _f.readSint32BE();
 		_address += 4;
 		break;
-	case 'd': //32-bit unsigned integer (dword), little-endian
+	case 'd': // 32-bit unsigned integer (dword), little-endian
 		p->_type = kUInt;
 		p->_value = _f.readUint32LE();
 		_address += 4;
 		break;
-	case 'D': //32-bit unsigned integer (dword), big-endian
+	case 'D': // 32-bit unsigned integer (dword), big-endian
 		p->_type = kUInt;
 		p->_value = _f.readUint32BE();
 		_address += 4;

Modified: tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h	2010-06-18 02:30:19 UTC (rev 50004)
+++ tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h	2010-06-18 02:36:45 UTC (rev 50005)
@@ -71,8 +71,8 @@
 		}
 	}
 
-	//This test requires script-15.dmp from Sam & Max: Hit The Road.
-	//1ab08298c9c8fb4c77953756989c7449 *script-15.dmp
+	// This test requires script-15.dmp from Sam & Max: Hit The Road.
+	// 1ab08298c9c8fb4c77953756989c7449 *script-15.dmp
 	void testScummv6DisassemblerScript15() {
 		try {
 			Scumm::v6::Disassembler s;
@@ -95,8 +95,8 @@
 		}
 	}
 
-	//This test requires script-31.dmp from Sam & Max: Hit The Road.
-	//f75f7ce110f378735d449f8eeb4a68e5 *script-31.dmp
+	// This test requires script-31.dmp from Sam & Max: Hit The Road.
+	// f75f7ce110f378735d449f8eeb4a68e5 *script-31.dmp
 	void testScummv6DisassemblerScript31() {
 		try {
 			Scumm::v6::Disassembler s;
@@ -113,8 +113,8 @@
 		}
 	}
 
-	//This test requires script-33.dmp from Sam & Max: Hit The Road.
-	//9f09418bf34abbdec0ec54f388d8dca4 *script-33.dmp
+	// This test requires script-33.dmp from Sam & Max: Hit The Road.
+	// 9f09418bf34abbdec0ec54f388d8dca4 *script-33.dmp
 	void testScummv6DisassemblerScript33() {
 		try {
 			Scumm::v6::Disassembler s;
@@ -136,8 +136,8 @@
 		}
 	}
 
-	//This test requires room-9-202.dmp from Sam & Max: Hit The Road.
-	//f010dc659264674a2b6da298acd0b88b *room-9-202.dmp
+	// This test requires room-9-202.dmp from Sam & Max: Hit The Road.
+	// f010dc659264674a2b6da298acd0b88b *room-9-202.dmp
 	void testScummv6StackChangeFixRoom9202() {
 		try {
 			Scumm::v6::Disassembler s;
@@ -151,8 +151,8 @@
 		}
 	}
 	
-	//This test requires script-30.dmp from Sam & Max: Hit The Road.
-	//6e48faca13e1f6df9341567608962744 *script-30.dmp
+	// This test requires script-30.dmp from Sam & Max: Hit The Road.
+	// 6e48faca13e1f6df9341567608962744 *script-30.dmp
 	void testScummv6StackChangeFixScript30() {
 		try {
 			Scumm::v6::Disassembler s;


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