Ejemplo n.º 1
0
void ISOFileSystem::DoState(PointerWrap &p)
{
	auto s = p.Section("ISOFileSystem", 1);
	if (!s)
		return;

	int n = (int) entries.size();
	p.Do(n);

	if (p.mode == p.MODE_READ)
	{
		entries.clear();
		for (int i = 0; i < n; ++i)
		{
			u32 fd = 0;
			OpenFileEntry of;

			p.Do(fd);
			p.Do(of.seekPos);
			p.Do(of.isRawSector);
			p.Do(of.isBlockSectorMode);
			p.Do(of.sectorStart);
			p.Do(of.openSize);

			bool hasFile = false;
			p.Do(hasFile);
			if (hasFile) {
				std::string path;
				p.Do(path);
				of.file = GetFromPath(path);
			} else {
				of.file = NULL;
			}

			entries[fd] = of;
		}
	}
	else
	{
		for (EntryMap::iterator it = entries.begin(), end = entries.end(); it != end; ++it)
		{
			OpenFileEntry &of = it->second;
			p.Do(it->first);
			p.Do(of.seekPos);
			p.Do(of.isRawSector);
			p.Do(of.isBlockSectorMode);
			p.Do(of.sectorStart);
			p.Do(of.openSize);

			bool hasFile = of.file != NULL;
			p.Do(hasFile);
			if (hasFile) {
				std::string path = "";
				path = EntryFullPath(of.file);
				p.Do(path);
			}
		}
	}
}
Ejemplo n.º 2
0
void ISOFileSystem::DoState(PointerWrap &p)
{
	int n = (int) entries.size();
	p.Do(n);

	if (p.mode == p.MODE_READ)
	{
		entries.clear();
		for (int i = 0; i < n; ++i)
		{
			u32 fd;
			p.Do(fd);
			std::string path;
			p.Do(path);
			OpenFileEntry of;
			of.file = path.empty() ? NULL : GetFromPath(path);
			p.Do(of.seekPos);
			p.Do(of.isRawSector);
			p.Do(of.sectorStart);
			p.Do(of.openSize);
			entries[fd] = of;
		}
	}
	else
	{
		for (EntryMap::iterator it = entries.begin(), end = entries.end(); it != end; ++it)
		{
			p.Do(it->first);
			std::string path = "";
			if (it->second.file != NULL)
				path = EntryFullPath(it->second.file);
			p.Do(path);
			p.Do(it->second.seekPos);
			p.Do(it->second.isRawSector);
			p.Do(it->second.sectorStart);
			p.Do(it->second.openSize);
		}
	}
	p.DoMarker("ISOFileSystem");
}