Ejemplo n.º 1
0
int main(int argc, char *argv[]) {
	if (argc != 3) {
		printf("Format: %s ST.exe titanic.dat\n", argv[0]);
		exit(0);
	}

	if (!inputFile.open(argv[1])) {
		error("Could not open input file");
	}
	res.loadFromEXE(argv[1]);

	if (inputFile.size() == ENGLISH_10042C_FILESIZE)
		_version = ENGLISH_10042C;
	else if (inputFile.size() == ENGLISH_10042B_FILESIZE)
		_version = ENGLISH_10042B;
	else if (inputFile.size() == ENGLISH_10042_FILESIZE)
		_version = ENGLISH_10042;
	else {
		printf("Unknown version of ST.exe specified");
		exit(0);
	}

	if (!outputFile.open(argv[2], Common::kFileWriteMode)) {
		error("Could not open output file");
	}

	writeHeader();
	writeData();
	writeFinalEntryHeader();

	inputFile.close();
	outputFile.close();
	return 0;
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
0
int main(int argc, char *argv[]) {
	if (argc < 2) {
		printf("Format: %s ST.exe [ST_german.exe] [titanic.dat]\n", argv[0]);
		exit(0);
	}

	if (!inputFile.open(argv[1])) {
		error("Could not open input file");
	}
	resEng.loadFromEXE(argv[1]);

	if (argc >= 3) {
		resGer.loadFromEXE(argv[2]);
	}

	if (inputFile.size() == ENGLISH_10042C_FILESIZE)
		_version = ENGLISH_10042C;
	else if (inputFile.size() == ENGLISH_10042B_FILESIZE)
		_version = ENGLISH_10042B;
	else if (inputFile.size() == ENGLISH_10042_FILESIZE)
		_version = ENGLISH_10042;
	else if (inputFile.size() == GERMAN_10042D_FILESIZE) {
		printf("German version detected. You must use an English versoin "
			"for the primary input file\n");
		exit(0);
	} else {
		printf("Unknown version of ST.exe specified\n");
		exit(0);
	}

	if (!outputFile.open(argc == 4 ? argv[3] : "titanic.dat", Common::kFileWriteMode)) {
		printf("Could not open output file\n");
		exit(0);
	}

	writeHeader();
	writeData();
	writeFinalEntryHeader();

	inputFile.close();
	outputFile.close();
	return 0;
}
Ejemplo n.º 4
0
PECursorManager::PECursorManager(const Common::String &appName) {
	Common::PEResources exe;
	if (!exe.loadFromEXE(appName)) {
		// Not all have cursors anyway, so this is not a problem
		return;
	}

	const Common::Array<Common::WinResourceID> cursorGroups = exe.getNameList(Common::kPEGroupCursor);

	_cursors.resize(cursorGroups.size());
	for (uint i = 0; i < cursorGroups.size(); i++) {
		_cursors[i].id = cursorGroups[i].getID();
		_cursors[i].cursorGroup = Graphics::WinCursorGroup::createCursorGroup(exe, cursorGroups[i]);
	}
}
Ejemplo n.º 5
0
Common::Error PinkEngine::init() {
	debugC(10, kPinkDebugGeneral, "PinkEngine init");
	initGraphics(640, 480);

	Common::PEResources exeResources;
	Common::String fileName = isPeril() ? "pptp.exe" : "hpp.exe";
	if (!exeResources.loadFromEXE(fileName)) {
		return Common::kNoGameDataFoundError;
	}

	_console = new Console(this);
	_director = new Director();

	initMenu(exeResources);

	Common::String orbName;
	Common::String broName;
	if (isPeril()) {
		orbName = "PPTP.ORB";
		broName = "PPTP.BRO";
		_bro = new BroFile;
	} else {
		orbName = "HPP.ORB";
	}

	if (!_orb.open(orbName) || (_bro && !_bro->open(broName) && _orb.getTimestamp() == _bro->getTimestamp()))
		return Common::kNoGameDataFoundError;

	if (!loadCursors(exeResources))
		return Common::kNoGameDataFoundError;

	setCursor(kLoadingCursor);

	_orb.loadGame(this);
	debugC(6, kPinkDebugGeneral, "Modules are loaded");

	syncSoundSettings();

	if (ConfMan.hasKey("save_slot"))
		loadGameState(ConfMan.getInt("save_slot"));
	else
		initModule(_modules[0]->getName(), "", nullptr);

	return Common::kNoError;
}