Esempio n. 1
0
bool TROPUSRLoader::Load(const std::string& filepath, const std::string& configpath)
{
	if (m_file)
		Close();

	// TODO: This seems to be always true... A bug in ExistsFile() ?
	if (!Emu.GetVFS().ExistsFile(filepath))
		Generate(filepath, configpath);

	m_file = Emu.GetVFS().OpenFile(filepath, vfsRead);
	LoadHeader();
	LoadTableHeaders();
	LoadTables();

	Close();
	return true;
}
Esempio n. 2
0
bool TROPUSRLoader::Load(const std::string& filepath, const std::string& configpath)
{
	const std::string& path = vfs::get(filepath);

	if (!fs::is_file(path))
	{
		Generate(filepath, configpath);
	}

	if (!m_file.open(path, fs::read))
	{
		return false;
	}

	if (!LoadHeader() || !LoadTableHeaders() || !LoadTables())
	{
		return false;
	}

	m_file.release();
	return true;
}