Beispiel #1
0
bool WinFont::loadFromPE(const Common::String &fileName, const WinFontDirEntry &dirEntry) {
	Common::PEResources exe;

	if (!exe.loadFromEXE(fileName))
		return false;

	// Let's pull out the font directory
	Common::SeekableReadStream *fontDirectory = exe.getResource(Common::kPEFontDir, Common::String("FONTDIR"));
	if (!fontDirectory) {
		warning("No font directory in '%s'", fileName.c_str());
		return false;
	}

	uint32 fontId = getFontIndex(*fontDirectory, dirEntry);
	
	delete fontDirectory;

	// Couldn't match the face name
	if (fontId == 0xffffffff) {
		warning("Could not find face '%s' in '%s'", dirEntry.faceName.c_str(), fileName.c_str());
		return false;
	}

	// Actually go get our font now...
	Common::SeekableReadStream *fontStream = exe.getResource(Common::kPEFont, fontId);
	if (!fontStream) {
		warning("Could not find font %d in %s", fontId, fileName.c_str());
		return false;
	}

	bool ok = loadFromFNT(*fontStream);
	delete fontStream;
	return ok;
}
Beispiel #2
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);
}
Beispiel #3
0
void writeBitmap(const char *sectionStr, const char *resId) {
	char nameBuffer[256];
	sprintf(nameBuffer, "%s/%s", sectionStr, resId);

	Common::File *file = res.getResource(getResId(sectionStr),
		Common::WinResourceID(resId));
	assert(file);
	writeBitmap(nameBuffer, file);
}