Exemplo n.º 1
0
void writeResource(const char *sectionStr, uint32 resId) {
	char nameBuffer[256];
	sprintf(nameBuffer, "%s/%u", sectionStr, resId);
	
	Common::File *file = res.getResource(getResId(sectionStr), resId);
	assert(file);
	writeResource(nameBuffer, file);
}
Exemplo n.º 2
0
void writeResource(const char *sectionStr, uint32 resId, bool isEnglish = true) {
	char nameBuffer[256];
	sprintf(nameBuffer, "%s/%u", sectionStr, resId);

	Common::PEResources &res = isEnglish ? resEng : resGer;
	Common::File *file = res.getResource(getResId(sectionStr), resId);
	assert(file);
	writeResource(nameBuffer, file);
}
Exemplo n.º 3
0
void outputAllResources(PAKFile &out) {
	char filename[128];
	for (const ResourceProvider *resource = obtainResourceProviders();
	     resource->id != kMaxResIDs; ++resource) {
		const ExtractFilename *desc = getFilenameDesc(resource->id);

		snprintf(filename, sizeof(filename), "%08X", getFilename(resource, desc));

		writeResource(out, filename, (ResTypes)desc->type, resource->provider);
	}
}
Exemplo n.º 4
0
void writeData() {
	for (int idx = 0; idx < (resGer.empty() ? 1 : 2); ++idx) {
		bool isEnglish = idx == 0;

		writeBitmap("Bitmap", "BACKDROP", isEnglish);
		writeBitmap("Bitmap", "EVILTWIN", isEnglish);
		writeBitmap("Bitmap", "RESTORED", isEnglish);
		writeBitmap("Bitmap", "RESTOREF", isEnglish);
		writeBitmap("Bitmap", "RESTOREU", isEnglish);
		writeBitmap("Bitmap", "STARTD", isEnglish);
		writeBitmap("Bitmap", "STARTF", isEnglish);
		writeBitmap("Bitmap", "STARTU", isEnglish);
		writeBitmap("Bitmap", "TITANIC", isEnglish);
		writeBitmap("Bitmap", 133, isEnglish);
		writeBitmap("Bitmap", 164, isEnglish);
		writeBitmap("Bitmap", 165, isEnglish);
	}

	writeResource("STFONT", 149);
	writeResource("STFONT", 151);
	writeResource("STFONT", 152);
	writeResource("STFONT", 153);

	writeResource("STARFIELD", 132);
	writeStarfieldPoints();
	writeStarfieldPoints2();

	writeResource("TEXT", "STVOCAB.TXT");
	writeResource("TEXT", "JRQUOTES.TXT");
	writeResource("TEXT", 155);

	writeStringArray("TEXT/ITEM_DESCRIPTIONS", ITEM_DESCRIPTIONS, 46);
	writeStringArray("TEXT/ITEM_NAMES", ITEM_NAMES, 46);
	writeStringArray("TEXT/ITEM_IDS", ITEM_IDS, 40);
	writeStringArray("TEXT/ROOM_NAMES", ROOM_NAMES, 34);
	writeStringArray("TEXT/STRINGS", STRINGS_EN, 58);
	writeStringArray("TEXT/STRINGS/DE", STRINGS_DE, 104);
	const int TEXT_PHRASES[3] = { 0x61D3C8, 0x618340, 0x61B1E0 };
	const int TEXT_REPLACEMENTS1[3] = { 0x61D9B0, 0x61C788, 0x61B7C8 };
	const int TEXT_REPLACEMENTS2[3] = { 0x61DD20, 0x61CAF8, 0x61BB38 };
	const int TEXT_REPLACEMENTS3[3] = { 0x61F5C8, 0x61E3A0, 0x61D3E0 };
	const int TEXT_PRONOUNS[3] = { 0x631318, 0x6300F8, 0x62F138 };
	writeStringArray("TEXT/PHRASES", TEXT_PHRASES[_version], 376);
	writeStringArray("TEXT/REPLACEMENTS1", TEXT_REPLACEMENTS1[_version], 218);
	writeStringArray("TEXT/REPLACEMENTS2", TEXT_REPLACEMENTS2[_version], 1576);
	writeStringArray("TEXT/REPLACEMENTS3", TEXT_REPLACEMENTS3[_version], 82);
	writeStringArray("TEXT/PRONOUNS", TEXT_PRONOUNS[_version], 15);

	const int SENTENCES_DEFAULT[3] = { 0x5C0130, 0x5BEFC8, 0x5BE008 };
	const int SENTENCES_BARBOT[2][3] = {
		{ 0x5ABE60, 0x5AACF8, 0x5A9D38 }, { 0x5BD4E8, 0x5BC380, 0x5BB3C0 }
	};
	const int SENTENCES_BELLBOT[20][3] = {
		{ 0x5C2230, 0x5C10C8, 0X5C0108 }, { 0x5D1670, 0x5D0508, 0x5CF548 },
		{ 0x5D1A80, 0x5D0918, 0x5CF958 }, { 0x5D1AE8, 0x5D0980, 0x5CF9C0 },
		{ 0x5D1B88, 0x5D0A20, 0x5CFA60 }, { 0x5D2A60, 0x5D18F8, 0x5D0938 },
		{ 0x5D2CD0, 0x5D1B68, 0x5D0BA8 }, { 0x5D3488, 0x5D2320, 0x5D1360 },
		{ 0x5D3900, 0x5D2798, 0x5D17D8 }, { 0x5D3968, 0x5D2800, 0x5D1840 },
		{ 0x5D4668, 0x5D3500, 0x5D2540 }, { 0x5D47A0, 0x5D3638, 0x5D2678 },
		{ 0x5D4EC0, 0x5D3D58, 0x5D2D98 }, { 0x5D5100, 0x5D3F98, 0x5D2FD8 },
		{ 0x5D5370, 0x5D4208, 0x5D3248 }, { 0x5D5548, 0x5D43E0, 0x5D3420 },
		{ 0x5D56B8, 0x5D4550, 0x5D3590 }, { 0x5D57C0, 0x5D4658, 0x5D3698 },
		{ 0x5D5B38, 0x5D49D0, 0x5D3A10 }, { 0x5D61B8, 0x5D5050, 0x5D4090 }
	};
	writeSentenceEntries("Sentences/Default", SENTENCES_DEFAULT[_version]);
	writeSentenceEntries("Sentences/Barbot", SENTENCES_BARBOT[0][_version]);
	writeSentenceEntries("Sentences/Barbot2", SENTENCES_BARBOT[1][_version]);
	writeSentenceEntries("Sentences/Bellbot", SENTENCES_BELLBOT[0][_version]);
	writeSentenceEntries("Sentences/Bellbot/1", SENTENCES_BELLBOT[1][_version]);
	writeSentenceEntries("Sentences/Bellbot/2", SENTENCES_BELLBOT[2][_version]);
	writeSentenceEntries("Sentences/Bellbot/3", SENTENCES_BELLBOT[3][_version]);
	writeSentenceEntries("Sentences/Bellbot/4", SENTENCES_BELLBOT[4][_version]);
	writeSentenceEntries("Sentences/Bellbot/5", SENTENCES_BELLBOT[5][_version]);
	writeSentenceEntries("Sentences/Bellbot/6", SENTENCES_BELLBOT[6][_version]);
	writeSentenceEntries("Sentences/Bellbot/7", SENTENCES_BELLBOT[7][_version]);
	writeSentenceEntries("Sentences/Bellbot/8", SENTENCES_BELLBOT[8][_version]);
	writeSentenceEntries("Sentences/Bellbot/9", SENTENCES_BELLBOT[9][_version]);
	writeSentenceEntries("Sentences/Bellbot/10", SENTENCES_BELLBOT[10][_version]);
	writeSentenceEntries("Sentences/Bellbot/11", SENTENCES_BELLBOT[11][_version]);
	writeSentenceEntries("Sentences/Bellbot/12", SENTENCES_BELLBOT[12][_version]);
	writeSentenceEntries("Sentences/Bellbot/13", SENTENCES_BELLBOT[13][_version]);
	writeSentenceEntries("Sentences/Bellbot/14", SENTENCES_BELLBOT[14][_version]);
	writeSentenceEntries("Sentences/Bellbot/15", SENTENCES_BELLBOT[15][_version]);
	writeSentenceEntries("Sentences/Bellbot/16", SENTENCES_BELLBOT[16][_version]);
	writeSentenceEntries("Sentences/Bellbot/17", SENTENCES_BELLBOT[17][_version]);
	writeSentenceEntries("Sentences/Bellbot/18", SENTENCES_BELLBOT[18][_version]);
	writeSentenceEntries("Sentences/Bellbot/19", SENTENCES_BELLBOT[19][_version]);

	const int SENTENCES_DESKBOT[3][3] = {
		{ 0x5DCD10, 0x5DBBA8, 0x5DABE8 }, { 0x5E8E18, 0x5E7CB0, 0x5E6CF0 },
		{ 0x5E8BA8, 0x5E7A40, 0x5E6A80 }
	};
	writeSentenceEntries("Sentences/Deskbot", SENTENCES_DESKBOT[0][_version]);
	writeSentenceEntries("Sentences/Deskbot/2", SENTENCES_DESKBOT[1][_version]);
	writeSentenceEntries("Sentences/Deskbot/3", SENTENCES_DESKBOT[2][_version]);

	const int SENTENCES_DOORBOT[12][3] = {
		{ 0x5EC110, 0x5EAFA8, 0x5E9FE8 }, { 0x5FD930, 0x5FC7C8, 0x5FB808 },
		{ 0x5FDD0C, 0x5FCBA4, 0x5FBBE4 }, { 0x5FE668, 0x5FD500, 0x5FC540 },
		{ 0x5FDD40, 0x5FCBD8, 0X5FBC18 }, { 0x5FFF08, 0x5FEDA0, 0x5FDDE0 },
		{ 0x5FE3C0, 0x5FD258, 0x5FC298 }, { 0x5FF0C8, 0x5FDF60, 0x5FCFA0 },
		{ 0x5FF780, 0x5FE618, 0x5FD658 }, { 0x5FFAC0, 0x5FE958, 0x5FD998 },
		{ 0x5FFC30, 0x5FEAC8, 0x5FDB08 }, { 0x6000E0, 0x5FEF78, 0x5FDFB8 }
	};
	writeSentenceEntries("Sentences/Doorbot", SENTENCES_DOORBOT[0][_version]);
	writeSentenceEntries("Sentences/Doorbot/2", SENTENCES_DOORBOT[1][_version]);
	writeSentenceEntries("Sentences/Doorbot/100", SENTENCES_DOORBOT[2][_version]);
	writeSentenceEntries("Sentences/Doorbot/101", SENTENCES_DOORBOT[3][_version]);
	writeSentenceEntries("Sentences/Doorbot/102", SENTENCES_DOORBOT[4][_version]);
	writeSentenceEntries("Sentences/Doorbot/107", SENTENCES_DOORBOT[5][_version]);
	writeSentenceEntries("Sentences/Doorbot/110", SENTENCES_DOORBOT[6][_version]);
	writeSentenceEntries("Sentences/Doorbot/111", SENTENCES_DOORBOT[7][_version]);
	writeSentenceEntries("Sentences/Doorbot/124", SENTENCES_DOORBOT[8][_version]);
	writeSentenceEntries("Sentences/Doorbot/129", SENTENCES_DOORBOT[9][_version]);
	writeSentenceEntries("Sentences/Doorbot/131", SENTENCES_DOORBOT[10][_version]);
	writeSentenceEntries("Sentences/Doorbot/132", SENTENCES_DOORBOT[11][_version]);

	const int SENTENCES_LIFTBOT[3] = { 0x6026B0, 0x601548, 0x600588 };
	const int SENTENCES_MAITRED[2][3] = {
		{ 0x60CFD8, 0x60BE70, 0x60AEB0 }, { 0x614288, 0x613120, 0x612160 }
	};
	const int SENTENCES_PARROT[3] = { 0x615858, 0x6146F0, 0x613730 };
	const int SENTENCES_SUCCUBUS[3] = { 0x616698, 0x615530, 0x614570 };
	const int MAPPINGS_BARBOT[3] = { 0x5B28A0, 0x5B173E, 0x5B0778 };
	const int MAPPINGS_BELLBOT[3] = { 0x5CD830, 0x5CC6C8, 0x5CB708 };
	const int MAPPINGS_DESKBOT[3] = { 0x5E2BB8, 0x5E1A50, 0x5E0A90 };
	const int MAPPINGS_DOORBOT[3] = { 0x5F7950, 0x5F67E8, 0x5F5828 };
	const int MAPPINGS_LIFTBOT[3] = { 0x608660, 0x6074F8, 0x606538 };
	const int MAPPINGS_MAITRED[3] = { 0x6125C8, 0x611460, 0x6104A0 };
	const int MAPPINGS_PARROT[3] = { 0x615B68, 0x614A00, 0x613A40 };
	const int MAPPINGS_SUCCUBUS[3] = { 0x6189F0, 0x617888, 0x6168C8 };
	const int WORDS_BARBOT[3] = { 0x5BE2E0, 0x5BD178, 0x5BC1B8 };
	const int WORDS_BELLBOT[3] = { 0x5D8230, 0x5D70C8, 0x5D6108 };
	const int WORDS_DESKBOT[3] = { 0x5EAAA8, 0x5E9940, 0x5E8980 };
	const int WORDS_DOORBOT[3] = { 0x601098, 0x5FFF30, 0x5FEF70 };
	const int WORDS_LIFTBOT[3] = { 0x60C788, 0x60B620, 0x60A660 };
	writeSentenceEntries("Sentences/Liftbot", SENTENCES_LIFTBOT[_version]);
	writeSentenceEntries("Sentences/MaitreD", SENTENCES_MAITRED[0][_version]);
	writeSentenceEntries("Sentences/MaitreD/1", SENTENCES_MAITRED[1][_version]);
	writeSentenceEntries("Sentences/Parrot", SENTENCES_PARROT[_version]);
	writeSentenceEntries("Sentences/SuccUBus", SENTENCES_SUCCUBUS[_version]);
	writeSentenceMappings("Mappings/Barbot", MAPPINGS_BARBOT[_version], 8);
	writeSentenceMappings("Mappings/Bellbot", MAPPINGS_BELLBOT[_version], 1);
	writeSentenceMappings("Mappings/Deskbot", MAPPINGS_DESKBOT[_version], 4);
	writeSentenceMappings("Mappings/Doorbot", MAPPINGS_DOORBOT[_version], 4);
	writeSentenceMappings("Mappings/Liftbot", MAPPINGS_LIFTBOT[_version], 4);
	writeSentenceMappings("Mappings/MaitreD", MAPPINGS_MAITRED[_version], 1);
	writeSentenceMappings("Mappings/Parrot", MAPPINGS_PARROT[_version], 1);
	writeSentenceMappings("Mappings/SuccUBus", MAPPINGS_SUCCUBUS[_version], 1);
	writeWords("Words/Barbot", WORDS_BARBOT[_version]);
	writeWords("Words/Bellbot", WORDS_BELLBOT[_version]);
	writeWords("Words/Deskbot", WORDS_DESKBOT[_version]);
	writeWords("Words/Doorbot", WORDS_DOORBOT[_version], 3);
	writeWords("Words/Liftbot", WORDS_LIFTBOT[_version]);
	writePhrases("Phrases/Bellbot", BELLBOT_COMMON_PHRASES);

	writeResponseTree();
	writeNumbers();
	writeAllScriptQuotes();
	writeAllScriptResponses();
	writeAllScriptRanges();

	writeAllTagMappings();
	writeAllUpdateStates();
	writeAllScriptPreResponses();
	writeBarbotFrameRanges();
	writeMissiveOMatMessages();
	writeBedheadData();
	writeParrotLobbyLinkUpdaterEntries();
}
Exemplo n.º 5
0
const Result CtrlrWindows::exportWithDefaultPanel(CtrlrPanel*  panelToWrite, const bool isRestricted, const bool signPanel, RSAKey privateKey)
{
	if (panelToWrite == nullptr)
	{
		return (Result::fail("Windows Native: exportWithDefaultPanel got nullptr for panel"));
	}

	File	me = File::getSpecialLocation(File::currentExecutableFile);
	File	newMe;
	HANDLE	hResource;
	MemoryBlock panelExportData,panelResourcesData;
	MemoryBlock iconData(BinaryData::ico_midi_png, BinaryData::ico_midi_pngSize);

	FileChooser fc(CTRLR_NEW_INSTANCE_DIALOG_TITLE,
					me.getParentDirectory().getChildFile(File::createLegalFileName(panelToWrite->getProperty(Ids::name))).withFileExtension(me.getFileExtension()),
					"*"+me.getFileExtension(),
					panelToWrite->getOwner().getProperty(Ids::ctrlrNativeFileDialogs));

	if (fc.browseForFileToSave(true))
	{
		newMe = fc.getResult();

		if (!newMe.hasFileExtension(me.getFileExtension()))
		{
			newMe = newMe.withFileExtension(me.getFileExtension());
		}

		if (!me.copyFileTo (newMe))
		{
			return (Result::fail("Windows Native: exportMeWithNewResource can't copy \""+me.getFullPathName()+"\" to \""+newMe.getFullPathName()+"\""));
		}
	}
	else
	{
		return (Result::fail("Windows Native: exportMeWithNewResource \"Save file\" dialog failed"));
	}

	hResource = BeginUpdateResource(newMe.getFullPathName().toUTF8(), FALSE);

	if (hResource)
	{
		String error;

		if ( (error = CtrlrPanel::exportPanel (panelToWrite, File::nonexistent, newMe, &panelExportData, &panelResourcesData, isRestricted)) == String::empty)
		{
			if (	writeResource (hResource, MAKEINTRESOURCE(CTRLR_INTERNAL_PANEL_RESID), RT_RCDATA, panelExportData)
				&&	writeResource (hResource, MAKEINTRESOURCE(CTRLR_INTERNAL_RESOURCES_RESID), RT_RCDATA, panelResourcesData)
				)
			{
				EndUpdateResource(hResource, FALSE);
			}
			else
			{
				return (Result::fail("Windows Native: exportMeWithNewResource writeResource[panel] failed"));
			}

			if (isRestricted && privateKey != RSAKey())
			{
				/* Sign the panel */
				MemoryBlock signature = signData (panelResourcesData, privateKey);
			}
		}
		else
		{
			return (Result::fail("Windows Native: exportMeWithNewResource exportPanel error: \""+error+"\""));
		}

		return (Result::ok());
	}

	return (Result::fail("Windows Native: exportMeWithNewResource BeginUpdateResource failed"));
}