if (((!(mustBeInExpanded && (oldPointer < 0x300200)) && (orgNewLen <= oldLen)) || (newLen <= oldLen)) && (oldPointer + oldLen <= beginAt))
if ((orgNewLen <= oldLen) && !(mustBeInExpanded && (oldPointer < 0x300200)) && (oldPointer + oldLen <= beginAt))
    public boolean writetoFree(byte[] rawData, int[] pointerLoc,        int pointerBase, int pointerLen, int oldLen, int newLen, int beginAt,        boolean mustBeInExpanded)    {        if (rawData == null || pointerLoc == null)            return false;        int pointerDelay = 0;        int orgNewLen = newLen;        byte[] data;        // 0xff shielding if the new data starts or ends with 0        if ((rawData[0] == 0) && (rawData[rawData.length - 1] == 0))        {            data = new byte[rawData.length + 2];            data[0] = (byte) 0xff;            data[data.length - 1] = (byte) 0xff;            System.arraycopy(rawData, 0, data, 1, rawData.length);            newLen += 2;            pointerDelay = 1;        }        else if (rawData[0] == 0)        {            data = new byte[rawData.length + 1];            data[0] = (byte) 0xff;            System.arraycopy(rawData, 0, data, 1, rawData.length);            newLen++;            pointerDelay = 1;        }        else if (rawData[rawData.length - 1] == 0)        {            data = new byte[rawData.length + 1];            data[data.length - 1] = (byte) 0xff;            System.arraycopy(rawData, 0, data, 0, rawData.length);            newLen++;        }        else            data = rawData;        //make sure ROM is expanded if needed        if ((newLen > oldLen) || mustBeInExpanded)            askExpandType();        //store old pointer for use later        int oldPointer;        if (pointerLen < 0)            oldPointer = rom.readRegAsmPointer(pointerLoc[0]);        else            oldPointer = toRegPointer(rom.readMulti(pointerLoc[0], pointerLen)                + pointerBase);        //do not bother with shielding before 0x300200.        if (((!(mustBeInExpanded && (oldPointer < 0x300200)) && (orgNewLen <= oldLen)) || (newLen <= oldLen))            && (oldPointer + oldLen <= beginAt))        {            //if it fits in the same place, then write there            nullifyArea(oldPointer, oldLen);            if (oldPointer < 0x300200)                rom.write(oldPointer, rawData, orgNewLen);            else            {                if (pointerLen < 0)                    for (int i = 0; i < pointerLoc.length; i++)                        rom.writeRegAsmPointer(pointerLoc[i], oldPointer                            + pointerDelay);                else                    for (int i = 0; i < pointerLoc.length; i++)                        rom.write(pointerLoc[i], toSnesPointer(oldPointer                            + pointerDelay), pointerLen);                rom.write(oldPointer, data, newLen);            }            return true;        }        else        {            //if it's too big to fit in the same place...            //back-up old data in case there isn't enough space            byte[] oldData = rom.readByte(oldPointer, oldLen);            //delete old data from ROM, it may be part of the empty space            // found            nullifyArea(oldPointer, oldLen);            try            {                //look for space...                int newPointer = findFreeRange(beginAt, newLen);                //write data there                rom.write(newPointer, data, newLen);                //change pointer                newPointer = newPointer - pointerBase + pointerDelay;                //write pointer                if (pointerLen > 0)                    for (int i = 0; i < pointerLoc.length; i++)                        rom.write(pointerLoc[i], toSnesPointer(newPointer),                            pointerLen);                else                    for (int i = 0; i < pointerLoc.length; i++)                        rom.writeRegAsmPointer(pointerLoc[i], newPointer);                //success!                return true;            }            catch (EOFException e)            {                //if there isn't space, rewrite old data, and return failure                rom.write(oldPointer, oldData);                return false;            }        }    }