Пример #1
0
void writeResponseTree() {
	outputFile.seek(dataOffset);

	const uint OFFSETS[3] = { 0x619520, 0x618340, 0x617380 };
	for (int idx = 0; idx < 1022; ++idx) {
		inputFile.seek(OFFSETS[_version] - FILE_DIFF[_version] + idx * 8);
		uint id = inputFile.readLong();
		uint offset = inputFile.readLong();

		outputFile.writeLong(id);
		if (!id) {
			// An end of list id
		} else if (offset >= OFFSETS[_version] && offset <= (OFFSETS[_version] + 0x1FF0)) {
			// Offset to another table
			outputFile.writeByte(0);
			outputFile.writeLong((offset - OFFSETS[_version]) / 8);
		} else {
			// Offset to ASCIIZ string
			outputFile.writeByte(1);
			writeString(offset);
		}
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader("TEXT/TREE", dataOffset, size);
	dataOffset += size;
}
Пример #2
0
void writeParrotLobbyLinkUpdaterEntries() {
	static const int OFFSETS[3] = { 0x5A5B38, 0x5A5320, 0x5A4360 };
	static const int COUNTS[5] = { 7, 5, 6, 9, 1 };
	static const int SKIP[5] = { 36, 36, 40, 36, 0 };
	uint recordOffset = OFFSETS[_version], linkOffset;
	byte vals[8];

	outputFile.seek(dataOffset);

	for (int groupNum = 0; groupNum < 4; ++groupNum) {
		for (int entryNum = 0; entryNum < COUNTS[groupNum];
				++entryNum, recordOffset += 36) {
			inputFile.seek(recordOffset - FILE_DIFF[_version]);
			linkOffset = inputFile.readUint32LE();
			for (int idx = 0; idx < 8; ++idx)
				vals[idx] = inputFile.readUint32LE();

			// Write out the entry
			inputFile.seek(linkOffset - FILE_DIFF[_version]);
			outputFile.writeString(inputFile);
			outputFile.write(vals, 8);
		}

		// Skip space between groups
		recordOffset += SKIP[groupNum];
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader("DATA/PARROT_LOBBY_LINK_UPDATOR", dataOffset, size);
	dataOffset += size;
}
Пример #3
0
void writeResource(const char *name, Common::File *file) {
	outputFile.seek(dataOffset);
	outputFile.write(*file, file->size());

	writeEntryHeader(name, dataOffset, file->size());
	dataOffset += file->size();
	delete file;
}
Пример #4
0
void writeStarfieldPoints() {
	outputFile.seek(dataOffset);

	const int OFFSETS[3] = { 0x59DE4C, 0x59DBEC, 0x59CC1C };
	inputFile.seek(OFFSETS[_version] - FILE_DIFF[_version]);
	uint size = 876 * 12;

	outputFile.write(inputFile, size);
	writeEntryHeader("STARFIELD/POINTS", dataOffset, size);
	dataOffset += size;
}
Пример #5
0
void writeStringArray(const char *name, const char *const *strings, int count) {
	outputFile.seek(dataOffset);

	// Iterate through writing each string
	for (int idx = 0; idx < count; ++idx) {
		outputFile.writeString(strings[idx]);
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader(name, dataOffset, size);
	dataOffset += size;
}
Пример #6
0
void writeBarbotFrameRanges() {
	outputFile.seek(dataOffset);

	for (int idx = 0; idx < 60; ++idx) {
		outputFile.writeLong(BARBOT_FRAME_RANGES[idx]._startFrame);
		outputFile.writeLong(BARBOT_FRAME_RANGES[idx]._endFrame);
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader("FRAMES/BARBOT", dataOffset, size);
	dataOffset += size;
}
Пример #7
0
void writeTagMappings(const char *name, const TagMapping *map, int count) {
	outputFile.seek(dataOffset);

	for (int idx = 0; idx < count; ++idx, ++map) {
		outputFile.writeLong(map->_src);
		outputFile.writeLong(map->_dest);
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader(name, dataOffset, size);
	dataOffset += size;
}
Пример #8
0
void writeUpdateStates(const char *name, const UpdateState8 *states) {
	outputFile.seek(dataOffset);

	for (; states->_src; ++states) {
		outputFile.writeLong(states->_src);
		outputFile.writeLong(states->_dest);
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader(name, dataOffset, size);
	dataOffset += size;
}
Пример #9
0
void writePhrases(const char *name, const CommonPhrase *phrases) {
	for (uint idx = 0; phrases->_str; ++idx, ++phrases) {
		outputFile.seek(dataOffset + idx * 4);
		outputFile.writeString(phrases->_str);
		outputFile.writeLong(phrases->_dialogueId);
		outputFile.writeLong(phrases->_roomNum);
		outputFile.writeLong(phrases->_val1);
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader("Phrases/Bellbot", dataOffset, size);
	dataOffset += size;
}
Пример #10
0
void writeUpdateStates(const char *name, const UpdateState12 *states) {
	outputFile.seek(dataOffset);

	for (; states->_newId; ++states) {
		outputFile.writeLong(states->_newId);
		outputFile.writeLong(states->_newValue);
		outputFile.writeLong(states->_idMatch);
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader(name, dataOffset, size);
	dataOffset += size;
}
Пример #11
0
void writeNumbers() {
	outputFile.seek(dataOffset);

	// Iterate through writing each string
	for (int idx = 0; idx < 76; ++idx) {
		outputFile.writeString(NUMBERS[idx]._text);
		outputFile.writeLong(NUMBERS[idx]._value);
		outputFile.writeLong(NUMBERS[idx]._flags);
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader("TEXT/NUMBERS", dataOffset, size);
	dataOffset += size;
}
Пример #12
0
void writeSentenceMappings(const char *name, uint offset, int numValues) {
	inputFile.seek(offset - FILE_DIFF[_version]);
	outputFile.seek(dataOffset);

	uint id;
	while ((id = inputFile.readLong()) != 0) {
		outputFile.writeLong(id);

		for (int ctr = 0; ctr < numValues; ++ctr)
			outputFile.writeLong(inputFile.readLong());
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader(name, dataOffset, size);
	dataOffset += size;
}
Пример #13
0
void writeBitmap(const char *name, Common::File *file) {
	outputFile.seek(dataOffset);

	// Write out the necessary bitmap header so that the ScummVM
	// BMP decoder can properly handle decoding the bitmaps
	outputFile.write("BM", 2);
	outputFile.writeLong(file->size() + 14);	// Filesize
	outputFile.writeLong(0);					// res1 & res2
	outputFile.writeLong(0x436);				// image offset

	outputFile.write(*file, file->size());

	writeEntryHeader(name, dataOffset, file->size() + 14);
	dataOffset += file->size() + 14;
	delete file;
}
Пример #14
0
void writeSentenceEntries(const char *name, uint tableOffset) {
	outputFile.seek(dataOffset);

	uint v1, v2, v9, v11, v12, v13;
	uint offset3, offset5, offset6, offset7, offset8, offset10;

	for (uint idx = 0; ; ++idx) {
		inputFile.seek(tableOffset - FILE_DIFF[_version] + idx * 0x34);
		v1 = inputFile.readLong();
		if (!v1)
			// Reached end of list
			break;

		// Read data fields
		v2 = inputFile.readLong();
		offset3 = inputFile.readLong();
		/* v4 = */inputFile.readLong();
		offset5 = inputFile.readLong();
		offset6 = inputFile.readLong();
		offset7 = inputFile.readLong();
		offset8 = inputFile.readLong();
		v9 = inputFile.readLong();
		offset10 = inputFile.readLong();
		v11 = inputFile.readLong();
		v12 = inputFile.readLong();
		v13 = inputFile.readLong();

		outputFile.writeLong(v1);
		outputFile.writeLong(v2);
		writeString(offset3);
		outputFile.writeLong(v1);
		writeString(offset5);
		writeString(offset6);
		writeString(offset7);
		writeString(offset8);
		outputFile.writeLong(v9);
		writeString(offset10);
		outputFile.writeLong(v11);
		outputFile.writeLong(v12);
		outputFile.writeLong(v13);
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader(name, dataOffset, size);
	dataOffset += size;
}
Пример #15
0
void writeMissiveOMatMessages() {
	outputFile.seek(dataOffset);

	for (int idx = 0; idx < 3; ++idx)
		outputFile.writeString(MISSIVEOMAT_MESSAGES[idx]);

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader("TEXT/MISSIVEOMAT/WELCOME", dataOffset, size);
	dataOffset += size;

	static const int MESSAGES[3] = { 0x5A63C0, 0x5A5BA8, 0x5A4A18 };
	writeStringArray("TEXT/MISSIVEOMAT/MESSAGES", MESSAGES[_version], 58);
	static const int FROM[3] = { 0x5A61F0, 0x5A59D8, 0x5A4BE8 };
	writeStringArray("TEXT/MISSIVEOMAT/FROM", FROM[_version], 58);
	static const int TO[3] = { 0x5A62D8, 0x5A5AC0, 0x5A4B00 };
	writeStringArray("TEXT/MISSIVEOMAT/TO", TO[_version], 58);
}
Пример #16
0
void writeScriptQuotes(const char *name, const ScriptQuote *quotes, 
		uint tag1, uint tag2, uint rangeStart, uint rangeEnd) {
	outputFile.seek(dataOffset);
	outputFile.writeLong(tag1);
	outputFile.writeLong(tag2);
	outputFile.writeLong(rangeStart);
	outputFile.writeLong(rangeEnd);

	for (; quotes->_index; ++quotes) {
		outputFile.writeLong(quotes->_index);
		outputFile.writeLong(quotes->_tagId);
		outputFile.writeLong(quotes->_dialogueId);
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader(name, dataOffset, size);
	dataOffset += size;
}
Пример #17
0
void writeBedheadData() {
	outputFile.seek(dataOffset);

	writeBedheadGroup(ON_CLOSED, 4);
	writeBedheadGroup(ON_RESTING_TV, 2);
	writeBedheadGroup(ON_RESTING_UV, 2);
	writeBedheadGroup(ON_CLOSED_WRONG, 2);
	writeBedheadGroup(OFF_OPEN, 3);
	writeBedheadGroup(OFF_RESTING_UTV, 1);
	writeBedheadGroup(OFF_RESTING_V, 1);
	writeBedheadGroup(OFF_RESTING_G, 3);
	writeBedheadGroup(OFF_OPEN_WRONG, 1);
	writeBedheadGroup(OFF_RESTING_D_WRONG, 1);

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader("DATA/BEDHEAD", dataOffset, size);
	dataOffset += size;
}
Пример #18
0
void writeStarfieldPoints2() {
	outputFile.seek(dataOffset);

	const int OFFSETS[3] = { 0x5A2F28, 0x5A2CC8, 0x5A1CF8 };
	for (int rootCtr = 0; rootCtr < 80; ++rootCtr) {
		inputFile.seek(OFFSETS[_version] - FILE_DIFF[_version] + rootCtr * 8);
		uint offset = inputFile.readUint32LE();
		uint count = inputFile.readUint32LE();

		outputFile.writeLong(count);
		inputFile.seek(offset - FILE_DIFF[_version]);
		outputFile.write(inputFile, count * 4 * 4);
	}

	uint size = outputFile.size() - dataOffset;
	outputFile.write(inputFile, size);
	writeEntryHeader("STARFIELD/POINTS2", dataOffset, size);
	dataOffset += size;
}
Пример #19
0
void writeWords(const char *name, uint tableOffset, int recordCount = 2) {
	outputFile.seek(dataOffset);
	int recordSize = recordCount * 4;

	uint val, strOffset;
	for (uint idx = 0; ; ++idx) {
		inputFile.seek(tableOffset - FILE_DIFF[_version] + idx * recordSize);
		val = inputFile.readLong();
		strOffset = inputFile.readLong();

		if (!val)
			// Reached end of list
			break;

		outputFile.writeLong(val);
		writeString(strOffset);
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader(name, dataOffset, size);
	dataOffset += size;
}
Пример #20
0
void writeStringArray(const char *name, uint offset, int count) {
	outputFile.seek(dataOffset);

	inputFile.seek(offset - FILE_DIFF[_version]);
	uint *offsets = new uint[count];
	for (int idx = 0; idx < count; ++idx)
		offsets[idx] = inputFile.readLong();

	// Iterate through reading each string
	for (int idx = 0; idx < count; ++idx) {
		if (offsets[idx]) {
			inputFile.seek(offsets[idx] - FILE_DIFF[_version]);
			outputFile.writeString(inputFile);
		} else {
			outputFile.writeString("");
		}
	}

	uint size = outputFile.size() - dataOffset;
	writeEntryHeader(name, dataOffset, size);
	dataOffset += size;

	delete[] offsets;
}