if (activeNode.toString().equalsIgnoreCase("[0a xx xx xx xx]"))
if (activeNode.endcc && activeNode.cc != null)
    public String parseString(String str, boolean showCC, boolean codesOnly)    {        char[] buffer = new char[81920];        int pos = 0; // position in returned string        int ipos = 0;        CCNode activeNode = ccTable, prevNode = null;        boolean opcode = false, endcc = false;        int arglevel = 0;        int menulevel = 0;        int curcode = 0; // initial byte of current control code TODO init to ?        int ch;        for (int i = 0; i < str.length(); i++)        {            ch = str.charAt(ipos++) & 0xFF;            //len++;            // if there are arguments left to count, decrement arg level and            // continue            if (arglevel > 0)            {                if (showCC)                {                    addCode(buffer, ch, pos);                    pos += 4;                }                arglevel--;                if (arglevel == 0)                    buffer[pos++] = '\u1234';                continue;            }            if (endcc)                break;            // if opcode was not previously set            if (!opcode)            {                if (isCC(ch))                {                    curcode = ch;                    opcode = true;                    if (codesOnly && showCC)                    {                        buffer[pos++] = '\u1234';                    }                }            }            // do more stuff            // if opcode is true, ...            // note that none of this will happen when there are arguments in            // the queue,            // so the active node will still be the original argument node when            // the arguments            // finally close, so everything will proceed in an orderly fashion.            // (an argument node will just run through a few extra bytes and            // add them to the string,            // whereas other nodes involve adding only one character to the            // string)            if (opcode)            {                // search for a subnode matching the current byte                // (as of initial iteration, activeNode is the root node)                int n = searchNode(activeNode, ch);                if (n == -1)                {                    // if no match was found, this is an invalid code                    opcode = false;                    activeNode = ccTable;                    prevNode = null;                }                else                {                    // set the active node to a subnode of itself                    prevNode = activeNode;                    activeNode = (CCNode) activeNode.nodes.get(n);                }                // okay, now we have a byte from the ROM, and have                // associated                // it                // with a node. depending on the node type, do stuff                if (activeNode.type == TYPE_ARGLIST)                {                    // set arg level to num_arg - 1 because we've already read                    // one of the argument bytes                    arglevel = activeNode.num_arg - 1;                    //                    System.out.println(activeNode.toString() + ": num_arg = "                    //                        + activeNode.num_arg);                    //if arg multipler, multiply arguments                    if (activeNode.arg_multiplier && ch < MAX_ARG_MULT)                    {                        CCNode t = prevNode;                        while (!t.isTerminator)                            t = (CCNode) t.nodes.get(0);                        arglevel = ((t.num_arg - 1) * ch);                        if (!showCC)                            System.out.println("arg_mult debug: " + "ch = "                                + ch + ", t = " + t.toString()                                + ", t.num_arg = " + t.num_arg                                + ", arglevel = " + arglevel);                        //                        arglevel = t.num_arg;                        //                        System.out.println(                        //                            "parseString(): arglevel = "                        //                                + arglevel                        //                                + " ("                        //                                + t.toString()                        //                                + "'s num_arg = "                        //                                + t.num_arg                        //                                + ", val = "                        //                                + t.value                        //                                + ", level = "                        //                                + t.level                        //                                + ") (will be mult'd by "                        //                                + ch                        //                                + ") at offset "                        //                                + i);                        //                        arglevel *= ch;                        //                        arglevel--;                    }                    if (!showCC && curcode == 9)                        System.out.println("[09] has " + arglevel + " args.");                    if (curcode == 0x15 || curcode == 0x16 || curcode == 0x17)                    {                        if (codesOnly)                        {                            if (showCC)                            {                                addCode(buffer, curcode, pos);                                pos += 4;                                addCode(buffer, ch, pos);                                pos += 4;                            }                        }                        else                        {                            int c = ((curcode - 0x15) * 256) + ch;                            for (int p = 0; p < comprTable[c].length;)                            {                                buffer[pos++] = comprTable[c][p++];                            }                        }                    }                    else if (showCC)                    {                        addCode(buffer, ch, pos);                        pos += 4;                    }                }                if (activeNode.type == TYPE_CODE)                {                    // only add a bracketed code if the current code is not a                    // compression code                    if (curcode != 0x15 && curcode != 0x16 && curcode != 0x17                        && showCC)                    {                        addCode(buffer, ch, pos);                        pos += 4;                    }                }                // if the current node is a first-byte code with value 2,                // terminate text block                if (activeNode.level == 0 && activeNode.value == 0x02)                {                    if (menulevel > 0)                        menulevel--;                    else                        break;                }                if (activeNode.toString().equalsIgnoreCase("[0a xx xx xx xx]"))                {                    endcc = true;                }                //                else if (                //                    activeNode.isTerminator                //                        && activeNode.toString().equals("[0A XX XX XX XX]"))                //                {                //                    break;                //                }                // if the active node is a terminator node, stop stuff                if (activeNode.isTerminator)                {                    //                    System.out.println("End of " + activeNode.toString());                    if (arglevel == 0)                        buffer[pos++] = '\u1234';                    opcode = false;                    if (activeNode.toString().equals("[19 02]"))                        menulevel++;                    // reset the active node so we start from the                    // beginning                    activeNode = ccTable;                }            }            else            {                // if the current byte is not a control code,                // add it to the string as-is                //buffer[pos++] = (char) ch;                char cht = (char) (ch - 0x30);                //make sure brackets never get added as characters                if (codesOnly && showCC)                {                    addCode(buffer, ch, pos);                    pos += 4;                }                else                {                    if (cht == '[' || cht == ']')                    {                        if (showCC)                        {                            addCode(buffer, ch, pos);                            pos += 4;                            buffer[pos++] = '\u1234';                        }                    }                    else                    {                        buffer[pos++] = cht;                    }                }            }        }        return parseGrouping(new String(buffer, 0, pos));        //		char* newstr = new char[pos];        //		for(i = 0; i < pos; i++)        //			newstr[i] = buffer[i];        //        //		newstr[pos] = 0;        //        //		return newstr;    }