[Scummvm-cvs-logs] SF.net SVN: scummvm:[52094] tools/branches/gsoc2010-decompiler/decompiler
pidgeot at users.sourceforge.net
pidgeot at users.sourceforge.net
Sun Aug 15 00:11:24 CEST 2010
Revision: 52094
http://scummvm.svn.sourceforge.net/scummvm/?rev=52094&view=rev
Author: pidgeot
Date: 2010-08-14 22:11:24 +0000 (Sat, 14 Aug 2010)
Log Message:
-----------
DECOMPILER: Mass enum member renaming
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp
tools/branches/gsoc2010-decompiler/decompiler/codegen.h
tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
tools/branches/gsoc2010-decompiler/decompiler/doc/cfg.tex
tools/branches/gsoc2010-decompiler/decompiler/doc/codegen.tex
tools/branches/gsoc2010-decompiler/decompiler/doc/disassembler.tex
tools/branches/gsoc2010-decompiler/decompiler/graph.h
tools/branches/gsoc2010-decompiler/decompiler/instruction.h
tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.cpp
tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.h
tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp
tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp
tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h
tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp
tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.cpp
tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.cpp
tools/branches/gsoc2010-decompiler/decompiler/test/cfg_test.h
tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/pasc.cpp
tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/subopcode.cpp
tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h
Modified: tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp 2010-08-14 22:11:24 UTC (rev 52094)
@@ -27,6 +27,10 @@
#include <iostream>
#include <set>
+
+
+
+
#include <boost/format.hpp>
#define GET(vertex) (boost::get(boost::vertex_name, _g, vertex))
@@ -103,7 +107,7 @@
}
EntryPtr StackEntry::dup(std::ostream &output) {
- if (_type == seDup)
+ if (_type == kDupStackEntry)
return this;
EntryPtr dupEntry = new DupEntry(++dupindex);
@@ -111,30 +115,79 @@
return dupEntry;
}
+
EntryPtr IntEntry::dup(std::ostream &output) {
return new IntEntry(_val, _isSigned);
}
+
std::string CodeGenerator::constructFuncSignature(const Function &func) {
return "";
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
std::string CodeGenerator::indentString(std::string s) {
std::stringstream stream;
stream << std::string(kIndentAmount * _indentLevel, ' ') << s;
return stream.str();
}
+
+
+
+
+
+
+
+
+
+
+
+
CodeGenerator::CodeGenerator(Engine *engine, std::ostream &output, ArgOrder binOrder, ArgOrder callOrder) : _output(output), _binOrder(binOrder), _callOrder(callOrder) {
_engine = engine;
_indentLevel = 0;
}
+
+
+
+
+
+
typedef std::pair<GraphVertex, EntryStack> DFSEntry;
+
+
+
void CodeGenerator::generate(const Graph &g) {
_g = g;
+
+
+
+
+
+
+
for (FuncMap::iterator fn = _engine->_functions.begin(); fn != _engine->_functions.end(); ++fn)
{
_indentLevel = 0;
@@ -150,8 +203,23 @@
addOutputLine(funcSignature, false, true);
}
+
+
+
+
+
+
+
GroupPtr lastGroup = GET(entryPoint);
+
+
+
+
+
+
+
+
// DFS from entry point to process each vertex
Stack<DFSEntry> dfsStack;
std::set<GraphVertex> seen;
@@ -175,11 +243,26 @@
}
}
+
+
+
+
+
+
+
+
+
+
+
if (printFuncSignature) {
_curGroup = lastGroup;
addOutputLine("}", true, false);
}
+
+
+
+
// Print output
GroupPtr p = GET(entryPoint);
while (p != NULL) {
@@ -187,6 +270,33 @@
if (it->_unindentBefore) {
assert(_indentLevel > 0);
_indentLevel--;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
}
_output << boost::format("%08X: %s") % p->_start->_address % indentString(it->_line) << std::endl;
if (it->_indentAfter)
@@ -226,18 +336,19 @@
if (!boost::get(boost::edge_attribute, _g, *ie)._isJump || inGroup->_stackLevel == -1)
continue;
switch (inGroup->_type) {
- case kDoWhileCond:
+ case kDoWhileCondGroupType:
addOutputLine("do {", false, true);
break;
- case kIfCond:
+ case kIfCondGroupType:
if (!_curGroup->_startElse)
addOutputLine("}", true, false);
break;
- case kWhileCond:
+ case kWhileCondGroupType:
addOutputLine("}", true, false);
break;
default:
break;
+
}
}
@@ -250,13 +361,15 @@
for (ElseEndIterator elseIt = _curGroup->_endElse.begin(); elseIt != _curGroup->_endElse.end(); ++elseIt) {
if (!(*elseIt)->_coalescedElse)
addOutputLine("}", true, false);
+
+
}
}
void CodeGenerator::processInst(const Instruction inst) {
switch (inst._type) {
// We handle plain dups here because their behavior should be identical across instruction sets and this prevents implementation error.
- case kDup:
+ case kDupInstType:
{
std::stringstream s;
EntryPtr p = _stack.pop()->dup(s);
@@ -266,26 +379,26 @@
_stack.push(p);
break;
}
- case kUnaryOpPre:
- case kUnaryOpPost:
- _stack.push(new UnaryOpEntry(_stack.pop(), inst._codeGenData, inst._type == kUnaryOpPost));
+ case kUnaryOpPreInstType:
+ case kUnaryOpPostInstType:
+ _stack.push(new UnaryOpEntry(_stack.pop(), inst._codeGenData, inst._type == kUnaryOpPostInstType));
break;
- case kBinaryOp:
+ case kBinaryOpInstType:
{
EntryPtr op1 = _stack.pop();
EntryPtr op2 = _stack.pop();
- if (_binOrder == kFIFO)
+ if (_binOrder == kFIFOArgOrder)
_stack.push(new BinaryOpEntry(op2, op1, inst._codeGenData));
- else if (_binOrder == kLIFO)
+ else if (_binOrder == kLIFOArgOrder)
_stack.push(new BinaryOpEntry(op1, op2, inst._codeGenData));
break;
}
- case kCondJump:
- case kCondJumpRel:
+ case kCondJumpInstType:
+ case kCondJumpRelInstType:
{
std::stringstream s;
switch (_curGroup->_type) {
- case kIfCond:
+ case kIfCondGroupType:
if (_curGroup->_startElse && _curGroup->_code.size() == 1) {
OutEdgeRange oer = boost::out_edges(_curVertex, _g);
bool coalesceElse = false;
@@ -303,11 +416,11 @@
s << "if (" << _stack.pop() << ") {";
addOutputLine(s.str(), _curGroup->_coalescedElse, true);
break;
- case kWhileCond:
+ case kWhileCondGroupType:
s << "while (" << _stack.pop() << ") {";
addOutputLine(s.str(), false, true);
break;
- case kDoWhileCond:
+ case kDoWhileCondGroupType:
s << "} while (" << _stack.pop() << ")";
addOutputLine(s.str(), true, false);
break;
@@ -316,13 +429,13 @@
}
}
break;
- case kJump:
- case kJumpRel:
+ case kJumpInstType:
+ case kJumpRelInstType:
switch (_curGroup->_type) {
- case kBreak:
+ case kBreakGroupType:
addOutputLine("break;");
break;
- case kContinue:
+ case kContinueGroupType:
addOutputLine("continue;");
break;
default:
@@ -342,6 +455,7 @@
break;
}
+
OutEdgeRange targetR = boost::out_edges(boost::target(*e, _g), _g);
for (OutEdgeIterator targetE = targetR.first; targetE != targetR.second; ++targetE) {
// Don't output jump to while loop that has jump to next vertex
@@ -358,11 +472,11 @@
break;
}
break;
- case kReturn:
+ case kReturnInstType:
// TODO: Allow specification of return value as part of return statement
addOutputLine("return;");
break;
- case kSpecial:
+ case kSpecialCallInstType:
{
_argList.clear();
bool returnsValue = (inst._codeGenData.find("r") == 0);
@@ -387,13 +501,21 @@
}
}
+
+
+
+
void CodeGenerator::addArg(EntryPtr p) {
- if (_callOrder == kFIFO)
+ if (_callOrder == kFIFOArgOrder)
_argList.push_front(p);
- else if (_callOrder == kLIFO)
+ else if (_callOrder == kLIFOArgOrder)
_argList.push_back(p);
}
+
+
+
+
void CodeGenerator::processSpecialMetadata(const Instruction &inst, char c, int pos) {
switch (c) {
case 'p':
@@ -404,3 +526,4 @@
break;
}
}
+
Modified: tools/branches/gsoc2010-decompiler/decompiler/codegen.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/codegen.h 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/codegen.h 2010-08-14 22:11:24 UTC (rev 52094)
@@ -39,15 +39,15 @@
* Types of stack entries.
*/
enum StackEntryType {
- seInt, ///< Integer
- seVar, ///< Variable
- seBinOp, ///< Binary operation
- seUnaryOp, ///< Unary operation
- seDup, ///< Duplicated entry
- seArray, ///< Array access
- seString, ///< String
- seList, ///< List
- seCall ///< Function call
+ kIntStackEntry, ///< Integer
+ kVarStackEntry, ///< Variable
+ kBinOpStackEntry, ///< Binary operation
+ kUnaryOpStackEntry, ///< Unary operation
+ kDupStackEntry, ///< Duplicated entry
+ kArrayStackEntry, ///< Array access
+ kStringStackEntry, ///< String
+ kListStackEntry, ///< List
+ kCallStackEntry ///< Function call
};
class StackEntry;
@@ -145,7 +145,7 @@
* @param val The value contained in the stack entry.
* @param isSigned Whether or not the value is signed. This will affect output.
*/
- IntEntry(int32 val, bool isSigned) : StackEntry(seInt), _val(val), _isSigned(isSigned) { }
+ IntEntry(int32 val, bool isSigned) : StackEntry(kIntStackEntry), _val(val), _isSigned(isSigned) { }
/**
* Constructor for IntEntry.
@@ -153,7 +153,7 @@
* @param val The value contained in the stack entry.
* @param isSigned Whether or not the value is signed. This will affect output.
*/
- IntEntry(uint32 val, bool isSigned) : StackEntry(seInt), _val(val), _isSigned(isSigned) { }
+ IntEntry(uint32 val, bool isSigned) : StackEntry(kIntStackEntry), _val(val), _isSigned(isSigned) { }
/**
* Gets the value associated with the IntEntry.
@@ -187,7 +187,7 @@
*
* @param varName The name of the variable.
*/
- VarEntry(std::string varName) : StackEntry(seVar), _varName(varName) { }
+ VarEntry(std::string varName) : StackEntry(kVarStackEntry), _varName(varName) { }
virtual std::ostream &print(std::ostream &output) const;
};
@@ -210,7 +210,7 @@
* @param op The operator for this entry.
*/
BinaryOpEntry(EntryPtr lhs, EntryPtr rhs, std::string op) :
- StackEntry(seBinOp), _lhs(lhs), _rhs(rhs), _op(op) { }
+ StackEntry(kBinOpStackEntry), _lhs(lhs), _rhs(rhs), _op(op) { }
virtual std::ostream &print(std::ostream &output) const;
};
@@ -233,7 +233,7 @@
* @param isPostfix Whether or not the operator should be postfixed to the operand.
*/
UnaryOpEntry(EntryPtr operand, std::string op, bool isPostfix) :
- StackEntry(seUnaryOp), _operand(operand), _op(op), _isPostfix(isPostfix) { }
+ StackEntry(kUnaryOpStackEntry), _operand(operand), _op(op), _isPostfix(isPostfix) { }
virtual std::ostream &print(std::ostream &output) const;
};
@@ -251,7 +251,7 @@
*
* @param idx Index to distinguish multiple duplicated entries.
*/
- DupEntry(int idx) : StackEntry(seDup), _idx(idx) { }
+ DupEntry(int idx) : StackEntry(kDupStackEntry), _idx(idx) { }
virtual std::ostream &print(std::ostream &output) const;
};
@@ -276,7 +276,7 @@
* @param arrayName The name of the array.
* @param idxs std::deque of stack entries representing the indexes used (left-to-right).
*/
- ArrayEntry(std::string arrayName, std::deque<EntryPtr> idxs) : StackEntry(seArray), _arrayName(arrayName), _idxs(idxs) { }
+ ArrayEntry(std::string arrayName, std::deque<EntryPtr> idxs) : StackEntry(kArrayStackEntry), _arrayName(arrayName), _idxs(idxs) { }
virtual std::ostream &print(std::ostream &output) const;
};
@@ -294,7 +294,7 @@
*
* @param str The string in the entry.
*/
- StringEntry(std::string str) : StackEntry(seString), _str(str) { }
+ StringEntry(std::string str) : StackEntry(kStringStackEntry), _str(str) { }
virtual std::ostream &print(std::ostream &output) const;
};
@@ -312,7 +312,7 @@
*
* @param items The items stored in the list.
*/
- ListEntry(EntryList items) : StackEntry(seList), _items(items) { }
+ ListEntry(EntryList items) : StackEntry(kListStackEntry), _items(items) { }
virtual std::ostream &print(std::ostream &output) const;
};
@@ -332,7 +332,7 @@
* @param funcName The name of the function.
* @param args std::deque of stack entries representing the arguments used.
*/
- CallEntry(std::string funcName, EntryList args) : StackEntry(seCall), _funcName(funcName), _args(args) { }
+ CallEntry(std::string funcName, EntryList args) : StackEntry(kCallStackEntry), _funcName(funcName), _args(args) { }
virtual std::ostream &print(std::ostream &output) const;
};
@@ -348,8 +348,8 @@
* Enumeration for the different argument/operand orderings.
*/
enum ArgOrder {
- kFIFO, ///< First argument is pushed to stack first.
- kLIFO ///< First argument is pushed to stack last.
+ kFIFOArgOrder, ///< First argument is pushed to stack first.
+ kLIFOArgOrder ///< First argument is pushed to stack last.
};
/**
Modified: tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp 2010-08-14 22:11:24 UTC (rev 52094)
@@ -77,7 +77,7 @@
}
last = cur;
- addEdge = (it->_type != kJump && it->_type != kJumpRel && it->_type != kReturn);
+ addEdge = (it->_type != kJumpInstType && it->_type != kJumpRelInstType && it->_type != kReturnInstType);
prev = GET(cur);
}
@@ -85,10 +85,10 @@
// Add jump edges
for (ConstInstIterator it = insts.begin(); it != insts.end(); ++it) {
switch(it->_type) {
- case kJump:
- case kCondJump:
- case kJumpRel:
- case kCondJumpRel: {
+ case kJumpInstType:
+ case kCondJumpInstType:
+ case kJumpRelInstType:
+ case kCondJumpRelInstType: {
GraphEdge e = boost::add_edge(find(it), find(_engine->getDestAddress(it)), _g).first;
PUT_EDGE(e, true);
break;
@@ -296,19 +296,19 @@
stackLevel += curInst->_stackChange;
// For stack operations, the new stack level becomes the expected stack level starting from the next group
- if (curInst->_type == kStack) {
+ if (curInst->_type == kStackInstType) {
expectedStackLevel = stackLevel;
grNext->_stackLevel = stackLevel;
}
// Group ends after a jump
- if (curInst->_type == kJump || curInst->_type == kJumpRel || curInst->_type == kCondJump || curInst->_type == kCondJumpRel) {
+ if (curInst->_type == kJumpInstType || curInst->_type == kJumpRelInstType || curInst->_type == kCondJumpInstType || curInst->_type == kCondJumpRelInstType) {
stackLevel = grNext->_stackLevel;
continue;
}
// Group ends with a return
- if (curInst->_type == kReturn) {
+ if (curInst->_type == kReturnInstType) {
stackLevel = grNext->_stackLevel;
continue;
}
@@ -329,7 +329,7 @@
} while (grCur->_start != grCur->_end && it != grCur->_end);
// Group ends when stack is balanced, unless just before conditional jump
- if (stackLevel == expectedStackLevel && !forceMerge && nextInst->_type != kCondJump && nextInst->_type != kCondJumpRel) {
+ if (stackLevel == expectedStackLevel && !forceMerge && nextInst->_type != kCondJumpInstType && nextInst->_type != kCondJumpRelInstType) {
continue;
}
@@ -396,17 +396,17 @@
for (VertexIterator v = vr.first; v != vr.second; ++v) {
GroupPtr gr = GET(*v);
// Undetermined block that ends with conditional jump
- if (out_degree(*v, _g) == 2 && gr->_type == kNormal) {
+ if (out_degree(*v, _g) == 2 && gr->_type == kNormalGroupType) {
InEdgeRange ier = boost::in_edges(*v, _g);
bool isWhile = false;
for (InEdgeIterator e = ier.first; e != ier.second; ++e) {
GroupPtr sourceGr = GET(boost::source(*e, _g));
// Block has ingoing edge from block later in the code that isn't a do-while condition
- if (sourceGr->_start->_address > gr->_start->_address && sourceGr->_type != kDoWhileCond)
+ if (sourceGr->_start->_address > gr->_start->_address && sourceGr->_type != kDoWhileCondGroupType)
isWhile = true;
}
if (isWhile)
- gr->_type = kWhileCond;
+ gr->_type = kWhileCondGroupType;
}
}
}
@@ -416,13 +416,13 @@
for (VertexIterator v = vr.first; v != vr.second; ++v) {
GroupPtr gr = GET(*v);
// Undetermined block that ends with conditional jump...
- if (out_degree(*v, _g) == 2 && gr->_type == kNormal) {
+ if (out_degree(*v, _g) == 2 && gr->_type == kNormalGroupType) {
OutEdgeRange oer = boost::out_edges(*v, _g);
for (OutEdgeIterator e = oer.first; e != oer.second; ++e) {
GroupPtr targetGr = GET(boost::target(*e, _g));
// ...to earlier in code
if (targetGr->_start->_address < gr->_start->_address)
- gr->_type = kDoWhileCond;
+ gr->_type = kDoWhileCondGroupType;
}
}
}
@@ -433,7 +433,7 @@
for (VertexIterator v = vr.first; v != vr.second; ++v) {
GroupPtr gr = GET(*v);
// Undetermined block with unconditional jump...
- if (gr->_type == kNormal && (gr->_end->_type == kJump || gr->_end->_type == kJumpRel) && out_degree(*v, _g) == 1) {
+ if (gr->_type == kNormalGroupType && (gr->_end->_type == kJumpInstType || gr->_end->_type == kJumpRelInstType) && out_degree(*v, _g) == 1) {
OutEdgeIterator oe = boost::out_edges(*v, _g).first;
GraphVertex target = boost::target(*oe, _g);
GroupPtr targetGr = GET(target);
@@ -444,9 +444,9 @@
for (InEdgeIterator ie = ier.first; ie != ier.second; ++ie) {
GroupPtr sourceGr = GET(boost::source(*ie, _g));
// ...to block immediately after a do-while condition, or to jump target of a while condition
- if ((targetGr->_prev == sourceGr && sourceGr->_type == kDoWhileCond) || sourceGr->_type == kWhileCond) {
+ if ((targetGr->_prev == sourceGr && sourceGr->_type == kDoWhileCondGroupType) || sourceGr->_type == kWhileCondGroupType) {
if (validateBreakOrContinue(gr, sourceGr))
- gr->_type = kBreak;
+ gr->_type = kBreakGroupType;
}
}
}
@@ -458,19 +458,19 @@
for (VertexIterator v = vr.first; v != vr.second; ++v) {
GroupPtr gr = GET(*v);
// Undetermined block with unconditional jump...
- if (gr->_type == kNormal && (gr->_end->_type == kJump || gr->_end->_type == kJumpRel) && out_degree(*v, _g) == 1) {
+ if (gr->_type == kNormalGroupType && (gr->_end->_type == kJumpInstType || gr->_end->_type == kJumpRelInstType) && out_degree(*v, _g) == 1) {
OutEdgeIterator oe = boost::out_edges(*v, _g).first;
GraphVertex target = boost::target(*oe, _g);
GroupPtr targetGr = GET(target);
// ...to a while or do-while condition...
- if (targetGr->_type == kWhileCond || targetGr->_type == kDoWhileCond) {
+ if (targetGr->_type == kWhileCondGroupType || targetGr->_type == kDoWhileCondGroupType) {
bool isContinue = true;
// ...unless...
OutEdgeRange toer = boost::out_edges(target, _g);
bool afterJumpTargets = true;
for (OutEdgeIterator toe = toer.first; toe != toer.second; ++toe) {
// ...it is targeting a while condition which jumps to the next sequential group
- if (targetGr->_type == kWhileCond && GET(boost::target(*toe, _g)) == gr->_next)
+ if (targetGr->_type == kWhileCondGroupType && GET(boost::target(*toe, _g)) == gr->_next)
isContinue = false;
// ...or the instruction is placed after all jump targets from condition
if (GET(boost::target(*toe, _g))->_start->_address > gr->_start->_address)
@@ -480,7 +480,7 @@
isContinue = false;
if (isContinue && validateBreakOrContinue(gr, targetGr))
- gr->_type = kContinue;
+ gr->_type = kContinueGroupType;
}
}
}
@@ -489,7 +489,7 @@
bool ControlFlow::validateBreakOrContinue(GroupPtr gr, GroupPtr condGr) {
GroupPtr from, to, cursor;
- if (condGr->_type == kDoWhileCond) {
+ if (condGr->_type == kDoWhileCondGroupType) {
to = condGr;
from = gr;
} else {
@@ -497,7 +497,7 @@
from = condGr->_next;
}
- GroupType ogt = (condGr->_type == kDoWhileCond ? kWhileCond : kDoWhileCond);
+ GroupType ogt = (condGr->_type == kDoWhileCondGroupType ? kWhileCondGroupType : kDoWhileCondGroupType);
// Verify that destination deals with innermost while/do-while
for (cursor = from; cursor->_next != NULL && cursor != to; cursor = cursor->_next) {
if (cursor->_type == condGr->_type) {
@@ -527,8 +527,8 @@
for (VertexIterator v = vr.first; v != vr.second; ++v) {
GroupPtr gr = GET(*v);
// if: Undetermined block with conditional jump
- if (gr->_type == kNormal && (gr->_end->_type == kCondJump || gr->_end->_type == kCondJumpRel)) {
- gr->_type = kIfCond;
+ if (gr->_type == kNormalGroupType && (gr->_end->_type == kCondJumpInstType || gr->_end->_type == kCondJumpRelInstType)) {
+ gr->_type = kIfCondGroupType;
}
}
}
@@ -537,7 +537,7 @@
VertexRange vr = boost::vertices(_g);
for (VertexIterator v = vr.first; v != vr.second; ++v) {
GroupPtr gr = GET(*v);
- if (gr->_type == kIfCond) {
+ if (gr->_type == kIfCondGroupType) {
OutEdgeRange oer = boost::out_edges(*v, _g);
GraphVertex target;
uint32 maxAddress = 0;
@@ -552,10 +552,10 @@
}
targetGr = GET(target);
// else: Jump target of if immediately preceded by an unconditional jump...
- if (targetGr->_prev->_end->_type != kJump && targetGr->_prev->_end->_type != kJumpRel)
+ if (targetGr->_prev->_end->_type != kJumpInstType && targetGr->_prev->_end->_type != kJumpRelInstType)
continue;
// ...which is not a break or a continue...
- if (targetGr->_prev->_type == kContinue || targetGr->_prev->_type == kBreak)
+ if (targetGr->_prev->_type == kContinueGroupType || targetGr->_prev->_type == kBreakGroupType)
continue;
// ...to later in the code
OutEdgeIterator toe = boost::out_edges(find(targetGr->_prev->_start->_address), _g).first;
@@ -572,7 +572,7 @@
bool ControlFlow::validateElseBlock(GroupPtr ifGroup, GroupPtr start, GroupPtr end) {
for (GroupPtr cursor = start; cursor != end; cursor = cursor->_next) {
- if (cursor->_type == kIfCond || cursor->_type == kWhileCond || cursor->_type == kDoWhileCond) {
+ if (cursor->_type == kIfCondGroupType || cursor->_type == kWhileCondGroupType || cursor->_type == kDoWhileCondGroupType) {
// Validate outgoing edges of conditions
OutEdgeRange oer = boost::out_edges(find(cursor->_start), _g);
for (OutEdgeIterator oe = oer.first; oe != oer.second; ++oe) {
@@ -592,7 +592,7 @@
}
// Unless group is a simple unconditional jump...
- if (cursor->_start->_type == kJump || cursor->_start->_type == kJumpRel)
+ if (cursor->_start->_type == kJumpInstType || cursor->_start->_type == kJumpRelInstType)
continue;
// ...validate ingoing edges
@@ -602,11 +602,11 @@
GroupPtr sourceGr = GET(source);
// Edges going to conditions...
- if (sourceGr->_type == kIfCond || sourceGr->_type == kWhileCond || sourceGr->_type == kDoWhileCond) {
+ if (sourceGr->_type == kIfCondGroupType || sourceGr->_type == kWhileCondGroupType || sourceGr->_type == kDoWhileCondGroupType) {
// ...must not come from outside the range [start, end]...
if (start->_start->_address > sourceGr->_start->_address || sourceGr->_start->_address > end->_start->_address) {
// ...unless source is simple unconditional jump...
- if (sourceGr->_start->_type == kJump || sourceGr->_start->_type == kJumpRel)
+ if (sourceGr->_start->_type == kJumpInstType || sourceGr->_start->_type == kJumpRelInstType)
continue;
// ...or the edge is from the if condition associated with this else
if (ifGroup == sourceGr)
Modified: tools/branches/gsoc2010-decompiler/decompiler/doc/cfg.tex
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/doc/cfg.tex 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/doc/cfg.tex 2010-08-14 22:11:24 UTC (rev 52094)
@@ -10,7 +10,7 @@
\item Perform analysis on vertices
\end{itemize}
-Calls to in-script functions are not represented with edges in the graph. This is done to keep functions separate from one another, so if your engine uses a jump as part of calling functions, you need to make sure you have given that particular jump the type kCall.
+Calls to in-script functions are not represented with edges in the graph. This is done to keep functions separate from one another, so if your engine uses a jump as part of calling functions, you need to make sure you have given that particular jump the type kCallInstType.
The first step is handled in the constructor, while the next three steps are handled by the \code{createGroups()} method. The last step is handled by the \code{analyze} method.
Modified: tools/branches/gsoc2010-decompiler/decompiler/doc/codegen.tex
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/doc/codegen.tex 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/doc/codegen.tex 2010-08-14 22:11:24 UTC (rev 52094)
@@ -80,27 +80,27 @@
When disassembling, you can store metadata for a given instruction to be used during code generation.
Default handling exists for a number of instruction types, described below. To get the default handling, simply call the base class implementation of \code{processInst} from your code.
-\paragraph{kDup}
+\paragraph{kDupInstType}
The topmost stack entry is popped, and two duplicated copies are pushed to the stack. If the entry being duplicated was not already a duplicate, an assignment will be output to assign the original stack entry to a special dup variable, to show that the original entry is not being recalculated.
-\paragraph{kUnaryOpPre/kUnaryOpPost}
+\paragraph{kUnaryOpPreInstType/kUnaryOpPostInstType}
The topmost stack entry is popped, and a \code{UnaryOpEntry} is created and pushed to the stack, using the codegen metadata as the operator, and the previously popped entry as the operand. The exact type determines whether the operator is pre- or postfixed to the operand.
-\paragraph{kBinaryOp}
+\paragraph{kBinaryOpInstType}
The two topmost stack entries are popped, and a BinaryOpEntry is created and pushed to the stack, using the codegen metadata as the operator and the previously popped entries as the operands. The order of the operands is determined by the value of the field \code{\_binOrder}, as described in Section~\vref{sec:argOrder}.
-\paragraph{kCondJump and kCondJumpRel}
+\paragraph{kCondJumpInstType and kCondJumpRelInstType}
The information on the stack is then read, and an if, while or do-while condition is output using the topmost stack entry. In general, you will want to call the base class method after handling one of these opcodes.
-\paragraph{kJump and kJumpRel}
+\paragraph{kJumpInstType and kJumpRelInstType}
If the current group has been detected as a break or a continue, a break or continue statement is output. Otherwise, the jump is analyzed and output unless it is a jump back to the condition of a while-loop that ends there, or it is determined that the jump is unnecessary due to an else block following immediately after.
-\paragraph{kReturn}
+\paragraph{kReturnInstType}
This simply adds a line \code{return;} to the output.
\emph{Note:} The default handling does not currently allow specifying a return value as part of the statement, as in \code{return 0;}. You will have to handle that yourself.
-\paragraph{kSpecial}
+\paragraph{kSpecialCallInstType}
The metadata is treated similar to parameter specifications in \code{SimpleDisassembler} (see Section~\vref{sec:simpledisasm}). If the specification string starts with the character \code{r}, this signifies that the call returns a value, and processing starts at the next character.
For each character in the metadata string, \code{processSpecialMetadata} is called with the instruction being processed, and the current metadata character to be handled. The default implementation only understands the character \code{p}, which pops an argument from the stack and adds it to the argument list.
Once the metadata string has been processed fully, then an entry representing the function call is pushed to the stack if the call returns a value. Otherwise, the call is added to the output.
@@ -110,13 +110,13 @@
Due to the conflict with the specification of a return value, it is recommended that you do not adopt \code{r} as a metadata character.
\paragraph{Other types}
-No default handling exists for types other than those mentioned above, so you must handle them yourself in the \code{processInst} method of your subclass. This includes types like \code{kLoad} and \code{kStore}.
+No default handling exists for types other than those mentioned above, so you must handle them yourself in the \code{processInst} method of your subclass. This includes types like \code{kLoadInstType} and \code{kStoreInstType}.
-Note that this also includes \code{kCall}. Although many engines might want to handle this in a manner similar to \code{kSpecial} opcodes, this is left to the engine-specific code so they can fully make sense of the metadata they choose to add to the function.
+Note that this also includes \code{kCallInstType}. Although many engines might want to handle this in a manner similar to \code{kSpecialCallInstType} opcodes, this is left to the engine-specific code so they can fully make sense of the metadata they choose to add to the function.
\subsection{Order of arguments}
\label{sec:argOrder}
-The generic handling of binary operators (kBinaryOp) and magic functions (kSpecial) can be configured to display their arguments using FIFO or LIFO - respectively, the first and the last entry to be pushed onto the stack is used as the first (leftmost) argument. This is set as part of the constructor for the \code{CodeGenerator} class, using the enumeration values \code{kFIFO} and \code{kLIFO}.
+The generic handling of binary operators (kBinaryOpInstType) and magic functions (kSpecialCallInstType) can be configured to display their arguments using FIFO or LIFO - respectively, the first and the last entry to be pushed onto the stack is used as the first (leftmost) argument. This is set as part of the constructor for the \code{CodeGenerator} class, using the enumeration values \code{kFIFOArgOrder} and \code{kLIFOArgOrder}.
To provide an example, consider the following sequence of instructions:
Modified: tools/branches/gsoc2010-decompiler/decompiler/doc/disassembler.tex
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/doc/disassembler.tex 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/doc/disassembler.tex 2010-08-14 22:11:24 UTC (rev 52094)
@@ -38,7 +38,7 @@
This is particularly important during code flow analysis; since this part is engine-independent, the analysis must have some way of distinguishing the different types of instructions. Additionally, this information can be used during code generation to generalize the recognition of constructs--for example, the code generated for addition and the code generated for multiplication will generally be identical, with the exception of that single arithmetic instruction doing the work.
-Most of the types are self-explanatory, with the possible exception of \code{kSpecial}. \code{kSpecial} should be used for all "magic functions"--opcodes that perform some function specific to the engine, like playing a sound, drawing a graphic, or saving the game.
+Most of the types are self-explanatory, with the possible exception of \code{kSpecialCallInstType}. \code{kSpecialCallInstType} should be used for all "magic functions"--opcodes that perform some function specific to the engine, like playing a sound, drawing a graphic, or saving the game.
During code generation, some instruction types have a pre-defined handling, while others must be handled on your own. It is possible to override the default handling for any or all opcodes if you wish. For details, see Section~\vref{sec:codegen}.
@@ -134,8 +134,8 @@
\begin{C++}
\begin{lstlisting}
START_OPCODES;
- OPCODE(0x01, "POP", kStack, -1, "");
- OPCODE(0x03, "POP2", kStack, -2, "");
+ OPCODE(0x01, "POP", kStackInstType, -1, "");
+ OPCODE(0x03, "POP2", kStackInstType, -2, "");
END_OPCODES;
\end{lstlisting}
\end{C++}
@@ -182,7 +182,7 @@
_address}};
}
s << '"';
- p->_type = kString;
+ p->_type = kStringParamType;
p->_value = s.str();
}
break;
@@ -200,11 +200,11 @@
\begin{C++}
\begin{lstlisting}
START_OPCODES;
- OPCODE(0x00, "PUSH", kStack, 1, "B");
- OPCODE(0x01, "POP", kStack, -1, "");
- OPCODE(0x02, "PUSH", kStack, 1, "w");
- OPCODE(0x03, "POP2", kStack, -2, "");
- OPCODE(0x80, "PRINT", kSpecial, 0, "c");
+ OPCODE(0x00, "PUSH", kStackInstType, 1, "B");
+ OPCODE(0x01, "POP", kStackInstType, -1, "");
+ OPCODE(0x02, "PUSH", kStackInstType, 1, "w");
+ OPCODE(0x03, "POP2", kStackInstType, -2, "");
+ OPCODE(0x80, "PRINT", kSpecialCallInstType, 0, "c");
END_OPCODES;
\end{lstlisting}
\end{C++}
@@ -219,13 +219,13 @@
\begin{C++}
\begin{lstlisting}
START_OPCODES;
- OPCODE(0x00, "PUSH", kStack, 1, "B");
- OPCODE(0x01, "POP", kStack, -1, "");
- OPCODE(0x02, "PUSH", kStack, 1, "w");
- OPCODE(0x03, "POP2", kStack, -2, "");
- OPCODE(0x80, "PRINT", kSpecial, 0, "c");
+ OPCODE(0x00, "PUSH", kStackInstType, 1, "B");
+ OPCODE(0x01, "POP", kStackInstType, -1, "");
+ OPCODE(0x02, "PUSH", kStackInstType, 1, "w");
+ OPCODE(0x03, "POP2", kStackInstType, -2, "");
+ OPCODE(0x80, "PRINT", kSpecialCallInstType, 0, "c");
START_SUBOPCODE(0xFF);
- OPCODE(0x00, "HALT", kSpecial, 0, "");
+ OPCODE(0x00, "HALT", kSpecialCallInstType, 0, "");
END_SUBOPCODE;
END_OPCODES;
\end{lstlisting}
@@ -245,7 +245,7 @@
\begin{C++}
\begin{lstlisting}
START_OPCODES;
- OPCODE_MD(0x14, "add", kBinaryOp, -1, "", "+");
+ OPCODE_MD(0x14, "add", kBinaryOpInstType, -1, "", "+");
END_OPCODES;
\end{lstlisting}
\end{C++}
Modified: tools/branches/gsoc2010-decompiler/decompiler/graph.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/graph.h 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/graph.h 2010-08-14 22:11:24 UTC (rev 52094)
@@ -41,12 +41,12 @@
* Enumeration representing the different kinds of groups.
*/
enum GroupType {
- kNormal, ///< Normal group.
- kWhileCond, ///< Group is the condition check for a while-loop.
- kDoWhileCond, ///< Group is the condition check for a do-while-loop.
- kIfCond, ///< Group is the condition check for an if.
- kBreak, ///< Group is a break.
- kContinue ///< Group is a continue.
+ kNormalGroupType, ///< Normal group.
+ kWhileCondGroupType, ///< Group is the condition check for a while-loop.
+ kDoWhileCondGroupType, ///< Group is the condition check for a do-while-loop.
+ kIfCondGroupType, ///< Group is the condition check for an if.
+ kBreakGroupType, ///< Group is a break.
+ kContinueGroupType ///< Group is a continue.
};
struct Group;
@@ -252,7 +252,7 @@
/**
* Parameterless constructor for Group. Required for use with STL and Boost, should not be called manually.
*/
- Group() : _refCount(0), _stackLevel(-1), _type(kNormal) { }
+ Group() : _refCount(0), _stackLevel(-1), _type(kNormalGroupType) { }
/**
* Constructor for Group.
@@ -267,7 +267,7 @@
_start = start;
_end = end;
_stackLevel = -1;
- _type = kNormal;
+ _type = kNormalGroupType;
_prev = prev.get();
_startElse = false;
if (_prev != NULL)
@@ -286,22 +286,22 @@
friend std::ostream &operator<<(std::ostream &output, GroupPtr group) {
output << "{Block type: ";
switch(group->_type) {
- case kNormal:
+ case kNormalGroupType:
output << "Normal";
break;
- case kWhileCond:
+ case kWhileCondGroupType:
output << "While condition";
break;
- case kDoWhileCond:
+ case kDoWhileCondGroupType:
output << "Do-while condition";
break;
- case kIfCond:
+ case kIfCondGroupType:
output << "If condition";
break;
- case kBreak:
+ case kBreakGroupType:
output << "Break";
break;
- case kContinue:
+ case kContinueGroupType:
output << "Continue";
break;
}
@@ -321,18 +321,18 @@
if (param != inst->_params.begin())
output << ",";
output << " ";
- if (param->_type != kString) {
- if (inst->_type == kCondJump || inst->_type == kCondJumpRel || inst->_type == kJump || inst->_type == kJumpRel || inst->_type == kCall) {
+ if (param->_type != kStringParamType) {
+ if (inst->_type == kCondJumpInstType || inst->_type == kCondJumpRelInstType || inst->_type == kJumpInstType || inst->_type == kJumpRelInstType || inst->_type == kCallInstType) {
// Output numerical arguments to jumps in hexadecimal
switch (param->_type) {
- case kSByte:
- case kShort:
- case kInt:
+ case kSByteParamType:
+ case kShortParamType:
+ case kIntParamType:
output << boost::format(" 0x%X") % param->getSigned();
break;
- case kByte:
- case kUShort:
- case kUInt:
+ case kByteParamType:
+ case kUShortParamType:
+ case kUIntParamType:
output << boost::format(" 0x%X") % param->getUnsigned();
break;
default:
Modified: tools/branches/gsoc2010-decompiler/decompiler/instruction.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/instruction.h 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/instruction.h 2010-08-14 22:11:24 UTC (rev 52094)
@@ -34,33 +34,33 @@
* Enumeration for categorizing the different kinds of instructions.
*/
enum InstType {
- kBinaryOp, ///< Binary operation (e.g. +, &&, etc.), including comparisons.
- kCall, ///< Regular function call.
- kCondJump, ///< Conditional jump (absolute address).
- kCondJumpRel, ///< Conditional jump (relative address).
- kDup, ///< Instruction duplicates the most recent stack entry.
- kJump, ///< Unconditional jump (absolute address).
- kJumpRel, ///< Unconditional jump (relative address).
- kLoad, ///< Load value to stack.
- kReturn, ///< Return from regular function call.
- kSpecial, ///< Special functions.
- kStack, ///< Stack allocation or deallocation (altering stack pointer).
- kStore, ///< Store value from stack in memory.
- kUnaryOpPre, ///< Unary operation (e.g. !) with operator placed before the operator.
- kUnaryOpPost ///< Unary operation with operator placed after the operator.
+ kBinaryOpInstType, ///< Binary operation (e.g. +, &&, etc.), including comparisons.
+ kCallInstType, ///< Regular function call.
+ kCondJumpInstType, ///< Conditional jump (absolute address).
+ kCondJumpRelInstType, ///< Conditional jump (relative address).
+ kDupInstType, ///< Instruction duplicates the most recent stack entry.
+ kJumpInstType, ///< Unconditional jump (absolute address).
+ kJumpRelInstType, ///< Unconditional jump (relative address).
+ kLoadInstType, ///< Load value to stack.
+ kReturnInstType, ///< Return from regular function call.
+ kSpecialCallInstType, ///< Special functions.
+ kStackInstType, ///< Stack allocation or deallocation (altering stack pointer).
+ kStoreInstType, ///< Store value from stack in memory.
+ kUnaryOpPreInstType, ///< Unary operation (e.g. !) with operator placed before the operator.
+ kUnaryOpPostInstType ///< Unary operation with operator placed after the operator.
};
/**
* Enumeration for categorizing the different kinds of parameters.
*/
enum ParamType {
- kSByte, ///< Signed 8-bit integer.
- kByte, ///< Unsigned 8-bit integer.
- kShort, ///< Signed 16-bit integer.
- kUShort, ///< Unsigned 16-bit integer.
- kInt, ///< Signed 32-bit integer.
- kUInt, ///< Unsigned 32-bit integer.
- kString ///< Text string.
+ kSByteParamType, ///< Signed 8-bit integer.
+ kByteParamType, ///< Unsigned 8-bit integer.
+ kShortParamType, ///< Signed 16-bit integer.
+ kUShortParamType, ///< Unsigned 16-bit integer.
+ kIntParamType, ///< Signed 32-bit integer.
+ kUIntParamType, ///< Unsigned 32-bit integer.
+ kStringParamType ///< Text string.
};
/**
@@ -112,7 +112,7 @@
std::string _codeGenData; ///< String containing metadata for code generation. See the extended documentation for details.
Instruction(uint32 opcode = 0, uint32 address = 0,
- std::string name = "", InstType type = kSpecial, int16 stackChange = 0) :
+ std::string name = "", InstType type = kSpecialCallInstType, int16 stackChange = 0) :
_opcode(opcode), _address(address), _name(name), _type(type), _stackChange(stackChange) {}
/**
@@ -128,17 +128,17 @@
for (param = inst._params.begin(); param != inst._params.end(); ++param) {
if (param != inst._params.begin())
output << ",";
- if (inst._type == kCondJump || inst._type == kCondJumpRel || inst._type == kJump || inst._type == kJumpRel || inst._type == kCall) {
+ if (inst._type == kCondJumpInstType || inst._type == kCondJumpRelInstType || inst._type == kJumpInstType || inst._type == kJumpRelInstType || inst._type == kCallInstType) {
// Output numerical arguments to jumps in hexadecimal
switch (param->_type) {
- case kSByte:
- case kShort:
- case kInt:
+ case kSByteParamType:
+ case kShortParamType:
+ case kIntParamType:
output << boost::format(" 0x%X") % param->getSigned();
break;
- case kByte:
- case kUShort:
- case kUInt:
+ case kByteParamType:
+ case kUShortParamType:
+ case kUIntParamType:
output << boost::format(" 0x%X") % param->getUnsigned();
break;
default:
Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.cpp 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.cpp 2010-08-14 22:11:24 UTC (rev 52094)
@@ -37,7 +37,7 @@
void Kyra::Kyra2CodeGenerator::processInst(const Instruction inst) {
switch (inst._type) {
- case kLoad:
+ case kLoadInstType:
switch (inst._opcode) {
case 2:
// If something has been called previously in this group, don't output retval variable
@@ -71,7 +71,7 @@
break;
}
break;
- case kStore:
+ case kStoreInstType:
switch (inst._opcode) {
case 8:
{
@@ -105,7 +105,7 @@
break;
}
break;
- case kStack:
+ case kStackInstType:
if (inst._opcode == 12) {
for (int i = inst._params[0].getSigned(); i != 0; --i) {
if (!_stack.empty())
@@ -119,12 +119,12 @@
}
}
break;
- case kCondJump:
+ case kCondJumpInstType:
switch (_curGroup->_type) {
- case kIfCond:
- case kWhileCond:
+ case kIfCondGroupType:
+ case kWhileCondGroupType:
break;
- case kDoWhileCond:
+ case kDoWhileCondGroupType:
_stack.push(new UnaryOpEntry(_stack.pop(), "!", false));
break;
default:
@@ -137,7 +137,7 @@
}
CodeGenerator::processInst(inst);
break;
- case kCall:
+ case kCallInstType:
{
_argList.clear();
Function f = _engine->_functions.find(inst._params[0].getUnsigned())->second;
@@ -145,7 +145,7 @@
processSpecialMetadata(inst, f._metadata[i], i);
_stack.push(new CallEntry(f._name, _argList));
// Leave call on stack if this is a condition, or other calls follow in same group
- if (_curGroup->_type == kIfCond || _curGroup->_type == kWhileCond || _curGroup->_type == kDoWhileCond || inst._address != findLastCall()._address) {
+ if (_curGroup->_type == kIfCondGroupType || _curGroup->_type == kWhileCondGroupType || _curGroup->_type == kDoWhileCondGroupType || inst._address != findLastCall()._address) {
break;
} else if (!f._retVal) {
std::stringstream stream;
@@ -157,7 +157,7 @@
}
break;
}
- case kSpecial:
+ case kSpecialCallInstType:
{
if (inst._opcode != 14)
return;
@@ -168,7 +168,7 @@
processSpecialMetadata(inst, metadata[i], i);
_stack.push(new CallEntry(inst._name, _argList));
// Leave call on stack if this is a condition, or other calls follow in same group
- if (_curGroup->_type == kIfCond || _curGroup->_type == kWhileCond || _curGroup->_type == kDoWhileCond || inst._address != findLastCall()._address) {
+ if (_curGroup->_type == kIfCondGroupType || _curGroup->_type == kWhileCondGroupType || _curGroup->_type == kDoWhileCondGroupType || inst._address != findLastCall()._address) {
break;
} else if (!returnsValue) {
std::stringstream stream;
@@ -189,7 +189,7 @@
const Instruction &Kyra::Kyra2CodeGenerator::findFirstCall() {
ConstInstIterator it = _curGroup->_start;
do {
- if (it->_type == kCall || (it->_type == kSpecial && it->_opcode == 14))
+ if (it->_type == kCallInstType || (it->_type == kSpecialCallInstType && it->_opcode == 14))
return *it;
} while (it++ != _curGroup->_end);
@@ -199,7 +199,7 @@
const Instruction &Kyra::Kyra2CodeGenerator::findLastCall() {
ConstInstIterator it = _curGroup->_end;
do {
- if (it->_type == kCall || (it->_type == kSpecial && it->_opcode == 14))
+ if (it->_type == kCallInstType || (it->_type == kSpecialCallInstType && it->_opcode == 14))
return *it;
} while (it-- != _curGroup->_start);
@@ -214,7 +214,7 @@
case 's':
{
EntryPtr p = _stack.peekPos(pos);
- if (p->_type == seInt) {
+ if (p->_type == kIntStackEntry) {
IntEntry *ie = (IntEntry *)p.get();
addArg(new StringEntry(((Kyra::Kyra2Engine *)_engine)->_textStrings[ie->getValue()]));
} else {
Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.h 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.h 2010-08-14 22:11:24 UTC (rev 52094)
@@ -34,7 +34,7 @@
private:
/**
* Finds the first call instruction in the current group and returns it.
- * The call may either be a kCall or kSpecial.
+ * The call may either be a kCallInstType or kSpecialCallInstType.
* Used to check whether retVal should be output by pushRet.
*
* @return The first call instruction in the current group. If no calls are found, returns the first instruction.
@@ -43,7 +43,7 @@
/**
* Finds the last call instruction in the current group and returns it.
- * The call may either be a kCall or kSpecial.
+ * The call may either be a kCallInstType or kSpecialCallInstType.
* Used to check whether retVal should be output by calls.
*
* @return The last call instruction in the current group. If no calls are found, returns the last instruction.
@@ -56,7 +56,7 @@
* @param engine Pointer to the Engine used for the script.
* @param output The std::ostream to output the code to.
*/
- Kyra2CodeGenerator(Engine *engine, std::ostream &output) : CodeGenerator(engine, output, kLIFO, kLIFO) {}
+ Kyra2CodeGenerator(Engine *engine, std::ostream &output) : CodeGenerator(engine, output, kLIFOArgOrder, kLIFOArgOrder) {}
protected:
void processInst(const Instruction inst);
virtual void processSpecialMetadata(const Instruction &inst, char c, int pos);
Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp 2010-08-14 22:11:24 UTC (rev 52094)
@@ -401,10 +401,10 @@
if (hasParam) { \
Parameter p; \
if (isSigned) { \
- p._type = kShort; \
+ p._type = kShortParamType; \
p._value = parameter; \
} else { \
- p._type = kUShort; \
+ p._type = kUShortParamType; \
p._value = (uint32)parameter; \
} \
LAST_INST._params.push_back(p);\
@@ -416,16 +416,16 @@
parameter *= 2;
if (parameter < minFuncAddr)
jumpTargets.insert(_insts.size());
- OPCODE("jumpTo", kJump, 0, true, false);
+ OPCODE("jumpTo", kJumpInstType, 0, true, false);
break;
case 1:
- OPCODE("setRetValue", kStore, 0, true, true);
+ OPCODE("setRetValue", kStoreInstType, 0, true, true);
break;
case 2:
if (parameter == 0) {
- OPCODE("pushRet", kLoad, 1, false, false);
+ OPCODE("pushRet", kLoadInstType, 1, false, false);
} else if (parameter == 1) {
- OPCODE("pushPos", kSpecial, 0, false, false); // Sets up function call
+ OPCODE("pushPos", kSpecialCallInstType, 0, false, false); // Sets up function call
} else {
// Error: invalid parameter halts execution
throw UnknownOpcodeException(address, opcode);
@@ -433,41 +433,41 @@
break;
case 3:
case 4:
- OPCODE("push", kLoad, 1, true, true);
+ OPCODE("push", kLoadInstType, 1, true, true);
break;
case 5:
- OPCODE("pushVar", kLoad, 1, true, true);
+ OPCODE("pushVar", kLoadInstType, 1, true, true);
break;
case 6:
- OPCODE("pushBPNeg", kLoad, 1, true, true);
+ OPCODE("pushBPNeg", kLoadInstType, 1, true, true);
break;
case 7:
- OPCODE("pushBPAdd", kLoad, 1, true, true);
+ OPCODE("pushBPAdd", kLoadInstType, 1, true, true);
break;
case 8:
if (parameter == 0) {
- OPCODE("popRet", kStore, -1, false, false);
+ OPCODE("popRet", kStoreInstType, -1, false, false);
} else if (parameter == 1) {
- OPCODE("popPos", kReturn, 0, false, false); // Returns from function call
+ OPCODE("popPos", kReturnInstType, 0, false, false); // Returns from function call
} else {
// Error: invalid parameter halts execution
throw UnknownOpcodeException(address, opcode);
}
break;
case 9:
- OPCODE("popVar", kStore, -1, true, true);
+ OPCODE("popVar", kStoreInstType, -1, true, true);
break;
case 10:
- OPCODE("popBPNeg", kStore, -1, true, true);
+ OPCODE("popBPNeg", kStoreInstType, -1, true, true);
break;
case 11:
- OPCODE("popBPAdd", kStore, -1, true, true);
+ OPCODE("popBPAdd", kStoreInstType, -1, true, true);
break;
case 12:
- OPCODE("addSP", kStack, -parameter, true, true);
+ OPCODE("addSP", kStackInstType, -parameter, true, true);
break;
case 13:
- OPCODE("subSP", kStack, parameter, true, true);
+ OPCODE("subSP", kStackInstType, parameter, true, true);
break;
case 14:
parameter = (uint8)parameter;
@@ -475,21 +475,21 @@
// Error: unknown function
throw UnknownOpcodeException(address, opcode);
}
- OPCODE_MD(_funcs[parameter]._name, kSpecial, 0, false, false, _funcs[parameter]._metadata)
+ OPCODE_MD(_funcs[parameter]._name, kSpecialCallInstType, 0, false, false, _funcs[parameter]._metadata)
break;
case 15:
parameter *= 2;
if (parameter < minFuncAddr)
jumpTargets.insert(_insts.size());
- OPCODE("ifNotJmp", kCondJump, -1, true, false);
+ OPCODE("ifNotJmp", kCondJumpInstType, -1, true, false);
break;
case 16:
if (parameter == 0) {
- OPCODE_MD("boolNegate", kUnaryOpPre, 0, false, false, "!");
+ OPCODE_MD("boolNegate", kUnaryOpPreInstType, 0, false, false, "!");
} else if (parameter == 1) {
- OPCODE_MD("arithmeticNegate", kUnaryOpPre, 0, false, false,"-");
+ OPCODE_MD("arithmeticNegate", kUnaryOpPreInstType, 0, false, false,"-");
} else if (parameter == 2) {
- OPCODE_MD("bitwiseNegate", kUnaryOpPre, 0, false, false, "~");
+ OPCODE_MD("bitwiseNegate", kUnaryOpPreInstType, 0, false, false, "~");
} else {
// Error: invalid parameter halts execution
throw UnknownOpcodeException(address, opcode);
@@ -498,58 +498,58 @@
case 17:
switch (parameter) {
case 0:
- OPCODE_MD("eval_band", kBinaryOp, -1, false, false, "&&");
+ OPCODE_MD("eval_band", kBinaryOpInstType, -1, false, false, "&&");
break;
case 1:
- OPCODE_MD("eval_bor", kBinaryOp, -1, false, false, "||");
+ OPCODE_MD("eval_bor", kBinaryOpInstType, -1, false, false, "||");
break;
case 2:
- OPCODE_MD("eval_eq", kBinaryOp, -1, false, false, "==");
+ OPCODE_MD("eval_eq", kBinaryOpInstType, -1, false, false, "==");
break;
case 3:
- OPCODE_MD("eval_neq", kBinaryOp, -1, false, false, "!=");
+ OPCODE_MD("eval_neq", kBinaryOpInstType, -1, false, false, "!=");
break;
case 4:
- OPCODE_MD("eval_leq", kBinaryOp, -1, false, false, "<=");
+ OPCODE_MD("eval_leq", kBinaryOpInstType, -1, false, false, "<=");
break;
case 5:
- OPCODE_MD("eval_lt", kBinaryOp, -1, false, false, "<");
+ OPCODE_MD("eval_lt", kBinaryOpInstType, -1, false, false, "<");
break;
case 6:
- OPCODE_MD("eval_geq", kBinaryOp, -1, false, false, ">=");
+ OPCODE_MD("eval_geq", kBinaryOpInstType, -1, false, false, ">=");
break;
case 7:
- OPCODE_MD("eval_gt", kBinaryOp, -1, false, false, ">");
+ OPCODE_MD("eval_gt", kBinaryOpInstType, -1, false, false, ">");
break;
case 8:
- OPCODE_MD("eval_add", kBinaryOp, -1, false, false, "+");
+ OPCODE_MD("eval_add", kBinaryOpInstType, -1, false, false, "+");
break;
case 9:
- OPCODE_MD("eval_sub", kBinaryOp, -1, false, false, "-");
+ OPCODE_MD("eval_sub", kBinaryOpInstType, -1, false, false, "-");
break;
case 10:
- OPCODE_MD("eval_mult", kBinaryOp, -1, false, false, "*");
+ OPCODE_MD("eval_mult", kBinaryOpInstType, -1, false, false, "*");
break;
case 11:
- OPCODE_MD("eval_div", kBinaryOp, -1, false, false, "/");
+ OPCODE_MD("eval_div", kBinaryOpInstType, -1, false, false, "/");
break;
case 12:
- OPCODE_MD("eval_shr", kBinaryOp, -1, false, false, ">>");
+ OPCODE_MD("eval_shr", kBinaryOpInstType, -1, false, false, ">>");
break;
case 13:
- OPCODE_MD("eval_shl", kBinaryOp, -1, false, false, "<<");
+ OPCODE_MD("eval_shl", kBinaryOpInstType, -1, false, false, "<<");
break;
case 14:
- OPCODE_MD("eval_land", kBinaryOp, -1, false, false, "&");
+ OPCODE_MD("eval_land", kBinaryOpInstType, -1, false, false, "&");
break;
case 15:
- OPCODE_MD("eval_lor", kBinaryOp, -1, false, false, "|");
+ OPCODE_MD("eval_lor", kBinaryOpInstType, -1, false, false, "|");
break;
case 16:
- OPCODE_MD("eval_mod", kBinaryOp, -1, false, false, "%");
+ OPCODE_MD("eval_mod", kBinaryOpInstType, -1, false, false, "%");
break;
case 17:
- OPCODE_MD("eval_xor", kBinaryOp, -1, false, false, "^");
+ OPCODE_MD("eval_xor", kBinaryOpInstType, -1, false, false, "^");
break;
default:
// Error: invalid parameter halts execution
@@ -558,7 +558,7 @@
}
break;
case 18:
- OPCODE("setRetAndJmp", kSpecial, -2, false, false);
+ OPCODE("setRetAndJmp", kSpecialCallInstType, -2, false, false);
break;
default:
throw UnknownOpcodeException(i*2, code);
@@ -585,9 +585,9 @@
// Correct jumps to functions so they're treated as calls
bool lastWasPushPos = false;
for (InstIterator it = _insts.begin(); it != _insts.end(); ++it) {
- if (it->_type == kJump || it->_type == kCondJump) {
+ if (it->_type == kJumpInstType || it->_type == kCondJumpInstType) {
if (lastWasPushPos || _engine->_functions.find(it->_params[0].getUnsigned()) != _engine->_functions.end()) {
- it->_type = kCall;
+ it->_type = kCallInstType;
}
}
lastWasPushPos = (it->_name.compare("pushPos") == 0);
Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp 2010-08-14 22:11:24 UTC (rev 52094)
@@ -40,7 +40,7 @@
// can just look directly at the opcode, but this should be easier
// to read.
switch (inst._type) {
- case kLoad:
+ case kLoadInstType:
switch (inst._opcode) {
case 0x00: // pushByte
_stack.push(new IntEntry(inst._params[0].getUnsigned(), false));
@@ -71,7 +71,7 @@
}
}
break;
- case kStore:
+ case kStoreInstType:
switch (inst._opcode) {
case 0x42: // writeByteVar
case 0x43: // writeWordVar
@@ -110,19 +110,19 @@
break;
}
break;
- case kStack:
+ case kStackInstType:
// Only two opcodes in SCUMMv6, 0x1A and 0xA7: both are single item pop
_stack.pop();
//addOutputLine("// pop();");
break;
- case kCondJumpRel:
+ case kCondJumpRelInstType:
switch (_curGroup->_type) {
- case kIfCond:
- case kWhileCond:
+ case kIfCondGroupType:
+ case kWhileCondGroupType:
if (inst._opcode == 0x5C) // jumpTrue
_stack.push(new UnaryOpEntry(_stack.pop(), "!", false));
break;
- case kDoWhileCond:
+ case kDoWhileCondGroupType:
if (inst._opcode == 0x5D) // jumpFalse
_stack.push(new UnaryOpEntry(_stack.pop(), "!", false));
break;
@@ -136,7 +136,7 @@
}
CodeGenerator::processInst(inst);
break;
- case kUnaryOpPost:
+ case kUnaryOpPostInstType:
switch (inst._opcode) {
case 0x4E: // byteVarInc
case 0x4F: // wordVarInc
@@ -167,7 +167,7 @@
break;
}
break;
- case kSpecial:
+ case kSpecialCallInstType:
switch (inst._opcode) {
case 0xA4CD: // arrayOp_assignString
{
@@ -423,12 +423,12 @@
case 'j':
case 'i':
switch (inst._params[0]._type) {
- case kSByte:
- case kShort:
+ case kSByteParamType:
+ case kShortParamType:
addArg(new IntEntry(inst._params[0].getSigned(), true));
break;
- case kByte:
- case kUShort:
+ case kByteParamType:
+ case kUShortParamType:
addArg(new IntEntry(inst._params[0].getUnsigned(), false));
break;
default:
Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h 2010-08-14 22:11:24 UTC (rev 52094)
@@ -71,7 +71,7 @@
* @param engine Pointer to the Engine used for the script.
* @param output The std::ostream to output the code to.
*/
- Scummv6CodeGenerator(Engine *engine, std::ostream &output) : CodeGenerator(engine, output, kFIFO, kFIFO) {}
+ Scummv6CodeGenerator(Engine *engine, std::ostream &output) : CodeGenerator(engine, output, kFIFOArgOrder, kFIFOArgOrder) {}
protected:
void processInst(const Instruction inst);
virtual void processSpecialMetadata(const Instruction &inst, char c, int pos);
Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp 2010-08-14 22:11:24 UTC (rev 52094)
@@ -63,114 +63,114 @@
}
START_OPCODES;
- OPCODE(0x00, "pushByte", kLoad, 1, "B");
- OPCODE(0x01, "pushWord", kLoad, 1, "s");
- OPCODE(0x02, "pushByteVar", kLoad, 1, "B");
- OPCODE(0x03, "pushWordVar", kLoad, 1, "w");
- OPCODE(0x06, "byteArrayRead", kLoad, 0, "B");
- OPCODE(0x07, "wordArrayRead", kLoad, 0, "w");
- OPCODE(0x0A, "byteArrayIndexedRead", kLoad, -1, "B");
- OPCODE(0x0B, "wordArrayIndexedRead", kLoad, -1, "w");
- OPCODE(0x0C, "dup", kDup, 1, "");
- OPCODE_MD(0x0D, "not", kUnaryOpPre, 0, "", "!");
- OPCODE_MD(0x0E, "eq", kBinaryOp, -1, "", "==");
- OPCODE_MD(0x0F, "neq", kBinaryOp, -1, "", "!=");
- OPCODE_MD(0x10, "gt", kBinaryOp, -1, "", ">");
- OPCODE_MD(0x11, "lt", kBinaryOp, -1, "", "<");
- OPCODE_MD(0x12, "le", kBinaryOp, -1, "", "<=");
- OPCODE_MD(0x13, "ge", kBinaryOp, -1, "", ">=");
- OPCODE_MD(0x14, "add", kBinaryOp, -1, "", "+");
- OPCODE_MD(0x15, "sub", kBinaryOp, -1, "", "-");
- OPCODE_MD(0x16, "mul", kBinaryOp, -1, "", "*");
- OPCODE_MD(0x17, "div", kBinaryOp, -1, "", "/");
- OPCODE_MD(0x18, "land", kBinaryOp, -1, "", "&&");
- OPCODE_MD(0x19, "lor", kBinaryOp, -1, "", "||");
- OPCODE(0x1A, "pop", kStack, -1, "");
- OPCODE(0x42, "writeByteVar", kStore, -1, "B");
- OPCODE(0x43, "writeWordVar", kStore, -1, "w");
- OPCODE(0x46, "byteArrayWrite", kStore, -2, "B");
- OPCODE(0x47, "wordArrayWrite", kStore, -2, "w");
- OPCODE(0x4A, "byteArrayIndexedWrite", kStore, -3, "B");
- OPCODE(0x4B, "wordArrayIndexedWrite", kStore, -3, "w");
- OPCODE_MD(0x4E, "byteVarInc", kUnaryOpPost, 0, "B", "++");
- OPCODE_MD(0x4F, "wordVarInc", kUnaryOpPost, 0, "w", "++");
- OPCODE_MD(0x52, "byteArrayInc", kUnaryOpPost, -1, "B", "++");
- OPCODE_MD(0x53, "wordArrayInc", kUnaryOpPost, -1, "w", "++");
- OPCODE_MD(0x56, "byteVarDec", kUnaryOpPost, 0, "B", "--");
- OPCODE_MD(0x57, "wordVarDec", kUnaryOpPost, 0, "w", "--");
- OPCODE_MD(0x5A, "byteArrayDec", kUnaryOpPost, -1, "B", "--");
- OPCODE_MD(0x5B, "wordArrayDec", kUnaryOpPost, -1, "w", "--");
- OPCODE(0x5C, "jumpTrue", kCondJumpRel, -1, "s");
- OPCODE(0x5D, "jumpFalse", kCondJumpRel, -1, "s");
- OPCODE_MD(0x5E, "startScript", kSpecial, 0x1020, "", "lpp"); // Variable stack arguments
- OPCODE_MD(0x5F, "startScriptQuick", kSpecial, 0x1010, "", "lp"); // Variable stack arguments
- OPCODE_MD(0x60, "startObject", kSpecial, 0x1030, "", "lppp"); // Variable stack arguments
- OPCODE_MD(0x61, "drawObject", kSpecial, -2, "", "pp");
- OPCODE_MD(0x62, "drawObjectAt", kSpecial, -3, "", "ppp");
- OPCODE_MD(0x63, "drawBlastObject", kSpecial, -5, "", "ppppp");
- OPCODE_MD(0x64, "setBlastObjectWindow", kSpecial, -4, "", "pppp");
- OPCODE(0x65, "stopObjectCodeA", kSpecial, 0, "");
- OPCODE(0x66, "stopObjectCodeB", kSpecial, 0, "");
- OPCODE(0x67, "endCutscene", kSpecial, 0, "");
- OPCODE_MD(0x68, "beginCutscene", kSpecial, 0x1000, "", "l"); // Variable stack arguments
- OPCODE(0x69, "stopMusic", kSpecial, 0, "");
- OPCODE_MD(0x6A, "freezeUnfreeze", kSpecial, -1, "", "p");
+ OPCODE(0x00, "pushByte", kLoadInstType, 1, "B");
+ OPCODE(0x01, "pushWord", kLoadInstType, 1, "s");
+ OPCODE(0x02, "pushByteVar", kLoadInstType, 1, "B");
+ OPCODE(0x03, "pushWordVar", kLoadInstType, 1, "w");
+ OPCODE(0x06, "byteArrayRead", kLoadInstType, 0, "B");
+ OPCODE(0x07, "wordArrayRead", kLoadInstType, 0, "w");
+ OPCODE(0x0A, "byteArrayIndexedRead", kLoadInstType, -1, "B");
+ OPCODE(0x0B, "wordArrayIndexedRead", kLoadInstType, -1, "w");
+ OPCODE(0x0C, "dup", kDupInstType, 1, "");
+ OPCODE_MD(0x0D, "not", kUnaryOpPreInstType, 0, "", "!");
+ OPCODE_MD(0x0E, "eq", kBinaryOpInstType, -1, "", "==");
+ OPCODE_MD(0x0F, "neq", kBinaryOpInstType, -1, "", "!=");
+ OPCODE_MD(0x10, "gt", kBinaryOpInstType, -1, "", ">");
+ OPCODE_MD(0x11, "lt", kBinaryOpInstType, -1, "", "<");
+ OPCODE_MD(0x12, "le", kBinaryOpInstType, -1, "", "<=");
+ OPCODE_MD(0x13, "ge", kBinaryOpInstType, -1, "", ">=");
+ OPCODE_MD(0x14, "add", kBinaryOpInstType, -1, "", "+");
+ OPCODE_MD(0x15, "sub", kBinaryOpInstType, -1, "", "-");
+ OPCODE_MD(0x16, "mul", kBinaryOpInstType, -1, "", "*");
+ OPCODE_MD(0x17, "div", kBinaryOpInstType, -1, "", "/");
+ OPCODE_MD(0x18, "land", kBinaryOpInstType, -1, "", "&&");
+ OPCODE_MD(0x19, "lor", kBinaryOpInstType, -1, "", "||");
+ OPCODE(0x1A, "pop", kStackInstType, -1, "");
+ OPCODE(0x42, "writeByteVar", kStoreInstType, -1, "B");
+ OPCODE(0x43, "writeWordVar", kStoreInstType, -1, "w");
+ OPCODE(0x46, "byteArrayWrite", kStoreInstType, -2, "B");
+ OPCODE(0x47, "wordArrayWrite", kStoreInstType, -2, "w");
+ OPCODE(0x4A, "byteArrayIndexedWrite", kStoreInstType, -3, "B");
+ OPCODE(0x4B, "wordArrayIndexedWrite", kStoreInstType, -3, "w");
+ OPCODE_MD(0x4E, "byteVarInc", kUnaryOpPostInstType, 0, "B", "++");
+ OPCODE_MD(0x4F, "wordVarInc", kUnaryOpPostInstType, 0, "w", "++");
+ OPCODE_MD(0x52, "byteArrayInc", kUnaryOpPostInstType, -1, "B", "++");
+ OPCODE_MD(0x53, "wordArrayInc", kUnaryOpPostInstType, -1, "w", "++");
+ OPCODE_MD(0x56, "byteVarDec", kUnaryOpPostInstType, 0, "B", "--");
+ OPCODE_MD(0x57, "wordVarDec", kUnaryOpPostInstType, 0, "w", "--");
+ OPCODE_MD(0x5A, "byteArrayDec", kUnaryOpPostInstType, -1, "B", "--");
+ OPCODE_MD(0x5B, "wordArrayDec", kUnaryOpPostInstType, -1, "w", "--");
+ OPCODE(0x5C, "jumpTrue", kCondJumpRelInstType, -1, "s");
+ OPCODE(0x5D, "jumpFalse", kCondJumpRelInstType, -1, "s");
+ OPCODE_MD(0x5E, "startScript", kSpecialCallInstType, 0x1020, "", "lpp"); // Variable stack arguments
+ OPCODE_MD(0x5F, "startScriptQuick", kSpecialCallInstType, 0x1010, "", "lp"); // Variable stack arguments
+ OPCODE_MD(0x60, "startObject", kSpecialCallInstType, 0x1030, "", "lppp"); // Variable stack arguments
+ OPCODE_MD(0x61, "drawObject", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x62, "drawObjectAt", kSpecialCallInstType, -3, "", "ppp");
+ OPCODE_MD(0x63, "drawBlastObject", kSpecialCallInstType, -5, "", "ppppp");
+ OPCODE_MD(0x64, "setBlastObjectWindow", kSpecialCallInstType, -4, "", "pppp");
+ OPCODE(0x65, "stopObjectCodeA", kSpecialCallInstType, 0, "");
+ OPCODE(0x66, "stopObjectCodeB", kSpecialCallInstType, 0, "");
+ OPCODE(0x67, "endCutscene", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x68, "beginCutscene", kSpecialCallInstType, 0x1000, "", "l"); // Variable stack arguments
+ OPCODE(0x69, "stopMusic", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x6A, "freezeUnfreeze", kSpecialCallInstType, -1, "", "p");
START_SUBOPCODE_WITH_PREFIX(0x6B, "cursorCommand");
- OPCODE(0x90, "cursorOn", kSpecial, 0, "");
- OPCODE(0x91, "cursorOff", kSpecial, 0, "");
- OPCODE(0x92, "userputOn", kSpecial, 0, "");
- OPCODE(0x93, "userputOff", kSpecial, 0, "");
- OPCODE(0x94, "softCursorOn", kSpecial, 0, "");
- OPCODE(0x95, "softCursorOff", kSpecial, 0, "");
- OPCODE(0x96, "softUserputOn", kSpecial, 0, "");
- OPCODE(0x97, "softUserputOff", kSpecial, 0, "");
- OPCODE_MD(0x99, "setCursorImg", kSpecial, -2, "", "z");
- OPCODE_MD(0x9A, "setCursorHotspot", kSpecial, -2, "", "pp");
- OPCODE_MD(0x9C, "initCharset", kSpecial, -1, "", "p");
- OPCODE_MD(0x9D, "charsetColors", kSpecial, 0x1000, "", "l"); // Variable stack arguments
- OPCODE_MD(0xD6, "setCursorTransparency", kSpecial, -1, "", "p");
+ OPCODE(0x90, "cursorOn", kSpecialCallInstType, 0, "");
+ OPCODE(0x91, "cursorOff", kSpecialCallInstType, 0, "");
+ OPCODE(0x92, "userputOn", kSpecialCallInstType, 0, "");
+ OPCODE(0x93, "userputOff", kSpecialCallInstType, 0, "");
+ OPCODE(0x94, "softCursorOn", kSpecialCallInstType, 0, "");
+ OPCODE(0x95, "softCursorOff", kSpecialCallInstType, 0, "");
+ OPCODE(0x96, "softUserputOn", kSpecialCallInstType, 0, "");
+ OPCODE(0x97, "softUserputOff", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x99, "setCursorImg", kSpecialCallInstType, -2, "", "z");
+ OPCODE_MD(0x9A, "setCursorHotspot", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x9C, "initCharset", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x9D, "charsetColors", kSpecialCallInstType, 0x1000, "", "l"); // Variable stack arguments
+ OPCODE_MD(0xD6, "setCursorTransparency", kSpecialCallInstType, -1, "", "p");
END_SUBOPCODE;
- OPCODE(0x6C, "breakHere", kSpecial, 0, "");
- OPCODE_MD(0x6D, "ifClassOfIs", kSpecial, 0x1011, "", "rlp"); // Variable stack arguments
- OPCODE_MD(0x6E, "setClass", kSpecial, 0x1010, "", "lp"); // Variable stack arguments
- OPCODE_MD(0x6F, "getState", kSpecial, 0, "", "rp");
- OPCODE_MD(0x70, "setState", kSpecial, -2, "", "pp");
- OPCODE_MD(0x71, "setOwner", kSpecial, -2, "", "pp");
- OPCODE_MD(0x72, "getOwner", kSpecial, 0, "", "rp");
- OPCODE(0x73, "jump", kJumpRel, 0, "s");
- OPCODE_MD(0x74, "startSound", kSpecial, -1, "", "p");
- OPCODE_MD(0x75, "stopSound", kSpecial, -1, "", "p");
- OPCODE_MD(0x76, "startMusic", kSpecial, -1, "", "p");
- OPCODE_MD(0x77, "stopObjectScript", kSpecial, -1, "", "p");
- OPCODE_MD(0x78, "panCameraTo", kSpecial, -1, "", "p");
- OPCODE_MD(0x79, "actorFollowCamera", kSpecial, -1, "", "p");
- OPCODE_MD(0x7A, "setCameraAt", kSpecial, -1, "", "p");
- OPCODE_MD(0x7B, "loadRoom", kSpecial, -1, "", "p");
- OPCODE_MD(0x7C, "stopScript", kSpecial, -1, "", "p");
- OPCODE_MD(0x7D, "walkActorToObj", kSpecial, -3, "", "ppp");
- OPCODE_MD(0x7E, "walkActorTo", kSpecial, -3, "", "ppp");
- OPCODE_MD(0x7F, "putActorAtXY", kSpecial, -4, "", "pppp");
- OPCODE_MD(0x80, "putActorAtObject", kSpecial, -3, "", "zp");
- OPCODE_MD(0x81, "faceActor", kSpecial, -2, "", "pp");
- OPCODE_MD(0x82, "animateActor", kSpecial, -2, "", "pp");
- OPCODE_MD(0x83, "doSentence", kSpecial, -4, "", "pppp");
- OPCODE_MD(0x84, "pickupObject", kSpecial, -2, "", "z");
- OPCODE_MD(0x85, "loadRoomWithEgo", kSpecial, -4, "", "ppz");
- OPCODE_MD(0x87, "getRandomNumber", kSpecial, 0, "", "rp");
- OPCODE_MD(0x88, "getRandomNumberRange", kSpecial, -1, "", "rpp");
- OPCODE_MD(0x8A, "getActorMoving", kSpecial, 0, "", "rp");
- OPCODE_MD(0x8B, "isScriptRunning", kSpecial, 0, "", "rp");
- OPCODE_MD(0x8C, "getActorRoom", kSpecial, 0, "", "rp");
- OPCODE_MD(0x8D, "getObjectX", kSpecial, 0, "", "rp");
- OPCODE_MD(0x8E, "getObjectY", kSpecial, 0, "", "rp");
- OPCODE_MD(0x8F, "getObjectDir", kSpecial, 0, "", "rp");
- OPCODE_MD(0x90, "getActorWalkBox", kSpecial, 0, "", "rp");
- OPCODE_MD(0x91, "getActorCostume", kSpecial, 0, "", "rp");
- OPCODE_MD(0x92, "findInventory", kSpecial, -1, "", "rpp");
- OPCODE_MD(0x93, "getInventoryCount", kSpecial, 0, "", "rp");
- OPCODE_MD(0x94, "getVerbFromXY", kSpecial, -1, "", "rpp");
+ OPCODE(0x6C, "breakHere", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x6D, "ifClassOfIs", kSpecialCallInstType, 0x1011, "", "rlp"); // Variable stack arguments
+ OPCODE_MD(0x6E, "setClass", kSpecialCallInstType, 0x1010, "", "lp"); // Variable stack arguments
+ OPCODE_MD(0x6F, "getState", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x70, "setState", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x71, "setOwner", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x72, "getOwner", kSpecialCallInstType, 0, "", "rp");
+ OPCODE(0x73, "jump", kJumpRelInstType, 0, "s");
+ OPCODE_MD(0x74, "startSound", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x75, "stopSound", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x76, "startMusic", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x77, "stopObjectScript", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x78, "panCameraTo", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x79, "actorFollowCamera", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x7A, "setCameraAt", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x7B, "loadRoom", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x7C, "stopScript", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x7D, "walkActorToObj", kSpecialCallInstType, -3, "", "ppp");
+ OPCODE_MD(0x7E, "walkActorTo", kSpecialCallInstType, -3, "", "ppp");
+ OPCODE_MD(0x7F, "putActorAtXY", kSpecialCallInstType, -4, "", "pppp");
+ OPCODE_MD(0x80, "putActorAtObject", kSpecialCallInstType, -3, "", "zp");
+ OPCODE_MD(0x81, "faceActor", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x82, "animateActor", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x83, "doSentence", kSpecialCallInstType, -4, "", "pppp");
+ OPCODE_MD(0x84, "pickupObject", kSpecialCallInstType, -2, "", "z");
+ OPCODE_MD(0x85, "loadRoomWithEgo", kSpecialCallInstType, -4, "", "ppz");
+ OPCODE_MD(0x87, "getRandomNumber", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x88, "getRandomNumberRange", kSpecialCallInstType, -1, "", "rpp");
+ OPCODE_MD(0x8A, "getActorMoving", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x8B, "isScriptRunning", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x8C, "getActorRoom", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x8D, "getObjectX", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x8E, "getObjectY", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x8F, "getObjectDir", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x90, "getActorWalkBox", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x91, "getActorCostume", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x92, "findInventory", kSpecialCallInstType, -1, "", "rpp");
+ OPCODE_MD(0x93, "getInventoryCount", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x94, "getVerbFromXY", kSpecialCallInstType, -1, "", "rpp");
OPCODE_BASE(0x95)
- OPCODE_BODY("beginOverride", kSpecial, 0, "", "");
+ OPCODE_BODY("beginOverride", kSpecialCallInstType, 0, "", "");
// FIXME/TODO: beginOverride skips the following jump - that jump is instead to a "finally" handler
// To simulate this, we simply skip the jump instruction, so the sequential order appears the same.
// Semantically, it would probably be more correct to model this as a conditional jump,
@@ -179,262 +179,262 @@
_f.seek(3, SEEK_CUR);
_address += 3;
OPCODE_END;
- OPCODE(0x96, "endOverride", kSpecial, 0, "");
- OPCODE_MD(0x97, "setObjectName", kSpecial, -1, "c", "ps");
- OPCODE_MD(0x98, "isSoundRunning", kSpecial, 0, "", "rp");
- OPCODE_MD(0x99, "setBoxFlags", kSpecial, 0x1100, "", "pl"); // Variable stack arguments
- OPCODE(0x9A, "createBoxMatrix", kSpecial, 0, "");
+ OPCODE(0x96, "endOverride", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x97, "setObjectName", kSpecialCallInstType, -1, "c", "ps");
+ OPCODE_MD(0x98, "isSoundRunning", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0x99, "setBoxFlags", kSpecialCallInstType, 0x1100, "", "pl"); // Variable stack arguments
+ OPCODE(0x9A, "createBoxMatrix", kSpecialCallInstType, 0, "");
START_SUBOPCODE_WITH_PREFIX(0x9B, "resourceRoutines");
- OPCODE_MD(0x64, "loadScript", kSpecial, -1, "", "p");
- OPCODE_MD(0x65, "loadSound", kSpecial, -1, "", "p");
- OPCODE_MD(0x66, "loadCostume", kSpecial, -1, "", "p");
- OPCODE_MD(0x67, "loadRoom", kSpecial, -1, "", "p");
- OPCODE_MD(0x68, "nukeScript", kSpecial, -1, "", "p");
- OPCODE_MD(0x69, "nukeSound", kSpecial, -1, "", "p");
- OPCODE_MD(0x6A, "nukeCostume", kSpecial, -1, "", "p");
- OPCODE_MD(0x6B, "nukeRoom", kSpecial, -1, "", "p");
- OPCODE_MD(0x6C, "lockScript", kSpecial, -1, "", "p");
- OPCODE_MD(0x6D, "lockSound", kSpecial, -1, "", "p");
- OPCODE_MD(0x6E, "lockCostume", kSpecial, -1, "", "p");
- OPCODE_MD(0x6F, "lockRoom", kSpecial, -1, "", "p");
- OPCODE_MD(0x70, "unlockScript", kSpecial, -1, "", "p");
- OPCODE_MD(0x71, "unlockSound", kSpecial, -1, "", "p");
- OPCODE_MD(0x72, "unlockCostume", kSpecial, -1, "", "p");
- OPCODE_MD(0x73, "unlockRoom", kSpecial, -1, "", "p");
- OPCODE_MD(0x75, "loadCharset", kSpecial, -1, "", "p");
- OPCODE_MD(0x76, "nukeCharset", kSpecial, -1, "", "p");
- OPCODE_MD(0x77, "loadFlObject", kSpecial, -2, "", "pp");
+ OPCODE_MD(0x64, "loadScript", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x65, "loadSound", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x66, "loadCostume", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x67, "loadRoom", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x68, "nukeScript", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x69, "nukeSound", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x6A, "nukeCostume", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x6B, "nukeRoom", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x6C, "lockScript", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x6D, "lockSound", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x6E, "lockCostume", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x6F, "lockRoom", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x70, "unlockScript", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x71, "unlockSound", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x72, "unlockCostume", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x73, "unlockRoom", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x75, "loadCharset", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x76, "nukeCharset", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x77, "loadFlObject", kSpecialCallInstType, -2, "", "pp");
END_SUBOPCODE;
START_SUBOPCODE_WITH_PREFIX(0x9C, "roomOps");
- OPCODE_MD(0xAC, "roomScroll", kSpecial, -2, "", "pp");
- OPCODE_MD(0xAE, "setScreen", kSpecial, -2, "", "pp");
- OPCODE_MD(0xAF, "setPalColor", kSpecial, -4, "", "pppp");
- OPCODE(0xB0, "shakeOn", kSpecial, 0, "");
- OPCODE(0xB1, "shakeOff", kSpecial, 0, "");
- OPCODE_MD(0xB3, "darkenPalette", kSpecial, -3, "", "ppp");
- OPCODE_MD(0xB4, "saveLoadRoom", kSpecial, -2, "", "pp");
- OPCODE_MD(0xB5, "screenEffect", kSpecial, -1, "", "p");
- OPCODE_MD(0xB6, "darkenPaletteRGB", kSpecial, -5, "", "ppppp");
- OPCODE_MD(0xB7, "setupShadowPalette", kSpecial, -5, "", "ppppp");
- OPCODE_MD(0xBA, "palManipulate", kSpecial, -4, "", "pppp");
- OPCODE_MD(0xBB, "colorCycleDelay", kSpecial, -2, "", "pp");
- OPCODE_MD(0xD5, "setPalette", kSpecial, -1, "", "p");
- OPCODE_MD(0xDC, "copyPalColor", kSpecial, -2, "", "pp");
+ OPCODE_MD(0xAC, "roomScroll", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0xAE, "setScreen", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0xAF, "setPalColor", kSpecialCallInstType, -4, "", "pppp");
+ OPCODE(0xB0, "shakeOn", kSpecialCallInstType, 0, "");
+ OPCODE(0xB1, "shakeOff", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0xB3, "darkenPalette", kSpecialCallInstType, -3, "", "ppp");
+ OPCODE_MD(0xB4, "saveLoadRoom", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0xB5, "screenEffect", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xB6, "darkenPaletteRGB", kSpecialCallInstType, -5, "", "ppppp");
+ OPCODE_MD(0xB7, "setupShadowPalette", kSpecialCallInstType, -5, "", "ppppp");
+ OPCODE_MD(0xBA, "palManipulate", kSpecialCallInstType, -4, "", "pppp");
+ OPCODE_MD(0xBB, "colorCycleDelay", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0xD5, "setPalette", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xDC, "copyPalColor", kSpecialCallInstType, -2, "", "pp");
END_SUBOPCODE;
START_SUBOPCODE_WITH_PREFIX(0x9D, "actorOps");
- OPCODE_MD(0x4C, "setCostume", kSpecial, -1, "", "p");
- OPCODE_MD(0x4D, "setWalkSpeed", kSpecial, -2, "", "pp");
- OPCODE_MD(0x4E, "setSound", kSpecial, 0x1000, "", "l"); // Variable stack arguments
- OPCODE_MD(0x4F, "setWalkFrame", kSpecial, -1, "", "p");
- OPCODE_MD(0x50, "setTalkFrame", kSpecial, -2, "", "pp");
- OPCODE_MD(0x51, "setStandFrame", kSpecial, -1, "", "p");
- OPCODE_MD(0x52, "82?", kSpecial, -3, "", "ppp");
- OPCODE(0x53, "init", kSpecial, 0, "");
- OPCODE_MD(0x54, "setElevation", kSpecial, -1, "", "p");
- OPCODE(0x55, "setDefAnim", kSpecial, 0, "");
- OPCODE_MD(0x56, "setPalette", kSpecial, -2, "", "pp");
- OPCODE_MD(0x57, "setTalkColor", kSpecial, -1, "", "p");
- OPCODE_MD(0x58, "setName", kSpecial, 0, "c", "s");
- OPCODE_MD(0x59, "setInitFrame", kSpecial, -1, "", "p");
- OPCODE_MD(0x5B, "setWidth", kSpecial, -1, "", "p");
- OPCODE_MD(0x5C, "setScale", kSpecial, -1, "", "p");
- OPCODE(0x5D, "setNeverZClip", kSpecial, 0, "");
- OPCODE_MD(0x5E, "setAlwaysZClip", kSpecial, -1, "", "p");
- OPCODE(0x5F, "setIgnoreBoxes", kSpecial, 0, "");
- OPCODE(0x60, "setFollowBoxes", kSpecial, 0, "");
- OPCODE_MD(0x61, "setAnimSpeed", kSpecial, -1, "", "p");
- OPCODE_MD(0x62, "setShadowMode", kSpecial, -1, "", "p");
- OPCODE_MD(0x63, "setTalkPos", kSpecial, -2, "", "pp");
- OPCODE_MD(0xC5, "setCurActor", kSpecial, -1, "", "p");
- OPCODE_MD(0xC6, "setAnimVar", kSpecial, -2, "", "pp");
- OPCODE(0xD7, "setIgnoreTurnsOn", kSpecial, 0, "");
- OPCODE(0xD8, "setIgnoreTurnsOff", kSpecial, 0, "");
- OPCODE(0xD9, "initLittle", kSpecial, 0, "");
- OPCODE_MD(0xE1, "setAlwaysZClip?", kSpecial, -1, "", "p");
- OPCODE_MD(0xE3, "setLayer", kSpecial, -1, "", "p");
- OPCODE_MD(0xE4, "setWalkScript", kSpecial, -1, "", "p");
- OPCODE(0xE5, "setStanding", kSpecial, 0, "");
- OPCODE_MD(0xE6, "setDirection", kSpecial, -1, "", "p");
- OPCODE_MD(0xE7, "turnToDirection", kSpecial, -1, "", "p");
- OPCODE(0xE9, "freeze", kSpecial, 0, "");
- OPCODE(0xEA, "unfreeze", kSpecial, 0, "");
- OPCODE_MD(0xEB, "setTalkScript", kSpecial, -1, "", "p");
+ OPCODE_MD(0x4C, "setCostume", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x4D, "setWalkSpeed", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x4E, "setSound", kSpecialCallInstType, 0x1000, "", "l"); // Variable stack arguments
+ OPCODE_MD(0x4F, "setWalkFrame", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x50, "setTalkFrame", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x51, "setStandFrame", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x52, "82?", kSpecialCallInstType, -3, "", "ppp");
+ OPCODE(0x53, "init", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x54, "setElevation", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x55, "setDefAnim", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x56, "setPalette", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x57, "setTalkColor", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x58, "setName", kSpecialCallInstType, 0, "c", "s");
+ OPCODE_MD(0x59, "setInitFrame", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x5B, "setWidth", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x5C, "setScale", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x5D, "setNeverZClip", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x5E, "setAlwaysZClip", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x5F, "setIgnoreBoxes", kSpecialCallInstType, 0, "");
+ OPCODE(0x60, "setFollowBoxes", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x61, "setAnimSpeed", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x62, "setShadowMode", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x63, "setTalkPos", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0xC5, "setCurActor", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xC6, "setAnimVar", kSpecialCallInstType, -2, "", "pp");
+ OPCODE(0xD7, "setIgnoreTurnsOn", kSpecialCallInstType, 0, "");
+ OPCODE(0xD8, "setIgnoreTurnsOff", kSpecialCallInstType, 0, "");
+ OPCODE(0xD9, "initLittle", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0xE1, "setAlwaysZClip?", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xE3, "setLayer", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xE4, "setWalkScript", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0xE5, "setStanding", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0xE6, "setDirection", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xE7, "turnToDirection", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0xE9, "freeze", kSpecialCallInstType, 0, "");
+ OPCODE(0xEA, "unfreeze", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0xEB, "setTalkScript", kSpecialCallInstType, -1, "", "p");
END_SUBOPCODE;
START_SUBOPCODE_WITH_PREFIX(0x9E, "verbOps");
- OPCODE_MD(0x7C, "loadImg", kSpecial, -1, "", "p");
- OPCODE_MD(0x7D, "loadString", kSpecial, 0, "c", "s");
- OPCODE_MD(0x7E, "setColor", kSpecial, -1, "", "p");
- OPCODE_MD(0x7F, "setHiColor", kSpecial, -1, "", "p");
- OPCODE_MD(0x80, "setXY", kSpecial, -2, "", "pp");
- OPCODE(0x81, "setOn", kSpecial, 0, "");
- OPCODE(0x82, "setOff", kSpecial, 0, "");
- OPCODE(0x83, "kill", kSpecial, 0, "");
- OPCODE(0x84, "init", kSpecial, 0, "");
- OPCODE_MD(0x85, "setDimColor", kSpecial, -1, "", "p");
- OPCODE(0x86, "setDimmed", kSpecial, 0, "");
- OPCODE_MD(0x87, "setKey", kSpecial, -1, "", "p");
- OPCODE(0x88, "setCenter", kSpecial, 0, "");
- OPCODE_MD(0x89, "setToString", kSpecial, -1, "", "p");
- OPCODE_MD(0x8B, "setToObject", kSpecial, -2, "", "pp");
- OPCODE_MD(0x8C, "setBkColor", kSpecial, -1, "", "p");
- OPCODE_MD(0xC4, "setCurVerb", kSpecial, -1, "", "p");
- OPCODE(0xFF, "redraw", kSpecial, 0, "");
+ OPCODE_MD(0x7C, "loadImg", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x7D, "loadString", kSpecialCallInstType, 0, "c", "s");
+ OPCODE_MD(0x7E, "setColor", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x7F, "setHiColor", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x80, "setXY", kSpecialCallInstType, -2, "", "pp");
+ OPCODE(0x81, "setOn", kSpecialCallInstType, 0, "");
+ OPCODE(0x82, "setOff", kSpecialCallInstType, 0, "");
+ OPCODE(0x83, "kill", kSpecialCallInstType, 0, "");
+ OPCODE(0x84, "init", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x85, "setDimColor", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x86, "setDimmed", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x87, "setKey", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x88, "setCenter", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x89, "setToString", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x8B, "setToObject", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x8C, "setBkColor", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xC4, "setCurVerb", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0xFF, "redraw", kSpecialCallInstType, 0, "");
END_SUBOPCODE;
- OPCODE_MD(0x9F, "getActorFromXY", kSpecial, -1, "", "rpp");
- OPCODE_MD(0xA0, "findObject", kSpecial, -1, "", "rpp");
- OPCODE_MD(0xA1, "pseudoRoom", kSpecial, 0x1010, "", "lp"); // Variable stack arguments
- OPCODE_MD(0xA2, "getActorElevation", kSpecial, 0, "", "rp");
- OPCODE_MD(0xA3, "getVerbEntrypoint", kSpecial, -1, "", "rpp");
+ OPCODE_MD(0x9F, "getActorFromXY", kSpecialCallInstType, -1, "", "rpp");
+ OPCODE_MD(0xA0, "findObject", kSpecialCallInstType, -1, "", "rpp");
+ OPCODE_MD(0xA1, "pseudoRoom", kSpecialCallInstType, 0x1010, "", "lp"); // Variable stack arguments
+ OPCODE_MD(0xA2, "getActorElevation", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0xA3, "getVerbEntrypoint", kSpecialCallInstType, -1, "", "rpp");
START_SUBOPCODE_WITH_PREFIX(0xA4, "arrayOps");
- OPCODE_MD(0xCD, "assignString", kSpecial, -1, "wc", "");
- OPCODE_MD(0xD0, "assignIntList", kSpecial, 0x1100, "w", ""); // Variable stack arguments
- OPCODE_MD(0xD4, "assign2DimList", kSpecial, 0x1100, "w", ""); // Variable stack arguments
+ OPCODE_MD(0xCD, "assignString", kSpecialCallInstType, -1, "wc", "");
+ OPCODE_MD(0xD0, "assignIntList", kSpecialCallInstType, 0x1100, "w", ""); // Variable stack arguments
+ OPCODE_MD(0xD4, "assign2DimList", kSpecialCallInstType, 0x1100, "w", ""); // Variable stack arguments
END_SUBOPCODE;
START_SUBOPCODE_WITH_PREFIX(0xA5, "saveRestoreVerbs");
- OPCODE_MD(0x8D, "saveVerbs", kSpecial, -3, "", "ppp");
- OPCODE_MD(0x8E, "restoreVerbs", kSpecial, -3, "", "ppp");
- OPCODE_MD(0x8F, "deleteVerbs", kSpecial, -3, "", "ppp");
+ OPCODE_MD(0x8D, "saveVerbs", kSpecialCallInstType, -3, "", "ppp");
+ OPCODE_MD(0x8E, "restoreVerbs", kSpecialCallInstType, -3, "", "ppp");
+ OPCODE_MD(0x8F, "deleteVerbs", kSpecialCallInstType, -3, "", "ppp");
END_SUBOPCODE;
- OPCODE_MD(0xA6, "drawBox", kSpecial, -5, "", "ppppp");
- OPCODE(0xA7, "pop", kStack, -1, "");
- OPCODE_MD(0xA8, "getActorWidth", kSpecial, 0, "", "rp");
+ OPCODE_MD(0xA6, "drawBox", kSpecialCallInstType, -5, "", "ppppp");
+ OPCODE(0xA7, "pop", kStackInstType, -1, "");
+ OPCODE_MD(0xA8, "getActorWidth", kSpecialCallInstType, 0, "", "rp");
START_SUBOPCODE(0xA9); // wait
- OPCODE_MD(0xA8, "waitForActor", kSpecial, -1, "s", "pj");
- OPCODE(0xA9, "waitForMessage", kSpecial, 0, "");
- OPCODE(0xAA, "waitForCamera", kSpecial, 0, "");
- OPCODE(0xAB, "waitForSentence", kSpecial, 0, "");
- OPCODE_MD(0xE2, "waitUntilActorDrawn", kSpecial, -1, "s", "pj");
- OPCODE_MD(0xE8, "waitUntilActorTurned", kSpecial, -1, "s", "pj");
+ OPCODE_MD(0xA8, "waitForActor", kSpecialCallInstType, -1, "s", "pj");
+ OPCODE(0xA9, "waitForMessage", kSpecialCallInstType, 0, "");
+ OPCODE(0xAA, "waitForCamera", kSpecialCallInstType, 0, "");
+ OPCODE(0xAB, "waitForSentence", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0xE2, "waitUntilActorDrawn", kSpecialCallInstType, -1, "s", "pj");
+ OPCODE_MD(0xE8, "waitUntilActorTurned", kSpecialCallInstType, -1, "s", "pj");
END_SUBOPCODE;
- OPCODE_MD(0xAA, "getActorScaleX", kSpecial, 0, "", "rp");
- OPCODE_MD(0xAB, "getActorAnimCounter", kSpecial, 0, "", "rp");
- OPCODE_MD(0xAC, "soundKludge", kSpecial, 0x1000, "", "l"); // Variable stack arguments
- OPCODE_MD(0xAD, "isAnyOf", kSpecial, 0x1011, "", "rlp"); // Variable stack arguments
+ OPCODE_MD(0xAA, "getActorScaleX", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0xAB, "getActorAnimCounter", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0xAC, "soundKludge", kSpecialCallInstType, 0x1000, "", "l"); // Variable stack arguments
+ OPCODE_MD(0xAD, "isAnyOf", kSpecialCallInstType, 0x1011, "", "rlp"); // Variable stack arguments
START_SUBOPCODE_WITH_PREFIX(0xAE, "systemOps");
- OPCODE(0x9E, "restartGame", kSpecial, 0, "");
- OPCODE(0x9F, "pauseGame", kSpecial, 0, "");
- OPCODE(0xA0, "shutDown", kSpecial, 0, "");
+ OPCODE(0x9E, "restartGame", kSpecialCallInstType, 0, "");
+ OPCODE(0x9F, "pauseGame", kSpecialCallInstType, 0, "");
+ OPCODE(0xA0, "shutDown", kSpecialCallInstType, 0, "");
END_SUBOPCODE;
- OPCODE_MD(0xAF, "isActorInBox", kSpecial, -1, "", "rpp");
- OPCODE_MD(0xB0, "delay", kSpecial, -1, "", "p");
- OPCODE_MD(0xB1, "delaySeconds", kSpecial, -1, "", "p");
- OPCODE_MD(0xB2, "delayMinutes", kSpecial, -1, "", "p");
- OPCODE(0xB3, "stopSentence", kSpecial, 0, "");
+ OPCODE_MD(0xAF, "isActorInBox", kSpecialCallInstType, -1, "", "rpp");
+ OPCODE_MD(0xB0, "delay", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xB1, "delaySeconds", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xB2, "delayMinutes", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0xB3, "stopSentence", kSpecialCallInstType, 0, "");
START_SUBOPCODE_WITH_PREFIX(0xB4, "printLine");
- OPCODE_MD(0x41, "XY", kSpecial, -2, "", "pp");
- OPCODE_MD(0x42, "color", kSpecial, -1, "", "p");
- OPCODE_MD(0x43, "right", kSpecial, -1, "", "p");
- OPCODE(0x45, "center", kSpecial, 0, "");
- OPCODE(0x47, "left", kSpecial, 0, "");
- OPCODE(0x48, "overhead", kSpecial, 0, "");
- OPCODE(0x4A, "mumble", kSpecial, 0, "");
- OPCODE_MD(0x4B, "msg", kSpecial, 0, "c", "s");
- OPCODE(0xFE, "begin", kSpecial, 0, "");
- OPCODE(0xFF, "end", kSpecial, 0, "");
+ OPCODE_MD(0x41, "XY", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x42, "color", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x43, "right", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x45, "center", kSpecialCallInstType, 0, "");
+ OPCODE(0x47, "left", kSpecialCallInstType, 0, "");
+ OPCODE(0x48, "overhead", kSpecialCallInstType, 0, "");
+ OPCODE(0x4A, "mumble", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x4B, "msg", kSpecialCallInstType, 0, "c", "s");
+ OPCODE(0xFE, "begin", kSpecialCallInstType, 0, "");
+ OPCODE(0xFF, "end", kSpecialCallInstType, 0, "");
END_SUBOPCODE;
START_SUBOPCODE_WITH_PREFIX(0xB5, "printText");
- OPCODE_MD(0x41, "XY", kSpecial, -2, "", "pp");
- OPCODE_MD(0x42, "color", kSpecial, -1, "", "p");
- OPCODE_MD(0x43, "right", kSpecial, -1, "", "p");
- OPCODE(0x45, "center", kSpecial, 0, "");
- OPCODE(0x47, "left", kSpecial, 0, "");
- OPCODE(0x48, "overhead", kSpecial, 0, "");
- OPCODE(0x4A, "mumble", kSpecial, 0, "");
- OPCODE_MD(0x4B, "msg", kSpecial, 0, "c", "s");
- OPCODE(0xFE, "begin", kSpecial, 0, "");
- OPCODE(0xFF, "end", kSpecial, 0, "");
+ OPCODE_MD(0x41, "XY", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x42, "color", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x43, "right", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x45, "center", kSpecialCallInstType, 0, "");
+ OPCODE(0x47, "left", kSpecialCallInstType, 0, "");
+ OPCODE(0x48, "overhead", kSpecialCallInstType, 0, "");
+ OPCODE(0x4A, "mumble", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x4B, "msg", kSpecialCallInstType, 0, "c", "s");
+ OPCODE(0xFE, "begin", kSpecialCallInstType, 0, "");
+ OPCODE(0xFF, "end", kSpecialCallInstType, 0, "");
END_SUBOPCODE;
START_SUBOPCODE_WITH_PREFIX(0xB6, "printDebug");
- OPCODE_MD(0x41, "XY", kSpecial, -2, "", "pp");
- OPCODE_MD(0x42, "color", kSpecial, -1, "", "p");
- OPCODE_MD(0x43, "right", kSpecial, -1, "", "p");
- OPCODE(0x45, "center", kSpecial, 0, "");
- OPCODE(0x47, "left", kSpecial, 0, "");
- OPCODE(0x48, "overhead", kSpecial, 0, "");
- OPCODE(0x4A, "mumble", kSpecial, 0, "");
- OPCODE_MD(0x4B, "msg", kSpecial, 0, "c", "s");
- OPCODE(0xFE, "begin", kSpecial, 0, "");
- OPCODE(0xFF, "end", kSpecial, 0, "");
+ OPCODE_MD(0x41, "XY", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x42, "color", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x43, "right", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x45, "center", kSpecialCallInstType, 0, "");
+ OPCODE(0x47, "left", kSpecialCallInstType, 0, "");
+ OPCODE(0x48, "overhead", kSpecialCallInstType, 0, "");
+ OPCODE(0x4A, "mumble", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x4B, "msg", kSpecialCallInstType, 0, "c", "s");
+ OPCODE(0xFE, "begin", kSpecialCallInstType, 0, "");
+ OPCODE(0xFF, "end", kSpecialCallInstType, 0, "");
END_SUBOPCODE;
START_SUBOPCODE_WITH_PREFIX(0xB7, "printSystem");
- OPCODE_MD(0x41, "XY", kSpecial, -2, "", "pp");
- OPCODE_MD(0x42, "color", kSpecial, -1, "", "p");
- OPCODE_MD(0x43, "right", kSpecial, -1, "", "p");
- OPCODE(0x45, "center", kSpecial, 0, "");
- OPCODE(0x47, "left", kSpecial, 0, "");
- OPCODE(0x48, "overhead", kSpecial, 0, "");
- OPCODE(0x4A, "mumble", kSpecial, 0, "");
- OPCODE_MD(0x4B, "msg", kSpecial, 0, "c", "s");
- OPCODE(0xFE, "begin", kSpecial, 0, "");
- OPCODE(0xFF, "end", kSpecial, 0, "");
+ OPCODE_MD(0x41, "XY", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x42, "color", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x43, "right", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x45, "center", kSpecialCallInstType, 0, "");
+ OPCODE(0x47, "left", kSpecialCallInstType, 0, "");
+ OPCODE(0x48, "overhead", kSpecialCallInstType, 0, "");
+ OPCODE(0x4A, "mumble", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x4B, "msg", kSpecialCallInstType, 0, "c", "s");
+ OPCODE(0xFE, "begin", kSpecialCallInstType, 0, "");
+ OPCODE(0xFF, "end", kSpecialCallInstType, 0, "");
END_SUBOPCODE;
START_SUBOPCODE_WITH_PREFIX(0xB8, "printActor");
- OPCODE_MD(0x41, "XY", kSpecial, -2, "", "pp");
- OPCODE_MD(0x42, "color", kSpecial, -1, "", "p");
- OPCODE_MD(0x43, "right", kSpecial, -1, "", "p");
- OPCODE(0x45, "center", kSpecial, 0, "");
- OPCODE(0x47, "left", kSpecial, 0, "");
- OPCODE(0x48, "overhead", kSpecial, 0, "");
- OPCODE(0x4A, "mumble", kSpecial, 0, "");
- OPCODE_MD(0x4B, "msg", kSpecial, 0, "c", "s");
- OPCODE_MD(0xFE, "begin", kSpecial, -1, "", "p");
- OPCODE(0xFF, "end", kSpecial, 0, "");
+ OPCODE_MD(0x41, "XY", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x42, "color", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x43, "right", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x45, "center", kSpecialCallInstType, 0, "");
+ OPCODE(0x47, "left", kSpecialCallInstType, 0, "");
+ OPCODE(0x48, "overhead", kSpecialCallInstType, 0, "");
+ OPCODE(0x4A, "mumble", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x4B, "msg", kSpecialCallInstType, 0, "c", "s");
+ OPCODE_MD(0xFE, "begin", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0xFF, "end", kSpecialCallInstType, 0, "");
END_SUBOPCODE;
START_SUBOPCODE_WITH_PREFIX(0xB9, "printEgo");
- OPCODE_MD(0x41, "XY", kSpecial, -2, "", "pp");
- OPCODE_MD(0x42, "color", kSpecial, -1, "", "p");
- OPCODE_MD(0x43, "right", kSpecial, -1, "", "p");
- OPCODE(0x45, "center", kSpecial, 0, "");
- OPCODE(0x47, "left", kSpecial, 0, "");
- OPCODE(0x48, "overhead", kSpecial, 0, "");
- OPCODE(0x4A, "mumble", kSpecial, 0, "");
- OPCODE_MD(0x4B, "msg", kSpecial, 0, "c", "s");
- OPCODE(0xFE, "begin", kSpecial, 0, "");
- OPCODE(0xFF, "end", kSpecial, 0, "");
+ OPCODE_MD(0x41, "XY", kSpecialCallInstType, -2, "", "pp");
+ OPCODE_MD(0x42, "color", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0x43, "right", kSpecialCallInstType, -1, "", "p");
+ OPCODE(0x45, "center", kSpecialCallInstType, 0, "");
+ OPCODE(0x47, "left", kSpecialCallInstType, 0, "");
+ OPCODE(0x48, "overhead", kSpecialCallInstType, 0, "");
+ OPCODE(0x4A, "mumble", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0x4B, "msg", kSpecialCallInstType, 0, "c", "s");
+ OPCODE(0xFE, "begin", kSpecialCallInstType, 0, "");
+ OPCODE(0xFF, "end", kSpecialCallInstType, 0, "");
END_SUBOPCODE;
- OPCODE_MD(0xBA, "talkActor", kSpecial, -1, "c", "ps");
- OPCODE_MD(0xBB, "talkEgo", kSpecial, 0, "c", "s");
+ OPCODE_MD(0xBA, "talkActor", kSpecialCallInstType, -1, "c", "ps");
+ OPCODE_MD(0xBB, "talkEgo", kSpecialCallInstType, 0, "c", "s");
START_SUBOPCODE(0xBC); // dimArray
- OPCODE_MD(0xC7, "dimArrayInt", kSpecial, -1, "w", "pv");
- OPCODE_MD(0xC8, "dimArrayBit", kSpecial, -1, "w", "pv");
- OPCODE_MD(0xC9, "dimArrayNibble", kSpecial, -1, "w", "pv");
- OPCODE_MD(0xCA, "dimArrayByte", kSpecial, -1, "w", "pv");
- OPCODE_MD(0xCB, "dimArrayString", kSpecial, -1, "w", "pv");
- OPCODE_MD(0xCC, "dimArray_nukeArray", kSpecial, 0, "w", "v");
+ OPCODE_MD(0xC7, "dimArrayInt", kSpecialCallInstType, -1, "w", "pv");
+ OPCODE_MD(0xC8, "dimArrayBit", kSpecialCallInstType, -1, "w", "pv");
+ OPCODE_MD(0xC9, "dimArrayNibble", kSpecialCallInstType, -1, "w", "pv");
+ OPCODE_MD(0xCA, "dimArrayByte", kSpecialCallInstType, -1, "w", "pv");
+ OPCODE_MD(0xCB, "dimArrayString", kSpecialCallInstType, -1, "w", "pv");
+ OPCODE_MD(0xCC, "dimArray_nukeArray", kSpecialCallInstType, 0, "w", "v");
END_SUBOPCODE;
- OPCODE_MD(0xBE, "startObjectQuick", kSpecial, 0x1020, "", "lpp"); // Variable stack arguments
- OPCODE_MD(0xBF, "startScriptQuick2", kSpecial, 0x1010, "", "lp"); // Variable stack arguments
+ OPCODE_MD(0xBE, "startObjectQuick", kSpecialCallInstType, 0x1020, "", "lpp"); // Variable stack arguments
+ OPCODE_MD(0xBF, "startScriptQuick2", kSpecialCallInstType, 0x1010, "", "lp"); // Variable stack arguments
START_SUBOPCODE(0xC0); // dim2DimArray
- OPCODE_MD(0xC7, "dim2DimArrayInt", kSpecial, -2, "w", "ppv");
- OPCODE_MD(0xC8, "dim2DimArrayBit", kSpecial, -2, "w", "ppv");
- OPCODE_MD(0xC9, "dim2DimArrayNibble", kSpecial, -2, "w", "ppv");
- OPCODE_MD(0xCA, "dim2DimArrayByte", kSpecial, -2, "w", "ppv");
- OPCODE_MD(0xCB, "dim2DimArrayString", kSpecial, -2, "w", "ppv");
+ OPCODE_MD(0xC7, "dim2DimArrayInt", kSpecialCallInstType, -2, "w", "ppv");
+ OPCODE_MD(0xC8, "dim2DimArrayBit", kSpecialCallInstType, -2, "w", "ppv");
+ OPCODE_MD(0xC9, "dim2DimArrayNibble", kSpecialCallInstType, -2, "w", "ppv");
+ OPCODE_MD(0xCA, "dim2DimArrayByte", kSpecialCallInstType, -2, "w", "ppv");
+ OPCODE_MD(0xCB, "dim2DimArrayString", kSpecialCallInstType, -2, "w", "ppv");
END_SUBOPCODE;
- OPCODE_MD(0xC4, "abs", kSpecial, 0, "", "rp");
- OPCODE_MD(0xC5, "getDistObjObj", kSpecial, -1, "", "rpp");
- OPCODE_MD(0xC6, "getDistObjPt", kSpecial, -2, "", "rppp");
- OPCODE_MD(0xC7, "getDistPtPt", kSpecial, -3, "", "rpppp");
- OPCODE_MD(0xC8, "kernelGetFunctions", kSpecial, 0x1000, "", "l"); // Variable stack arguments
- OPCODE_MD(0xC9, "kernelSetFunctions", kSpecial, 0x1000, "", "l"); // Variable stack arguments
- OPCODE_MD(0xCA, "delayFrames", kSpecial, -1, "", "p");
- OPCODE_MD(0xCB, "pickOneOf", kSpecial, 0x1011, "", "rlp"); // Variable stack arguments
- OPCODE_MD(0xCC, "pickOneOfDefault", kSpecial, 0x111, "", "rplp"); // Variable stack arguments
- OPCODE_MD(0xCD, "stampObject", kSpecial, -4, "", "pppp");
- OPCODE(0xD0, "getDateTime", kSpecial, 0, "");
- OPCODE(0xD1, "stopTalking", kSpecial, 0, "");
- OPCODE_MD(0xD2, "getAnimateVariable", kSpecial, -1, "", "rpp");
- OPCODE_MD(0xD4, "shuffle", kSpecial, -2, "w", "vpp");
- OPCODE_MD(0xD5, "jumpToScript", kSpecial, 0x1020, "", "lpp"); // Variable stack arguments
- OPCODE_MD(0xD6, "band", kBinaryOp, -1, "", "&");
- OPCODE_MD(0xD7, "bor", kBinaryOp, -1, "", "|");
- OPCODE_MD(0xD8, "isRoomScriptRunning", kSpecial, 0, "", "rp");
- OPCODE_MD(0xDD, "findAllObjects", kSpecial, 0, "", "rp");
- OPCODE_MD(0xE1, "getPixel", kSpecial, -1, "", "rpp");
- OPCODE_MD(0xE3, "pickVarRandom", kSpecial, 0x1001, "w", "rlw"); // Variable stack arguments
- OPCODE_MD(0xE4, "setBoxSet", kSpecial, -1, "", "p");
- OPCODE_MD(0xEC, "getActorLayer", kSpecial, 0, "", "rp");
- OPCODE_MD(0xED, "getObjectNewDir", kSpecial, 0, "", "rp");
+ OPCODE_MD(0xC4, "abs", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0xC5, "getDistObjObj", kSpecialCallInstType, -1, "", "rpp");
+ OPCODE_MD(0xC6, "getDistObjPt", kSpecialCallInstType, -2, "", "rppp");
+ OPCODE_MD(0xC7, "getDistPtPt", kSpecialCallInstType, -3, "", "rpppp");
+ OPCODE_MD(0xC8, "kernelGetFunctions", kSpecialCallInstType, 0x1000, "", "l"); // Variable stack arguments
+ OPCODE_MD(0xC9, "kernelSetFunctions", kSpecialCallInstType, 0x1000, "", "l"); // Variable stack arguments
+ OPCODE_MD(0xCA, "delayFrames", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xCB, "pickOneOf", kSpecialCallInstType, 0x1011, "", "rlp"); // Variable stack arguments
+ OPCODE_MD(0xCC, "pickOneOfDefault", kSpecialCallInstType, 0x111, "", "rplp"); // Variable stack arguments
+ OPCODE_MD(0xCD, "stampObject", kSpecialCallInstType, -4, "", "pppp");
+ OPCODE(0xD0, "getDateTime", kSpecialCallInstType, 0, "");
+ OPCODE(0xD1, "stopTalking", kSpecialCallInstType, 0, "");
+ OPCODE_MD(0xD2, "getAnimateVariable", kSpecialCallInstType, -1, "", "rpp");
+ OPCODE_MD(0xD4, "shuffle", kSpecialCallInstType, -2, "w", "vpp");
+ OPCODE_MD(0xD5, "jumpToScript", kSpecialCallInstType, 0x1020, "", "lpp"); // Variable stack arguments
+ OPCODE_MD(0xD6, "band", kBinaryOpInstType, -1, "", "&");
+ OPCODE_MD(0xD7, "bor", kBinaryOpInstType, -1, "", "|");
+ OPCODE_MD(0xD8, "isRoomScriptRunning", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0xDD, "findAllObjects", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0xE1, "getPixel", kSpecialCallInstType, -1, "", "rpp");
+ OPCODE_MD(0xE3, "pickVarRandom", kSpecialCallInstType, 0x1001, "w", "rlw"); // Variable stack arguments
+ OPCODE_MD(0xE4, "setBoxSet", kSpecialCallInstType, -1, "", "p");
+ OPCODE_MD(0xEC, "getActorLayer", kSpecialCallInstType, 0, "", "rp");
+ OPCODE_MD(0xED, "getObjectNewDir", kSpecialCallInstType, 0, "", "rp");
END_OPCODES;
InstIterator it;
@@ -447,7 +447,7 @@
it->_stackChange = -popBefore - popAfter + pushTotal;
InstIterator it2 = it;
for (--it2; popBefore != 0; --it2)
- if (it2->_type == kLoad)
+ if (it2->_type == kLoadInstType)
--popBefore;
it->_stackChange -= it2->_params[0].getSigned() + 1;
}
@@ -526,7 +526,7 @@
_address++;
if (inStr)
s << '"';
- p->_type = kString;
+ p->_type = kStringParamType;
p->_value = s.str();
}
break;
Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.cpp 2010-08-14 21:29:45 UTC (rev 52093)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.cpp 2010-08-14 22:11:24 UTC (rev 52094)
@@ -30,8 +30,8 @@
uint32 Scumm::v6::Scummv6Engine::getDestAddress(const Instruction &inst) const {
switch(inst._type) {
- case kJumpRel:
- case kCondJumpRel:
+ case kJumpRelInstType:
+ case kCondJumpRelInstType:
return inst._params[0].getSigned() + inst._address + 3;
default:
return 0;
Modified: tools/branches/gsoc2010-decompiler/decompiler/simple_disassembler.cpp
@@ Diff output truncated at 100000 characters. @@
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