@Override
	public void setTMMoves(List<Integer> moveIndexes) {
		int offset = romEntry.getValue("TmMoves");
		for (int i = 1; i <= 50; i++) {
			writeWord(offset + (i - 1) * 2, moveIndexes.get(i - 1));
		}
		int otherOffset = romEntry.getValue("TmMovesDuplicate");
		if (otherOffset > 0) {
			// Emerald/FR/LG have *two* TM tables
			System.arraycopy(rom, offset, rom, otherOffset, 100);
		}

		int iiOffset = romEntry.getValue("ItemImages");
		if (iiOffset > 0) {
			int[] pals = romEntry.arrayEntries.get("TmPals");
			// Update the item image palettes
			// Gen3 TMs are 289-338
			for (int i = 0; i < 50; i++) {
				Move mv = moves[moveIndexes.get(i)];
				int typeID = typeToByte(mv.type);
				writePointer(iiOffset + (289 + i) * 8 + 4, pals[typeID]);
			}
		}

		// Item descriptions
		if (romEntry.getValue("MoveDescriptions") > 0) {
			// JP blocked for now - uses different item structure anyway
			int idOffset = romEntry.getValue("ItemData");
			int mdOffset = romEntry.getValue("MoveDescriptions");
			int entrySize = romEntry.getValue("ItemEntrySize");
			int limitPerLine = (romEntry.romType == RomType_FRLG) ? 24 : 18;
			for (int i = 0; i < 50; i++) {
				int itemBaseOffset = idOffset + (i + 289) * entrySize;
				int moveBaseOffset = mdOffset + (moveIndexes.get(i) - 1) * 4;
				int moveTextPointer = readPointer(moveBaseOffset);
				String moveDesc = readVariableLengthString(moveTextPointer);
				String newItemDesc = RomFunctions
						.rewriteDescriptionForNewLineSize(moveDesc, "\\n",
								limitPerLine, ssd);
				// Find freespace
				int fsBytesNeeded = translateString(newItemDesc).length + 1;
				int newItemDescOffset = RomFunctions.freeSpaceFinder(rom,
						(byte) 0xFF, fsBytesNeeded,
						romEntry.getValue("FreeSpace"));
				if (newItemDescOffset < romEntry.getValue("FreeSpace")) {
					String nl = System.getProperty("line.separator");
					log("Couldn't insert new item description." + nl);
					return;
				}
				writeVariableLengthString(newItemDesc, newItemDescOffset);
				writePointer(itemBaseOffset + 0x14, newItemDescOffset);
			}
		}
	}